Introduction
This experiment demonstrates how to use the HP03S sensor to measure air pressure with Arduino.
Components Needed
- HP03S Sensor
- Arduino
- Jumper Wires
Circuit Setup
- Connect the HP03S sensor to the Arduino using I2C pins (SDA, SCL, VCC, GND).
The HP03S sensor uses I2C communication to send air pressure data to the Arduino.
Code for Air Pressure Measurement
Upload the following code to your Arduino to read the air pressure:
#include
#include
HP03S sensor;
void setup() {
Serial.begin(9600);
sensor.begin();
}
void loop() {
float pressure = sensor.readPressure();
Serial.print("Air Pressure: ");
Serial.print(pressure);
Serial.println(" hPa");
delay(1000);
}
Explanation
The HP03S sensor measures the atmospheric pressure and sends the data to the Arduino via I2C, which then outputs it in hPa (hectopascals).
Troubleshooting
- If readings are incorrect, ensure proper wiring and I2C initialization.
- If no readings are appearing, verify sensor communication through I2C using the correct library.