Need assistance connectingGravity: Analog Water Pressure Sensor (1MPa) to Rasberry Pi 4 model B

Hi, I purchased a pressure sensor for my water control smart system and the ADS115 and Bi 4 level shifter.. When I connect everything to the pi, i2c does not recognise the device. I checked over the wiring and code meticulously but could not figure it out. Please help happy to video chat to go through the wiring and code.

1 Like

Hi Muhammad,

Firstly, welcome to the forum!

So that we can get an idea of what exactly is going on with your project are you able to post come images, namely of your wiring setup and also your code?

1 Like

Hi Dan,

Thank you for welcoming me! I am also very grateful to have found support here, so thanks again!

I have provided some images of the wiring, the code, and a screenshot of the diagram I was following.

Please also find my code below:

from time import sleep
import Adafruit_ADS1x15

adc = Adafruit_ADS1x15.ADS1115(address=0x48, busnum=1)

#Gain = 2/3 for reading voltages from 0 to 6.144V.
#See table 3 in ADS1115 datasheet
GAIN = 2/3

#Main loop.
while True:
value = [0]
# Read ADC channel 0
value[0] = adc.read_adc(0, gain=GAIN)
# Ratio of 15 bit value to max volts determines volts
volts = value[0] / 32767.0 * 6.144
# Tests shows linear relationship between psi & voltage:
psi = 50.0 * volts - 25.0
# Bar conversion
bar = psi * 0.0689475729

print("Voltage: {0:0.3f}V, PSI: {1:0.0f}, Bar: {2:0.1f}".format(volts, psi, bar))

sleep(1)


2 Likes

Thanks for the debugging information @Muhammad269422 - I think I can see the culprit… none of the pins are soldered :sweat_smile:

This arrangement may work intermittently, but it’s more reliable and to solder pin headers. Have a go and let us know how it goes! :smiley: