Espritmodel.com Telemetry Radio
Reply
Thread Tools
Old Jul 20, 2009, 11:37 PM
Registered User
BushmanLA's Avatar
Joined Dec 2005
1,803 Posts
Discussion
8 channel PPM generator

Hi guys, I'm currently writing code for a PIC based PPM generator. Basically it will read 8 analog voltages and convert this into a 'standard' PPM frame that most RC radios will be able to read into their trainer port.

I hope to have the following features in the final design.
8 proportional channels
end point adjustment
trim
aircraft profiles
channel mixing

I'm posting this here because I'm not nearly as familiar with RC radio features as you guys are and I'm hoping to get some advice as to what kind of things would be useful etc.

The basic idea is that many stand alone radio modules can be purchased that accept a PPM signal. The PPM generator could be used instead of buying an expensive RC controller. It can also be used to turn a cheap 4 or 6 channel radio into an 8 channel radio. My main reason for building this is so that I can use my X45 joystick to control my FPV aircraft. I've been flying PC sims for so long I just don't enjoy the feel of a thumb stick.


Anyway, if something like this already exists, or if you have any ideas of features you think should be added. Let me know. I'll be posting my progress here so you can tell me what I'm doing wrong or stupid. I always value the opinions of people who actually know what they are doing



So here is the plan so far. I'm using a PIC 18F4525. The PPM frame is generated using the CCP module working in compare mode with timer3.
Timer3 is incrementing every .4us, when the value of timer3 = the value I give to the CCP module, an interrupt is generated, the output pin is toggled, and I calculate and assing a new value to put into the CCP module for the next rise/fall of the signal.
I figured doing it this was has two main benefits.
1. I can program the rest of the user interface etc without worrying about missing the PPM timing.
2. As long as I can calculate and enter the next CCP match value before the time for the toggle has actually passed, there will never be any jitter or signal distortion etc. Since the shortest time I'll ever have is about 300us and I'm executing an instruction every .1us, this is a trivial task.


The interrupt code has been written and is working great so far.


Now I'm working on the AD inputs and converting this into appropriate signal timing.

So a few questions for you guys.
Should I go ahead and make this 12 channels while I'm at it?
How important is exponential rates etc, and what is the most common method of applying it?
What kind of channel mixing options should I try and fit in?
BushmanLA is offline Find More Posts by BushmanLA
Reply With Quote
Sign up now
to remove ads between posts
Old Jul 21, 2009, 01:15 AM
iPhly R/C with iPhone
iter's Avatar
Silicon Valley, Calif
Joined Jan 2005
1,723 Posts
Some of the lessons I am learning with my Polyglot project, which seems to address some of the same niches as yours:

* It's a ton of fun.
* It's not cheaper than COTS stuff (not if I factor in the programming time).
* I have a whole new appreciation for COTS stuff. As I am designing my own, I am learning about what some higher-end radios do, and I wonder if how much I can achieve if I hack one instead of rolling my own. It is certainly the cheaper route.
* A great benefit of building my own is that i get to make it exactly how I want it. I don't want to put in a feature that I don't have (or understand) the need for.

The bit about COTS is especially important. If all you want is a joystick that can drive your real-life model, you can simply solder its pots to an existing TX and not worry about building your own device. You can find out in a couple of hours what other features you may or may not want on top of that.

My code, though for a different uC, is under the GPL is you want to compare notes.

Ari.
iter is offline Find More Posts by iter
Reply With Quote
Old Jul 21, 2009, 04:32 AM
Registered User
BushmanLA's Avatar
Joined Dec 2005
1,803 Posts
Quote:
Originally Posted by iter
My code, though for a different uC, is under the GPL is you want to compare notes.

Ari.

