Skip to main content

Quick Start

This guide introduces the FoBE Breakout LPS22 and how to use it.

Hardware diagram

The following figure illustrates the FoBE Breakout LPS22 hardware diagram.


FoBE Breakout LPS22 Hardware Diagram

Mechanical dimensions

FoBE Breakout LPS22 is a single-sided 25.4mm x 25.4mm (1" x 1") 1.6mm thick PCB with two SH1.0 4-pin connectors and a set of 5-pin 2.54mm header holes. Fixing by 4 x 1.6mm Screw holes.


FoBE Breakout LPS22 Mechanical Dimensions

Interfaces

The module provides dual 5-Pin JST SH1.0 connectors, compatible with STEMMA QT / Qwiic.

2.54mm 5-PinJST-SH1.0Features
GNDGNDGround
3V33V3Power supply, Only 3.3V
SDASDAI2C-Data line
SCLSCLI2C-Clock line
INTInterrupt, Active Low

Advanced

Jumper

The module features two jumper pad:

InterfaceDescription
LED-JUMPERDisconnect this jumper to turn off the power LED for further power saving
LPS22-ADDRI2C address selector:
0x5D Set JUMPER:H
0x5C Set JUMPER:L

Programming

Running with FoBE Quill ESP32S3 Mesh

Let's get started with the FoBE Quill ESP32S3 Mesh using the MFP interface.

  1. Connect the FoBE Breakout LPS22 to the FoBE Quill ESP32S3 Mesh using the MFP interface.

FoBE Breakout LPS22 Connection

  1. Create a sketch or PlatformIO project, or follow the FoBE Quill ESP32S3 Programming Guide for pre-configuration.

  2. Install the necessary library in your project:

adafruit/Adafruit LPS2X@^2.0.6
  1. Copy the following code into your sketch or PlatformIO project:
#include <Adafruit_LPS2X.h>

#define I2C_ADDRESS 0x5C // I2C address definition for LPS22
#define I2C_SDA_PIN PIN_MFP3 // SDA pin for MFP to I2C cable, change if needed
#define I2C_SCL_PIN PIN_MFP4 // SCL pin for MFP to I2C cable, change if needed
#define PERI_EN_PIN PIN_PERI_EN // Peripheral enable pin, change if needed

Adafruit_LPS22 sensor;

void setup()
{
// Initialize serial communication
Serial.begin(115200);
Serial.println("Serial initialized");

// Initialize peripheral power
if (PERI_EN_PIN >= 0)
{
pinMode(PERI_EN_PIN, OUTPUT);
digitalWrite(PERI_EN_PIN, HIGH); // Enable peripheral power
Serial.println("Peripheral power enabled");
}

// Initialize sensor
Wire.begin(I2C_SDA_PIN, I2C_SCL_PIN);
sensor.begin_I2C(I2C_ADDRESS);
Serial.println("I2C bus initialized");
while (!sensor.begin_I2C(I2C_ADDRESS))
{
delay(200);
}
Serial.println("LPS22 sensor initialized");

// Start measurement
// LPS22 is ready for measurements after initialization
}

void loop()
{
delay(1000); // Wait equivalent to sensor.wait()

sensors_event_t temp, pressure;
Adafruit_Sensor *temp_sensor = sensor.getTemperatureSensor();
Adafruit_Sensor *pressure_sensor = sensor.getPressureSensor();

// Equivalent to sensor.update() == RESULT_OK
if (temp_sensor && pressure_sensor)
{
temp_sensor->getEvent(&temp);
pressure_sensor->getEvent(&pressure);

// Equivalent to sensor.hasNewData()
if (temp.temperature != 0.0 || pressure.pressure != 0.0)
{
// Display data on screen
Serial.print("\033[H\033[J");
Serial.println("> FoBE Breakout LPS22 Monitor");
Serial.println();
Serial.print("\033[7m");
Serial.printf("%-12s%-12s%-12s\n", "INDEX", "VALUE", "UNIT");
Serial.print("\033[0m");
Serial.printf("%-12s%-12.2f%-12s\n", "TEMP", temp.temperature, "°C");
Serial.printf("%-12s%-12.2f%-12s\n", "PRESSURE", pressure.pressure, "hPa");
}
}
}
important

This example code uses ANSI output formatting. Your terminal must support ANSI escape codes to display the output correctly.

# platformio.ini
[env:fobe_quill_esp32s3_mesh]
platform = FoBE Espressif 32
board = fobe_quill_esp32s3_mesh
framework = arduino
lib_deps =
adafruit/Adafruit LPS2X@^2.0.6
monitor_speed = 115200
monitor_raw = true
  1. Build and upload the project. You should see the FoBE Breakout LPS22 Monitor output in the serial monitor (raw mode).
> FoBE Breakout LPS22 Monitor

INDEX VALUE UNIT
TEMP 27.60 °C
PRESSURE 1001.28 hPa