LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ultrasonic sensor not working

Hi Folks, I need some help with my ultrasonic sensor that is not working, Im trying to get my ultra sonic sensor to measure the distance in a tank and to switch on a output for me, but the sensor only works occasionally, first i thought it may be a loose connection but then i found that when I have the trigger disconnected and in my hand it switches my output that i have connected through a shield. i found sometimes that even if the + & - are not connected to the sensor it gives a brief high on the output, any help would be appreciated. 

0 Kudos
Message 1 of 6
(3,895 Views)

Hi,

  1. Maybe you can list down the condition to ensure the ultrasonic sensor is ready to measure. Like make sure +/- are connected.
  2. After you list down all condition, you can do a "filter" like case structure/Boolean to ensure ultrasonic sensor is full fill all the condition you state in Step 1, only start take measurement.
  3. You can add these "filter" before take measurement too, like check the status of +/- for every single measurement. 
  4. If you sucess in Step 2, I think it can avoid the "+/- not connected but still got output." event etc. you stated.

If you face difficulties during follows steps above, we can discuss at here for next step.

0 Kudos
Message 2 of 6
(3,827 Views)

Hi, Ive double checked that the +/- are connected with correct polarity. Im unsure what you mean in step 2&3. Im new to Labview and Arduino so ive a very basic knowledge to programming

0 Kudos
Message 3 of 6
(3,778 Views)

The first thing to do when troubleshooting sensors is to read the sensor directly in the simplest way possible.  You gave no info on the sensor but however you are reading its output you need to set it up so it's facing a solid, flat object that you are SURE will reflect its beam.  Do NOT use water in a tank yet because you don't know if water will bounce your signal or what effect ripples on the water will have.

 

Most of the ultrasonic sensors work by triggering a pulse and then reading the return reflection.  Then you calculate the distance by the time delay between the trigger and return pulse.  I assume you are doing this in the Arduino so you should read the data from it directly and verify you are getting the signals you expect.  A cheap oscilloscope would be great to use here if you have one.  If not just read the value over and over while you move the target and make sure you're reading the distances correctly and not getting false measurements.

 

 I would also suggest you go search for a tutorial on this.  There are a LOT of them on this subject.  For example:

Arduino - Ultrasonic Sensor - Tutorialspoint

 

If you still have trouble post the equipment you're using and the Arduino code.  You could also try Arduino forums since your problem is very likely in the hardware or the C code, not LabVIEW.

 

Good luck!  I did something similar with an HC-SR04 sensor connected to a Raspberry Pi and it worked pretty "well".  Unfortunately, not "well" enough to track the water level in my WELL! ☹️

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 6
(3,767 Views)

Hi NI quist,

Firstly thanks for your response, I'm also using a HC-SR04, I know I have it connected up correctly because it occasionally works when i have a solid object in front of it(Ive followed loads of tutiorals to get it working firstly), but the problem is that it only works intermittently and only when i have thew ECHO disconnected and when im touching the ECHO wire. that was fine just to get it working but now it wont work no matter what i do.  

0 Kudos
Message 5 of 6
(3,755 Views)

Hi,

  1. I saw that you said "it occasionally works when i have a solid object in front of it".
    • Do you have any idea to make your ultrasonic sensor have more stable performance?
    • Because you said that your VI is working fine sometimes,seems like your block diagram is correct. Maybe you can try to focus on your hardware connection first.
  2. About the Step 2&3, I just means that you can use case structure (or other function), to check whether your hardware is ready to measure calculation or not. It's ok you can focus on your hardware first.
0 Kudos
Message 6 of 6
(3,745 Views)