Sei sulla pagina 1di 13

Ver

si
on11.
10

HandsOn:
DoEngi
neer
i
ng
Anyt
i
me,Anywher
e
wi
t
hNImyDAQ

uk.
ni
.
com
i
r
el
and.
ni
.
com
uk.
ni
.
com/
handson

Goal
Get hands-on with the NI myDAQ, a technology to enable students to Do Engineering. In this
exercise, we will use NI myDAQ and NI LabVIEW to explore SmartGrid technology

Scenario
The NI myDAQ myGrid is a tool to simulate how renewable energy sources can be used to supplement
power plants that utilise expendable fuels. It shows a model of how power is generated, transmitted and
distributed in a real-life industrial, commercial or residential setting. It combines expendable and
renewable energy sources to power a load (LEDs in this case). NI LabVIEW is used to optimise the system
as the power production from the solar panel and the load change. This is visualised through a power
produced and consumed display, as well as an RPM measurement from the generator.

More details on the myGrid components and instructions for how to build your own myGrid are included
at http://bit.ly/nvej0h

CONCEPTS COVERED

Using the myDAQ Instruments to explore a circuit or system


Using NI LabVIEW to create custom instrumentation applications

Exercise 1 Exploring the myGrid


Application
In this first exercise, we will use an application written using NI LabVIEW to explore our myGrid
system
1.

Open LabVIEW

a. If you have not already done so, start LabVIEW, either from the shortcut on your
desktop, or by going to Start>>Programs>>National Instruments LabVIEW 2011.
2. Open the myGrid Application
a. Select Open from the Getting Started Splash Screen
b. Navigate to the relevant folder on the desktop and select myGrid.vi to open

3. Explore front panel controls


a.
b.

c.

d.
e.
f.

Generator Power fill slideControls how much power is applied to the generator
through analog output 0.
Manual Control of Houses switchesControl which LEDs are connected to the power
produced by turning on and off the reed relays through DO 2, 3, and 4. When fewer LEDs
are connected to power, less power is necessary to turn them on.
Waveform chartDisplays the analog input readings. The DPDT switch on the PCB
controls which set of channels are measured; either the voltage before and after the
shunt resistor or the voltages supplied by the motor and the solar panel.
Cycles Per Second gaugeMeasures the rotational speed of the motors with the hall
effect sensor and digital input 0.
Auto Control of Houses When the Auto Time button is on, the LED houses
automatically turn off and on depending on the timer.
MilliWatt Gauge Displays the power consumption of the myGrid. This feature only
works properly when the DPDT switch is set to A.

4. Run the application


a. Start the program with the Generator Power set to zero, the SPST switch turned on, and
the DPDT switch set to position B.
The waveform should now show the voltage generated by the motors (zero) and the voltage generated
from the solar panel. To increase the solar panels output, the 5V supply has been wired to the
potentiometer and then in series with the solar panel.
b.
c.

Turn on the LEDs and try adjusting the POT to see how it changes the solar panels output
voltage. Depending on the ambient light, the LEDs may or may not turn on.
Adjust the POT to a level where the LEDs are off. Now, increase the Generator Power till
the LEDs turn on again.

The waveform chart should show that the motors are now generating power for the LEDs.
d.

Switch the DPDT to position A. The two analog input channels are now reading the
voltage before and after the shunt resistor.

The difference of these two measurements can be used to determine the power consumption of the
circuit, which is displayed in the milliWatts meter. This meter only gives a proper reading when the
DPDT is set to position A.

5. Explore the LabVIEW code for the myGrid application


a. Switch to the block diagram of the myGrid vi, use Window>>Show Block Diagram to
switch to the block diagram, or press Ctrl+H on your keyboard to use the shortcut key
b. This application has three parallel loops to control the myGrid

c.

The top loop controls the power generation to the motor. A DAQ Assistant express vi is
used to send the output to Analog Output channel 0 on the myDAQ. The value of the
voltage sent is determined by the Generator Power slider on the front panel

d.

The middle loop acquires the signals from the myGrid which relate to the voltage
generated from the battery, the voltage generated from the solar panel, as well as
calculating the power consumption of the circuit

e.

The bottom loop controls the load on the myGrid (LEDs). A DAQ assistant express vi is
used to send the digital signals to the myDAQ depending on the values selected by the
user. The auto control of house lighting can also be used to set the load on the myGrid.

Exercise 2 Using the myDAQ


