LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DOUBT IN CONNECTION USING DAQ 6009

Hi,

I am trying to get reading from sensor and save it every 15 second in labview. Sensor is capable of outputting analog current. So what I did is I am acquiring current from sensor and using linear scale I am trying to get distance in mm in labview. I am using ai0 for 1 sensor (pin 2 and 3 in 6009) and ai1 for sensor 2( pin 5 and 6). I am writing values recorded by sensor in spreadsheet every 15 seconds. I want to place my sensor somewhere in range of 570mm - 590mm( senor range is from 100-600mm) so instead of checking every time on screen i thought to use 3 led( yellow, green, red color). If my range exceeds 590mm it turns on red light, if it is below 570mm it turns on yellow light, else turn on green light (570-590mm). I  am confused which pins should I use to wire led. Each Led requires 2.2V to turn on so i am planning to give it through daq since 2 led will light on at one time (1 for each sensor and daq can provide 5 V). Can I use one pin in daq for all three led for one sensor  or do i need to use different pins for each sensor. I am attaching vi with logic for 1 sensor and will copy the same under this for another sensor(later).

Is it possible if i use led with high voltage and power it from power supply Can I still control it with labview. 

Hope to get some guidance in this.

 

Thank You

 

Regards

Himanshu 

0 Kudos
Message 1 of 11
(2,639 Views)

You have two problems:

 

(1) Hardware:

You would use the digital outputs for the LEDs. The amount of current to power your LED is limited by the USB. CHeck the documentation. If you need higher powers, you can drive it e.g. via a SSR or similar.

 

(2) Software:

Your program is highly flawed and will not work the way you think it does because you don't seem to understand dataflow. Did you ever look at one of the shipping examples?

 

  • What is the purpose of the small FOR loop? It does not do anything useful except churning electrons.
  • All your inner while loops spin like crazy, repeating the same data over and over until three different stop buttons are pressed or an error occurs. You only need to write to an output if it is different to the current state.
  • Only after all inner loops complete, a new sample will be read and things start over with the next iteration of the big loop.
  • The middle one of the inner while loops tries to write DBL data instead of booleans to a digital line.
  • Why are you converting dynamic data to a cluster array with one element for display?
  • The FOR loop on the right cannot start until the big while loop has completed, at which time it will save the data accumulated in the autoindexing tunnel and will take forever to write it all to files because if the long delay.
  • Why do you need to clear all tasks and create them again with every iteration of the big while loop?
  • ...

Familiarize yourself with the magic of dataflow. Use one single global while loop where you read the data point, decide which LEDs to light based on the value, then write the digital outputs accordingly. Write to file at regular intervals, also in the same loop.

Message 2 of 11
(2,624 Views)

It appears to me that you have a electical engineering question than a labview.


@Hnagpal wrote:

 Each Led requires 2.2V to turn on so i am planning to give it through daq since 2 led will light on at one time (1 for each sensor and daq can provide 5 V). Can I use one pin in daq for all three led for one sensor  or do i need to use different pins for each sensor. I am attaching vi with logic for 1 sensor and will copy the same under this for another sensor(later).

Is it possible if i use led with high voltage and power it from power supply Can I still control it with labview. 

Hope to get some guidance in this.

 

Thank You

 

Regards

Himanshu 




 

You talk about sensors that outputs current and then you mentioned about the distance so I am going to assume it is a linear stage or proximity sensor. and you want two LEDs to indicate distance is above or below certain range.  Looking at the manual it looks like the module can output enough current to drive two LEDs. But you'd need 4 LEDs for two sensors if you still want to go for two color scheme. I would rather have one LED ON/OFF to indicate the chnage. It would be easier to inplement and well within the reach of your module. For connections see this, they actually have small example of LED driver.

        Answer  to your last question is Yes, you can. But its little tricky. You'd need to make a small circuit for voltage controlled switch to turn ON/OFF the external power supply for LED. Its not very difficult and you could find bunch of circuits online that are easier to build.

Hope it answers your question.



------------------------------------------------------------------------------------------------------
Kudos are (always) welcome for the good post. 🙂
Message 3 of 11
(2,618 Views)

Hi odessy27,

 

Thanks for replying. I tried to remake my vi, if you can take a look and suggest me if I am on right path.  I am trying to write data to file.

 

odessy27 : I am attaching sensor datasheet. It says from range between 100-600mm it has linear relationship with current. I am using three led if value is less than or equal to 570 it turn on yellow, if greater than 590 it turn on red and i attached data to get on third light that is green because sensor will output value between 100-600mm so value remaining will be in between 570 & 590 at that point it turn on green. But I will be using two sensor at same time from 6009 which mean 6 led in total and at one time two led will be glowing 1 each from each sensor.

 

I am trying to understand and learn this language seeing related topics on the forum but get confused. If you guys can suggest me how should i approach to learn labview.

 

thanks again

 

Regards 

Download All
0 Kudos
Message 4 of 11
(2,585 Views)

Okay,

        I am not sure if you still have hardware question but just to me clear you wuld need 6 different channels for six LEDs. I have attaced a VI, which by no means is complete or clean, considering I put it together in 5 minutes before leaving work. but it should give you an idea to get on the track. As altenbach said, you need to review your fundamentals about labview, 'Learning with LabVIEW' is a good book for beginers also there are tons of material and examples on web (try NI webcasts or youtube tutorial videos for labview.) Also go to help>>Find Examples in labview, good place to get started.

Hope it helps.

 

 

-Nilesh



------------------------------------------------------------------------------------------------------
Kudos are (always) welcome for the good post. 🙂
0 Kudos
Message 5 of 11
(2,562 Views)

Thanks Nilesh,

If you don't mind can you please convert it into 8.6 version. I am not able to open since I guess it is built in 9.

 

Thanks again

 

Regards

Himanshu

0 Kudos
Message 6 of 11
(2,541 Views)

Hi,

I was able to convert. I ran this vi, but at one time one sensor runs. I put indicators on data out of both daq of daq read function and it runs one sensor at a time.

And t does not show the value which is on sensor.Can you suggest what should be done to make both running at sametime and to see exact value. And on indicator it shows maximum value of 0.01054 and if sensor have reading 0mm it keep changes the value like 0.0020. I am using the resistor of 220ohms for both the sensors. That is going between pin 2 and 3 of usb 6009

0 Kudos
Message 7 of 11
(2,518 Views)

The VI I attached was not complete. I am hoping you added number of channels needed for your application. Now, what do you mean by, it runs one sensor at a time? did you check it using highlight execution?  If both daq read Vi are in same while loop, you should get values simultenously. 

  Did you read the sensor spec sheet/manual? As far as I remember, the sensor output is current and with labview you are measuring the current and not the distance. To convert the current value to the distance you need to have a conversion factor in mm/amp, (it should be in spec sheet or can be calculated by dividing the max distance sensor can measure by max current op of the sensor.)  Multiply the output of the sensor read by this conversion factor and you should get the value in distance. 



------------------------------------------------------------------------------------------------------
Kudos are (always) welcome for the good post. 🙂
0 Kudos
Message 8 of 11
(2,504 Views)

Hi,

I was able to get sensor working. But they are running fine in seperate vi's. Can you please suggest how can i make them work together in one vi. If i try to do that it's giving an error. I was tring to put one under the other

 

 

Thanks

 

Regard

Download All
0 Kudos
Message 9 of 11
(2,503 Views)

It shows error in start function of daq. I used a custom scale to output the value.

 

Thanks

 

 

0 Kudos
Message 10 of 11
(2,500 Views)