Convert Receiver channels to PPM with arduino

Electronic projects that are either related to the firmwares for the 9x, or simply great for radio control applications.
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Convert Receiver channels to PPM with arduino

Post by jhsa »

Hi guys, reading the forum I just came across this posted by another member..


http://www.multircshop.com/site/index.p ... uct_id=599


I think it is a brilliant idea. But I like building things and I wonder how easy would be making one using a small arduino like the pro mini, or even if we like to mess with the electronics build our own board.. I have a couple of Atmega8 chips that I could use for it..
My big problem as always is, I can't code :(
Any of you know somewhere where I could get at least a base code for it?? I have no idea what I'm talking about now..
I have a couple of receivers but none otput PPM, I could use this to help some people at my club's field. For example, I keep telling a friend not to fly over the cars and people but he keeps doing it maybe because he he is not 100% in control of the aircraft.. I mean he can land and take off but still has some problems.. with something like this I could help him before he gets himself in trouble.. :o

Thanks

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

User avatar
Flaps 30
Posts: 1490
Joined: Tue Dec 27, 2011 6:04 pm
Country: -
Location: Wokingham Berkshire

Re: Single channels to PPM with arduino

Post by Flaps 30 »

I am trying to think why you would need a single channel device. Is this with the view of giving this guy a shock, should he stray into an area near people and cars?
ABBC3_OFFTOPIC
I would have thought that as a club, you would have a scheme where you cannot fly without an instructor until you have passed a test. We use the BMFA 'A' test as a minimum standard to achieve before you can fly alone. Even then you have to show that you can fly safely, or you could find yourself in trouble with the club.
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Single channels to PPM with arduino

Post by jhsa »

Maybe I didn't express myself very well.. What I mean is connect every single channel from the receiver to the device ( arduino, atmega, whatever..) and output PPM..

No, unfortunately at my club they don't do that.. I've seen guys smashing beautiful planes because they think they can fly and just don't ask for help. Most of the aircraft doesn't even take off, or if it does, it's not for very long..
I don't mind helping the people, well, some of them that really want to be helped, that is why I would like to build something like this..
will change the topic title as it might be confusing as it is..

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Convert Receiver channels to PPM with arduino

Post by MikeB »

I'm unclear where exactly you wish to use this.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Convert Receiver channels to PPM with arduino

Post by jhsa »

To connect to any receiver that doesn't output PPM.. Or should I say PPM SUM (can't understand why they call it like this..)..
Then we just connect it to the trainer port and voilá, a wireless trainer system with any receiver that you might have.. even the original flysky that ship with the 9x..
Also a wireless system for the sim, using the flysky modules that we don't use anymore. I have an old radio as one of my sim TXs.. sometimes with my son it is a bit difficult with the wire in the way as he sometimes pulls it out of the USB port ;) :D
so, I can see a few applications for this..

João
João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

lebenj
Posts: 83
Joined: Wed Jan 23, 2013 4:12 pm
Country: -

Re: Convert Receiver channels to PPM with arduino

Post by lebenj »

yes it can be interesting to learn flying with the trainer / instructor funccion, but without any wire.
also to play with a simulador without any cable....

there was a french guy o made a serie of board, but don't have more.... and will not make more, he is the father of "the brain" so a lot of work.
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Convert Receiver channels to PPM with arduino

Post by jhsa »

so time for us to make one then,, as he doesn't want to make them anymore.. :D
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Convert Receiver channels to PPM with arduino

Post by jhsa »

Ok, I've been doing some research and found this..

https://github.com/davidbuzz/BuzzsArdui ... _to_ppm328

http://code.google.com/p/ardupilot-mega/wiki/Encoder

http://code.google.com/p/ardupilot-mega ... ATMega328p

The thing is, all of them use failsafe set to a predefined channel which is not needed, at least not for my project..
The one in the first link seems promising but I would like to take the failsafe out or at least disable it for using it as a wireless trainer system..
Obviously if you want to use it on an aircraft then we should be able to select which channel is throttle..

Thoughts?

Thanks,

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Convert Receiver channels to PPM with arduino

Post by jhsa »

I just Love this from the first link :mrgreen:

TIPS:
* any channel that you don't connect a PWM input on, will emit a default value ( which is 1500 for all channels excpt throttle, which is 1100.
* disconnecting any channel after booting will cause the system to use the last-known-position of the input, until a good signal returns.
* D0 and D1 are also used by the Serial Programmer/bootloader. You can not reprogram this unit with PWM inputs still connected to D0 and D1, unplug unit from PWM sources before re-programming.
* THis is not a "failsafe" unit, if has no failsafe functionality.
* If this code causes your expensive toys to crash, or worse, it's your fault for being a bad person, so you should be nicer, as karma's a b***h.
* Not my fault. none of it. I love you too, now go away.
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
Rob Thomson
Site Admin
Posts: 4543
Joined: Tue Dec 27, 2011 11:34 am
Country: United Kingdom
Location: Albury, Guildford
Contact:

