Swap currents based on voltage

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
zinc55
 
Posts: 30
Joined: Thu Jan 19, 2012 6:52 pm

Swap currents based on voltage

Post by zinc55 »

That title is probably wrong, but I'm trying to get an R/C receiver to send signals to the Arduino. There are two wires for output. If you press the controller up, one wire will send 9v, the other one will act as ground. However, if down is pressed, the wires will swap, and the wire that previously sent current will act as ground, while the wire that previously acted as ground will send current. A thought of using a transistor, but I'm not sure how I would use it. Any ideas?

hjohnson
 
Posts: 78
Joined: Sun Dec 20, 2009 9:17 pm

Re: Swap currents based on voltage

Post by hjohnson »

So you have an RC controller that originally drove a motor, if I had to guess?

Your best bet is to run both signals into the Arduino and process it all out there. Be sure to use use two voltage dividers http://en.wikipedia.org/wiki/Voltage_di ... _divider_2, one on each of the two signals, to drop them to an arduino-safe 5V.

ASCII schematic for divider:

9V
|
3.6K
|------- signal to arduino.
4.3K
|
GND

When that's done, just process the signal in arduino: If both are low, no RC signal, otherwise, only one of them will be high. A few if statements and you're all set.

User avatar
philba
 
Posts: 387
Joined: Mon Dec 19, 2011 6:59 pm

Re: Swap currents based on voltage

Post by philba »

This RC receiver sounds like it has an integrated HBridge - used to control motor direction http://en.wikipedia.org/wiki/H_bridge.

To work with an arduino, you will need to first find a common ground (via battery minus terminal, most likely). Secondly, you will need to reduce the voltage to 5V or less. You could do this with a voltage divider using 2 resistors http://en.wikipedia.org/wiki/Voltage_di ... ve_divider Use 2 10K resistors and your arduino will see 4.5V. Then run each output wire through a divider to a digital input pin on the arduino (says 0 and 1). A high on a pin will indicate 9V on the corresponding output. If you can run the receiver off of 5V (instead of 9), you could skip the divider.

Is the control proportional (i.e. 1/2 up delivers lower voltage as read on a voltmeter)? If the output is proportional then your arduino will see a series of pulses (wider is faster). IN your arduino code you might need to take that into account.

note: hjohnson beat me to it. I posted anyway since there was additional info.

Additional note: the receiver isn't sending current. Current is being drawn by the motor (or load). The H Bridge is simply changing the polarity of the output pins. In general, current is pulled, not pushed. Voltage is "pushed".

hjohnson
 
Posts: 78
Joined: Sun Dec 20, 2009 9:17 pm

Re: Swap currents based on voltage

Post by hjohnson »

Or even better, if it is proportional, still use the voltage dividers, but run the 2 lines through 2 separate decoupling capacitor into two of the analog pins on the arduino. That way, you can actually take advantage of that proportional-ness of the input.

Harry

User avatar
philba
 
Posts: 387
Joined: Mon Dec 19, 2011 6:59 pm

Re: Swap currents based on voltage

Post by philba »

Yeah, though I would use a low pass filter with a cutoff of something like 1Khz.

User avatar
zinc55
 
Posts: 30
Joined: Thu Jan 19, 2012 6:52 pm

Re: Swap currents based on voltage

Post by zinc55 »

The R/C controller isn't proportional, just on/off. I have plenty of 10k resistors, but could I use the ground of the Arduino as common ground?

Thanks for the help!

hjohnson
 
Posts: 78
Joined: Sun Dec 20, 2009 9:17 pm

Re: Swap currents based on voltage

Post by hjohnson »

If you use two 4.7K ohm resistors as your voltage divider, then use a .1uF capacitor across the output, that should be roughly a low-pass filter with a cutoff frequency of 677 Hz or so, what with the Thevenin equivalent resistance of the two resistors. Assuming the frequency doesn't go too high, the reactance of the cap shouldn't matter all that much.

User avatar
zinc55
 
Posts: 30
Joined: Thu Jan 19, 2012 6:52 pm

Re: Swap currents based on voltage

Post by zinc55 »

It works wonderfully! Thanks for all the help!

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”