Hi all, I am trying to figure out the simplest and easiest way to control a DC motor using PWM. The catch is, I am wanting to maintain a constant speed based on the rotation of the sewing machine its powering....In other words, I want the PWM signal to be adjusted to keep the motor running at a steady speed regardless of load on the motor..I want to achieve this by asking the PWM to increase or decrease its duty cycle based on the actual RPM of the sewing machine shaft. The way I want to do it is feed a signal to my UNO board that is basically 0V DC or 12VDC. Each time the shaft makes one rotation it will briefly make contact with a resistor that closes a circuit and tells the Arduino its voltage changed from 0 to 12...I essentially want the Arduino to interpret the time it takes to go from 0 to 12VDC and adjust the PWM signal to maintain a constant RPM...
I have NO idea how to program this or if there is an existing project I can reference. I new to programming and aruino but am very good with electronics. Thanks all...Any ideas are appreciated! Thanks!
The way I want to do it is feed a signal to my UNO board that is basically 0V DC or 12VDC.
Probably not. 12V will destroy your Arduino pin.
I essentially want the Arduino to interpret the time it takes to go from 0 to 12VDC and adjust the PWM signal to maintain a constant RPM...
Not too difficult. Feed the 5V (not 12V) signal into an interrupt pin, and, in the ISR, record when the pulse arrives. The time between pulses gives you a measure of speed. Increase the PWM value if the time is too long. Decrease it if the time is too short.
So,
You have a 12 volt motor. You will need a mosfet driver to control the motor, getting its signal from a PWM pin.
You want arduino to detect how fast the motor is going. You mention a 12 volt signal, how? Or maybe a different sensor?
When you have these two setup, the rest is all in the coding.
Including understanding voltage compatibly? Hmmm.
[/quote]
Thanks for the response, minus the sarcasm. Yes I am an electrical engineer but I have no experience with Arduino nor am I familiar with its operating voltage or any kind of programming language. Can you provide a link to where I can view the sample source code for this type of PWM programming? Ty
jackwp:
So,
You have a 12 volt motor. You will need a mosfet driver to control the motor, getting its signal from a PWM pin.
You want arduino to detect how fast the motor is going. You mention a 12 volt signal, how? Or maybe a different sensor?
When you have these two setup, the rest is all in the coding.
Yes Ive already got the motor running off a pair of IRF540's and as per the previous suggestion Ill probably be using 0 and 5VDC. Any help with how to code what I need? Basically "Set PWM so that time between 0V and 5V is .15s. If time is too long or short, adjust PWM accordingly"