I would love to, do you have a link? I plan on releasing all my code and schematics as well, as soon as the code is in at least in a non embarrassing form.
BushmanLA is offline Find More Posts by BushmanLA
Reply With Quote
Old Jul 21, 2009, 11:26 AM
iPhly R/C with iPhone
iter's Avatar
Silicon Valley, Calif
Joined Jan 2005
1,723 Posts
http://www.rcgroups.com/forums/showthread.php?t=1069110
http://www.rcgroups.com/forums/attac...mentid=2625904
iter is offline Find More Posts by iter
Reply With Quote
Old Jul 22, 2009, 11:01 AM
fast
fmkit's Avatar
ISRAEL
Joined Aug 2007
2,566 Posts
Quote:
Originally Posted by BushmanLA
..................................
So a few questions for you guys.
Should I go ahead and make this 12 channels while I'm at it?
How important is exponential rates etc, and what is the most common method of applying it?
What kind of channel mixing options should I try and fit in?
I'm less than 3 years into RC hobby and never got used to thumbsticks.
I used Cypress PSOC controllers to make my own transmitter.
With these you can get most of work done in hardware (no jitter) with empty main loop. You can have max 8 analog (proportional channels) per chip and 20 servo outputs (per chip).
I've learned that making 20ch PPM frame cost speed
make 8-10 channels frame with 2-3 modifiers(SHIFT keys) so RX side will make 40channels out of 10 received.
It is better to make TX as simple as possible - no mixes, no expo...no models!
if you can make your PPM stream you probably can decode it too so let RX do all the specifics and never crash anything because of wrong model set.

I have one controller for everything: tank,cars,planes and even tricopter/heli.
fmkit is online now Find More Posts by fmkit
Last edited by fmkit; Jul 22, 2009 at 11:16 AM.
Reply With Quote
Old Jul 22, 2009, 02:05 PM
Registered User
France
Joined Nov 2003
278 Posts
Hi BushmanLA,
Nice project with lot of features.
I do not understand if you want to make a TX from a PC without sticks, or if you want to go for a new TX.
Anyway, you will have a lot of fun with mixes, and trying to make something different is always interesting.
There is a lot of things to do in mixes, so you might want to focus first on a model that you want to fly.
Olivier
obor is offline Find More Posts by obor
Reply With Quote
Old Jul 27, 2009, 02:19 AM
Registered User
BushmanLA's Avatar
Joined Dec 2005
1,803 Posts
Quote:
Originally Posted by obor
Hi BushmanLA,
I do not understand if you want to make a TX from a PC without sticks, or if you want to go for a new TX.

My device will be simple be a PPM generator. You have to supply the analog inputs from an old joystick or whatever.

Right now I have the PPM frame generated pretty much like fmkit mentioned. It is all done in with timer hardware so there is no jitter, and the frame length is kept constant (this important for some receivers like bergs).

Now I just have to add support for an LCD display, saving presets in EEPROM, switches for adding trim, blah blah blah.
BushmanLA is offline Find More Posts by BushmanLA
Reply With Quote
Old Jul 31, 2009, 04:24 PM
Registered User
Janusz's Avatar
Poland, Kujawsko-Pomorskie, Wloclawek
Joined Feb 2006
128 Posts
Hi.
Janusz is offline Find More Posts by Janusz
Reply With Quote
Old Jul 31, 2009, 06:22 PM
The reviewer
XJet's Avatar
Tokoroa
Joined Mar 2004
3,827 Posts
Quote:
Originally Posted by Janusz
Hi.
Hey Janusz, the 16F84 has no ADCs so your circuit won't work -- unless you're planning on simply triggering an off/on change with the variable resistors.
XJet is offline Find More Posts by XJet
Reply With Quote
Old Jul 31, 2009, 09:26 PM
Xtreme Power Systems
Lake Havasu, AZ
Joined Jun 2005
15,702 Posts
There are pin compatible PICs that do have A/D converters.
JimDrew is offline Find More Posts by JimDrew
RCG Plus Member
Reply With Quote
Old Feb 05, 2012, 03:25 PM
Registered User
United States, NM, Santa Fe
Joined Feb 2012
3 Posts
PIC Code?

I'm working on the same sort of thing with an 18F4520 and I already have the
Switch inputs / ADC / LCD code mostly worked out.

I also have a PPM generator routine written, I'm just not sure how to tie it into
the timers.

I'd love to get a look at your code to see how you're generating your PPM
stream and how the timers are used.

Bleeptech.
Bleeptech is offline Find More Posts by Bleeptech
Reply With Quote
Old Feb 06, 2012, 08:43 AM
Registered User
Joined Nov 2011
59 Posts
Nice project. Is there a spec somewhere that defines what the ppm stream should look like?

