LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Drive LEDs on 8-bit Digital I/O for WattsView Power Monitor

Hi could someone please help me with modifying the following LabVIEW program: 

 

About the program: 

I'm currently building a bike generator that would have the ability to power LEDs (based on whatever power is output). The LEDs would look like it's scrolling. While doing some testing, it appeared that the maximum power obtained while pedalling the bike was about 3 W. Connected to the generator is a serial power monitor called WattsView, which is a circuit that contains a loop that measures amps using the hall effect. This circuit collects data of volts and amps, sends it the software it went with onto the computer, and I am also able to view power (calculated).

 

On the WattsView circuit, an 8-bit Digital I/O is also included, which operates from 0 to 5 Volts DC. Below is a picture of how WattsView looks like. On the WattsView website, a free LabVIEW driver is also included. Below is also a screenshot of the program. 

 

WattsView Website: http://wattsview.com/

 

 

I currently do not have access to LabVIEW (it's on my work computer), so I will post other screenshots later. However, below is a table of what I would like to do with the 8-Bit Digital IO Port. 

 

Basically, I would like to have each LED turn on when it reaches +0.3 W. Currently, my idea of doing it would be to create a constant from the power indicator of the LabVIEW program. I will then use the In Range & Coerce Function to set the upper and lower limits for the power range (using the power constants). 

 

Upper limit: 0 W

Lower limit: 2.4 W

 

The In Range output will then be connected to the selector terminal of the case structure. So when: 

 

In Range Output = 1: Execute equation to turn on necessary LEDs  

In Range Output = 0: Do nothing 

 

At this point, I have no idea where to go, particularly with the case for when In Range Output = 1. I was thinking of doing a bunch of nested case structures within this case for the different ranges. However, I don't know how I would do it so that the LEDs would scroll up when power increases, and scrolls down when power decreases. Any light of this situation? Any tips or advice is greatly appreciated. 

 

Thank you for taking the time to look at my post! 

0 Kudos
Message 1 of 12
(3,683 Views)

ake your power.  Use Quotient/ Reminder to divide by 0.3.  Use the quotient output to add 1.  That will tell you how many LED's to turn on.  Use In Range and Coerce to coerce the value to be 8 or less .  (Since 2.4 divided by .3 is quotient 8.  Adding 1 makes it 9).   Call this value X.

 

I would then use that value to initialize an array of that many (X) True booleans.  Append it to an array of (8-X) False booleans.

0 Kudos
Message 2 of 12
(3,677 Views)

Thank you Ravensfan! 

 

When I do this, do I take power as a constant? Or indicator? I'm not sure what format of the power value I'm supposed to use. 

0 Kudos
Message 3 of 12
(3,671 Views)

You use whatever value of power that you are getting now.  If there is some sort of function that reads the power for you, then use the wire coming out of the function in the math.

0 Kudos
Message 4 of 12
(3,655 Views)

I'm still confused on how to obtain power in the correct format. 

 

Below is a screenshot of the entire LabVIEW WattsView Driver (Block Diagram) 

 

Driver Block Diagram.jpg

Circled in red is the data of volts and amps that is being collected from the WattsView circuit connected to the generator. Double clicking this icon for "4 Mat Data" opens the following Front Panel:

 

4 Mat Data FP.jpg

 

I opened the block diagram for this VI, and below is how it looked liked. Circuled in red, I determind this is where the output of power is, for P = V*I. Therefore, I created an indicator for the power to display the values on this VIs Front Panel. 

 

4 Mat Data Block Diagram.jpg

 

I copied the Power indicator onto the main LabVIEW Driver Program, and below is how it now looks like: 

 

Adding Power to Main Diagram.jpg

 

I am unable to connect the Power indicator to the input of the Quotient and Remainder Function. This function accepts a double 64-bit, which is the data type of the Power indicator. Now I'm lost. How do I make this Power as the proper input into this function? And how would I go about inputting a constant valu of 0.3 into the second input of the function? 

 

0 Kudos
Message 5 of 12
(3,640 Views)

You are connecting two inputs to each other.  That is why you have a broken wire.  What is the source of the data?

 

Knowing how to create a constant to input into a functions is a basic LabVIEW concept.

 

Have you taken any LabVIEW tutorials?

LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

 

Who created the VI you have shown?  The colors on the block diagram are atrocious.  The use of stacked sequence structures and local variables are the signs of someone who is not experienced in LabVIEW programming and will likely have problems with the operation due to dataflow issues.

0 Kudos
Message 6 of 12
(3,630 Views)

The program was written and provided by the company who created WattsView. 

 

I right clicked the power indicator and clicked create constant. Is this correct? 

Following your advice, below is what I currently have for the equation: 

 

Drive 8 LEDs Equation.jpg

 

Is my work correct so far? Now I'm stuck at the initialize array of (y) True Booleans. Am I using the correct array? 

Also, what did you mean by "Append it to an array of (8-X) False booleans" ? 

 

In working with these arrays, will I be using the DIGITAL OUPU AND STATES to the left? This was already included in the program. 

0 Kudos
Message 7 of 12
(3,624 Views)

@janedoe12345 wrote:

The program was written and provided by the company who created WattsView. 

 


One more example where the company probably gave a co-op student the task of creating a "LabVIEW driver" for their device.

 

Wire in a True constant to the other input of the Initialize Array.

 

Create another Initialize Array with a False constant.  For the  length input of that one, take your X wire and subtract it from 8 and wire it in.

Take the two outputs of those Initialize Arrays and feed to a Build Array function with Concatenate inputs turned on.

 

0 Kudos
Message 8 of 12
(3,617 Views)

Thank you so much! This is extremly helpful, I greatly appreciate it. Smiley Happy

 

Howver, how did you get the appended array? 

 

DId you just make a bunch of LEDs on the front panel? 

0 Kudos
Message 9 of 12
(3,612 Views)

You can drop an array container, then drop a boolean into it.

 

But I just right clicked on the output of the Build Array after I changed it to Concatenate mode, and picked Create Indicator.

0 Kudos
Message 10 of 12
(3,610 Views)