Servo and PPM

Hi I am using two arduinos (Mega and Uno). The Uno generates a PPM stream which is sent to the Mega via 433MHz. The code I found for doing this works great, except that it blocks the servo library almost completely. When I try to use a servo it jitters once ever few seconds or so but never move.

When I looked into what could be the cause I found that it’s probably the use of timer1. Since both uses this, and the PPM reading resets the timer alot I suppose that interferes with the timing of the servo signal.

So I tried changing the PPM code to use timer3 instead, which works for reading and printing the PPM but the servo still wont move.

The servo is not broken, it works with the same board using another sketch.

Am I missing something obvious here or does this go deeper?

Thankful for any help!

Read_any_PPM.ino (1.33 KB)

The Uno generates a PPM stream which is sent to the Mega via 433MHz.

Why? It would make a lot more sense to send the servo position/speed desired, and have the Mega generate the PPM pulses, using the Servo library.

he Uno generates a PPM stream which is sent to the Mega via 433MHz.

Does your transmitter have the bandwidth to transmit this?

What does the output of the receiver look like on a scope.

@PaulS I am using a PPM stream because I want to control several servos in the future and I have found that I get greater range when sending PPM instead of regular bytes with Serial/SoftwareSerial. Also if a send bytes and a single bit gets flipped I have to either discard the packet or I will possible get a big error. If I send PPM and I don't get the exact value it doesn't matter that much since 10uS makes out to be 2 degrees on a servo which in my application does not matter. In the future Paul I wouldn't mind you being a bit more open minded before replying to my threads with the attitude that I am an idiot. This isn't the first time you have left a snide reply on my threads on this forum. Thanks.

@Grumpy_mike The bandwith should be max 4KB/s and the transmission is working. On the receiving mega I can print the channel values received, +-3uS from the sent value. So I know for a fact that all the values I send arrive. I just can't get the servo to move.

void loop()
  //You can delete everithing inside loop() and put your own code here
  int count;

  while(ppm[count] != 0){  //print out the servo values

count is a local variable. It is NOT initialized to any known value. You can not, therefore, use it as an index into the array.

Forget connecting with a transmitter / receiver for the moment and just use a wire. Try and get it going like that and then worry about sending the signal. I must say this is not the way I would do things and can not see any advantage in what you are trying to do, I can only see trouble.

I did try using a wire before I made this thread (which I forgot to mention), with the same result. I am certain there's no problem with the wireless link itself. Nontheless I will try again witha wire tomorrow.

May I ask how you would have done it, and what's the advantage with your way? I really just want to learn and make my project as good as possible :) Thanks you for all your help :)

I can see pros and con's for using PPM. In a standard RC setup, PPM has the advantage that it's easy to multiplex several PWM channels, and the relatively high frame rate combined with mechanical inertia on the servos means occasional noise on the channel will be corrected next frame.

However, if you've got some processing horsepower, you could add simple forward error correction and use a serial protocol and potentially get more efficient use of your bandwidth.

Unless your signal is 100% then any signal dropout will result in random behavoure on the servo. If you only have to get any changes through. You can add error detection and correction and make a much more robust system.

You can also use the receiving Arduino to keep things simmering for a short period if it does find errors in the received data.

Another way to think about the problem is that you only need to send data when the data changes - so perhaps new data is only needed for one channel. The receiving Arduino can continue generating and sending outputs based on the last input received. If there is no change in the data you could send a short "things are OK" message at regular intervals so the receiver knows that the transmitter is still working happily.