Promini as CPPM (PPMSUM) decoder?

Post Reply
dr.tom
Posts: 141
Joined: Fri Mar 30, 2012 4:46 pm
Location: Croatia
Contact:

Promini as CPPM (PPMSUM) decoder?

Post by dr.tom »

Hello,

I'm flying a 2m wingspan model,
best range is when my UHF RX and VTX antennas are separated as much as they can, on vinglets...
video: http://www.youtube.com/watch?v=D_kiIUaa ... A7&index=2

but then I have to route all servo cables over whole wing (rx is there because of keeping the antenna short)
I did it with flat cable but it's not so practical on long run...
http://www.flyfreak.net/fpv-i-ap/nova-s ... /#msg95425
It would be better to route PPMSUM via 3 thin wires(-,+,PPM) and decode it in big spacious fuselage(power would be distributed to servos there also, no problem there)


I saw on web that promini can decode PPM SUM signal to PWM.
( in reply to this topic, scroll a little bit down http://diydrones.com/profiles/blogs/gal ... sed-on-apm )


Since I have PPMSUM on Rangelink RX. (by the way, it works in Multiwii pretty good, but in plane I have plain servos not MWC)

can someone point to a code that would input PPMSUM
and output at least 7 PWM channels out (more are welcome if possible) :)

the subject was discussed here also, but more pricy solutions were only offered,
http://fpvlab.com/forums/showthread.php ... PM-decoder
And it seems like a cheap Pro Mini can handle it in a blink

This doesn't use the PWM modules on the 328 chip (there are only 2 or 3)
so you can have up to 9 outputs with 50 Hz PPM.
This is possible because the entire program is interrupt driven.
The one 16 bit timer does everything.


Thanks :)
Attachments
PPM to PWM decoder.jpg
Last edited by dr.tom on Tue Dec 18, 2012 9:12 am, edited 1 time in total.

User avatar
Hamburger
Posts: 2580
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: Promini as CPPM (PPMSUM) decoder?

Post by Hamburger »

you could either
- run an MWC on your winged gadget and benefit from enhanced stability feature
or
- reduce MWii to the ppmsum2pwm portion (remove all sensor and mixing stuff etc.)

dr.tom
Posts: 141
Joined: Fri Mar 30, 2012 4:46 pm
Location: Croatia
Contact:

Re: Promini as CPPM (PPMSUM) decoder?

Post by dr.tom »

thanks for the tip
(and for making MWC code better and better, I keep seeing your name in updates) :)

I already have an OSD with autopilot(attitude, heading and altitude lock and RTH functions)
from 1m:50s http://www.youtube.com/watch?v=zbk3ipTgMqo
(hoping that MWC coders will fully implement GPS RTH for planes too,
I like it on my multirotors very much :) viewtopic.php?f=9&t=1696 )

will try to remove unwanted pieces like you suggested,
the problem part will be to make mwc to output all PWM channels out...but will try :)

dr.tom
Posts: 141
Joined: Fri Mar 30, 2012 4:46 pm
Location: Croatia
Contact:

Re: Promini as CPPM (PPMSUM) decoder?

Post by dr.tom »

configured MWii to read 8 channels over PPM sum
for now on full MWC board not to mess with sensor part, to avoid getting i2C errors,
later will try on plain promini arduino and solder pins

Image


every channel works OK
reacts correctly to stick/button/pot movement.

high
Image

low
Image

but I'm stuck at getting it spit out as PWM on 328p, no mix, no anything, just decode ppmSUM to each pwm
first 4 channels work ok, how do I activate other 4?
(I do not need 6 inputs like with classical RX, only 1, so outputs can use some of those pins if needed because of I/O pins restrictions)

wrote it like this in output, line 1048 (dev1284):

Code: Select all

