RaspberryPi + Pioneer System Remote

The article briefly describes the Pioneer System Remote (SR) bus, shows how to connect RaspberryPi to the System Remote bus and CLI C program for RaspberryPi that controls the Pioneer M-10X amplifier via GPIO. As a revelation, a method of using this program is given.

In a nutshell about the Pioneer System Remote


Some Pioneer Corporation home audio / video components can be connected to each other via a control bus called SR (short for System Remote). The purpose of such a combination of individual components into a single system is, of course, the convenience of the consumer, because in this case a whole row of devices can be controlled from one remote control.

The connectors of this bus are designated as CONTROL IN and CONTROL OUT and are made in the form of mono mini jack 3.5mm jacks. Therefore, the blocks can be connected via the SR bus using conventional two-pin audio cables with 3.5 mm mini plug mono plugs (TS type connector, from Tip-Sleeve). Devices connected in series, daisy-chain: CONTROL OUTone component connects to the CONTROL IN input of another. The tip of the connector carries the actual SR bus signal, but with the Sleeve contact, things are a little more complicated. On some components (for example, the M-10X amplifier) ​​there is honest “ground”, and then everything is as it should be: Tip - signal, Sleeve - “ground”. But there are components (usually players) that use the sleeve pin of the SR bus connector to transmit a digital audio signal. In this case, the “ground” is taken from the component case or from the “ground” of the analog audio jack. In fact, if the “earths” of the components are connected in any way, then you can completely forget about the Sleeve contact of the SR bus connector.

