Hi, I connected two step motors to two L293d driver. Each driver for one motor. They run well alone but not together.
The first motor run well with his driver and the second the same. Just when I put them together in the same code, only one run well, the second motor become mad.
The same with the second motor, it run well with his driver but when I put them together, the first motor become mad.
Do I have to link the two drivers together? Is it even possible ?
Many thanks.
Welcome to the forum.
Please provide a copy of your code using code tags.
Also, please tell us which Arduino board you are using.
Finally, please provide a wiring diagram for your project.
On your annotated schematic be sure to show all connections, power, ground, power sources and any other hardware connected to it.
Hello,
there's a copy of the code on Arduino Mega R3,
also I put a fresh diagram.
The connections must be ok because the two motors are working well but alone. not together.
Any advise are welcome.
Many thanks.
Nicolas
(attachments)
DEMO 2 MOT L293d.pdf (54.5 KB)
DEMO_2_L293d.ino (1.9 KB)
Apparently something is wrong it does not work properly. I need an annotated schematic so I can help you.
An annotated Schematic. Do you mean more détails?
I can writedown on the Schematic more détails, even If I don't know what else I can put there. Sorry I'm really a beginner.
So, I will send more détails.
Actually you did a good job. The schematic is a bit different but ok. What is missing is the power sources and the lines connecting to the pins.
The Arduino should not power the motors, it sounds like the Arduino or your computer regulator is being overloaded. I recommend you find another driver other then the L293d driver as it looses about 3V driving the motor and that is burnt as heat. A MOSFET output would be much better.
Hi, @arduino_01
Please try and put directly into post your code and schematic.
@arduino_01 schematic.
@arduino_01 Code;
// DEMO _ 2 MOTORS.
// MOTOR 1 and 2 runs well, but separeted only. Not together.
#include <Stepper.h>
int Pin1 = 9; // Red B
int Pin2 = 10; // Blue B'
int Pin3 = 11; // Black A'
int Pin4 = 12; // Green A
float revolution1 = 400; // the number of steps in one revolution of motor
int Pin5 = 4; // Green A
int Pin6 = 5; // Black A'
int Pin7 = 6; // Blue B'
int Pin8 = 7; // Red B
float revolution2 = 400;
Stepper Moteur1(revolution1, 12, 11, 10, 9); // the correct stepping order for motor
#define Moteur1_OFF digitalWrite(9,LOW);digitalWrite(10,LOW);digitalWrite(11,LOW); digitalWrite(12,LOW);
#define Moteur1_ON digitalWrite(9,HIGH); digitalWrite(10,HIGH); digitalWrite(11,HIGH); digitalWrite(12,HIGH);
Stepper Moteur2(revolution2, 4, 5, 6, 7); // the correct stepping order for motor
#define Moteur2_OFF digitalWrite(9,LOW);digitalWrite(10,LOW);digitalWrite(11,LOW); digitalWrite(12,LOW);
#define Moteur2_ON digitalWrite(9,HIGH); digitalWrite(10,HIGH); digitalWrite(11,HIGH); digitalWrite(12,HIGH);
unsigned long currenTime1 = 0;
unsigned long prevMillis_Moteur1 = 0;
unsigned long interval_Moteur1 = 100;
unsigned long currenTime2 = 0;
unsigned long prevMillis_Moteur2 = 0;
unsigned long interval_Moteur2 = 100;
void setup() { }
void loop() {
currenTime1 = millis();
if (currenTime1 - prevMillis_Moteur1 >= interval_Moteur1) { // Elapse time has reached the interval
prevMillis_Moteur1 = currenTime1; // Save the current time as previous time
Moteur1_ON;
Moteur1.setSpeed(3);
Moteur1.step(revolution1 / 400);
}
// currenTime2 = millis();
// if (currenTime2 - prevMillis_Moteur2 >= interval_Moteur2) { // Elapse time has reached the interval
// prevMillis_Moteur2 = currenTime2; // Save the current time as previous time
// Moteur2_ON;
// Moteur2.setSpeed(3);
// Moteur2.step(revolution2 / 400);
// }
}
Tom....
![]()
Well, that's great. Gonna follow these advises and I feel its gonna be perfect.
I'm so grateful for your kindly job to help people with their projects. That's already helped me so much.
So, many many thank you to you and your team.![]()
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
