Hey guys!
I am in the midst of doing a Water Control Valve via a geared Stepper motor 1:5.18 using LN298N motor driver with a 12V3A power supply and currently I am having two major problems
First
I would really love to obtain some help in coding for a stepper motor as now I am only able to make the motor to open the valve from 0% to 100%. I would like the valve to be able to open by percentage such as 1%,2%,3% and etc. Any help would be great. If there are any links which could help me in coding I deeply appreciate it!
Second
Is it possible to not use limit switch instead create a function data which inputs the position of the stepper motor into an SD card? (This is to home the stepper motor so that it would not destroy the valve)
For instance, I limit my stepper motor to 3 rotations clockwise. When it is controlled and moved 1 rotation and I off the power, when I start it back, the Arduino reads the data from the SD card and automatically knows that the stepper motor is at 1 rotation and it only either can go another two clockwise rotation or 1 anticlockwise rotation.
Thanks everyone and have a good day!
P.S. Below are attachment of the Stepper motor and the Motor Driver. I am also using the Arduino UNO!
In response to your First question please post the program that represents your best attempt and tell us in detail what it actually does and what you want it to do that is different. It will make it much easier to focus on the parts you need help with rather than wasting time on things that you can do.
In response to your Second question the short answer is NO. The Arduino cannot know where the stepper motor is when the Arduino starts. If the position had been stored and the valve had been moved (for whatever reason) while the Arduino was off then it would probably run the motor too far and cause damage.
The longer answer is that if you can arrange a physical stop that the motor cannot damage then you could drive the motor against it without damaging the motor. HOWEVER this is more appropriate for a direct-drive motor and there must be a great risk that the gearbox would be damaged even if the valve is not.
Separately, an L298 is a poor choice for driiving a stepper motor.
Finally (maybe I'm just slow this morning) what does WTA stand for?
Robin2:
In response to your First question please post the program that represents your best attempt and tell us in detail what it actually does and what you want it to do that is different. It will make it much easier to focus on the parts you need help with rather than wasting time on things that you can do.
I will attach my codes down below but its just on the testing phase for now. I have just started on this project and I have not used Arduino before. Thanks for the link below! Seems helpful. I ll take my time to go through it slowly!
Robin2:
In response to your Second question the short answer is NO. The Arduino cannot know where the stepper motor is when the Arduino starts. If the position had been stored and the valve had been moved (for whatever reason) while the Arduino was off then it would probably run the motor too far and cause damage.
The longer answer is that if you can arrange a physical stop that the motor cannot damage then you could drive the motor against it without damaging the motor. HOWEVER this is more appropriate for a direct-drive motor and there must be a great risk that the gearbox would be damaged even if the valve is not.
I understand. If somehow I had coupled and joint the motor and the valve together therefore it stays in the position and does not move (not removed, fixed) when the Arduino is powered off. Is it possible still to have the stored data to know roughly the final location of the valve from the data stored?
Robin2:
Separately, an L298 is a poor choice for driiving a stepper motor.
Finally (maybe I'm just slow this morning) what does WTA stand for?
Using L298 is for me to just test the stepper motor since its dirt cheap. I needed to see if the motor runs smoothly as I purchased it online
Also! WTA means "want to ask". Sorry if it got you confused. Its a thing in my place's forum
MechanicalStudent:
Is it possible still to have the stored data to know roughly the final location of the valve from the data stored?
You can write Arduino data to its EEPROM memory and it will be retained when the Arduino is powered off. Be aware, however, that the EEPROM can't be written to indefinitely. IIRC the limit for any one cell is about 100,000 writes.