Go Down

Topic: Decoding Radio Control signal pulses (Read 35 times) previous topic - next topic

mem

Separating odd and even channels could work although it would require very significant rework of the library to support this.

I don't have the time to look into this but would be happy to assist if someone  comfortable working with timer interrupts wants to try and get this going.

But in my opinion, its much less effort to modify a suitable RC receiver to get access to the PPM stream so it can be decoded by the current code.

Alexander Buschek

Since I aked a lot I just want to give a short update. Yes. Arduino does a perfect job for RC models. I started with a fully programmable Gear Door Sequencer that can handel as mans Servos as pins are available.

Every delay and speed of each servo can be individually set.

This is the init of the servos shown on the video below.

Code: [Select]
 // Prepare Servo Parameters and timings
 gearParameters[sNosegear].servoPin = 2;
 gearParameters[sNosegear].upPos_us = 1000;
 gearParameters[sNosegear].downPos_us = 2000;
 gearParameters[sNosegear].delays[GEAR_UP].wait_ms = 100;
 gearParameters[sNosegear].delays[GEAR_UP].delay_ms = 4000;
 gearParameters[sNosegear].delays[GEAR_DOWN].wait_ms = 7500;
 gearParameters[sNosegear].delays[GEAR_DOWN].delay_ms = 4000;

 gearParameters[sNoseDoor].servoPin = 4;
 gearParameters[sNoseDoor].upPos_us = 1000;
 gearParameters[sNoseDoor].downPos_us = 2000;
 gearParameters[sNoseDoor].delays[GEAR_UP].wait_ms = 4500;
 gearParameters[sNoseDoor].delays[GEAR_UP].delay_ms = 750;
 gearParameters[sNoseDoor].delays[GEAR_DOWN].wait_ms = 6700;
 gearParameters[sNoseDoor].delays[GEAR_DOWN].delay_ms = 750;

 gearParameters[sMainGear].servoPin = 3;
 gearParameters[sMainGear].upPos_us = 800;
 gearParameters[sMainGear].downPos_us = 2200;
 gearParameters[sMainGear].delays[GEAR_UP].wait_ms = 100;
 gearParameters[sMainGear].delays[GEAR_UP].delay_ms = 5000;
 gearParameters[sMainGear].delays[GEAR_DOWN].wait_ms = 1000; // Wait for door to open
 gearParameters[sMainGear].delays[GEAR_DOWN].delay_ms = 5000;

 gearParameters[sMainDoor].servoPin = 5;
 gearParameters[sMainDoor].upPos_us = 800;
 gearParameters[sMainDoor].downPos_us = 2000;
 gearParameters[sMainDoor].delays[GEAR_UP].wait_ms = 5500;
 gearParameters[sMainDoor].delays[GEAR_UP].delay_ms = 750;
 gearParameters[sMainDoor].delays[GEAR_DOWN].wait_ms = 100;
 gearParameters[sMainDoor].delays[GEAR_DOWN].delay_ms = 750;


Here it is in action:

http://www.youtube.com/watch?v=VtJAJNm8W8k

I plan to add a swicth that tells Arduino if the gear is up to prevent damage if the switch on the TX is set to down and the gear is actually down or vice versa.

Downside: I cannot use the Decoding lib as I had hoped. The PPM signal of the Jeti R10, R14 or R18 is not sufficient. BTW it is also not sufficient to use it in the way Jeti intended it, that one RX can serve as a satellite in case of signal loss. I did some more investigation and observed the same behaviour: wild servo movements if the Sat signal from the other RX is used.

But I am totally happy that I stumbled into Ardino.

And thank you mem for your initial suppport  :)

Cheers Alexander

mem

Looks good, can't wait to see a video of it installed in the DC-6.

I am curious why the PPM signal was unable to be decoded by Arduino. Do you have any technical information on the JETI PPM output (or a scope trace showing the voltage levels and timing)

Alexander Buschek

Thank you mem. Well I guess you have to be patient.

If you're interestes please follow my build thread on rcgroups.com

http://www.rcgroups.com/forums/showthread.php?t=1116302&page=31#post15520864

Regarding the PPM signal. I don't have the electronic knowledge. That's why I use Arduino ;)

But to me it looks like a Problem on the Jeti Receiver. Another Jeti receiver isn't either capable to deal with the signal and shows the same weird behaviour of the servos when forcing it into signal loss.

I forwarded it to Jeti and let's see.

Cheers Alexander

mem

I have subscribed to your rcgroups thread and will follow it with interest.

If you get any info from JETI (or if anyone else with one of those receivers has a scope) I will see if I can help get it working with the library.

