Wednesday, August 18, 2010

Turn on a DC Computer Fan using a Solid-State Relay, myDAQ, and LabVIEW

This document explains using a low-cost solid-state relay to control a 12VDC Fan with your National Instruments myDAQ in LabVIEW. The digital output will be generated on the myDAQ digital line using the DAQ Assistant that is installed into LabVIEW with the NI DAQmx driver.



The LED is wired in series with a 330Ω resistor.  Assuming the LED has negligible resistance, the total resistance of the circuit is 330Ω.  According to Ohm’s Law, the current drive with a 5VDC power supply from the digital line would result in 5V÷330Ω= 15.15mA.  As stated in the specification sheet for the LED that is referenced at the bottom of the document, the Led can handle a current up to 20mA, and is recommended to be used with 16 to 18mA; so at 15.15mA we will be safe.  The LED requires a positive input on the longer lead side and a negative input on the shorter side, as seen in Figure 1 above.  We will supply power to this circuit using Digital Line 0 of the myDAQ, and ground the circuit to Digital Ground of the myDAQ.

Figure 2: Wiring Diagram
The user interface we created has a Boolean push button switch to control the SSR to be open or closed, which will then turn the fan on or off. 
Figure 3: LabVIEW Front Panel

In LabVIEW we need to create a front panel Boolean array control to output a 5V digital signal on Line0 to our Solid-State Relay.   This Boolean value is input into our DAQ Assistant which will output the corresponding value to the NI myDAQ digital line.  In digital Boolean logic, a Truecorresponds to a 5V signal, and a False corresponds to a 0V signal.  Therefore, a True will close the SSR, and complete the fan and power supply circuit, allowing power to flow to the fan.

Figure 4: Coding Block Diagram

The LabVIEW diagram looks very similar to the coding block diagram, except the SSR is not included.
Figure 5: LabVIEW 2009 Block Diagram
(The attached LabVIEW code snippet can be dragged-and-dropped to a LabVIEW block diagram, use attached PNG file.  After locating the PNG file, just drag the file icon onto a blank block diagram, as if you were dragging the file onto your desktop.)

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...

Popular Projects

My Blog List

Give support

Give support
Encourage Me through Comments & Followers

Followers