Posts: 13
Joined: Mon Dec 31, 2012 10:18 pm

Syma 107 Helicopter with PI

Sun Apr 14, 2013 4:52 am

I am trying to use my Pi to fly a Syma 107 helicopter and my thought was to replace the IR controller with software on my PI. A number of people have reverse engineered the protocol and got this working with Arduino so it should be possible in theory.

I purchased the following IR transmitter:

I have it connected to GPIO18 on my Pi (rev B).
VCC -> Pi 5v
CTL -> Pi GPIO18

I found some source code which I am trying to adapt to my needs in Lazarus using the wiringPi library. Of course I am replacing the pots in the code with software inputs. I do not really know C but the code seems pretty straightforward and easy to duplicate with wiringPi. ... -protocol/

So far I have not gotten it to work. I do not have an oscilloscope but when I view the LED with a digital camera, I can see it is flashing so I think the hardware part is correct. Doing some research, I am thinking the problem is most likely the frequency. The transmitter should transmit at 38Khz. I have done a bunch of searching (not really familiar with hardware) and it is not clear how to get that frequency with wiringPi.

The Arduino code from the link above does this which seems to set the frequency:

Code: Select all

 //setup PWM: f=38Khz PWM=0.5  
 byte v = 8000 / 38;
 TCCR2A = _BV(WGM20);
 TCCR2B = _BV(WGM22) | _BV(CS20); 
 OCR2A = v;
 OCR2B = v / 2;
Is there something analogous for the Pi or with wiringPi for setting the frequency?

Posts: 2
Joined: Tue Apr 23, 2013 3:26 pm

Re: Syma 107 Helicopter with PI

Fri May 03, 2013 9:17 am

I'd like to boost this post, as I'm failing to control my U802 3CH Helicopter with the RPi. A look at the PCB inside the remote control suggests that it is identical with the 3CH model of the Syma 107, further details of which can be found here: ... g-arduino/ or here: (where the author points out differences to the 2CH model).

I too lack an oscilloscope, but my feeling is that I'm failing to produce the 38kHz carrier signal using an IR LED on one of the RPi pins. My favourite weapon of choice is Perl and a look at ... pio-speed/ suggests that the wrapper for the BCM2835 C library doesn't manage the many frequency.

Does anyone know a Perl-ish way of triggering 38kHz output on the one PWM pin? Or any alternatives that don't involve learning C?

Posts: 10
Joined: Thu Sep 05, 2013 5:28 pm

Re: Syma 107 Helicopter with PI

Thu Jan 30, 2014 6:20 pm

Dear Friends,

I am also trying to duplicate the Syma S107G hack. I am looking to reproduce the results obtained here, with Arduino:

I want to validate and produce everything without using any type of o-scope. So, I enlisted the help of LIRC to help read the values from the controller (or an IR receiver like the link above) by using the mode2 module.

By using it, I can verify the encoding scheme and decode the bits like he did. As a result, I can also see that most of the pulse/space combinations are 13 uS which corresponds to the 38kHz.

The issue now is reproducing a signal for transmission. I have been trying to use the wiringPi delayMicroseconds function, but it will not give me 13 uS pulse/space combinations (I simply plugged the output PIN from the wiringPi code into the input for LIRC to determine what's happening). It doesn't get close (20 or 30 us pulses with some being very very high).

I am digging around to determine if there is something else I could be doing (overclocking, change in code, etc.) to get what we need. However, I think the solution would be to use the LIRC transmission code feature as a base for creating the signals, because I believe it can handle producing 38kHz signals. The goal would be to make that code less dependent on remote control files and more suitable to produce streams of data needed to control the copter.

I just wanted to share some feedback and hopefully help work towards a solution. Where are you guys at with this?

Return to “Other projects”