03-11-2015 08:20 PM
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!
03-13-2015 11:41 AM
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
03-13-2015 01:54 PM
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. But we'll be happy to help you work through it.
03-13-2015 02:00 PM
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
03-14-2015 04:49 PM
Hi guys, attached is
03-14-2015 08:06 PM
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.
03-30-2015 02:26 PM
Hi, please find attached updated code
04-01-2015 09:11 AM
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).