Simple 2 Way Motor Control For The Arduino
Simple 2 Way Motor Control For The Arduino
Table of Contents
File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
http://www.instructables.com/id/Simple-2-way-motor-control-for-the-arduino/
Intro: Simple 2-way motor control for the arduino
When I say simple, I don't mean use a speed control. But control the motor directly without any external circuitry. Here's how:
Note: This is not the safest way to control a motor. Each I/O pin can only handle 40 mA of current. I would recommend using a H-Bridge as pointed out by: Bongmaster &
Frollard.
I am not responsible for any thing bad that happens to you or to your arduino!
Tools:
- Computer with Arduino IDE installed
- A-B USB cord
http://www.instructables.com/id/Simple-2-way-motor-control-for-the-arduino/
Step 2: Connecting the motor
Connect your DC motor to your arduino.
I tried to add a good amount of comments to the code, but if you have any questions, please ask them.
http://www.instructables.com/id/Simple-2-way-motor-control-for-the-arduino/
Image Notes
1. Upload to I/O Board Button
File Downloads
_2Way_Motor_Control.pde (1 KB)
[NOTE: When saving, if you see .tmp as the file ext, rename it to '_2Way_Motor_Control.pde']
Step 4: How this works & more Ideas
How This Works:
When you make one pin HIGH & another LOW, the pin that is HIGH has a positive voltage & the pin that is LOW works like a ground(-).
Ideas:
Add a second motor. Sorry I don't have any code for this, But there is a schematic posted below.
Related Instructables
Comments
18 comments Add Comment
but, for big motors, use analog io or gnd+digital with an external driver is better (obviously)''
http://www.kpsec.freeuk.com/trancirc.htm
(scroll down to protection diode)
A motor is not an entirely resistive object. It has also some inductance. What does that mean? It means that when you reverse the voltage on the pins, the
current doesn't change its direction immediately. So, for a short moment, the motor acts like a current source.
http://www.instructables.com/id/Simple-2-way-motor-control-for-the-arduino/
Bongmaster says: Oct 31, 2009. 5:56 PM REPLY
kool but its best not to drive a motor directly from an arduino ;) could blow ure pins..
there was a 4 transistor version somewhere too. cant remember where tho XD
using pwm just means you're turning it on and off MANY times...more risk of burning out that expensive pin....my 2 cents.
http://www.instructables.com/id/Simple-2-way-motor-control-for-the-arduino/