#if defined(AIRPLANE)
    if(f.PASSTHRU_MODE){   // Direct passthru from RX
      servo[0]  = servoMid[0]+(rcCommand[ROLL]                  *servoReverse[0]);     // 
      servo[1]  = servoMid[1]+(rcCommand[PITCH]                 *servoReverse[1]);     // 
      servo[2]  = servoMid[2]+(rcCommand[THROTTLE]              *servoReverse[2]);     //   
      servo[3]  = servoMid[3]+(rcCommand[YAW]                  *servoReverse[3]);     //   
      servo[4]  = servoMid[4]+(rcCommand[AUX1]                  *servoReverse[4]);     //   
      servo[5]  = servoMid[5]+(rcCommand[AUX2]                   *servoReverse[5]);     //   
      servo[6]  = servoMid[6]+(rcCommand[AUX3]                 *servoReverse[6]);     //   
      servo[7]  = servoMid[7]+(rcCommand[AUX4]                  *servoReverse[7]);     //


Thanks for some help :)

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Promini as CPPM (PPMSUM) decoder?

Post by PatrikE »

Hi Tom,

Test this sketch.

Uses this defines

Code: Select all

    #define PPM_PWM_CONVERTER  // PPM to 8 servos 
    #define SERIAL_SUM_PPM         ROLL,PITCH,THROTTLE,YAW,AUX1,AUX2,AUX3,AUX4,8,9,10,11 //For Robe/Hitec/Futaba
.
.
.

  /***********************          Heli  &&   PPM_PWM_CONVERTER       ***********************/
    /* Set Maximum available movement for the servos. Depending on model */
    #define SERVO_ENDPOINT_HIGH {2000,2000,2000,2000,2000,2000,2000,2000};
    #define SERVO_ENDPOINT_LOW  {1020,1020,1020,1020,1020,1020,1020,1020};



Please test.

/Patrik
Attachments
MultiWii_PPM_Servo.zip
(130.44 KiB) Downloaded 250 times

dr.tom
Posts: 141
Joined: Fri Mar 30, 2012 4:46 pm
Location: Croatia
Contact:

Re: Promini as CPPM (PPMSUM) decoder?

Post by dr.tom »

It WORKS! :)

thank you very very much.


hope it will make use to some other pilots too,
because in long range FPV it is pretty useful to be able to decode PPM sum to PWM and place receiver far away, with short antenna.


it works like this on Promini
THR - > D12
ROLL -> A0
PITCH -> A1
YAW -> A2
AUX1 -> D11
AUX3 -> D10
AUX2 -> D3
AUX4 -> D9


I know that mwii supports thr failsafe for multirotors

but is there a possibility to add failsafe output on some more channels (at least 1 more)
so if ppmsum stream is lost(broken connection in flight) that OSD RTH can be engaged by arduino code
(throttle to preset ... us, and some auxch to preset ... us)

will look into code,
if it can just be added in failsafe routine
something like ... IF failsafe then (THR=xyz) AND (AUX1=zxy)

just trying this now... in multiwii tab
EDIT: it works! :D any channel needed can just be added ( rcData[ch] = some_setting; )

Code: Select all

  #if defined(FAILSAFE)
      if ( failsafeCnt > (5*FAILSAFE_DELAY) && f.ARMED) {                  // Stabilize, and set Throttle to specified level
        for(i=0; i<3; i++) rcData[i] = MIDRC;                               // after specified guard time after RC signal is lost (in 0.1sec)
        rcData[THROTTLE] = conf.failsafe_throttle;
        rcData[AUX1] = 2000;
      }
      failsafeCnt++;
    #endif


removed failsafe shutdown after xx seconds,
because in this situation, it should be ON until signal is back, no matter the time
(if link is broken for longer time, the plane can travel in RTH for 50 min without problem, either linear to home, or circle above home until you fix your gear)

will try to see if there is any impact on defining 300Hz servo output, since I do use digital servos on that plane.

User avatar
Hamburger
Posts: 2580
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: Promini as CPPM (PPMSUM) decoder?

Post by Hamburger »

Be careful with ghat 300Hz on promini.
I had intermittent servo jitter on heli - and crash.
The author Ronco assumed too much load with that option for the promini in interrupt handling.

dr.tom
Posts: 141
Joined: Fri Mar 30, 2012 4:46 pm
Location: Croatia
Contact:

Re: Promini as CPPM (PPMSUM) decoder?

Post by dr.tom »

is at least 160 Hz ok?

even enough to use it on first 2(roll+pitch) or 4 first channels(roll+pitch+thr+yaw) if possible,
because now it seems a little jerky on 50Hz, even at 1000us CT on plain promini without sensors.

other are just for switching OSD and autopilot options and doesn't matter so much that they don't respond so smoothly

thnx for reply and 'heads up' warning about 300Hz :)
Last edited by dr.tom on Mon Dec 17, 2012 11:24 pm, edited 1 time in total.

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Promini as CPPM (PPMSUM) decoder?

Post by PatrikE »

Gui for the new model
http://multiwii.googlecode.com/svn/branches/PatrikE/GUI/MultiWiiConfSERVO.zip

If it works good we can add the model in _shared.

Maby servo center offset should be added to :?:

dr.tom
Posts: 141
Joined: Fri Mar 30, 2012 4:46 pm
Location: Croatia
Contact:

Re: Promini as CPPM (PPMSUM) decoder?

Post by dr.tom »

Thanks Patrik

that would be GREAT,
to modify servo center(trim) in gui,

because it eliminates the need for constant reupload of the code
(maybe end points too?)

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Promini as CPPM (PPMSUM) decoder?

Post by PatrikE »

I'm working on a Gui to adjust the servosettings.
It's built in to the gui i linked to.

If you select airplane you will see a servo button in the gui.(Toggles some graphics)
But the arduino sketch don't havethe feature built in yet.(But it's comming...;))

Right now i can set midpoints.
Next step is rates and reverse servos.

Since it's within the Gui it will work wireless to if you have a working link.

dr.tom
Posts: 141
Joined: Fri Mar 30, 2012 4:46 pm
Location: Croatia
Contact:

Re: Promini as CPPM (PPMSUM) decoder?

Post by dr.tom »

Thank you,

I haveRCTimer BT and 433 links('#define LCD_SERIAL3W' option) available for trimming use on the field :)
http://rctimer.com/index.php?gOo=goods_ ... oductname=

I already fly long range on 433 UHF TX, so this module will only be used for setting up via laptop,
then removed, because the less RF on board, the better the range :)

but it must be set up for correct baudrate when you get it,
http://www.rcgroups.com/forums/showthre ... st23131956
it's initially setup is at different one (maybe for ardupilot?)
Last edited by dr.tom on Tue Dec 18, 2012 8:06 am, edited 2 times in total.

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Promini as CPPM (PPMSUM) decoder?

Post by PatrikE »

I have ordered the same link.
It's at the customs atm...

The renge on BT is not long!.
Build a serial relay station?
Android<->BT<->Arduino portforward<->433<->MWii

Just use the Muliti serial example in arduino.

User avatar
Hamburger
Posts: 2580
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: Promini as CPPM (PPMSUM) decoder?

Post by Hamburger »

dr.tom wrote:is at least 160 Hz ok?
even enough to use it on first 2(roll+pitch) or 4 first channels(roll+pitch+thr+yaw) if possible,
because now it seems a little jerky on 50Hz, even at 1000us CT on plain promini without sensors.
thnx for reply and 'heads up' warning about 300Hz :)

I use 160Hz on one heli and default 50Hz on the other. Seems to depend on ???.
With promini the pwm signal is generated in software, with current implementation the setting is always valid for all servos.
Jerky servo with such a low CT and at 50Hz? Can you try other brand of servos, maybe even analog?
With 50Hz we would expect it to be solid (and kinda slow). Or you could increase CT to a higher value (waste some mcu cycles) and hope it benefits the interrupt handling code. Someone with more knowledge on this topic would have to comment here.
On the heli CT is around 2.8ms. I did never feel a difference using higher update rates on the servos. But then I am not a proficient flyer :)

dr.tom
Posts: 141
Joined: Fri Mar 30, 2012 4:46 pm
Location: Croatia
Contact:

Re: Promini as CPPM (PPMSUM) decoder?

Post by dr.tom »

thnx,
my fault :)

my 500mw 433 tx was on table when I tested it, jerks came from RX,
when I plugged servo directly in it(it supports PWM+PPM at same time) it behaved same.

In a rush I forgot that TX has to be over 2m away from rx for clean run :)
now is ok on 50Hz. will try on 160Hz when I install it in plane.

I will stick to code set positions, because in new sketch they will be written in eeprom, and editable in GUI, right?
and I am sure eeprom can be messed up by strong FPV video TX,
(because one hexa flew over 60 flights OK, with AIO PRO 2560,
then we tried to hook up an 1500mW tx from my plane, separate battery, not connected to MWC in ANY way.
and in perfect hover about 30 sec later it crashed and inspection showed that acc calibration was erased, it couldn't take of any more, fliped.
after recalibrating again, it flew fine, but we removed VTX just in case... I don't want to take this risk with my plane)


updated first post with pictures of possible use,
I believe 2 arduinos can use same PPM line, right?

here's my soldered arduino with pins for servos and PPM in.
Image
Last edited by dr.tom on Sat Jan 12, 2013 3:30 pm, edited 3 times in total.

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Promini as CPPM (PPMSUM) decoder?

Post by PatrikE »

I will stick to code set positions, because in new sketch they will be written in eeprom, and editable in GUI, right?

Yes and No it's saved in Eeprom since a V2.1 and Partly editable with LCD!
I'm now modifying for Full Gui editing to.
But it's possible to make a hack if you want it hardcoded!

I like the Idé to use PPM as a BusProtocoll! (Like i2c)
Easy cable routing and fully configurable servoMixer.
Place a ProMini or Micro near the servos With a special Mixtable for each servoGroup.

Cost: 1 small arduino + 1 servoCable per servoGroup. About 10-15 €.

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Promini as CPPM (PPMSUM) decoder?

Post by PatrikE »

If your VTX can reset Eeprom...
What else can it do?

RC rx probably contains a Eeprom to!....
And what else? servos and ........

I would think twice about using it at all!

dr.tom
Posts: 141
Joined: Fri Mar 30, 2012 4:46 pm
Location: Croatia
Contact:

Re: Promini as CPPM (PPMSUM) decoder?

Post by dr.tom »

yes, it's super solution for many uses :)

for little money you can setup it like here :)
http://www.youtube.com/watch?feature=pl ... jIk#t=280s

btw, why does failsafe kick in only if I power the board without ppm stream connected?
If I unplug it(PPM in) during operation, failsafe doesn't activate...
did you try it?

regarding eeprom and VTX,
dunno, I fly long range with it in my plane, no problem of any kind. http://www.youtube.com/watch?v=s5iFd0ZU ... 7&index=17
but I know that it's a fact if you have a cellphone with incoming call 10-20cm from KK1 multi board,
it erases it's gyro settings, and model flips also when trying to takeoff. until you do the gyro reverse procedure again.

so I'm cautios before putting FPV gear in my multis
Image
(had it in tricopter dough, that was fun :) )
http://www.youtube.com/watch?v=Vk15-h3B7WU

dr.tom
Posts: 141
Joined: Fri Mar 30, 2012 4:46 pm
Location: Croatia
Contact:

Re: Promini as CPPM (PPMSUM) decoder?

Post by dr.tom »

new plug&play product doing right this thing needed for FPV models came up, just bought it and will report if it works ok.
http://www.foxtechfpv.com/rmilec-ppmpwm ... p-403.html

dr.tom
Posts: 141
Joined: Fri Mar 30, 2012 4:46 pm
Location: Croatia
Contact:

Re: Promini as CPPM (PPMSUM) decoder?

Post by dr.tom »

PatrikE cleaned up previous version of code, now it has failsafe in case ppm line gets disconnected.
Thanks.

here are some pics of my arduino decoder ready for pluging servos in :)
ImageImage
ImageImage
Image

but I ended up using the one linked in post above, because I needed arduino for some gimbal project:
viewtopic.php?f=7&t=2897

ImageImageImage

Post Reply