LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Arduino PWM for SSR

Hello!

I'm fairly new to labview so please bear with me:)

I am trying to create a PWM signal from the Using LIFA with a frequency of 1 Hz and adjustable duty cyle. The reasoning behind the 1 Hz frequency is because the digital output pin on the Arduino will control a solid state relay, and I do not want to overwork the relay as they heat up quickly. I have seen posts on this forum asking about adjusting the frequency, however I have not been able to come across anything regarding a frequency as low as one Hz.

Is this something that I can imliment in my labview block diagram or will it need to be coded into my .pde file.

any insight would be greatly appreciated..

B.

0 Kudos
Message 1 of 6
(7,822 Views)

Hello,

The two main PWM modes for Arduino are "Fast PWM" and "Phase-correct PWM". With Phase-correct PWM, you can get down to frequencies as low as 30Hz. This is calculated by frequency = (clock frequency)/(N*512, where N is the prescale factor (1, 8, 64, 256, 1024) and the clock frequency is 16MHz. You can see this post for information on how to change to PWM frequency. Also, there is a great document on the Arduino website which explains the difference between the different PWM modes. It looks like this will be the easiest way for you to implement a slower frequency. 

However, if you need the 1Hz frequency, it looks like it might be possible to attain a frequency lower than 30Hz with the Arduino using this library, however this has not been implemented into LIFA yet. Also, the ATMega328 documentation provides some information about another mode called the Clear Timer on Compare Match (CTC) Mode, where you may be able to using the OCR0A register to attain a lower frequency. I haven't tried this myself, but it might be a possibility. You can find information about this mode on page 101 of the ATMega328 manual.

Hope this helps!

- Julianne

Julianne K
Systems Engineer, Embedded Systems
Certified LabVIEW Architect, Certified LabVIEW Embedded Systems Developer
National Instruments
0 Kudos
Message 2 of 6
(4,467 Views)

Hi Julianne,

Thanks for the reply!

I will have to do some more research on the OCR0A regester, but it sounds like it could be a possibility.

I was fooling around with labview and tried simulating a square wave with a frequency of 1 hz, amplitude of .5 and offset of .5 . I could make an virtual LED blink and adjust the duty cycle, however the square wave output would not control the digital output arduino VI.

0 Kudos
Message 3 of 6
(4,467 Views)

There is an example of a low frequency PWM in the Low Frequency PWM thread.

Howard

0 Kudos
Message 4 of 6
(4,467 Views)

Thanks for posting. That is exactly what I am after.

Cheers

0 Kudos
Message 5 of 6
(4,467 Views)

hello.

need to knew more anformtion abut ssr and pwm with arduino

 

0 Kudos
Message 6 of 6
(4,073 Views)