gachimayaaa
Posts: 3
Joined: Sat Oct 25, 2014 2:46 am

DSM2/DSMX serial analysis

Sat Oct 25, 2014 2:56 am

I'm trying to connect and use a Spektrum, spread-spectrum R/C "satellite" reciever with my Pi. There is some information about doing so with the Arduino, including helpful source samples.

e.g. http://www.dogfight.no/2011/01/spectrum ... duino.html

I'm trying to do the same with my Pi and Python.

It appears this receiver can be talked to as a serial device. I have some doubts about how to get started. I have three wires, one of which is ground, one of which takes +3.3v and the third of which is for "communication". I think I can get myself started if I can figure out:

1) How do I do serial over "one wire"? Does it just get connected to the RX pin?
2) What should I be concerned about with regard to safety? (i.e., Resistors? Where?)
3) How can I view the data coming over the link? I'd like to be able to give an input on my transmitter and watch what values change.

Any ideas? I can of course supply more info if users can direct my as to what to ask, investigate, etc.

Thanks.

User avatar
joan
Posts: 14936
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: DSM2/DSMX serial analysis

Sat Oct 25, 2014 5:22 am

Firstly you'll need to disable the Pi's default use of the UART. It bungs boot messages out and then allows a login console. At least disable the login console part. Search for disable serial link.

From the blog it appears to be straightforward.

Connect ground, 3V3, and the UART RXD pin P1-10 (gpio15).

I suppose you could add an optional 2k resistor to the RXD line. It will provide a little protection in case you accidentally feed 5V into the receiver.

Set the baud rate to 115200 and that should be the end of the configuration.

stty -F /dev/ttyAMA0 115200

To test reception try

cat </dev/ttyAMA0 | od -x

Which should print out received data.

gachimayaaa
Posts: 3
Joined: Sat Oct 25, 2014 2:46 am

Re: DSM2/DSMX serial analysis

Sat Oct 25, 2014 6:01 am

Exactly like you say! Works like a charm. Now to fiddle with the bytes.

Thank you.

User avatar
joan
Posts: 14936
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: DSM2/DSMX serial analysis

Sat Oct 25, 2014 8:45 am

Good.

The blog was more complicated than needed for a Pi.

Firstly, the hardware peculiarities of the author's Arduino didn't let the serial port work in-situ.

Secondly, the need to have one circuit to run the software and another to download the software.

gachimayaaa
Posts: 3
Joined: Sat Oct 25, 2014 2:46 am

Re: DSM2/DSMX serial analysis

Sat Oct 25, 2014 10:34 am

In case it's of any use to anyone who stumbles upon this thread: https://github.com/stnbu/rpi/blob/master/dsm.py may help clarify things.

Return to “Beginners”