Re: Convert Receiver channels to PPM with arduino

Post by Rob Thomson »

Lovely :-)

Sent from my GT-I9300 using Tapatalk 2
Slope Soaring, FPV, and pretty much anything 'high tech'
...........if you think it should be in the wiki.. ask me for wiki access, then go add it!
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Convert Receiver channels to PPM with arduino

Post by jhsa »

I just tried to compile some of the code and it gives errors.. the arduino version and the others as well.. it seems like there are also libraries missing.. One of them has an hex file that can be downloaded but I don't know what fuses should be set.. Also couldn't find the information of what pins it uses..
I could look in the code But I still can't read chinese..
I think I need some help here :)
Thanks

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Convert Receiver channels to PPM with arduino

Post by jhsa »

Question, can I use the amega8-16PU at 8Mhz with the internal oscillator?
The reason is I would like to use an atmega 8 instead of the 328 for this project as I have more of them and just one 328.. don't know how I could compile a sketch for it using arduino though..
the code I want to use is written for arduino with the 328 but running at 8Mhz..

Thanks

João

EDIT: Here is what I'm trying to build but using and atmega8-16PU.
relevant bits on page 1 and 2..
Never mind the bikering on the thread.. It doesn't add anything useful to the project.. :(

http://www.multiwii.com/forum/viewtopic.php?f=13&t=2710
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Convert Receiver channels to PPM with arduino

Post by MikeB »

If it is of use to you, I just put a'scope on the outputs of a FrSky D8R-II. Channels 1, 2 and 3 all start at the same time, channels 4, 5 and 6 follow, all starting 2.3mS after channels 1, 2 and 3 started. Channels 7 and 8 start together, 4.6 mS after channels 1, 2 and 3 started.
This may make a difference to the code required.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Convert Receiver channels to PPM with arduino

Post by jhsa »

Mike, did you have a look at the code in that link? I did breadboard it but i'm not having good readings with my scope and the scope on the computer. I would think that he took that into account but I don't understand the code. Thanks 4 looking.

Maybe the reason I'm not having good readings is because the chennels are being displayed at the same time.. the receiver I have used is a frsky D6FR

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Convert Receiver channels to PPM with arduino

Post by MikeB »

Just had a quick look. The code relies on the 8 PPM pulses following each other. Basically it generates an interrupt whenever any of the 8 input signals changes. It expects one input to go low and the next to go high at the same time. When this interrupt happens it generates a 300uS pulse on the output.
This doesn't work correctly on the D8R-II as the pulses do NOT follow each other, don't know about the D6FR, I haven't got one.
For the D8R, you will need to measure each of the input pulses, store them and then generate your own output stream. You may also have trouble with the frame timing, th FrSky repeat rate on the servo pulses is 18mS. With 8 channels this is not long enough to include a sync puls in the combined stream.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Convert Receiver channels to PPM with arduino

Post by jhsa »

so this one is a no go then..
if only I knew how to :(
Will have to keep trying to find some code that works then..

Thanks..
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Convert Receiver channels to PPM with arduino

Post by jhsa »

Guys, first success. will upload a short video.. I think I got it working on my Stripduino :D
Will upload a little video on this post shortly ;)
Here it is.. now to build the real think.. hhmm tomorrow as it is late now :roll: :mrgreen:

[BBvideo 425,350]http://www.youtube.com/watch?v=e7tPZ9rs ... e=youtu.be[/BBvideo]


João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Convert Receiver channels to PPM with arduino

Post by MikeB »

Looks like the D6FR does send the pulses out one after the other. That would be possible with only 6 channels to send, 6*2mS is 12mS, leaving 6mS for the sync pulse.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Convert Receiver channels to PPM with arduino

Post by jhsa »

I have no means to check if the receiver sends the pulses one after the other.. the fact is that with the other code they seemed to be overlapping and therefore not working.. with this code (I'll post it when it's working) from a link on the first or second post on this thread, it seems to be working. maybe the code waits for all the pulses from the channels and then chains them in a PPM signal. so even if the receiver outputs them at the same time it will work..
My arduino is outputing 8 ch even if I'm only connecting 4 at the moment..

I'm using this code..

https://github.com/davidbuzz/BuzzsArdui ... _to_ppm328

At least with the scope I can't see any latency but eh, you've seen my scope :mrgreen: Next step is to build one and test with both radios..
I would still prefer to use a atmega8-16PU, but he says that this is only for the atmega 328. I can't find a board with m8 working at 16Mhz in the arduino IDE, so I guess I will have to use the 328P.

Thanks for your help Mike. Hopefully I can teach some people to fly with this, that is if they want to be taught of course. This could also be used as a wireless system for the simulator. will also try it..

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Convert Receiver channels to PPM with arduino

Post by MikeB »

I believe you are able to build opentx? If so, you have the gcc compiler installed. To compile to the mega8, you "just" need a makefile and the source files adjusted if necessary. Then you just "make" the project and you get a .hex file ready to load into the target processor using AvrDude.
Note that the mega8 is not quite the same as the mega328, the mega88 is the same as the 328, just less memory.

Mike.

Edit: Just checked the datasheets, the Mega8 does not have "interrupt on pin change" that this software needs to work.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Convert Receiver channels to PPM with arduino

Post by jhsa »

No worries then Mike.. I think I'll stick with the 328 ;)
Thanks for your help.. I will post my results and the arduino files when I'm done...

Joao
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Convert Receiver channels to PPM with arduino

Post by jhsa »

Ok built the circuit on stripboard but used the breadboard to program the atmega328P. Like this I don't have to put a programmer connector on the board.. I will only need to program it once.. hopefully :P

I based my circuit on this link.. very simple..

http://blog.petrockblock.com/2012/06/11 ... iguration/

I included a voltage divider to monitor the 2S lipo I will use to power the converter. The student radio can be set to trigger an alarm if the lipo voltage drops too low... Must be the first wireless buddy box with telemetry :mrgreen: Now I just have to find someone to help me testing this with a plane.. Mine of course :mrgreen:

I flashed the Arduino Nano Bootloader and then the code included in the Zip file. Didn't test fly it yet but it looks good on the radio's servo monitor.
Any questions I'll do my best to answer ;)


João
Attachments
buzz_8pwm_to_ppm328.zip
(7.55 KiB) Downloaded 433 times
070520132466.jpg
070520132465.jpg
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Convert Receiver channels to PPM with arduino

Post by jhsa »

A few more pictures.. ;)
And a little video..


[BBvideo 425,350]http://www.youtube.com/watch?v=SLcsMNzr ... e=youtu.be[/BBvideo]
Attachments
070520132468.jpg
070520132470.jpg
070520132471.jpg
070520132472.jpg
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Convert Receiver channels to PPM with arduino

Post by jhsa »

well, just came back from the field and I can say that the system worked very well.. Me and a friend were flying my easystar in turns. I gotta say, it was fun :) At one point I landed to reduce the amount of control on the trainer setup menu as the plane was too sensitive for his taste.. So, for now case closed. The project is here. It's not my project.. I just built it and the only thing I did different was adding a voltage divider to the board and connected to the A2 input of the D6FR receiver so the student radio can warn me if the system battery goes to low (2s LiPo) ;)
I just researched the internet a bit and built the one that seemed most appropriate to me
Have fun ;) :)

João

P:S: - I have some more nice projects in mind.
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
lebenj
Posts: 83
Joined: Wed Jan 23, 2013 4:12 pm
Country: -

Re: Convert Receiver channels to PPM with arduino

Post by lebenj »

Hello,

I have 2 T9x radio with open 9x. both have a FRSKY DJT module. with a direct jack cable, i can make "one teacher" and "one student" wihtout any problem

i have a D4R-II receiver, wich can give CPPM on channel 1 if i put a bridge on CH3 and CH4
then i've made a jack wire connect to CH1 and negative of this receiver, and i connect it to the other radio....

i was thinking i would be possible to get the same result as you, BUT NO!!!

does someone know why, and if there is a solution...

regards

Benjamin
jbabio
Posts: 19
Joined: Sun Feb 10, 2013 11:17 pm
Country: -

Re: Convert Receiver channels to PPM with arduino

Post by jbabio »

I know its solved now but want to mention the 8 Channel PPM Encoder Version 2 from 3d Robotics.
Fom 3Dr shop:
The PPM Encoder v2.0 plugs into the PWM servo output ports of any R/C receiver and encodes them into a PPM pulse suitable for many autopilots (e.g. PX4FMU). Modifications to the R/C receiver are not necessary.

The whole project is based around the ATMEL ATMEGA328p AVR processor and all timing is done within interrupts so accuracy and stability is optimized.

Firmware is free and was created by John Arne and Olivier Adler.

The design of the PPM Encoder is based on the Paperazzi PPM Encoder.
I own one and works nice.
Regards
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Convert Receiver channels to PPM with arduino

Post by jhsa »

lebenj wrote:
i was thinking i would be possible to get the same result as you, BUT NO!!!

does someone know why, and if there is a solution...
It should be possible.. did you enable "trainer" on the master radio? Did you configure it and calibrate the sudent radio on the master trainer configuration menu?
It should work..

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
lebenj
Posts: 83
Joined: Wed Jan 23, 2013 4:12 pm
Country: -

Re: Convert Receiver channels to PPM with arduino

Post by lebenj »

as i wrote it before, with a cable between the 2 radio, i have good results!
when i move the TRN on the master, the student radio can do the job.

but with the RX in CPPM mode connected to the trainer port of the master radio, it does not work for me....

strange....
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Convert Receiver channels to PPM with arduino

Post by jhsa »

ahhh, I might have jumped the line about the cable ;)

That with the receiver is strange..

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Convert Receiver channels to PPM with arduino

Post by MikeB »

How are you powering the D4R-II ?

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

Post Reply

Return to “General RC Electronic Projects and Discussion”