So I've got my arduino, arduino BT and my hacked and soldered RC car ready and I've been trying to get it to run by arduino control which I've seen is a fairly common project. I'm running into a problem with the parts I have though. I have 2 NPN power transistors, one H-bridge and 2NPN signal transistors. Aside from that I just have some basic resistors and diodes.
I'm running into 2 problems for controlling the car. 1 is that because the power source controls both motors, if one motor is off the other one will simply run backwards through the circuit and run that one. The other problem is that I'm switching the signal with a transistor and I'm not sure how to isolate the switch from the battery. There needs to be a lead to the base to turn on the current, but at the same time there needs to be one on the emitter back to the controller, so the massive battery current can enter the microcontroller. It works kinda to just put a small resistor (560Ohm) on the base pin and have the emitter run back to the arduino ground, but I'm not sure how safe this is. I'm not sure how to go about solving these two problems, and I'd really appreciate some help.
(Notes: the drive motor can only go forward and backwards until I get another H-Bridge, and the front turning mechanism is just a springloaded DC motor that limits the distance )
Get yourself a cheap electronic speed controller (ESC), then you can simply connect it to the arduino as a servo, you'll get much better control and you connect the rc car's battery directly to the ESC, on the plus side most hobby grade ESC's have what's known as a battery eliminator circuit that supplies a regulated 5v, which means the 3 wires coming from the ESC are Power plus Signal so the ESC can power the arduino aswell, then you only need 1 power source.
Is your main concern that emitter is connected to the ground on the arduino? as long as you have a suitable resistor between the arduino pin and the base of the transistor - that's fine. That's just how it works. The battery may have a lot of current available when it's called upon but it doesn't mean that it will fry a suitably designed circuit. For the motor control part - do you have a circuit diagram available?
Hey, thanks for the responses guys. I'm not sure where I could get an electronic speed control IC, the store I go to (http://www.leeselectronic.com/) does not seem to have any in stock except for one that's powered by... 40v???. Aside from that, my car circuit looks like this. I should note that the H-bridge I mentioned is a relay, not an IC
Here's a quickly cooked up messy diagram of the circuit. The 100Ohm resistors are used to show the motor leads as there's no motor in the simulator. The battery is the cell and the +5v/ground are microcontroller pins.
This one might be slightly different than the one I built off of but is close to exact. If you know how I might improve or fix it I'd really appreciate it. I also don't know why but when I actually built it a 2.2kOhm resistor completely blocked current on the transistors, I couldn't use them...
You appear to have a battery that is shorted out by a transistor on the right with the current only limited by a 100R resistor. (or is that another motor?)
The motor (100 resistor) appears to be fed from a double pole change over relay but wired up so the current always goes through the motor in the same direction, hence you can't change direction.
There also appears to be two coils or is that two relays? Either way it is wrong.
I assume the points marked 5V are outputs from the arduino.
The motors are coupled together that is why you are having the problems.
Motors should not go in the emitter of transistors but collectors. So the drive motor needs changing to the collector.
The battery -ve should be connected to ground. The +ve should be connected to the collector of the turn switch and drive switch (through the motor).
The turn switch idea will only work if your battery voltage is less than 5V because you need to put the base at the same voltage as the emitter to turn it off. You are better off here using a PNP transistor as a top switch.
Ah, thanks for the help Mike. I'm trying to use my L298 (the multiwatt pin version, N) with this, and it's making me extremely disappointed with myself because it should just be connecting and turning wires on and off. I simply cannot get the thing to run. I'm running out of free time tonight and so when I get the chance I'll try the circuit you designed.
I just don't understand why my L298N won't work. I'm following all the steps from this exactly (except of course the software part) and nothing is working.
Oh well that is ridiculous. The Current sense pin should just be connected to GND/-V. It's all working now! Full backwards/forwards control and breaking