LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

photoelectric sensor

Hello,

 

Greetings. I am trying to measure water level using photoelectric sensor (DFS-IR42). I used NI 6009 USB for data acquisition. But it shows 2 combined signal as the power input (VCC) are 2. I have attached the pictures of those. Now, my question is -- How can I get two separate voltage output /numeric value?

 

 Thanks in advance. 

Download All
0 Kudos
Message 1 of 8
(4,067 Views)

Hi Chowdhury_Milon,

 

I am confused by your question. Why would you be trying to measuring VCC with your DAQ? In most applications, VCC represents a power supply... Furthermore, why would you have two different power supplies in the system you have posted? It only shows a single +5V supply. In regards to your code, how is your DAQ Assistant Express VI configured? We cannot see its internals from the picture you have posted. Also, why are you using the Express VI within a while loop? This is generally a bad idea and should be avoided unless you have a good reason as to why you are doing this (I can't think of one off the top of my head).

 

To answer your specific question, you can retrieve two separate voltage outputs by parsing rows from the data array that is returned by the Express VI. Right now, you are attempting to feed the waveform output into a numeric indicator. I have no idea what that will do, but it is almost certainly not what you want.

 

Here are some tutorial resources you might want to check out before continuing to code:

Using the DAQmx API

Tasks in NI-DAQmx

 

If you look through these resources and still have questions about your application, feel free to follow-up here!

 

Cheers,

 

Duncan W.

 

Message 2 of 8
(4,024 Views)

Hello, Mr. DuncanW

 

Thanks for your reply. I have attached some pictures. I think it will clear your misunderstanding. 

Download All
0 Kudos
Message 3 of 8
(3,985 Views)

Alright I have a few more recommendations. I would also help if you could answer the following questions:

 

Why do you think the "combined signal" you are experiencing in LabVIEW is related to your device having two pins for a power supply?

How is your DAQ task configured? I cannot see its internals if you use an Express VI (which I would not recommend)

Are you sure you are receiving two signals? Your waveform chart appears to indicate otherwise. Remember there is a difference between a waveform and a numeric. You will need to extract the numeric data from the waveform.

 

If you are not already doing this, you need to wire the two VCC inputs to your device to a 5V power supply. These inputs should have no interaction with your DAQ system. I am not sure why you think these inputs are directly changing the output you see in LabVIEW (obviously they have an indirect impact). Only the signal output (Yellow wire) should be connected to your DAQ. The final wire (GRD) should be connected to the ground of your power supply.

 

Finally, can you please explain your problem more thoroughly? Why do you need two voltage outputs? Your device has only one signal output. Do you have two devices? Would you simply like to have two copies of this measurement in LabVIEW? I am confused as to what you are trying to do and why you are trying to do it.

 

Duncan W.

Message 4 of 8
(3,958 Views)

Hello, Mr. Duncan W,

 

Pardon me. My English is not good. For that, you can't understand ..... I bought new ultrasonic sensor (HC-SR04). I want to use Arduino Mega 2560 to measure distance (water level of a tank). Here I attached 1 pdf file. I have followed that file to make a VI. but my VI not working due to an error.

 

Would you see the problem by highlighting execution and give the solution, please? TIA.

0 Kudos
Message 5 of 8
(3,937 Views)

Check this article out for help resolving your error code. What this error means is that your Arduino is not properly connected to LabVIEW. This could be at the driver level, but I suspect it is in the way you are wiring your system. I cannot debug this by highlighting execution because your error is not related to your LabVIEW code. Make sure that all of your system's connections are correct and that your Arduino device is being recognized by both your computer and LabVIEW.

 

Duncan W.

Message 6 of 8
(3,922 Views)

Hello Mr. Duncan W

There were some mistakes in coding that why "Error 5003" was showered. I have modified the code. Now it runs but shows a fixed value (48). I also changed the baud rate 115200 to 9600 to show any differnece but no result. I have attached the modified code. I am using Arduino Mega 25600 and Arduino 1.8.3. LIFA_base is also ok.

 

Would you check please. 

Download All
0 Kudos
Message 7 of 8
(3,896 Views)

I see now. I did not realize that you had replaced your DAQ device with a new data acquisition system. Personally, I wouldn't recommend doing this, as it will make your life harder, but I will try to help troubleshoot. First off, make sure you understand your sensor's communication protocol. Specifically, check out the timing diagram. You will need to measure the elapsed time between trigger and echo and manipulate that measurement to obtain the distance between your sensor and the water level. I am not particularly familiar with the Arduino interface for LabVIEW, but, unless there is processing code you have not posted, your current readings will not make any sense because they discard signal timing (which is where the information is encoded).

 

If you have not already, you will likely need to write code to parse the time difference between trigger and echo signals and upload that code to your Arduino. You will probably not be able to make sufficiently accurate measurements from within LabVIEW unless you are running it on a Real-Time OS, which is a whole other can of worms that I wouldn't recommend opening for this project unless you have to. I apologize that we have still not gotten into the code itself, but I want to be sure that your methodology is correct before we debug your code. 

 

Duncan W.

0 Kudos
Message 8 of 8
(3,881 Views)