Quote:
Originally Posted by Mikesolar
So, if you don't have control over the frequency, how do you control the PWM with the arduino or can you have it do a 0-10vdc (or 0-5vdc) equivalant
|
The above picture is a representation of a PWM wave.
If you assume that the rising edge is the beginning of each pulse, the percentage of time the wave is high during each wave is called the duty cycle. In this picture, it looks like the wave is high for about one third of the duration on the wave, so the duty cycle would be 33%.
If it was only high a quarter of the time, the duty cycle would be 25%.
So, without varying the frequency of the wave you can vary how long the wave is high.
With the Arduino, you can send a PWM pin a value between 0 and 256, to control the percentage of time that the wave is high. In the case of the first example, you would send the Arduino PWM pin a value of 256 divided by 3, so you would send it a value of 85.
In the second example you would send a value of 256/4 or 64.
If you wanted the duty cycle to be 80%, you would send a value of about 204. I'm using the Arduino in integer mode to conserve memory, so there are some math errors but they are not so important.
There's a
good entry in Wikipedia that goes over this pretty well.
Does this help?
Best,
-AC