Alexander Buschek

Thank you for our interest!

I'll post information here if I find something on the Jeti issue.

Cheers Alexander

MatrixGTI

Hi all,
It's my first post on this Forum  ;)
I start programming Arduino only few weeks ago.
My problem is use the ServoDecode Library to grab 7 ch from a modifyed Graupner RX.
The RX send the impulse train all toghether on one wire connected to digital pin of Arduino 2009.
I add Servodecode library to my sketch and I have this errors compiling the library: (also with the example sketch)

o: In function `__vector_13':
C:\DOCUME~1\ADMINI~1\IMPOST~1\Temp\build1989424199835515901.tmp/ServoDecode.cpp:45: multiple definition of `__vector_13'

C:\DOCUME~1\ADMINI~1\IMPOST~1\Temp\build1989424199835515901.tmp\ServoDecode\ServoDecode.cpp.o:D:\arduino-0018\arduino-0018\libraries\ServoDecode/ServoDecode.cpp:45: first defined here

o: In function `__vector_10':
C:\DOCUME~1\ADMINI~1\IMPOST~1\Temp\build1989424199835515901.tmp/ServoDecode.cpp:52: multiple definition of `__vector_10'

C:\DOCUME~1\ADMINI~1\IMPOST~1\Temp\build1989424199835515901.tmp\ServoDecode\ServoDecode.cpp.o:D:\arduino-0018\arduino-0018\libraries\ServoDecode/ServoDecode.cpp:52: first defined here

o: In function `__vector_13':
C:\DOCUME~1\ADMINI~1\IMPOST~1\Temp\build1989424199835515901.tmp/ServoDecode.cpp:45: multiple definition of `pulseEnd'

C:\DOCUME~1\ADMINI~1\IMPOST~1\Temp\build1989424199835515901.tmp\ServoDecode\ServoDecode.cpp.o:D:\arduino-0018\arduino-0018\libraries\

and many more.....

I'm running Arduino 018 with the library taken from the start of this thread.

Any help will be apreciated and sorry for my bad english  ;)

mem

@MatrixGTI

are you sure you tried the code and the example sketch exactly as posted at the start of this thread? they compile okay for me using 0018

MatrixGTI

@mem
I copy/past the code in the first page, maybe happend something during copy.  May I ask u the link of the library as file and not as code.
just to be sure of the file structure.

Thanks

Flavio

mem

This forum does not have a mechanism to upload files but if you compare the beginning and end of the code you copied you should be able to see if there were any characters added or removed.

MatrixGTI

Problem Solved... was my fault. the example file was in the same dir of the library.... moved away and now i'm able to read data from my 7 ch RX  :D

Just to save time in experiment what is the minum delay between two reading loops ? 20ms will be enaugh ?

mem

The data is updated at the rate it comes in typically every 20ms. Each read turns interrupts off while getting the data so I would not read it more quickly  than every 10ms or so.  

LukeZ

Vince and Mem, check here for a design that uses diodes to encode a PPM stream from individual servo pulses:


Tweaked

mem,
I've been working with the Mega and this library interfaced with a Multiplex Profi 403 transmitter.  I ran the following sketch:
Code: [Select]
int pin = 49;  // set this to the pin connected to your receiver
unsigned long duration;

void setup()
{
 Serial.begin(9600);
 pinMode(pin, INPUT);
}

void loop()
{
 duration = pulseIn(pin, HIGH);
 Serial.println(duration);
 delay(250);
}
with the following result:
Code: [Select]
349
349
349
349
343
350
349
349
349
343
343
349
349
342
342
 the ppm signal appears to have a fixed mark and variable space, so I changed the sketch above to monitor the signal space instead with the following result:
Code: [Select]
646
646
1142
652
1136
1631
1142
652
1136
1632
1142
1632
1142
1632
 Adding the two together, it seems I'm sucessfully detecting anywhere from 997 to 1980ms pulses in the ppm signal.  Now that I'm confident I'm on the correct signal pin, I try the example sketch and get the following result:
