man im confused! everyone in this MSGboard knows exactly what
everyone else is talking about. im a beginner. ok ive looked online
and looked through books. this is what i dug up... a robot needs a
brain which is a microcontroller. so far, i can get my oopic to run
servos and turn lights on and off. my next step is to run somethign a
little more powerful than just some rc servos while still using the
microcontroller so i can program commands. I found these THREE TERMS
over and over again in threads and webpages that run more powerful
motors (usually electric drill motors) im no specialist with
electronics so correct me if im wrong anywhere. supposedly the
microcontroller sends and receives 5 volt (whatever a volt is) signals
to turn on and off lights and motors. now what actually powers the
motor i would assume is the batteries. now im assuming you cant power
an electric drill motor (DC MOTOR? whats the diff between a dc motor
and an rc car servo?) so you need a MOSFET and an H-BRIDGE to help you
control and power the motor? how does all this connect to the
microcontoller? and what does a mosfet and h-bridge do? please help me
i really really want to learn this...thanks!
This in itself is a great accomplishment. You understand how to get the
software to make things happen in the real world. The rest is mostly details.
Right. The power for whatever motor youuse will come from the robot's
batteries. The signal from the processor is nothing more than "instructions"
and not meant to supply any sizable current.
Okay, most electric drills these days have some sort of electronic control
circuit that converts AC from the wall into DC to drive the motor. Or, you can
buy electric screwdrivers (a real favorite of mine) and use them directly from
DC to operate them.
In all cases, you must control direction and speed. To control direction,
you need either to use a brute force approach, like a SPDT relay to swap the
positive and negative connections to the motor, -OR- the better solution, an
all-electronic switching device called an H-bridge.
An H-bridge circuit provides paths that let the motor terminals reverse
their connections, therefore reversing the direction that the motor will spin.
It typically takes a single bit from your processor to tell it to go forward or
reverse. You might choose for the default to be low=forward and high=reverse.
Now, you have to decide how to control the speed. Pulse width modulation is
the cheapest and easiest choice. That is usually abbreviated as PWM. All that
means is that you control speed not by changing the voltage, but by switching it
on and off very rapidly at full voltage.
The advantage to this is that your motor produces full torque, even at low
speeds. The disadvantage is that you must either make a device to control the
speed, or write a program that lets your robot "brain" control it on the fly.
Even that is not very hard to do.
You will select two bits to "talk to" the motor- one bit selects the
direction using the H-bridge. The other bit controls the power sent to the
motor- fully on or fully of- and therefore controls the speed. That is the PWM
I was talking about. Virtually all robot builders use a very low resistance
type of power transistor called a MOSFET to do this. It is a sort of ideal
switch device that takes a very low current signal and controls the raw power
being fed to the motor.
The way I handle PWM in simple robots is like this- I write a 1 millisecond
timer routine. Every millisecond, the routine generates an interrupt and the
processor then "services" the robot. I use a 100 Hertz PWM frequency. Each
"time slice" is 10% of the duty cycle. So, I have the processor figure out the
motor speed, how many percent it has been on versus how long it should be on,
and whether it should be turned on or off in this particular millisecond. So
for each PWM cycle, there are ten times that the processor checks the system
out, figures out what to do next, and sets the PWM to high or low.
You can do it any way you want, but this sort of scheduling lets the
processor have nearly a whole millisecond to do everything, then sleep the rest
of the time. Most software can get everything done in well under 500
microseconds- but it depends on the type of processor you are using. I prefer
the BL1800 card myself, and have not used the OOPIC at all.
I hope that this is helpful.
My robotics, space and CGI web page - http://home.cfl.rr.com/aichip
wow sir charles...thanks so much that was incredible. so an H-bridge
electronically switches the circuits for you!! wow!! and a mosfet
helps you switch the bit on and off at a certain rate to regulate the
speed of the motor while retaining torque. thats just mind blowing.
i have some more questions though...naturally it seems =). I went
onto how stuff works.com and looked up what a volt amp and ohm is. i
feel very good about that. And i also looked up on how some of the
little components of a green circuit board does.
i know in a normal household in america the current running through
is considered an alternating current(AC) and most products that you
buy that use motors is DC. what is DC? there arent any websites that
tell you what this is. why would a motor need to change an ac current
to a dc current. why do electric screwdrivers "automatically" have a
dc current converter? and why doesnt a drill? and also...probably the
most important thing...i dont think my four AA batteries be able to
run a DC screwdriver/drill motor for very long.
how can i power my motors to a wall jack, and still be able to control
it from my microprocessor? my batteries connect to my circuit board.
wouldnt a motor that takes so much power to run burn out my circuit
board? do i need some kind of bypass? again thankyou so much.. you
cleared so much up for me!!!
The secret is to use two seperate power supplies. I'm using a Mark-III
and am about as far along as you. See
for a description.
As for the controlling the motors, I'm using the H-Bridge described at:
with great success. One side of the hbridge using 5v from the PIC, while
the other side uses whatever voltage you need from a seperate battery
pack. The big advantage from what I understand is this setup minimizes
power surges caused by the motors starting & stopping.
Best o' luck
A transformer is an AC to AC adapter - to get DC you need a rectifier too.
"black plastic boxes as a plug" (aka "wall warts") often (not always) have a
simple rectifier, but still leave a little residual AC superimposed on the
DC - that is ripple.
You need to be careful your adapter has a built-in rectifier before you
connect to a regulator...
The rating panel will normally give the input voltage as 220 (or 110 in the
US) volts AC, and the output voltage as, say 9 volts DC, plus the current
but if the low voltage side says AC, you need an external rectifier..
Remove my PANTS to reply.
I just got 6 x 70W DC to torque converters off eBay. Maxon rare earth magnet
motors. Only 36mm diameter but if you have the amps these wonderful things
can deliver half a foot pound at stall - although how you get that much
torque down a 4mm, non-flatted shaft eludes me right now.
I don't usually tidy up even when we have visitors, but it just didn't seem
right putting these motors in my motor draw without freshening it out and
making a special space so I could gloat over them properly :o)
Robin G Hewitt
Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here.
All logos and trade names are the property of their respective owners.