View Single Post
Old 02-18-13, 07:54 PM   #40
AC_Hacker
Supreme EcoRenovator
 
AC_Hacker's Avatar
 
Join Date: Mar 2009
Location: Portland, OR
Posts: 4,004
Thanks: 303
Thanked 723 Times in 534 Posts
Default

Quote:
Originally Posted by Mikesolar View Post
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
__________________
I'm not an HVAC technician. In fact, I'm barely even a hacker...

Last edited by AC_Hacker; 02-22-13 at 11:39 AM..
AC_Hacker is offline   Reply With Quote