DC Motor Control

Hello everyone,

I'm trying to learn to drive a DC motor with Arduino. My goal is to apply PID control to control speed, maybe after controlling position but I'm very confused about it. The first problem is that I have a DC gear boxed metal motor with encoder but I do not have any clue about the value of the running voltage, ampere and gear ratio, but I guess it is Pololu's one of the 6 V 6 amp motor. I didn’t know because some gave it to me, he also has no information. Do you know how I learn those information?
Second problem, I assumed it is 6V 6A motor and try to drive with a L293B H-Bridge and I used 5V 1A power supply because I afraid to burn the motor. With that power supply and H-Bridge it has to be work but under the 240 PWM, it is not working also 255 PWM it is not turning if I do not turn it by myself initially. How can I solve this problem?
The last problem is that about PID control. I made some research on the internet I found the PID and encoder libraries for Arduino but I really do not understand how can use of them. So can someone suggest some material or web sites to help me?

Thank you.

How big is the motor and what is the resistance?

An L293 will not drive a 6A motor BTW.

I guess the motor is one of the pololu's 25D mm Gearmotors. Actually, I'm sure one of them but I'm not sure about that motor has which gear ratio and which amp? It could be 6A or 2.2A.

By the way I'm using L293B which supports 1.2 A. It has to turn I guess, didnt it? Could you suggest a h-bridge which is more proper for me.

Also I try to connect 12V, 1A power supply by using 50% duty ratio it turns a little bit easier.

I'm using this circuit to drive motor, I'm not using any resistance. Why do I need to use resistance and where?
http://s9.postimg.org/5qng5d72n/Untitled_Sketch_bb.png

Thank you for responding.

Hey,

i am working my ways into the different kind of motors myself. What helps me most is feeding the motors exactly the Volts & Ampere they are specced for. 90% of all problems solved that way.

It could be 6A or 2.2A.

Wow, big jump. So what you connect it can either be massive underpowered or burn out.
You will not get a motor workling properly if you do not know its specs and supply them accordingly.

By the way I'm using L293B which supports 1.2 A.

So it is either 6A, or 2.2A and your hardware with its 1.2A is not even in this range... this can not work out... these values are not fitting at all.

First step to solve your problems: get a power supply which gives the motor its needed values.

The first step is to figure out exactly what motor you have.

There should be some number or something on the motor, hopefully - either printed or written on the housing somewhere, or possibly on the "end bell" (rear) of the motor (you may have to look carefully at this, using proper lighting, as it is generally molded or embossed on the end bell housing). At a minimum, you should be able to find the manufacturer - which then may lead to the specs (go to the manufacturer's website, and do some searching there for spec sheets of similar motors - or, in a pinch, take a picture and send it to them asking about its specs).

Which leads me to wonder why you haven't posted a picture(s) of the motor to this thread - so we could possibly help you figure it out?

Last - to determine the stall current (which will vary depending on the voltage applied) - put a multimeter in series with the motor and battery: First, set you meter to measure current, and put the probes into the proper jacks on the meter for current measurement - then, hook up the meter in series with the motor - battery + to motor terminal, other terminal to meter, other meter terminal back to battery.

The motor should run, and you should see a current measurement (it will fluctuate some) - note that current (this is "no load" current) - now load the shaft down, but don't stall it - and note the current again (it will rise) - this is the approximate "running" current.

Finally - and most importantly - you need to get the "stall" current. This is best done by measuring the coil resistance, then using Ohm's law with your expected voltage - so disconnect and put your meter in resistance measurement mode, and with no voltage connected to the motor, measure the resistance between the motor terminals. Then (if you can) rotate the motor's shaft, and measure again. Do this a few times, then take the average value. Use this value for your calculations.

Do each of these things for 3 volts, 6 volts, 9 volts and 12 volts.

As you run the motor, note the amount and "quality" of noise coming from the motor. Also - by touch (or by an IR temp probe, if you have one) - note the temperature of the motor housing as it runs. If it seems like it is too high, or it is making weird noises, decrease the voltage. Also note the "smell" from the motor - if it has a large ozone smell, then excess sparking of the commutator is happening, so decrease the voltage. All of this can help you determine (at least get an idea of) what the highest voltage the motor should bel run at, and the amount of current it will draw for that (and other) voltages - so you can size your bridge/controller properly for the motor.

Finally - note that if you motor (for instance) needs 12 volts and draw 5 amps (at that voltage) - don't go out and get a "5 amp" controller - you want to size your controller to be 10-15% larger than what your motor will draw. So keep that in mind as well.

Good luck.

People always seem to confuse absolute max ratings with normal operating conditions.

An H-bridge rated 1.2A abs max will not be suitable for driving 1.2A in the same
way a rope with a breaking strain of 100kg is unsuitable for lifting a person weighing
100kg.