Arduino as RC PPM Handler

Hi All,

I’m new to Arduino and have been having issues in getting it to do what I would like it to. (Using 0023 and Duemilanove 328)

Here is the break down of what i want it to do;

I want to read a PPM signal from a single channel of a Futaba RX.(right from the signal pin of CH3 Output on the RX)
I then want to output the PPM value (Microseconds) to the Serial Monitor and a servo.

EXAMPLE:http://diydrones.com/profiles/blog/show?id=705844:BlogPost:38418 (tried this and got readings mentioned below)

I’ve tried PulseIn, and the multiple Servo Libraries located on the forum and nothing seems to be working. I’m constantly reading a value between 8000 & 10000 (should be around 1000 to 2000) and all the servo does is jitter. There is no control or relation to my RC TX input what so ever. :disappointed_relieved:

I would really appreciate the help and insight.

Regards,
FlyBoy38L

I've tried PulseIn, and the multiple Servo Libraries located on the forum and nothing seems to be working. I'm constantly reading a value between 8000 & 10000 (should be around 1000 to 2000) and all the servo does is jitter. There is no control or relation to my RC TX input what so ever.

Well, that's obvious from the code you posted.

Or not.

I then want to output the PPM value (Microseconds) to the Serial Monitor and a servo.

Depending on the serial bit-rate and the amount you're sending to the serial monitor, there could be your problem. But we can't see your code, so we're guessing.

Hi,

Thanks for the responses. I appreciate your help and tolerating my beginner questions. This problem seems like it would be common but my searches have yielded no helpful results.

Here is the code:

#include <Servo.h>

// declare variables
unsigned long PPM;
Servo servo1;


void setup() {
  
	Serial.begin(9600);	// opens serial port, sets data rate to 9600 bps
        servo1.attach(11);
        servo1.writeMicroseconds(1500); //Center Servo1
        pinMode(8,INPUT);  //Declare Digital Input pin
}

void loop() {
	
        //read incoming PPM signal
        PPM=pulseIn(8,HIGH);
   
        // say what you got:
        Serial.print("I received: ");        
        Serial.println(PPM, DEC);
        
        //write signal to servo1
        servo1.writeMicroseconds(PPM);
}

I’ve been unable to get sensible data. I’ve tried the ServoDecode library and that doesn’t work either. Many times I will get random characters in the Serial Monitor when starting up the Serial monitor as well. All the other code uses the 9600bps rate and everyone else seems to be having no issues with it.

Maybe it will deal with the timeout in PulseIn or the Serial Rate?

Thanks Again,
FlyBoy38L

Ok, lose the servo code. Do the readings settle down? Have you connected the grounds?

Try use an analog input pin, fx A0 instead of pin 8.

I am speaking in theory only, but I hope I'll help: 1. Is the servo library working? When you set it to middle position in the setup, is it working? If you set: /// servo1.writeMicroseconds(1000); delay(2secs); servo1.writeMicroseconds(2000); delay(2secs); /// Will the servo go from start to end every 2 secs? If yes, you know the problem is in the input itself or something with the reading.

Btw, what RC input are you using? Can we be sure that the input is the standard? Also, are you sure you got the signal wire? Are you sure it is PPM with 1-2ms pulse each 20ms? What servo are you using? Knowing everything is the key to success. :)

Problem resolved!

Thanks for the help guys. Turns out the one of the GNDs on the board I am borrowing is not working. I connected the ground from my receiver to another ground. When I was rebuilding the setup I chose to use another open ground port. Works well now. It only jitters a bit but that is to be expected I guess. (PPM jumps 1480-1520 when centered) I don't think it will harm my project that much. I tried a simple filter that took the PPM, divided by 10, rounded to an integer, and then was multiplied back to PPM. Settled down a tad.

I read values from 1090-1910. I have bee using a Castle Creations BERG Receiver and a Futaba S3004 servo. Looks like I have room for End Point Adjustment!

I plan on using this to create a current limiting device for RC aircraft. Arduino will read an analog input (0-3.3V) from a current sensor and pull the throttle back accordingly to keep below a preset limit. I believe a simple ForLoop would do the job.

I like to push the limits of Power Systems and have fried a few Speed Controls/Motors in my day. Hopefully this will put an end to all that!

I appreciate the help you guys offered.

Regards, FlyBoy38L