Ultrasonic sensor help needed

Hey guys
Been playing around with the ultrasonic sensor for a few days now. We have it set up plugged into the analog port 1. I initially used the labview example to test it, but the number given never changed. Today, I worked with new code that I found online. Attached is this code. It correctly gets the voltage like it is programmed and displays it to the dashboard, but in lays a tougher problem. Once again the number never changes. The voltage shown sticks at something like 4.56 for the sensor and never changes if I move it around.

Any ideas?

Ultrasonic code picture.jpg


Ultrasonic code picture.jpg

Your code looks fine. How did you wire the sensor? Do you have a DMM that you can use to measure the sensor independently?

We soldered pwm wires to the sensor according to the diagram given on the sensor website for analog, so it’s correct. The soldered wires are a part of a pwm cable that ends with a male connector. This male connector is then connected to a female to female pwm cable that is put into the analog breakout on the cRIO.

We do probably have a DMM lying around. How would i go about testing the sensor?

Verify that there is +5 volts on the +5 pin, with the black DMM lead on the GND pin. If not, check both. Verify correct polarity at the same time.

If yes, then put something about feet from the sensor - the ceiling makes a nice target if you’re working on a table. The voltage at tha AN pin, again with the black DMM lead on the GND pin, should be about 0.6 volts - more precisely, it should be 0.01 volt per inch. 60" = 0.6 V

If all that is fine, the sensor is working properly.

Thanks for the help. I’ll try this tomorrow.

What should I do if the sensor still remains at the constant 4.56 volts or so?

Get another one, 'cause that one’s bit the dust.

All assumes that you know what you’re saying when you wrote “so its correct”. Maybe have someone look real carefully for solder bridges and other issues?

I sure hope it’s fine! Do you think it may be a “dead” one because of the constant voltage it shows?

My suspicion is that you’re reading the supply voltage. Particularly because the sensor has a maximum range of 255 inches (2.55 volts). But it’s fed with about 5 volts…

Little solder globs can do that sort of thing. As can little ‘hairs’ of copper wire. and so on.

Thanks. I’ll check it out tomorrow