Check out this tutorial from our own Nick Poole!
Today we have a great tutorial from SparkFun employee Nick Poole. You may know Nick from some of his work in the product videos, as he is often instrumental in the creation of the devices for the demos. This time, Nick has made a fairly detailed tutorial about pairing an RC Hobby Controller with an Arduino. Read all about it here!
In this tutorial, Nick will guide you through using an RC transmitter, an Arduino, and other bits and bobs to get straightforward wireless control over your project. "Why not just use XBee?!," you might be thinking. Well, we love XBee and it definitely has its time and place, but sometimes you just want a good ol' fashioned RC joystick. Check out the tutorial for all the info, including sample code.
I used to read servos pulses from the receiver , alas I've switched to using DSM satellite receivers. Use a normal RX and bind them to the transmitter. Then just apply 3.3V and ground and they give TTL level async serial out. Key details:
115200 baud 8N1 I've seen this listed as 125K baud, my very precise calibrated scope says 115200.
The receiver sends a block of data every 20 msec....
The data comes in as binary bytes, I pair these into 16 bit words. Read this data as 16 bit binary words in big endian mode (IE MSB is first on the wire)
After the 20msec pause the first WORD is the number of times the receiver has lost link with the transmitter * 0x2C so if it looses link once the first WORD is 0x002C looses 16 times 0x02C0 etc...
The following words are all 16 bits and of the format
cccccc vv vvvvvvv Where cccccc is the channel number and vvvvvvvvvv is 10 bits of position data from 0x001 to 0x3FF 0x200 seems to be zero.
The system sends the whole data set twice in each frame with no pauses then waits 20msec and does it again. The second set of data may be differnt than the first if the stick is moving while sendingg, ie the second set of data may have updated positions.
The one area of confusion is that different TX's send different amounts of data (4,5,6,7,10 ch etc..) and I'm not 100% sure how to differentiate between the channel 0 data frame and the repeat signal quality frame loss frame. Different transmitters send the data in differnt orders, so you MUST read the channel data.
Hope that useful....
Aw cool! I must know more.
I assume you're talking about the Spektrum systems, correct?
Is there a way to tap into that serial signal with the park flyer receivers? (I have a few extras lying around) ...or is it only generated by the Satellite?
I just found this link which has more links inside it.
Do you have any more on this subject?
Really good, a couple of months ago I were looking after examples on just this! Thank you!
But for those - as me - who looks for something more straight off Arduino-compatible and more serious (i.e. longer range) solution for RC, I would want to tip you about another option I've found to be very interesting; there is this excellent but yet very unknown project called OpenLRS (Long Range System). It's based on a Atmega328 processor with the Arduino Bootloader and can function both as a Tx and a Rx with a range that regular off-the-shelf RC products only can dream about and that's even >without< the optional unidirectional 7W booster that provides additionally a couple of miles/kilometers of range. If it sounds interesting you should definitely give it a look! Perhaps Sparkfun even can do a deal with those behind that project and sell their products too, that would be truly awesome =)
darn! I sold my broken RC helicopter last year, although the RC part was probably fine. if only I knew about this...