Home About Technology Travel Pictures

PPM Switch

The I2C servo switch has been applied successfully for several years in various prototypes of the Flobo project. Despite its functional reliability its disadvantage is an extremely limited operating range. The cause is most likely interference of the main computer Gumstix, which is electrically coupled into the I2C bus and thus affects the sensitivity of the R/C receiver. In an appropriate test much greater distances were achieved when the Gumstix was switched off, or at least in idle mode (no read / write on flashdisk).

The main requirement for next version of the servo switch therefore was the electrical isolation between the autopilot and R/C circuit and hence a significant increase in range. Additional requirements were:

  • maximize the reuse of the receiver components, servos remain plugged in the receiver
  • remain functional on autopilot malfunction
  • protection against UAV hijacking from a different remote control


The solution presented here is based on bypassing the PPM signal from the receiver, decoding, synthesis, and subsequent feeding back into the receiver. The galvanic decoupling happens on the way from and back to the receiver.

Block diagram of R/C receiver and PPM-switch (figure similar to the illustration of the paparazzi project)

The figure shows that the PPM signal must be tapped in the receiver at the right place. In particular, note that the PPM switch does not create a separate sync signal (reset for decade counter). So the signal must be injected before the "Synchro Blank Detection" logic. This can sometimes be a problem, e.g. if the signal is processed via parallel tracks inside the receiver.

It is also evident from the figure that opto couplers require voltage supply from both sides - from autopilot circuit as well as from the R/C circuit. Receiver and switch are therefore connected via 4 cables. In addition, a miniature relay ensures that the receiver remains functional in case of a autopilot power failure - at least in remote control mode.


The circuit consists of the following components:

  • ATmega88 for decoding and synthesis of PPM signal
  • Two opto coupler type HCPL 0710 (5V CMOS compatibility, 40 ns maximum prop. delay)
  • Miniature relay DIP 9051-D
  • Two SMD LEDs for status display
Circuit Schematic (Eagle)

The circuit will be operated very close to the receiver. Thus the board was designed following the recommendations from Atmel (see Atmel Application Note "EMC Design Considerations"). Ground plane and power plane, exclusive use of SMD components and signal lines as direct as possible reduce radio interference. On the software side further noise reduction can be reached by switching off unneeded modules of the microcontroller.

Board (Eagle)


Contrary to the servo switch C (WinAVR) is now used as the programming language. The software has 3 main tasks:

  • Analysis of the incoming PPM signal
  • Sending a valid PPM signal, depending on the internal state
  • Communication via I2C bus

Basis for signal analysis and synthesis is Timer1 with 16 bit resolution. Prescaler and clock speed are configured to make timer values available directly in microseconds. Incoming signal edges are captured by hardware (ICR1) and outgoing pulses are also generated by hardware using the output capture (OCRA1). The main program consists simply of a busy loop, where changes in timer registers are regulary checked and accordingly processed. The benefit of this loop is avoiding too many global variables and saving of some clock cycles that would be necessary when executing interrupt service routines (ISR). Only I2C communication is currently processed using interrupts. However, interrupts would have the advantage of enabling the controller to go in sleep mode, so this option will be considered for future improvements.

Pulse lengths measured by input capture are assembled to a PPM frame which is validated by several rules. These rules define the minimum / maximum length of the sync blank / the servo pulses and the total length of the frame. Depending on the availability and validity of incoming PPM signals, the presence of I2C commands and the switch settings on the remote control (e.g. servo channel 7) the internal state of the PPM switch is determined. This state then dictates the data source from which the pulse lengths for the outgoing PPM signal are taken. The next figure shows the internal state and all state transitions.

State model

Meaning of the states in detail:

  • NoRC - no reception or no valid signal - autopilot control
  • Auto1 - switch position 1 - autopilot control
  • Auto2 - switch position 2 - autopilot control
  • Remote - switch position 0 - remote control (human)
  • Failsafe1 - no reception and no autopilot command - all servos in neutral position (EEPROM)
  • Failsafe2 - valid PPM frame, switch on Auto, but no autopilot command - manual control

I2C communication is mainly used for reading actual servo positions (PPM switch -> Autopilot) and for writing target servo positions (autopilot -> PPM switch). Additionally signal quality data and default positions can be exchanged. Here is the list of all commands implemented so far:

  • 0x80 (default): read all R/C servo positions starting with the status byte
  • 0x84: read all servo target position (auto mode) starting with the status byte
  • 0x88: read all servo neutral position starting with the status byte
  • 0x8C: read statistics: status byte, average frame length (2 bytes), number of valid frames (2 bytes), number of invalid frames (2 bytes)
  • 0xAA: set a single servo position, fast drive (n=servo chanel 1-7): AA nx xx
  • 0xBA: set a single servo position, soft drive: BA nx xx
  • 0xA0: set all servo positions (s: 0=fast, 1=soft): A0 sx xx sx xx sx xx sx xx ...
  • 0xD0: set all servo neutral positions (stored in EEPROM): D0 0x xx 0x xx 0x xx 0x xx ...

Additional features

If a valid PPM signal is applied by the remote control, the software tries to synchronize the outgoing signal with it. The temporal offset is 2.2 ms, i.e. lever positions of the remote control are passed to the servos without delay.

Comparision of input signal (top) and output signal (bottom) in Remote state

The flashing of the LEDs indicate the internal status. Green: 1x = Manual, 2x = Auto1, 3x = Auto2, Red: 1x = Failsafe1, 2x = Failsafe2, 3x = NORC. A state transition occurs not immediately at the first invalid or valid frame, but only when a configurable number of corresponding frames has been exceeded. This is to prevent that short-term glitches result in an immediate state transition.


As mentioned earlier, there is the difficulty of tapping the signal path in the receiver at the right place. Thererfore, a detailed circuit and signal analysis is necessary in advance. This has been done for the Graupner C19 receiver. After several failed attempts the solution results in the following minimum operation: Pin 13 (Enable) of the 4017 decade counter should be separated from the PCB, e.g. using a thin copper wire. This separates the clock input from the PPM signal. Similarly, the sync logic (reset of 4017) must be separated from the PPM signal by desoldering a 100 Ohm resistor (101), rotating it by 90 degrees and soldering it back to the PCB single sided. The now open end of the resistor is then connected to pin 13 of the 4017 by a short wire. This connection now forms the entrance to the manipulated PPM signal. The C19 uses inverted PPM signals - a new servo pulse starts with a LH edge. Thus the software must be configured to recognize the negative edges.

Modification of the Graupner C19 receiver and combination with PPM switch


After laboratory tests ran successfully, the circuit will now be tested in real life. Especially interest lies in determining whether the electrical isolation really does have a significant range increase. If the interference of the Gumstix will still affect the reception, an alternative for the main computer probably needs to be considered.

Complete control of the PPM signal offers the possibility of encryption of the remote control signals. If an encoding circuit was installed on the transmitter side, the PPM signal could be manipulated within bandwidth limitations. The use of this could be on the one hand to protect a UAV from hijacking, where the hijackers use a normal uncoded remote control. This would be a useful feature for long distance flights outside the reach of your remote control (Note: flying out of sight is not allowed in most countries). In the case of two remote controls using the same frequency the aircraft will not necessarily be controllable but can at least not be manipulated by others - whether intentionally or not. On the other hand, manipulation of the whole PPM frame including sync block allows for additional data transmission of some 100 bit/s.

Schematic illustration of encoding of the radio transmission

An alternative to the galvanic decoupling of the PPM signal persists in the decoupling of I2C bus. This would have several advantages, including the relay becoming obsolete - after all, it consumes about 30-40 mA. In addition, the I2C bus on the R/C side could be further exploited, e.g. for measuring voltage, currents and engine RPM. Perhaps an opto-coupled I2C bridge will be the next project presented here ...


Eagle Schema:ppmswitch.sch
Eagle Board:ppmswitch.brd
AVR Source Code (version 1.02):switch.c
Graupner C19 Schema (partial):c19_part.sch
C19 PCB, labeled:C19_schemaparts.jpg
03.01.2010, Achim Walther, Mail