Hello everyone,
I'm new to Arduino. My problem is I have two stepper motors both has different drivers(moon's driver). And a ESP32 controller.
Now, I've defined 4 pins in ESP32 using pinMode(pinNo,OUTPUT)
const int stepPin = 2; //stepPin and dirPin is directly connected to motor driver 2 and later connected to driver 1 through a common wire
const int dirPin = 4;
const int enpin2 = 15; //this pin is connected to motor driver 2
const int enpin1 = 18;//this pin is connected to motor driver
First let me tell you my project scenario:- I've connected a wheel with each stepper. A paper is mounted on a wheel of a stepper and by anyhow I mean by rotating motors I've to mount the whole paper roll on another wheel. So my question "Is there any way by which I can control my both steppers while one is active and other will follow him and while the 2nd will active 1st will follow him ?"
You can relate this problem with our old tape cassettes "How that brownish thin sheet mount from one wheel to another" that's what i want to achieve but in my case it is simple paper.
Thanking You.
//If you think information is not sufficient to understand the problem pleas let me know..
I understand the problem, but I don't think you understand the project. What do you have to control the tension of the paper between the two rolls? The diameter of the rolls will change as your project runs, therefore the length of paper being released will be more than the paper being taken up by the other stepper.
... you might be able to reduce the current/torque on the supply reel enough so that the paper tension remains constant as you wind up on the takeup reel.
Tape recorders didn't use stepper motors, they used a brushed motors to supply tension, and a single capstan wheel to control the speed during operation, with the capstan released for high-speed winding operations.
Yes sir. I'm using SR-3 mini driver (one of moon's drivers).
Could you please tell me how can I reduce torque/current to control the speed of the steppers..
see this image how my project actually looks like:
Now try to see that upper most portion where a cylindrical tube(which will inject some chemical solutions on the paper) and to its left side a cylindrical hollow is there from there we pass another chemical solutions manually .. Now the mechanism is first paper will receive chemical solution from right cylindrical hollow then it will go to the second tube for the second solution and then again it will come back to 1st hollow to receive another solution and after this cycle of process we've to do it on whole paper...
for more understanding see the 2nd hand made image
(4 times I repeated the cycle and after every cycle there is gap b/w samples of 2cms)
So what we need to do is to observe the paper after receiving first solution manually--> then 2nd solution will be injected by tube --> then again human will drop other solution and observe the reading and later after 2cm of distance again repeat the process .
So, the whole scenario is
1.At first, inject solution and observe paper while motors are stopped then
2.Move paper by some centimeter forward from supply wheel to takeup wheel and place the sampled area(of 1st step) just below to left cylindrical tube and
3.Then that uppermost cylindrical tube will inject a chemical solution on the paper.
4.Then move paper backward to again receive solution manually for the observation
5.Then move that complete portion and make 2cm gap also so that we can do the same process for the other portions of the paper ..
if anyone has any kind of lead pls do mention. About how approach to the problem ? How to solve this? Or the coding portion by which I can rotate my motors by at different time.
I was thinking that with identical steppers, one could use higher current on one to overpower lower current on the other.
Looking at your diagrams and description, it sounds like you move it back and forth through the mechanism, and it's not a strict feed-reel+takeup-reel system. My switch-set current limiting idea doesn't seem like it would solve your problem. It also seems unclear how you make the paper balance between the 4 wheels to make the gaps-- what happens when the two systems are out of sync? Does the paper pile up in one of the gaps?
To solve the "Out of sync" problem we will not rotate motors simultaneously. We will rotate them like when left will rotate CCW, it will pull right motor (as paper is connected) and then we'll rotate right motor(CW to take back paper on its previous position) then left motor will follow him.
See what I've tried yet (But I haven't tested its working)
const int stepPin = 2; //stepPin & dirPin both are common to motor driver 1 and driver 2
const int dirPin = 4;
const int enpin2 = 15; //enable pin of driver2, default value is LOW means motor always enable
const int enpin1 = 18;//enable pin of driver1, default value is LOW means motor always enable
void setup(){
Serial.begin(9600);
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
pinMode(enpin2, OUTPUT); //driver 2
pinMode(enpin1, OUTPUT);//driver 1
}
void loop(){
//Set direction of left motor ccw
digitalWrite(dirPin, LOW); //LOW indictes reverse direction
digitalWrite(enpin1, HIGH); // HIGH enable pin means driver is disabled
if (digitalRead(enpin2) == LOW) {
// Spin motor slowly
for (int x = 0; x < 1680; x++)
{
digitalWrite(stepPin, HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin, LOW);
delayMicroseconds(2000);
}
Serial.println("Left motor rotation done!");
}
delay(5000); // Wait 5 second
// Set right motor direction cw
digitalWrite(dirPin, HIGH);
digitalWrite(enpin2, HIGH);
digitalWrite(enpin1, LOW);
if (digitalRead(enpin1) == LOW) {
// Spin motor slowly
for (int x = 0; x < 1680; x++)
{
digitalWrite(stepPin, HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin, LOW);
delayMicroseconds(2000);
}
Serial.println("Right motor rotation done!");
}
delay(5000); // Wait 5 second
//Set direction of left motor ccw
digitalWrite(dirPin, HIGH);
digitalWrite(enpin1, HIGH);
digitalWrite(enpin2, LOW);
if (digitalRead(enpin2) == LOW) {
// Spin motor slowly
for (int x = 0; x < 1800; x++)
{
digitalWrite(stepPin, HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin, LOW);
delayMicroseconds(2000);
}
Serial.println("! cycle is completed!");
}
delay(5000);
}