# Constant Voltage and Amperage to Motor Controller

I've done some reading and asked some questions but can't seem to wrap my head around it.

I want to make a robot using 2 motors on the motor controller(tank treads).

It seems to me that having both motors on for X milliseconds would equal the robot traveling Y distance.

This however is not the case because as I'm sure you know. Voltage and Amperage tapers off the battery as it's used (See, I learned that!)

so what do I use or what term do I google to find out how to prevent this from happening.

What I want is that if the battery is supplying 9v at the beginning of its life, the motors get 7v. If the battery is supplying 6.999999v the whole thing stops. (Note: I may be talking about Amperage too, I don't know)

Essentially, I want to get as close to accurately predicting Xtime = Ydistance

I also should mention that if its possible I'd like to keep a single power supply (Arduino & Motor Controller)

Tonight, the "secret word" is: encoder.

walkitinkid: It seems to me that having both motors on for X milliseconds would equal the robot traveling Y distance.

Even if you had an "infinite" battery - this would never be true, because wheels/treads/legs/whatever slip on surfaces, motors vary in speed (even when supplied constant current and voltage), etc. In the real world, this will not work.

walkitinkid: This however is not the case because as I'm sure you know. Voltage and Amperage tapers off the battery as it's used (See, I learned that!)

so what do I use or what term do I google to find out how to prevent this from happening.

Well - the term you're looking for is "regulation" or "regulator" - ie: "voltage regulator" or "current regulator" - a voltage regulator ensures that a constant voltage is present at the output, whether the input voltage is too high or too low; there are certain limitations to this - many regulators (especially linear regulators like on the Arduino, which gives it a constant 5 volts to run on) have what is called a "drop out" voltage - that is, if the voltage goes below this amount, the regulator will stop working (in the case of the Arduino's voltage regulator, it's 7 volts).

A current regulator ensures a constant amount of current is available to a circuit or component, and won't let it go above or below a set point, regardless of whatever the circuit it is powering is doing, or the input. If you combine both of these circuits, you essentially get a regulated power supply - one which will supply a set voltage and current.

That said - you rarely see such lengths gone to for a small motor supply system. Generally, you just figure out your total current draw and max current draw, ballpark some averages, then figure out how long you want to run and how many amp-hours (Ah) of battery capacity you will need, and try to get a battery that will provide that capacity.

walkitinkid: What I want is that if the battery is supplying 9v at the beginning of its life, the motors get 7v. If the battery is supplying 6.999999v the whole thing stops. (Note: I may be talking about Amperage too, I don't know)

Not sure what you mean by this; voltage typically doesn't drop drastically in a battery until it's close to the end of the amount of current it can supply for the load in question. You'll see some drop, but not instantly on a fully charged battery (hopefully, you're not using any of those expensive PP3 square 9 volts, are you? If you are - STOP).

If you must use a "9 volt" source - grab a 9.6 volt radio-control battery pack and a proper smart charger (so you don't overcharge it - which is bad); go with an NiMH pack at first. Don't start with a lithium-based pack; even with a proper charger, they can and have caught people's houses on fire; you need to be very careful with them, and charge them properly (best way I've heard is to take a hollow concrete block, place it on a concrete surface, put the packs inside and charging, then top the holes off with another concrete block - even then, keep a fire extinguisher handy).

When you charge the pack, don't leave the house and check the packs regularly as they charge. If you notice anything abnormal, disconnect them from the charger.

These packs will give you a long run time, and they are fairly easy to work with (you may need to get some bare-lead plugs or whatnot from the hobby store to make connections to your robot, though). They will require an initial investment, but should last a good while.

walkitinkid: Essentially, I want to get as close to accurately predicting Xtime = Ydistance

You can't - for the reasons I cited before. They way you make your robot go for a given distance (as well as make sure both tracks or wheels move at the same rate) is via a wheel encoder system. This can be a simple slot encoder (if you don't care about the direction the motors/wheels spin) or a quadrature encoder (if you do).

The only thing you can predict (to a certain level of confidence) is - once you know your total current draw and how long you need to run for - is the size of the battery needed to make it run for that length of time (in reality, your calculations and what you see in real life will not match exactly - because batteries have specs, too - and the cells that make up the battery generally have a set "de-rating" graph that will tell you how long the battery will match it's rated amp-hours for a certain voltage level and temperature over time - also, the battery will heat up as it is used, which will de-rate it further - just keep that in mind).

walkitinkid: I also should mention that if its possible I'd like to keep a single power supply (Arduino & Motor Controller)

Yes, you can do this, but you might want to add some noise isolation components to the motors involved (generally just a simple small-value non-polarized ceramic capacitor across the leads of the motor will work well - but you can get more complicated if you need to; look up "DC motor noise suppression" for details). Ultimately, you'll want to power the motors directly off the battery, and -not- from the Arduino's voltage regulator. If your motors are 6 volt motors, though, you may want to look into whether they are -really- rated at 6 volts only, or if they have a larger range. Motors generally are rated in a range (3-6 volts, or 3-12 volts, etc) that they will operate at. Look on the motor itself for information on who the manufacturer is, and see if you can find a model number to look up the spec sheet online from the manufacturer. You can run a lower rated motor on a higher voltage supply, but it's life will be shortened (in some cases very rapidly - mainly in the brushes and bearings). If you are really worried, and the motor is rated lower than what the battery can supply, then you may want to see if you can find the same sized motor just in a higher rating bracket.