Hello, i'm need help regarding dc motor to control the opening and closing valve. The dc motor will be attached with arduino uno. I have try search the coding because i need the constant speed of dc motor to control the opening and closing the valve but couldn't get it. The valve will open at certain set value. Any suggestion of the code because i'm a beginner in this field. Thank you.
For opening and closing you will presumably need to be able to run the motor in both directions, and for that you need an h-bridge.
This tutorial shows how to hook up a motor to an L293 h-bridge chip, and control it with Arduino. The L293 is a bit outdated, and (for example) Pololu has a range of more modern tech, catering for various voltage and current requirements.
But a DC motor might not give you the precision you need to get the valve to a certain angle: a stepper might be better. Or even a servo; depends on the physical characteristics of the valve.
the valve will rotate at certain angle. For example, the valve will open at certain angle such as 20° of rotation it will allow the liquid to flow and close the valve. When it reached at 40° it will open the valve and allow the flow of liquid and close. If i using the stepper motor, how can i control it?
Steppers are easy: by their nature they "step", usually 200 steps a rev, so 1.8 degrees per step.
Robin2 has a tutorial thread on it, I can't find it right now though.
Also look at this tutorial.
Tq…i have read about the stepper motor. Can you give advise which stepper motor and driver is suitable for my project. And i using arduino uno
cyam87: Can you give advise which stepper motor and driver is suitable for my project.
They come in so many configurations, I think you should llok at the makers' sites to find one that fits your needs. Then search for a driver board that suits that motor.
You'll need to figure out how to attach the shaft to the valve.