Hi! I’m creating a 555 PWM to control a motor, I know it can be done by arduino but I prefer to use an external circuit to use the program to control other parts, im having difficulties thinking if is possible to only read the signal of the PWM, where do I need to read the voltage and what kind of libraries would I need to use, I will attach the proteus circuit diagram of the PWM.
To read the PWM signal is to read the pulse length. You just need to ensure the voltage of the signal is withing the limits of your Arduino.
I suspect you wont get a lot of help - it's going to take probably more code to read the PWM duty cycle than is will to read some other input and then control the motor. I hope that doesnt come across as rude - just trying to be realistic.
Controlling the motor directly with the Arduino means you dont need all that other circuitry (keep R1, R2, Q1) and you can make the motor speed dependant on some other variable.
An Arduino will have enough spare time to control a motor no matter how many other sensors you have to monitor or jobs to perform - PWM just keeps going until you change it, so you dont need to update a PWM signal every microsecond.
Thanks for making us all smile.
There is an error in your circuit. No common ground between the two power supplies.
The one for the motor is 12V and the other witch is arduino controlled is 5V
Ok I would have to use the milis function then because the code that I had already let’s me operate pulses but only that, thanks for the help
You can use a low-pass filter to get the average DC voltage. i.e If you are measuring the voltage across the motor, you should measure 6V at 50% PWM.
Note that the filter output (right side) should go ONLY to the meter. Don't filter the PWM to the MOSFET or motor.
A time constant of about 1 second should work well (100K & 10 uF, etc.).
Hopefully you have a multimeter, but if you are using an Arduino, use a voltage divider so you don't over-voltage and kill it! (The resistor in the filter can double as one of the voltage divider resistors).
Hi again facelessalex,
when you use
analogWrite(somePin, someVal);
the values is 0 to 255, corresponding to 0 to 100% duty cycle
and the PWM signal on the pin just keeps going on forever until you issue another analogWrite to change it. You dont need to keep writing to the analog/PWM pin every loop - only as frequently as you need to change motor speeds.
What are your your requirements for motor RPM changes?
or should I say: is the motor speed dependant on a sensor that can be read by the arduino?
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.