Hi all, I’ve got a servo steering the front wheels of my DIY car, and a motor powering a gearbox to run the back wheels.
The problems I have are…
I cannot power both the motor and the servo off the same power supply, so I have 3 supplies, 1x 9v for the arduino, 1x 6v for the servo, and 1x 1.5v for the motor. This is really inconvenient and I know there is a way! When I connect both up to the 6v, the motor takes all of the voltage and the servo turns to it’s lowest position.
As you can see the back wheels are struggling to turn, it’s very evident that it needs a differential, is there a way that I can DIY one of these fairly simply? Or possibly another solution?
Also, please recommendations in general!!! My first project away from the Arduino starter projects so please go easy on me!!
Marshiewoo (video and code below)
const int motorPin = 9;
const int servoPin = 10;
int desiredPos = 85;
int submitPos = 250;
long previousMillis = 0;
long interval1 = 20;
unsigned long currentMillis;
PP3 sized 9V alkaline batteries are good for maybe upto 100mA at most.
The rechargable NiMH 9V's will supply more current BTW, but a bit less capacity.
Cheap batteries are never the right choice, they have unknown current
and capacity specs - always leading brands from reputable sources. Rechargable
batteries have the capacity marked, so apart from the obvious reasons they are
much to be preferred because you know what you are getting.
One thing I've noticed is that many cheap battery holders have a shoddy riveted
construction that cannot take high current reliably (lots of resistance in the rivets).
Never use such holders for high current applications. Go for holders where the
contacts are single pieces of metal, then the only place corrosion can cause resistance
is on the battery contacts themselves which you can get to and clean.
I would love to have one single power supply to power the Arduino, the motor, and the servo!
If you want to do this right - use hobby R/C batteries. Likely the best for you would be a 9.6 volt NiMH pack, such as:
You'll also want to get a charger - best is a smart charger, like:
Don't cheap out on batteries or chargers here - and when you are charging a battery, always be around to monitor it (don't just hook it up and forget it) - this goes triple if using lithium-chemistry batteries!!!
For the servos, you will need to find out what voltage they support, but most like 4.8 - 6.0 volts. To that end, in order to run them, you need to drop the voltage from the battery to that level (DO NOT use the 5 volt output of the Arduino - it can't supply enough current). Your best bet is to use what is known as "BEC" in the hobby R/C world (Battery Eliminator Circuit) - it's basically a voltage regulator packaged up for the R/C world:
That one will output 5 amps at 5 volts; most BECs are integrated as part of a speed-controller - you'll have to look around to find a standalone unit, but that one above should work OK. It's a switching regulator, so it is fairly efficient as well. You could run both the Arduino and your servo easily off of it (and bypass the wasteful linear regulator on the Arduino).
One other thing:
You might want to put a fuse of appropriate size in-line with the positive output of the battery, just in case of any shorts or over-current issues. Measure (or calculate) the maximum amount of current used for all of your devices at once, add the current values together, add 10 percent, then select a fuse that comes close to that value.
Doing this is cheap protection in the event you need it. The alternative can be much worse (the battery catching fire or exploding).
and when you are charging a battery, always be around to monitor it (don't just hook it up and forget it)
I have a 1600mAh 9.6V NiMH pack which I charge outside. If it explodes it's outside. I charge it lying flat on the stone floor of the verandah in the hope that would sink excess heat if anything goes wrong.
(Just because I'm paranoid, doesn't mean they're not trying to get me.)
On the subject of charging...I know modern technology batteries need a matched charger and the charger has all sorts of intelligence. But with NiMH, is it enough to use say just a wall-wart, or even say a 12V car battery, on the assumption that 12V beats 9.6 and the flow will charge the NiMH pack? Or is there something else required in a charger other than the source voltage being more than the target's? Current limiting, for example?