Skip to content

Loki1976/AirPressureArduino

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

This is an Arduino sketch for a pressure monitoring system that uses an analog pressure sensor and an LCD display. It continuously reads pressure data from the sensor, converts the reading into a pressure value in bars, displays it on an LCD screen, and activates an alarm if the pressure falls below a set threshold.

Key Components Pressure Sensor: The code reads an analog signal from an analog-to-digital converter pin (A0), which is connected to a pressure sensor.

I2C LCD Display: It uses an I2C-compatible LCD display to show the pressure reading. The program initializes the display and writes "Pressure (Bar)" on the first line.

Alarm: An alarm is controlled by a digital output pin (pin 2). This could be connected to a buzzer, an LED, or a relay to trigger an external device.

Functionality Reading and Conversion: The loop() function continuously reads the raw analog value from pin A0. This value, which ranges from 0 to 1023, is then mapped to a pressure range. While the code aims to map the value to a pressure range of 0 to 8 bars, there's a slight error in the map() function's usage, as it's missing the final value for the input range.

Display: The updatePressure() function is responsible for converting the pressure value to a string and displaying it on the LCD's second line. It centers the text to make it more readable.

Alarm Trigger: The program checks if the converted pressure value is below 6.00 bars. If it is, the alarm pin is set to LOW, indicating a low-pressure condition. Otherwise, the alarm pin is set to HIGH, signaling that the pressure is okay. Note that this logic appears to be reversed and should be corrected to set the alarm HIGH for a low-pressure condition.

Debugging: A debugmode flag allows the user to enable or disable serial output. When enabled, the program prints detailed sensor information to the serial monitor, which is useful for calibration and troubleshooting.

About

AirPressure_Arduino (Tideford Organics)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages