Guide to Using a Bar100 with a Raspberry Pi
The Bar100 pressure sensor is designed to be used underwater at pressures up to 100 bar, or around 1000 meters depth in water. It communicates via I2C and comes with a 4-pin JST GH connector that is compatible with the Level Converter and other microcontrollers.
This example uses the BlueRobotics KellerLD Python Library with the sensor connected to a Raspberry Pi. The Raspberry Pi uses 3.3v logic levels on the I2C pins, so a logic level shifter is not required.
from kellerLD import KellerLD import time sensor = KellerLD() if not sensor.init(): print "Failed to initialize Keller LD sensor!" exit(1) print "Testing Keller LD series pressure sensor" print "Press Ctrl + C to quit" time.sleep(3) while True: try: sensor.read() print("pressure: %7.4f bar\ttemperature: %0.2f C") % (sensor.pressure(), sensor.temperature()) time.sleep(0.2) except Exception as e: print e