0

I'm trying to get the value of a single pin from an rc receiver (receiver info at bottom). What's the correct way to read the value coming in? Here's my existing code:

import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BCM)
GPIO.setup(23, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)

while True:
    print(GPIO.input(23))

GPIO.cleanup()

More info:

I have an RC receiver that controls servos / brushless motors. I've been having trouble finding a data sheet for it but an image of the receiver is below:

rc receiver

  • Have you identified a ground pin? Not much point in reading a pin unless you also connect its ground to the Pi. Have you confirmed that the range of voltages on the pin is Pi safe, i.e. between 0 and 3.3V? If so the code will read the pin's level as high (>2) or low (<1), The pull down is redundant. – joan Mar 2 '15 at 8:02
  • I know the ground column is the furthest right in the photo. You can see a little diagram on the receiver just left of where you see "BAT". I just read on my multimeter for the throttle signal pin an ACmA range of 2.4(low) - to 3.74(high). FYI the Throttle is CH3 with left-right pin order of signal, hot, ground. – Jacksonkr Mar 2 '15 at 19:44
2

I'm affraid there is no "value" here that you can read easily with RPi.

http://www.mitchr.me/SS/batteriesRequired/RCcontrolTheory/

Long story short: you would have to measure the time between pulses, use interrupts and python will be not fast enough to do that. C code will be more suited.

GPIO interrupts, read here:

http://www.raspberrypi.org/forums/viewtopic.php?f=44&t=7509 http://www.raspberrypi.org/forums/viewtopic.php?f=44&t=9207

And on electrical part of a problem. Those RC receivers works on 5V, GPIO is 3.3V. Voltage divider required.

  • I was planning on using C but it sounds like rpi still isn't the right tool for me. What if I plugged my analog pins into an arduino and then shipped the info off to rpi via digital? It might require some sort of "digital encapsulation" but it's doable ya? – Jacksonkr Mar 5 '15 at 17:23
  • 1
    They are not even "analog". What I would do is: use Arduino (or even better bare Atmega) to measure length of pulses and communicate with RPi via I2C. Arduino/Atmega would be I2C slave and RPi master – Paweł Spychalski Mar 6 '15 at 7:52
  • 1
    Starting with the arduino may be a good idea here as there is source code available. – Steve Robillard Mar 6 '15 at 11:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.