Society of Robots - Robot Forum
Electronics => Electronics => Topic started by: totalis on December 05, 2010, 01:34:53 PM
-
Basically i am converting a small RC car to use an ATMEGA328 as a control mechanism, ideally i would like to still be able to use the R/C remote to drive the car but have the ATMEGA as a 'middle man'
I have found that if i tie one of the motor outputs (electrical connection on motor) of the GND rail, the other will be either +4v or -4v.
My question is, how do i turn these +-4v signals into digital pin inputs for my microcontroller?
i have a range of transistors available as well as diodes, resistors and caps etc.
any help is appreciated
To help explain
4v 0v -4v
pin1 HIGH LOW LOW
pin2 LOW LOW HIGH
Many thanks
T
-
An H-Bridge can cover that just fine. With one half of the bridge connected to Pin 1 and the other half on Pin 2. Be sure to add Pull-Ups to the PNP transistors, and Pull-Downs to the NPN transistors as on startup with most MCUs, the IO pins are in a High-Z state and can accidentally create a short circuit within the bridge.
Remember to add protection diodes to the bridge as well.
-
I may have described this problem poorly.
Basically, if Vin is negative then the output has to be HIGH (+5v)
else if Vin >= 0 , the output is LOW (0v)
@macdad, thanks for the response, i am still trying to figure out what the circuit would look like.
I have tried a Unity gain inverting amplifier but i cannot seem to make it work.
T
-
Use the attached circuit, play around with the resistor values. The big "H" is the logic output that you can interface to your microcontroller. The -4V is Vin.
-
Hi,
I may have described this problem poorly.
No, it was quite clear - you want to decode the output of the H-bridge in your R/C-car.
I have tried a Unity gain inverting amplifier but i cannot seem to make it work.
Try this:
(http://That.Homepage.dk/Img/4V_to_0-5V_Xlator.png) (http://That.Homepage.dk/Img/4V_to_0-5V_Xlator.png)
If you would be OK with "low" on ~0.7V to 5V it would be even simpler.