LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NI 6009 with potentiometer & leds (NEED HELP!)

Hello everyone, I am currently doing my final year project which is based on Labview and USB NI 6009. I was given the task to light up 3 leds on the breadboard into a binary representation for the voltage I set from the potentiometer.(1v - 5v) Eg.(When the voltage is at 2v, the leds should light up  0 1 0, 3v will be 0 1 1 and so on.)

I have totally no idea how to do that, can any kind soul show me the way to do it?

I would really appreciate your help on this, the project is very important to me, so please help me if you can thanks.

 

Sorry for my bad english.

0 Kudos
Message 1 of 12
(4,027 Views)

In LabVIEW, look into the example finder (Help->Find Examples...) for DAQmx.  You need a simple read voltage and digital output by port.  Read the voltage, round toward -Infinity, convert to a U8, write to a digital port.  Remember that the DIO typically do not supply much current, so you will need buffer circuits to drive the LEDs.

 

When you run into problems, show us what you have done and where you are stuck.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 12
(4,019 Views)

Since this is YOUR school project, you need to do it so that you can learn something or show what you have learned.

 

1. Can you break up the task into smaller tasks? For example: Get voltage on potentiometer. Analyze voltage. Set LEDs.

2. After you have a list of tasks, where each task only performs one simple operation, define the inputs to each and outputs from each. Also define the relationships between the tasks. For example the Set LEDs task cannot be performed until you know what to set them to.

3. Write LabVIEW code for each task and test it separately.

4. Put all the tasks together and complete your project.

 

When you get to item 3 and have problems with your program, post again with specific questions.  Describe the task that your code should perform, along with the inputs and what you expect the outputs to be. Include the code with typical data saved as default. Tell us what does not work, what results actually occur, and any error messages.  Remember that we will not have your hardware so we cannot duplicate that part of your project.

 

Lynn

Message 3 of 12
(4,017 Views)

Shouldn't need a buffer for the LEDs, you can drive the little ones with the DAQ.  The DO's can sink more current than they can source.  There's an example in the 6008 users guide for how to connect an LED to the DAQ without a driver.  Even though the DO's are current-limited, it's still a good idea to install a current-limiting resistor.

0 Kudos
Message 4 of 12
(4,004 Views)

I recommend you "run" the hardware from MAX.  This will help you validate the steps you have to do in your program.

-------
Mark Ramsdale
-------
0 Kudos
Message 5 of 12
(3,998 Views)

I am able to come up with the code to light up the 3 leds at 3 levels of voltage (1v, 3v, 5v) with the potentiometer, and did a separate code on the binary representation of the leds. I am now having a problem combining the two codes together, I tried to replace the comparator(Greater or equal) with the coverter(Number to boolean array) so to light up the leds in binary using potentiometer instead.

 

Error: Unable to connect the converter(Number to boolean array) to DAQ Assistant(AnalogInput), I have connected two terminals of different types. Please have a look at my simple code. What should I do to combine both codes together?

 

I posted a picture of my connection on the USB NI 6009, are there any other ways of connecting it?

 

Sorry I am not good at using LabView yet and I am also a slow learner.

 

 

 

 

 

Download All
0 Kudos
Message 6 of 12
(3,968 Views)

Take the signal coming out of the AI DAQ Assistant and convert it to a U8 and then use the number to boolean array.  This can then go into the DO DAQ Assistant.

 

I can't tell what your potentiometer is connected to electrically.  It should have the +5V on one side of the pot, GND on the other side, and the AI DAQ Channel connected to the wiper.  This will make a nice voltage divider.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 12
(3,962 Views)

Also the LEDs are going to be real dim wired right now, if they light at all.

 

The digital outputs can sink more power than they can source.  In the 600x datasheet there's a diagram on how to connect LEDs to the DAQ; follow that schematic.  The anode (long lead) goes to 5V on all of them, cathode goes to the digital output, and you drive the line low to turn it on and high to turn the light off.

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

@SnowMule wrote:

...and you drive the line low to turn it on and high to turn the light off.


Which means you need to throw a NOT on the boolean array before writing to the Digital Output.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 9 of 12
(3,956 Views)

I am assuming that you had no formal training in LabVIEW looking at your VI architecture. Digital can be two different "active states"...Hi or Lo, you can decide that in your design. How you orient the LED's will depend on that thought. Led's need to be current limited. 6009 cannot current drive a bunch of leds..use a driver or common source other than the 6009 +5vdc.

 

Using integers...a DBL analog input to an Integer/Bool output will round up after the DBL 0.5 to 1, that being said..you can do some truncating.

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