Instruments to explore a system
The NI myDAQ comes with 8 built in software instruments to allow a student to explore circuits or
systems using instrumentation most commonly found in the lab, but very often not at home.
In this exercise, well use the xxx instrument to explore xxx of our myGrid system
1. Launch the NI ELVIS and myDAQ Instrument Lanucher
a. Goto Start>>Programs>>National Instruments>>NI ELVISmx and myDAQ
Instrument Launcher
b. Observe the 8 instruments available to use with the NI myDAQ
Screen shot needs to be of this when a mydaq is plugged in to show the greyed out
buttons.

c.

2.

Note how some of the instruments in this launcher are greyed out. These instruments
are available to use with the NI ELVIS platform

Use the DMM to measure the voltage at different points of the active circuit
a. Click on the Featured instruments tab to bring up a list of addition instruments available
with your myDAQ.

Note: The Get More Instruments button takes you to one of the myDAQ community pages. On the NI
community users share code, instruments, tips and knowledge. They are a good resource for new features
and content. If you have internet access then try it now, otherwise be sure to check out the NI community
at a later date. The landing page is shown below for your interest

b.

On the Featured instruments panel select DC Level Output to bring up the instrument
shown below. Click the start button and raise the voltage to spin the motor.

NOTE: Featured instruments such as the DC Level Output are all written in LabVIEW and the source code
is easily available on the community pages. This code often makes a great starting point if you are
developing your own custom instrument.
c.

View the NI ELVISmx Instrument Launcher once again and this time launch the Digital
Mult Meter .

d.

Run the DMM and use the probes to measure voltages at different parts of the circuit.

Here are some ideas of elements to measure on the circuit.

Measure the Voltage across the solar cell.


Shade the solar cell with your hand and measure the voltage again

Measure the voltage across the motor


Measure the voltage across the generator

3. Take some time exploring the circuit and the other instruments available in the NI
ELVISmx Instrument Launcher.

Exercise 3 See how to use LabVIEW to


make a custom instrument for NI myDAQ
In this exercise we will recreate part of the myGrid application we used earlier to learn how to
create applications using the myDAQ from LabVIEW.
LabVIEW The logic and method used in writing the
control of the motor in LabVIEW is similar to many other data acquisition and control applications
that can be written with the myDAQ.
1.
2.
3.

View the Block Diagram of the myGrid application that we studied earlier.
Click and drag to draw a box around
a
the top loop and the attached DAQ assistant express VI to
select them.
Delete all the selected Vis.
Vis. In this exercise we are going to rewrite this part of the code from
scratch to better understand how applications such as this can be written.

4. Pull up the Functions Palette by right-clicking


clicking on the white space on the LabVIEW
block diagram window.
5. Move your mouse over the Express Input palette and click the DAQ Assist Express
VI.. Click again on the white space of the LabVIEW block diagram to place
pla the DAQ
Assistant VI.

6. The Create New Express Task window appears:

7. To configure an Analogue output to drive the motor, click on Analog Output >>
Voltage. Click the + sign next to the Dev1, scroll down and highlight channel ao0 and
click Finish. This adds a physical channel to your measurement task.
8.

In the DAQ Assistant dialogue box that appears configure the task as shown below then click
OK:

9.

From the Functions palette place down Express>>Execution Controls>> While Loop Draw
this loop around the DAQ Assistant that you have just placed down

10. Adding timing to the loop will stop it using excess processor time. Add the function
Programming>>Timing>>Wait in the top right-hand corner of your new loop.

11. Right Click on the terminal of the Wait function and select Create Constant. Set the constant to
a value of 100. This will force the loop to iterate 10 times per second.

12. To stop the motor when the application stops we must output a voltage of 0. Hold down Ctrl
while clicking and dragging the DAQ Assistant VI out to the right-hand side of the while loop.
This will create a copy.

13. In a similar fashion make a copy of the numeric constant wired to the Wait function. Place this
directly below the other constant and set this constant to 0.

14. Switch to view the front panel (Ctrl-E)


(
and move the Stop button into a convenient position near
nea the
bottom left of the screen
15. From the Controls Palette place down Silver>>Numeric>>Vertical Pointer Slide.

16. Resize and rearrange this to look similar to the front panel shown below

17. Switch back to the Block Diagram and complete the wiring to resemble the diagram below:

18. Run the VI and observe its behavior as before

Download Build your own myGrid


Get the latest instructions, NI LabVIEW files, NI Multisim, and NI Ultiboard files from the
following link.

http://bit.ly/nvej0h

Potrebbero piacerti anche