I am building an Arduino controlled robot-car with a hacked RC car, I heard there is a way you can reverse polarity on the PWM pins to change the direction the motor spins. How is that done? Thanks so much.
You simply reverse the motor connections to whatever is driving it. If however you wish to reverse the "phasing" of the PWM signal, (change 20% on, 80% off, to 80% on, 20% off) simply feed it through a transistor or fet to invert the signal (phase).
So does a transistor reverse the polarity?
Used in common collector mode a transistor reverses the phase. Polarity is a relative thing. If your reference point is the circuit negative (commonly referred to as GND) then all signals are positive polarity. If you use VCC as your reference point then all signals are negative polarity.
So can I use a transistor to make negative positive and positive negative to make to motor spin to other direction?
Thanks so much and sorry if this question seems silly
What you need is an H-Bridge.
How it looks like your " with a hacked RC car"? There is a big chance , that it already has H-bridge, probably 2 of them. Post a picture. There is a pics from my last project, also based on "hacked R/C car" http://coolarduino.files.wordpress.com/2012/07/dscf0080.jpg On top and top-right you can see 4 +4 transistors, essential part of 2 H-bridges
Thank you so much!
You are welcome. Just figure out two signal lines of inputs to those bridges, "cut-in" with arduino and you would be able to take full control of the car. Some thoughts: - turn on/off leds representing right/left turning signals; - -//- front/rear lights; - "beep" horn; - add voice module, which would play "yes, sir!" or "no, sir" whenever radio receiver outputs some signals.
Thanks sooooo much. How do you add a voice module? Is it some sort of speaker? I heard there's something called a piezo, is that it?
Search for shieds, for example: https://www.sparkfun.com/products/10628
Hey Magician, Sorry I didn't see your post of the hacked RC car. What I mean by hacked is that it is bare bones-just the chassis and the motors. So I don't think it has an H-bridge. Thanks
Do I have to use a shield? Is there a bare-bones way to do it?
Simply to reverse a polarity you can do with a relay. Better way is H-bridge, as it was suggested above. http://www.talkingelectronics.com/projects/H-Bridge/H-Bridge-1.html If you are newbie, I don't think you are up to build one, search for shields, or at least for IC, L293 and L298 pretty common for starters. There are also a kits available, I just build one myself recently : http://www.solarbotics.com/product/k_cmd/ Though, after I assembled it I realized I need more current :blush:
Thank you so much for your help!