Guide to using the Bar100 with an Arduino

Introduction

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.

Example Code

This example uses the BlueRobotics KellerLD Library with the connected sensor. The example reads the sensor and prints the resulting values to the serial terminal.

Please remember to use a logic level converter, such as this one, to convert Arduino 5V levels to 3.3v!

If you’ve never used Arduino before, we suggest checking out some tutorials!

#include "Wire.h"
#include "KellerLD.h"

KellerLD sensor;

void setup() {
  
  Serial.begin(9600);
  
  Serial.println("Starting");
  
  Wire.begin();

  sensor.init();
  sensor.setFluidDensity(997); // kg/m^3 (freshwater, 1029 for seawater)
}

void loop() {
 
  sensor.read();

  Serial.print("Pressure: "); 
  Serial.print(sensor.pressure()); 
  Serial.println(" mbar");
  
  Serial.print("Temperature: "); 
  Serial.print(sensor.temperature()); 
  Serial.println(" deg C");
  
  Serial.print("Depth: "); 
  Serial.print(sensor.depth()); 
  Serial.println(" m");
  
  Serial.print("Altitude: "); 
  Serial.print(sensor.altitude()); 
  Serial.println(" m above mean sea level");

  delay(1000);
}