Code: [Select]
The decoder is READY
Cx0= 5935  Cx1= 1936  Cx2= 2056  Cx3= 1131  Cx4= 1500  Cx5= 1500  Cx6= 1500  Cx7= 1500  
Ch1= 820  Ch2= 1823  Ch3= 1131  Ch4= 1500  Ch5= 1500  Ch6= 1500  Ch7= 1500  
The decoder is READY
Cx0= 7034  Cx1= 1040  Cx2= 2039  Cx3= 1131  Cx4= 1500  Cx5= 1500  Cx6= 1500  Cx7= 1500  
Ch1= 1590  Ch2= 2039  Ch3= 1131  Ch4= 1500  Ch5= 1500  Ch6= 1500  Ch7= 1500  
The decoder is READY
Cx0= 8133  Cx1= 1137  Cx2= 2139  Cx3= 1131  Cx4= 1500  Cx5= 1500  Cx6= 1500  Cx7= 1500  
Ch1= 1686  Ch2= 2023  Ch3= 1131  Ch4= 1500  Ch5= 1500  Ch6= 1500  Ch7= 1500  
The decoder is READY
Cx0= 9232  Cx1= 767  Cx2= 2236  Cx3= 1131  Cx4= 1500  Cx5= 1500  Cx6= 1500  Cx7= 1500  
Ch1= 1317  Ch2= 2123  Ch3= 1131  Ch4= 1500  Ch5= 1500  Ch6= 1500  Ch7= 1500  
Ch1= 1866  Ch2= 2006  Ch3= 1131  Ch4= 1500  Ch5= 1500  Ch6= 1500  Ch7= 1500  
The decoder is READY
Cx0= 7884  Cx1= 917  Cx2= 2219  Cx3= 1131  Cx4= 1500  Cx5= 1500  Cx6= 1500  Cx7= 1500  
Ch1= 1466  Ch2= 1990  Ch3= 1131  Ch4= 1500  Ch5= 1500  Ch6= 1500  Ch7= 1500  
The decoder is READY
Cx0= 8983  Cx1= 2016  Cx2= 1990  Cx3= 1131  Cx4= 1500  Cx5= 1500  Cx6= 1500  Cx7= 1500  
Ch1= 2086  Ch2= 1990  Ch3= 1131  Ch4= 1500  Ch5= 1500  Ch6= 1500  Ch7= 1500  
Ch1= 1450  Ch2= 1973  Ch3= 1131  Ch4= 1500  Ch5= 1500  Ch6= 1500  Ch7= 1500  
The decoder is READY
Cx0= 6631  Cx1= 1190  Cx2= 1973  Cx3= 1131  Cx4= 1500  Cx5= 1500  Cx6= 1500  Cx7= 1500  
Ch1= 1740  Ch2= 1973  Ch3= 1131  Ch4= 1500  Ch5= 1500  Ch6= 1500  Ch7= 1500  
The decoder is in Failsafe
Cx0= 8733  Cx1= 1287  Cx2= 1956  Cx3= 1131  Cx4= 1500  Cx5= 1500  Cx6= 1500  Cx7= 1500  
Ch1= 1836  Ch2= 1956  Ch3= 1131  Ch4= 1500  Ch5= 1500  Ch6= 1500  Ch7= 1500  
The decoder is READY
Cx0= 9832  Cx1= 1723  Cx2= 1956  Cx3= 1131  Cx4= 1500  Cx5= 1500  Cx6= 1500  Cx7= 1500  
Ch1= 941  Ch2= 1940  Ch3= 1131  Ch4= 1500  Ch5= 1500  Ch6= 1500  Ch7= 1500  
The decoder is READY
Cx0= 9928  Cx1= 1490  Cx2= 1940  Cx3= 1131  Cx4= 1500  Cx5= 1500  Cx6= 1500  Cx7= 1500  
Ch1= 1037  Ch2= 2040  Ch3= 1131  Ch4= 1500  Ch5= 1500  Ch6= 1500  Ch7= 1500  
The decoder is READY
Cx0= 11027  Cx1= 808  Cx2= 1923  Cx3= 1131  Cx4= 1500  Cx5= 1500  Cx6= 1500  Cx7= 1500  
Ch1= 1357  Ch2= 1923  Ch3= 1131  Ch4= 1500  Ch5= 1500  Ch6= 1500  Ch7= 1500  
The decoder is READY
Cx0= 12126  Cx1= 904  Cx2= 1907  Cx3= 1131  Cx4= 1500  Cx5= 1500  Cx6= 1500  Cx7= 1500  
Ch1= 1453  Ch2= 2240  Ch3= 1131  Ch4= 1500  Ch5= 1500  Ch6= 1500  Ch7= 1500  
The decoder is in Failsafe
Cx0= 13225  Cx1= 2003  Cx2= 2240  Cx3= 1131  Cx4= 1500  Cx5= 1500  Cx6= 1500  Cx7= 1237  
Ch1= 1367  Ch2= 1890  Ch3= 1131  Ch4= 1500  Ch5= 1500  Ch6= 1500  Ch7= 1500  
 The transmitter is 7 channel with a 25ms ppm signal period.

Any insight why the above is happening?

Thanks in advance,
Billy

Go Up