Thanks much,
Colin
zoom99 is offline Find More Posts by zoom99
Reply With Quote
Old Feb 07, 2012, 10:54 PM
Registered User
United States, NM, Santa Fe
Joined Feb 2012
3 Posts
PPM Timing Specification

Here's what I'm using...
Code:
/* ----------------------------------------------------------------------- */
//
//	 			PPM Timing Specifications
//			
//
//		Standard ( =< 9 Channel) PPM Frame Spec is 22.5mS (22500uS) 
//
// 		Each frame consists of 4 to 9 channels (5 to 10 pulses), 
//		700uS to 1700uS in length followed by a sync gap >250uS 
//		in length.. 
//
// 		The width of each channel is 1 to 2mS (1.5mS when sticks centered). 
//		The sync gap is at least 2.5mS long, 
//		The frame length is approximately 22.5 mS (2250 uS).
//
// 		The output signal should look something like this:- 
//
//	            |<------------------ 1 frame (~22.5mS) -------------------->|
//	            |< 1~2mS >|                                 
//	             _         _        _        _        _                    _
//	 ___________| |_______| |______| |______| |______| |__ // ____________| |____
//	   sync gap     ch1       ch2      ch3      ch4       etc.  sync gap      ch1
//	
//		9 Channels should take a maximum of 18mS (18000uS) leaving 
//		4.5mS (450uS) for syncronization.
//
//		NOTES
//
//	(1) 	PPM frame period duration is not critical and depends on 
//		RC Transmitter type & Manufacturer.
//
//		JR/Graupner, Sanwa/Airtronics use POSITIVE shift
//
//		Futaba, Hitec, Tower Hobbies use NEGATIVE shift
//
//	(2) 	Frame separation sync gap depends on number of transmitter 
//		channels and will vary accordingly.
//
/* ----------------------------------------------------------------------- */
Bleeptech is offline Find More Posts by Bleeptech
Last edited by Bleeptech; Feb 09, 2012 at 02:43 PM. Reason: Remove excess crap.
Reply With Quote
Old Feb 08, 2012, 06:01 AM
Radio? Screwdriver!
United Kingdom, England, Bristol
Joined Aug 2011
939 Posts
Quote:
Originally Posted by XJet View Post
Hey Janusz, the 16F84 has no ADCs so your circuit won't work -- unless you're planning on simply triggering an off/on change with the variable resistors.
Even though this is an old thread, this ought to be corrected for any future readers. Even though the 16f84 doesn't have ADC, it doesn't mean that you can't measure analog values. If you notice, there is no positive power rails going to those variable resistors.

What he would be doing, is to charge the capacitor by setting the port pin high, then switching the port pin to an input (high-impedance). Then you watch how long it takes to discharge the capacitor - till it hits the 16f84 threshold voltage point where it changes from a Logic 1, to a 0.

This was very common technique 5-10 years ago, when there wasn't many cheap microcontrollers with ADC about - however nowadays, its less much common. It still does have a place however if you are designing to a low price point - i.e. toys.

First link on google I found about it, describes it more: http://www.josepino.com/microcontroller/adc_wout_adc
SimonChambers is offline Find More Posts by SimonChambers
RCG Plus Member
Reply With Quote
Old Feb 08, 2012, 08:43 AM
Registered User
Joined Nov 2011
59 Posts
Quote:
Originally Posted by Bleeptech View Post
Here's what I'm using...
Cool. Thanks a lot.

So each channel is measured rising edge to rising edge, with the start edge of one channel being the end edge of the previous channel ?

Colin
zoom99 is offline Find More Posts by zoom99
Last edited by zoom99; Feb 08, 2012 at 09:03 AM.
Reply With Quote
Reply


Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Discussion Futaba 8 and 9 channel PPM output to RF mdoule? bigandy DIY Electronics 9 Mar 02, 2008 12:23 PM
Futaba FP-R148DF 8 channel RX's for sale. Jim McPherson Aircraft - Electric - Airplanes (FS/W) 10 May 02, 2002 10:18 AM
8 channel radio for sale INTEGRA Aircraft - Electric - Airplanes (FS/W) 4 Mar 10, 2002 08:50 AM
GWS R4P Receiver 4-8 channel mods! Mario Electric Heli Talk 10 Dec 04, 2001 04:52 PM
Need an 8 channel receiver DNA Power Systems 5 Nov 12, 2001 06:22 AM