0

This is probably a rookie question but I was interested in hooking up my RPi 3 B+ to the following ultrasonic sensor to measure water level in a humid environment (for arguments sake, the Pi will not be in the humid environment).

This issue I seem to be having is that the sensor requires a supply voltage of 24V and the output would be an analog output of 0-5V.

Any tips for making this happen, or am I just dreaming?

Cheers

  • By the time you add all the additional hardware/level converters it would be easier and cheaper to use an Arduino. – Milliways Jan 18 at 22:54
  • I also want to be able to push data from the RPi to an FTP, can this be done with an Arduino? – Rob Jan 19 at 4:31
  • There are networking shields, but I would connect to the Arduino via serial (the USB cable can also power the Arduino) - another option is SPI. I use Arduino for many simple logging/control purposes from either the Pi or a normal desktop computer. They are ideal because of the inbuilt analog interfaces, low power consumption and they are cheap enough to dedicate to a single task. – Milliways Jan 19 at 4:55
0

The sensor you linked states that it takes a power supply of 12-24V. The Raspberry Pi can only provide 5V, so you'll need to find another way to power the sensor. You can buy 12V or 24V power bricks pretty easily - you'll just need to solder one up to the leads of the sensor.

It seems like the sensor puts out an analog output (a voltage that varies between 0 and 5) depending on distance observed. Unfortunately, the Raspberry Pi has no analog inputs. Fortunately, you can buy an ADC (analog to digital converter) in order to add analog inputs to the Raspberry Pi. You can find a tutorial on how to use an ADC with the Raspberry Pi here, as well as a link to buy one.

However, the Raspberry Pi GPIO operate on 3.3V only. You'll need a way to turn the 5V signal into a 3.3V signal. You can do this with a resistive divider circuit. You can find a tutorial about it on Hackaday here - note that while the article talks mostly about digital signals, using a resistive divider will work just fine with the analog signal produced by the sensor.

In summary:

  • Use a 12V to 24V power supply to power the sensor
  • Use a resistive divider (aka voltage divider) to turn the 5V output of the sensor into a 3.3V signal
  • Use an ADC chip to connect the sensor to the Raspberry Pi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.