Hello Arduino family, I have been working on part of the ventilator project which requires making the motor shaft move back and forth at a particular angle. For example, if I set the angle at 30 degrees then the motor shaft should go to 30 degrees and move back to 0 degrees. The motor I am using is in this link https://www.andymark.com/products/pg188-gearmotor-with-0-5-in-hex-output. Together with it, I am using solo 30A Roboclaw to read encoder pulse and control the motor. The Roboclaw I am using can be found at this link Roboclaw Solo 30A, 34VDC Motor Controller
My progress so far:
I am able to motor move back and forth using delay();
I am able to get speed and encoder pulse from the motor;
Try a servo motor, like the ones in a 3D printer or a CNC machine. With the right logic, they know where they are.
Or try putting some switches along your motor's travel path so your controller knows where things are at any one time. Take a look at DIY wind direction devices work.
Also, at power up, the motor needs to know where zero is to know anticipated travel distance. There is no guarantee that at a power failure, the motor will be at zero.
Hopefully this isn't too late, but I agree with @billz1 to consider servo motors that will have already solved the positioning issue. There are analog hobby servos and then more expensive digital servos that can receive exact position commands from the Arduino over serial.
I've worked with these servos before and they come in a large range of sizes. Would something like that work in a larger size?