New Rx Tx and Debugging


03.14.09 Posted in Quadcopter by

The replacement AR500 receiver came in the mail the other day. I managed to power it up without killing it like last time. I got a brand new transmitter too because the first one was the wrong mode. Mode 2 has the throttle on the left stick (which is standard in the US), and what I expected when I bought the first one. I was just unaware of the difference.

I used two servo extensions across the main data lines (instead of the usual configuration where the also connected to the power) and used a separate servo extension to go into the batt port. To my surprise, the receiver and transmitter connected automatically, so I was in business.

To read in the values of the receiver, I connect the lines to digital pins 2-7. I’m still a little shaky on just how the PWM output works, but I do know that there is one best way to read it in. Basically, I have six pins that I need to pulseIn( ) to get the pulse width. From what I understand, the receiver outputs a pulse in a very specific order for the channels. So the output may look like this:

  • Roll -> Roll2 -> Pitch -> Throttle -> Yaw -> Gear

With each pulse following the one before it. If I pulseIn( ) in this specific order, it will happen very fast (which is good). However, let’s say I pulseIn( Gear) after Roll. It will have to wait until the Gear channels pushes a pulse, and it skips all of the other useful channels in the middle. Of course, this is terribly inefficient. So if my probability is up to snuff, there are 6! = 720 possibilities for the channel output order. I tried for a while to get the correct one, but I couldn’t find a reasonably scientific way to figure it out. Soon, I was just guessing at the order. I got the loop time down to 34 milliseconds, but it needs to be way faster than that. Maybe I need to wait until I can get a ‘scope to figure it out. Looking at the code here, I’m not using a third parameter for pulseIn( ). When I do, that sets a timeout for how long it will wait for a pulse. It didn’t help. In fact, when I enabled the timeout, certain channels would always timeout! Oh well. This is a small problem I will need to solve soon.




Comments are closed.

Social Networks
Links
Search the Archives: