|
|
Portland, OR
Offline
Full Member
Karma: 0
Posts: 101
|
 |
« Reply #1 on: July 04, 2011, 03:08:25 am » |
The circuit you have posted above will only drive the motor in one direction. If all you want is something that drives straight, that circuit will be fine and you don't need two motors, one will work. If, as I suspect, you want something a little more interesting than that I do not think that circuit will work for you. You will need separate circuits for each motor assuming you want them to be able to do two different things, which again I'm assuming you do. I would read this as I think it might be more apropos. http://itp.nyu.edu/physcomp/Labs/DCMotorControlDo you plan on steering like a car or like a tank?
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 143
Posts: 19368
I don't think you connected the grounds, Dave.
|
 |
« Reply #2 on: July 04, 2011, 03:12:45 am » |
The circuit you have posted above will only drive the motor in one direction. It could drive two motors (or more), but not independently. It isn't clear from the OP what is required.
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Delhi, India
Offline
Jr. Member
Karma: 0
Posts: 80
~
|
 |
« Reply #3 on: July 04, 2011, 03:27:04 am » |
I have made this circuit, the problem is speed of motor can not be controlled and also i want to drive motor in both direction. The code has to be modified to drive in both direction but how? Regards, Shubham
|
|
|
|
« Last Edit: July 04, 2011, 03:28:58 am by gshubham96 »
|
Logged
|
Regards Shubham Garg
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 143
Posts: 19368
I don't think you connected the grounds, Dave.
|
 |
« Reply #4 on: July 04, 2011, 03:56:44 am » |
the problem is speed of motor can not be controlled You've done something wrong then. The code has to be modified to drive in both direction but how? What code?
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Copenhagen / Denmark
Offline
Edison Member
Karma: 5
Posts: 2346
Do it !
|
 |
« Reply #5 on: July 04, 2011, 03:56:52 am » |
It is not enough to modify the code to drive the motors in both directions.
You should use a H bridge for each motor.
Just google Arduino + H bridge there are tons of examples on how to do it.
|
|
|
|
|
Logged
|
|
|
|
|
Delhi, India
Offline
Jr. Member
Karma: 0
Posts: 80
~
|
 |
« Reply #6 on: July 04, 2011, 04:44:35 am » |
@ AWOL and MikMo the problem is speed of motor can not be controlled You've done something wrong then. speed of motor can not be controlled using a h-bridge coz it's just on/off, if I'm wrong plz let me know. The code has to be modified to drive in both direction but how? What code? int potPin = 0; // Analog pin 0 connected to the potentiometer int transistorPin = 9; // connected from digital pin 9 to the base of the transistor int potValue = 0; // value returned from the potentiometer void setup() { // set the transistor pin as an output pinMode(transistorPin, OUTPUT); } void loop() { // read the potentiometer, convert it to between 0 - 255 for the value accepted by the digital pin. potValue = analogRead(potPin) / 4; // potValue alters the supply from pin 9 which in turn controls the power running through the transistor analogWrite(9, potValue); } code from http://luckylarry.co.uk/arduino-projects/arduino-control-a-dc-motor-with-potentiometer-and-multiple-power-supplies/comment-page-1/#comment-6235I was guessing that can I use three pots, 2 will control the direction of two motors(actually a joystick) 1 will control the speed.
|
|
|
|
|
Logged
|
Regards Shubham Garg
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 143
Posts: 19368
I don't think you connected the grounds, Dave.
|
 |
« Reply #7 on: July 04, 2011, 04:54:45 am » |
speed of motor can not be controlled using a h-bridge coz it's just on/off, And PWM isn't just on/off?
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Delhi, India
Offline
Jr. Member
Karma: 0
Posts: 80
~
|
 |
« Reply #8 on: July 04, 2011, 04:57:02 am » |
so, we can use h-bridge to control speed?
|
|
|
|
|
Logged
|
Regards Shubham Garg
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 143
Posts: 19368
I don't think you connected the grounds, Dave.
|
 |
« Reply #9 on: July 04, 2011, 04:58:30 am » |
Yes. And braking or free-running stop.
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Delhi, India
Offline
Jr. Member
Karma: 0
Posts: 80
~
|
 |
« Reply #10 on: July 04, 2011, 11:08:54 am » |
|
|
|
|
|
Logged
|
Regards Shubham Garg
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 143
Posts: 19368
I don't think you connected the grounds, Dave.
|
 |
« Reply #11 on: July 04, 2011, 11:27:02 am » |
Does the link work? Yes.
Don't know about the tutorial - I can't read those cutesy "circuit diagrams", and I saw they used a 9V battery, so stopped at that point.
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
|