Pages: [1]   Go Down
Author Topic: bi direction without short ciruit  (Read 280 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
God Member
*****
Karma: 0
Posts: 507
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i'm using some motors ( some weak ones, and some hard core ones ) to set up a sample test with a joystick, and i want it to be bi directional, for instance, when i press the joystick left, the motor will spin left, and when i press right, the motor will spin to the right.

i now know reversing the voltage on the wires will infact turn the motor the opposite direction, but i also know connecting the motor from one pin to another is bad. and i think that i need a connection to 2 pins and a connection to ground, but i only have 2 wires, and i don't wanna short the arduino!

is there a way to safely hook it up, so even if i do connect two pins, or i connect bad to bad, no damage will be done?

secondary question:
i have a 5v motor that kills the arduino if i hook it up, and i want to be able to pwm it, so is an opto coupler good, or is there a diffrent way to do it with pwm?
and, can i opto couple it with things i have lying around, photodiode, resistors, led, potentiometers, switches?

thanks in advance!
-int big = 93;
Logged

Copenhagen / Denmark
Offline Offline
Edison Member
*
Karma: 6
Posts: 2360
Do it !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This is how to hook up a DC motor to Arduino for PWM one way control:

http://www.tigoe.net/pcomp/code/category/code/picbasic-pro/62

If you also want to be able to control direction you shold use a H bridge circuit, do it like this:

http://www.toddholoubek.com/classes/pcomp/hbridge/Hbridgel293.html

As i said in the other thread if you try to drive inductive loads like motors directly from Arduino pins, best case it won't work, worst case, you can kill the Arduino board.

Inductive loads pull a lot of current in generel, and especially just when they start up, usually much more than the max 40mA you can source from any Arduino pin

Optocouplers are no good in this case.
« Last Edit: December 27, 2007, 05:23:55 am by MikMo » Logged

0
Offline Offline
God Member
*****
Karma: 0
Posts: 507
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok, ill order the hbridge asap, thnks for the help.

i'm happy the the arduino is low cost, that way if i blow it up, its fairly cheap to replace, and thats why i dident lean twards any other microcontroller!
Logged

Pages: [1]   Go Up
Jump to: