LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using a proximity sensor, for distance tracking system in unison with led's

Hi Everyone!

 

I am only very new to the labview environment so I dont have very strong coding knowledge. I basically want to use a proximity sensor which will send out soundwaves at a particular distance interval. Basically if a certain distance (X1) is reached a green led will flash and will cause a buzzer to activate. Subsequently if a certian distance (X2) is reached, two led pins will be activated (ie: green red) and a higher frequency produced,3 led's (green red blue) for distance X3 4 led/s (green,red, blue, yellow) for X4. The proximity sensor that I will be using is a hcrs04 ping sensor with 4 pins (Vref, Ground, Trigger and Echo). Any help or contribution would be greatly appreciated!    

0 Kudos
Message 1 of 8
(3,723 Views)

Hi Dan,

 

I will try my best to help out here however I could use a few more details to do that. Can you tell me more about the physical system? i.e. Where are you generating the frequescies and using what?, Are the LED's on a specific device, how are you communicating with them? 

 

Any other information would be appreciated. Have you tried implementing any code up to now?

 

Regards,

Gavin

0 Kudos
Message 2 of 8
(3,672 Views)

I use those with my Raspberry Pis.  They're very easy to work with and there's info all over the web about how to set them up.  All you will need is a digital out to trigger it and then a digital in that can measure the pulse width returned.   A little simple math and you have your distance.  What hardware are you usingto interface it?

 

BTW, this sounds like a homework problem so don't expect anyone to code it for you.  Smiley Wink  But we'll be happy to help you work through it. 

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 3 of 8
(3,659 Views)

Gavin,

 

That module is a self-contained ultrasonic distance measurement device.  You send it a trigger pulse, it emits several pulses and reads them back, then it sends a variable width pulse back.  The width is proportional to the distance it measured.  They're a piece of cake (or Raspberry Pi in my case). 

 

http://www.micropik.com/PDF/HCSR04.pdf

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 4 of 8
(3,655 Views)

Hi guys, attached is

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

How does this VI relate to the description you posted in your original message?

 

You have a single LED in this VI.  And it isn't working with any proximity sensors.

0 Kudos
Message 6 of 8
(3,612 Views)

Hi, please find attached updated code

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

You really need to break this down.  Lighting the indicator LEDs with a DAQ Assistant is very trivial.  What you need to do is interface to your ultrasonic sensor and get to the point where you can make basic distance measurements.  Then, you can analyze the distance and determine which LEDs should be lit.  This should be very easy too EXCEPT maybe for the measuring the width of the return pulse.  You have not mentioned what DAQ hardware you are using.  If you have a decent card it should be able to measure the pulse-width directly on its digital input pins.

 

BTW, I realize you're new to LabVIEW but you will find that almost none of us ever use the DAQ Assistants prefering to write real DAQmx code for greater control and power over the hardware.  You might want to take a look through the examples that ship with LabVIEW to get your feet wet with DAQmx:  Help > Find Examples...  Hardware I/O >  DAQmx > Digital (In and Out).

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 8 of 8
(3,465 Views)