The SR bus control codes are nothing more than demodulated remote control signals. That is, the SR bus is simply a wired repeater of IR commands cleared of the carrier frequency. (In IR remotes, the modulation of ~ 40 kHz carrier frequency control codes is used in order, firstly, to reduce energy consumption for transmission and increase the battery life of the remote control, and secondly, to be able to tune out the signals of other people's remote controls). When an IR command is received from the remote control, the active SR receiver retransmits this command via the SR bus. All devices connected to the bus see the command. Pioneer Corporation components can be equipped with one SR bus connector (input only or output only), or two input and output. Input, CONTROL IN, is characterized by the presence of an interpreter of commands (a special chip; for example, in the M-10X amplifier it is a PD5637A chip), which is responsible for decoding and executing commands by the device. However, it should be noted that System Remote is the common bus, and control codes are relayed to both the CONTROL OUT outputs and the CONTROL IN inputs .

In the simplest case, the control codes are double-byte, where the first byte is the type of device, and the second byte is the actual command code for execution on this type of device. Below is a list of SR bus device types (first byte of the control command) for reference:

  • 0x73 Projectors
  • 0xA1 Tape decks (Blu-ray Players)
  • 0xA2 CD Players
  • 0xA3 DVD Players
  • 0xA4 Tuners
  • 0xA5 Amplifiers (AV Receivers)
  • 0xA8 Laserdisc Players
  • 0xAB Video Recorders (DVD Recorders)
  • 0xAA Plasma Displays

Devices on the SR bus do not have dedicated addresses, the bus is not addressable. Therefore, for example, if two CD players are connected to the bus, many commands with device type 0xA2 will execute both players simultaneously. There are many command codes, command sets depend on the type of device, year of release, and even on the component model. On one of the sites of Pioneer Corporation, in the Custom Install section, click on this link to download device codes and control commands for some specific models.


The protocol for transferring information via the System Remote bus is quite simple. Each component on the Tip pin of the bus connectors supports + 5V (TTL logic). To send a frame of information, it is necessary in a certain sequence and with a certain duration to submit to the contactTip bus SR ground potential (0V). Pioneer, like many Japanese manufacturers, uses a bit-width codification coding scheme in IR commands when a logical zero is encoded by a pulse of 0.56ms duration and then a pause of 0.56ms, and a logical unit is encoded by a pulse of 0.56ms duration and then pause 1.68ms.

Figure 1. Bit-length coding.

The structure of the SR bus frame for double-byte instructions is as follows:

  • frame header: 0V potential (pulse) is held on the bus for 9ms, then + 5V potential (pause) for 4.5ms
  • 8 bit: device type code
  • 8 bit: device type code bitwise negation
  • 8 bit: command code
  • 8 bit: command code bitwise negation
  • 1 bit: stop bit

The figure below shows the oscillogram of the SR bus frame 0xA55A38C7 transmitting the power toggle command (command code 0x38) to the amplifier (device type code 0xA5):


Figure 2. Frame 0xA55A38C7 of the System Remote bus.

Amplifier Pioneer M-10X


This is a power amplifier, from the controls it has only two buttons: a mechanical Power button and an electronic Standby button. Not much. But, fortunately, it is also equipped with the CONTROL IN input of the System Remote bus and understands three commands:
  • power toggle 0xA538
  • turn on the power (power on) 0xA558
  • turn off the power (power off) 0xA5D8


Connect RaspberryPi to the Pioneer System Remote Bus


The System Remote bus has TTL logic, the voltage varies from 0V to + 5V. On the GPIO RaspberryPi conclusions, the voltage can vary in the range from 0V to + 3.3V, while overvoltage protection for these conclusions is not provided on the board. Therefore, it is not possible to directly control the SR bus from the GPIO pin; you must use a level converter.

The circuit presented here is such a converter. The base of the transistor Q1 is connected through the resistor R1 to the leg P1-11 (GPIO17) RPi, the collector of the transistor through the resistor R2 - to the leg P1-02 (5V) RPi, and the emitter of the transistor - to the leg P1-20 (GND) RPi. By programmatically controlling the output of GPIO17 (base of transistor Q1), on the Tip terminal of terminal block J1 (collector of transistor Q1) we obtain a signal of the required level for control commands of the System Remote bus. Resistor R1 serves as the current limiter of the base, and resistor R2 as the current limiter of the collector of the transistor. When based on the 0V transistor (GPIO17 = 0), the transistor is closed and the potential + 5V is held at the emitter; when based on the transistor + 3.3V (GPIO17 = 1), the transistor is open and the potential 0V is held at the emitter. Therefore, strictly speaking, this circuit is a signal inverter with level conversion. OnFigure 2 above shows the oscillograms of the working circuit: in the upper graph - the signal on the transistor collector (SR bus), in the lower graph - the signal on the transistor base (GPIO17 pin; the real range of this signal is from 0V to + 3.3V).





To implement the scheme you will need:

  • contact breadboard
  • transistor KT3102 (Q1)
  • 1kΩ resistor (R1)
  • 10k ohm resistor (R2)
  • terminal block with contact pitch 2.54mm, for installation in a breadboard (J1)
  • mini plug 3.5mm mini plug (TS type connector)
  • wires

In order not to mess with the soldering of the plug, you can instead take a ready-made mono cable with a mini plug 3.5mm, cut off the connector on one side, and connect the conductors to the terminal block J1.

Attention! Be very careful with the RaspberryPi five-volt legs (P1-02 and P1-04), in no case do you accidentally short-circuit these contacts with other legs of the board, as this will damage it.

Pioneer M-10X Amplifier Power Management Program for RaspberryPi


The source code of the program for the Raspbian platform is located at this link . The code contains a nice (-19) call , so the program must be called by the root superuser. To build the program you need to use the command:

gcc -o m10xptgl m10xptgl.c

After the assembly, you need to create two symbolic links with alternative names m10xpon and m10xpoff to the executable file:

ln -s m10xptgl m10xpon
ln -s m10xptgl m10xpoff

The program generates a control command frame for the Pioneer M-10X amplifier on the GPIO17 foot. The actual program action (generated frame) depends on the name under which the program is running:

  • at startup with the name m10xpon , the amplifier turns on (exits Standby state, frame 0xA55A58A7)
  • at startup with the name m10xpoff , the amplifier turns off (transition to Standby state, frame 0xA55AD827)
  • at startup with the name m10xptgl , the power state of the amplifier switches (power toggle command, frame 0xA55A38C7)

You can specify an integer as an optional argument to the program, in which case the frame will be sequentially repeated as many times as specified by the command line argument.

In general, the project is simple, no more complicated than a training project on LED flashing, only here we “blink” the whole Pioneer amplifier.

Application



The circuit and program described in the article are convenient to use, for example, together with the shairport project , because in this case we get not only the AirPlay function on the old amplifier, but also the automatic on and off of the amplifier on demand.

To build a shairport project from source codes, use the sequence of the following commands:

apt-get install avahi-daemon mdns-scan libssl-dev libavahi-client-dev libasound2-dev
apt-get install libao4 libao-dev
apt-get install pulseaudio libpulse-dev
cd /root/src; git clone --depth 1 https://github.com/abrasive/shairport.git shairport
cd shairport
./configure
make

And run like this:

shairport -v --name="M10X" --on-start="/usr/local/sbin/m10xpon 10" --on-stop="/usr/local/sbin/m10xpoff 10"

Thanks for attention.

Also popular now: