Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: redloff on October 04, 2012, 04:17:23 PM

Title: 50$ robot rc signal processing
Post by: redloff on October 04, 2012, 04:17:23 PM
Hello everybody,

I've made 50$ robot and even managed to implement a push button interrupt handling to switch between different modes.
Additionally I scrapped a RC receiver from a toy car and soldered connectors where appropriate, so I could hook up receiver to any port on uC.

I have also tested that while playing with knobs on the transmitter I get either -4 or +4 Volts on the receiver (receiver has of course two output lines - forward/backward and left/right).

Now I would like to do something more than just hook up RC receiver directly to servos, as they are already nicely handled with PWM outputs.
What I would like to achieve is to detect this +/- 4V signal on two different input ports of the uC and handle those events with software.
Unfortunately I don't know where to connect and how to handle them. Should it be a standard input port or rather a2d?
Do I need to build any additional IC?

I will greatly appreciate any support  8)
Title: Re: 50$ robot rc signal processing
Post by: Soeren on October 04, 2012, 07:21:17 PM
Hi,


I have also tested that while playing with knobs on the transmitter I get either -4 or +4 Volts on the receiver (receiver has of course two output lines - forward/backward and left/right).
[...] What I would like to achieve is to detect this +/- 4V signal on two different input ports of the uC and handle those events with software.
With 3 resistors you could turn each of the +/-4V signal into eg. 1.5V (-4Vin), 2.5V (0Vin) and 3.5V (+4Vin) to feed into an A/D-C line (2 in total of course).

             o +5V
             |
            |R| 10k
             |
In o--[20k]--+--o Out
             |
            |R| 20k
             |
             / (gnd/0V)


With more external hardware, you could turn each channel into two digital signals (01, 00 and 10), which the controller can read faster and with a bit less programming, but at the cost of two I/O lines.
Title: Re: 50$ robot rc signal processing
Post by: waltr on October 04, 2012, 07:25:36 PM
Detect or measure the voltage?
Comparator input to detect, ADC input to measure analog voltage.

Warning: most digital devices (AtMega) do not like negative voltages. -4 volt to your processor can kill it. You need to have a circuit to prevents the negative voltage. Depending on exactly what you want to use this signal for will determine the circuit.
The circuit could be a diode and a resistor or a few Op-amps.

Lets us know what you want.

Edit: Soeren posted as I typed. His circuit is simple and safe.
Title: Re: 50$ robot rc signal processing
Post by: redloff on October 05, 2012, 11:50:22 AM
Thank you very much for the IC and a tip about negative voltages (I already experimeted with it but fortunately didn't burn anything).
The approach Soeren suggested is exactly what I would like to achieve.

Soeren: i understand +5V, GND and Out have to be plugged to the uC as +5V, GND and signal pins respectively, but what is "In" exactly? From the receiver I have two wires commig out, where should I connect the other one?
I'm sorry, I know this is an extremely lame question but IC schematics simply scare me (especially the open ones :))
I would also greatly appreciate any good and complete noob tutorial on understanding schematics, to be able to read things like you've posted and in future maybe even understand how they work  :D

One more question: isn't the receiver sending pwm signal to the uC?
If so, then I can imagine that handling the uC pin's high state interrupt wouldn't be enough to have a fluent speed control.
If the receiver is sending pulse signals, then servo movement would be rather jumpy, am I right?
Title: Re: 50$ robot rc signal processing
Post by: Soeren on October 09, 2012, 06:26:02 PM
Hi,

Soeren: i understand +5V, GND and Out have to be plugged to the uC as +5V, GND and signal pins respectively, but what is "In" exactly? From the receiver I have two wires commig out, where should I connect the other one?
Yes, it's the "hot" wire from the receiver, the other wire from the receiver is connected to ground (make sure that it IS the ground wire that you ground, especially if you power the receiver from the same power source as the logic.


I'm sorry, I know this is an extremely lame question but IC schematics simply scare me (especially the open ones :))
There's not an IC in sight!?
(IC is an acronym for Integrated Circuit).


I would also greatly appreciate any good and complete noob tutorial on understanding schematics, to be able to read things like you've posted and in future maybe even understand how they work  :D
I doubt that you can find anything really complete, but Google is your friend :)

Understanding a schematic sorta takes an understanding of how they work ;)


One more question: isn't the receiver sending pwm signal to the uC?
If so, then I can imagine that handling the uC pin's high state interrupt wouldn't be enough to have a fluent speed control.
If the receiver is sending pulse signals, then servo movement would be rather jumpy, am I right?
A standard receiver is sending PDM (Pulse Duration Modulation) signals, with a pulse duration of between 1ms and 2ms (some may overstep this standard though and duration may be as short as ~0.3ms to as high as ~2.8ms).
These pulses are repeated roughly at 50Hz (each 20ms).
Your task in software is to measure the durstion of this pulse

When you write about +/-4V, you have something besides the receiver added and only you can measure what signals it send.

Are you able to get eg. 1..2V out of the receiver, or is it only -4V, 0V and +4V?
Title: Re: 50$ robot rc signal processing
Post by: redloff on January 08, 2013, 05:24:30 AM
Sorry for bumping the subject, I had a little break in robotics...
@Soreen: thanks for clarifications, of course you were right - I have scrapped this RC module already with an IC which transforms pulse signal to (-4/+4V).

I managed to build an adapter based on your schematics with 3x10kOhm resistors and it works perfectly for one of the RC module outputs (up/down knob).
An interesting thing happend when I connect the other output (left/right knob) through the same adapter (and the same A2D port on uC for that matter). When I push the knob right, the output voltage rises from default 2.5 to over 3V, but when I push it to the left, the voltage on the uC circuit (not the output signal from the adapter, but the uC voltage) drops to around 1.5 V and everything obviously goes crazy as there is not enough voltage for the uC to operate.

I suspect the RC module is broken at some point, but perhaps anyone can think of other possibility or something I'm missing?

Also if anyone would be interested in undestanding basics of electronic circuits (ohm's and kirchhoff's laws and basic components) I can recommend searching on YT for "cuesta professor".
This guy has a lot of lectures and explaines everyting from scratch - for some people it might be even to annoying to listen to him as he really takes his time to explain the subject (;)) but in my case it was exactly what I was looking for. It helped me to briefly understand this voltage divider circuit and more.