Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to store ultrasonic sensor data till get to the next required target?

Solved!
Go to solution

Hi,

 

I have a proximity ultrasonic sensor used to control a weeding device. I am using the sensor to detect the differences of plant heights. Plants are weeds and crops, I want basically to kill weeds and avoid damaging to crops by the device. The crops are higher that weeds, so I am using LabVIEW with USB DAQ 1208FS to compare the different heights. My sensor is located in front of the device in about 20 inches. When it starts reading the first plant (weed) the device will act immediately and kill it. When it gets to the second plant (crop), the device will act on the first plant which means skip some weeds as the sensor read crop. This way I might kill crops along with weeds or skip weeds. Is it possible to store or delay the sensor data till the weeding device get to the required target? Thanks!

0 Kudos
Message 1 of 11
(7,922 Views)

Hi Mazin,

 

LabVIEW allow us to store data in some many different ways. Additionally there are different options to implement a delay depending on how you are implementing the solution. However if you give more details on how you are programming the solution right now or which driver or API version you are using, that would allow me to come back to you with a more precise reply.

 

Regards

Frank R.

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

Hi Frank R,

 

Thanks for your reply. I am using LabVIEW to acquire analog signal from the ultrasonic sensor and convert it to digital to operate a hydraulic solenoid valve (ON-OFF) which will move the weeding device up and down depending on the height differences of plants. I am using a time delay to control the timing of the device, but its not working for me. The time it takes the device to move up or down is about 2 seconds, and the distant from the sensor to the weeding device is 20 inches. I am using ULx as the DAQ is 1208FS from measurement computing. Attached is the VI that I am working with. Thanks!

 

Mazin 

0 Kudos
Message 3 of 11
(7,893 Views)

Hi Mazin,

 

You could take into account the Elapsed Time Express VI to count time and take decisions with it, since we have a Boolean in the output. (small change in the code)

Now, if you want to implement more changes but following an scalable solution and LabVIEW good programming practices, you could implement a state machine. With this pattern, it is easier to introduce changes and delays in the code.

 

You could check the example below just as a reference to understand the idea.

DAQmx Acquire and Digital Out State Machine

 

Regards

Frank R.

0 Kudos
Message 4 of 11
(7,880 Views)

Thanks Frank, I will try your suggestions!

 

 

0 Kudos
Message 5 of 11
(7,872 Views)

Hi Frank,

 

I tried different ways to modify some examples to use the elapsed time, but it messed up the VI. I am still a beginner in LabVIEW, so I would appreciate it if you could help me modify my VI using the elapsed time. Thanks!

 

Mazin

0 Kudos
Message 6 of 11
(7,865 Views)

Mazin,

 

Are you trying to introduce the delay here?

delay.PNG

Do you need to delay the data flow for 2 seconds there?

 

Regards

Frank R.

0 Kudos
Message 7 of 11
(7,850 Views)

Hi Frank,

 

I believe you are correct. The delay will introduced to the digital out. I attached a snippet of the VI. Thanks!

 

Mazin

0 Kudos
Message 8 of 11
(7,848 Views)

Mazin,

 

In that case, you could include a "time delay VI" instead. To ensure the proper data flow, you should cut there the error wires, and connect them in the input and output of the time delay VI (series connection). That way you could include a delay exactly there.

 

Regards

Frank R.

0 Kudos
Message 9 of 11
(7,833 Views)

Hi Frank,

 

Thanks for your help. Do you know how to use arrays to store data (voltage) from ultrasonic sensor for some amount of time then release it later. Thanks!

 

Mazin

0 Kudos
Message 10 of 11
(7,646 Views)