Pages: [1]   Go Down
Author Topic: How to run motor in both directions, using just 2 output pins  (Read 1547 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I want to run a dc motor, using just two output pins .

(I cant use a dpdt realy, and an h-bridge requires 4 pins)
{I just have tip 122, and I cant get any PNP transistors. }
Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1016
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You can use a H-bridge.

I think it is like this:
If you keep one pin low, the other pin uses PWM for forward speed.
To reverse, do it the other way around, the first pin for PWM and keep the second pin low.

If you build a H-bridge yourself, you need extra transistors. Perhaps the best way is to use a H-bridge with optocouplers. With optocouplers you don't have to worry about level shifting or inverting the signal for NPN or PNP transistors.

I like this kind of circuit: http://www.mcmanis.com/chuck/robotics/tutorial/h-bridge/bjt-circuit.html
It can be adapted for NPN transistors only.
Logged

Offline Offline
Edison Member
*
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Krodal, what do you thing of using one relay for ON/OFF and another for direction ?

(edit: no, wait, the ON/OFF relay could be replaced by a transistor to be able to use pwm for speed control (to some degree), right ? )
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

so what do i finally do?
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

what about using the L293D ?

the ENABLE pins will always be HIGH(5 v source). to switch off the motors, i can use analogWrite(0)

is this idea going to work?
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

http://www.st.com/internet/analog/product/63141.jsp
Logged

Offline Offline
Edison Member
*
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You might want to consider adafruit's motor shield then.

http://www.adafruit.com/products/81

(I'm not linked to adafruit industries in any way, I just happen to have one of those)
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

nop, will not spend so much on a shield
Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1016
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

nop, will not spend so much on a shield

5 or 6 dollars (inclusive shipping) on Ebay.
Search for "motor shield", it is the same as the Adafruit shield, but an older version with cheaper components.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 15
broddoyyyyyyyyyyyyyyyyy
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

basta semplicemente che ti compri due relè a doppio contatto
collegando i due centrali dei due relè hai due cavi del motore, i due contatti normalmente aperti del relè al meno, ed i due normalmente chiusi al più. Dopo di che fai un ponte tra il + ed il - dell'alimentazione dei relè, e diventa gnd, cosi hai un più per la sinistra ed un più per la destra. Se non hai capito ti posto uno schema.. smiley
sono italiano, e questo testo è stato tradotto, probabilmente non capirai..
appena ci riesco ti posto lo schema
« Last Edit: February 15, 2013, 01:59:34 pm by casari » Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 547
Posts: 27363
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

DPDT relay and transistor will work.

+V   C    -V
       M+
       M-
-V    C    +V

Use transistor to control application of voltage
When relay is connected to the left pins, current flows from top to bottom
When relay is connected to the right pins, current flows from bottom to top
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 547
Posts: 27363
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Okay TIP122, use that to connect V- to Gnd (sink current).
Don't forget a 1N4001 type diode across the relay +/- pairs (in parallel with the motor) with cathode on V+ and anod on V-
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

0
Offline Offline
Tesla Member
***
Karma: 145
Posts: 9696
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I want to run a dc motor, using just two output pins .

(I cant use a dpdt realy, and an h-bridge requires 4 pins)
{I just have tip 122, and I cant get any PNP transistors. }

You could modify a servo for continous rotation and control direction and speed just using one control line.
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Pakistan
Offline Offline
Sr. Member
****
Karma: 6
Posts: 357
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

http://www.instructables.com/id/Super-Easy-Reversible-Motor-Control-for-Arduino-/
Logged


Pages: [1]   Go Up
Jump to: