For more detailed informations about this project, please check its GitHub organisation.
IntroductionEvery day, we enter classrooms brimming with excitement and eagerness to learn. But little do we know, the air we breathe inside these four walls may not be as harmless as it seems. With growing concerns about the impact of CO2 on our health, it's crucial to monitor the levels of this gas in indoor spaces, especially in classrooms where ventilation can be limited.
That's why we, a group of students at Polytech Sorbonne, took matters into our own hands. We created a project called "Monitoring CO2" to keep track of the levels of this gas in our classrooms and ensure that we're breathing healthy air. With this innovative solution, we can have peace of mind knowing that we'll be alerted if the air quality becomes problematic. By taking a proactive approach to air quality, we are working to ensure that our classmates and teachers are breathing the healthiest air possible.
Video presentation (French)General schematicTo collect data from the CO2 sensor, we used an Arduino MKR 1310 microcontroller along with the following libraries: MKRWAN, Arduino Low Power, RTCZero, Adafruit EPD, TimeZone, LinkedList, and Edge Impulse.
The microcontroller first joins the LoRa network using the LoRaWAN module, and the backend server is notified. A downlink message containing the current real world time is then scheduled, and the microcontroller attempts to poll the downlink message and set its RTC clock with the real world time.
Once this is done, the CO2 sensor is put to sleep and the microcontroller also enters a sleep mode. It enters a main loop where it records the voltage of the motion sensor with 1 second intervals. When the CO2 sensor is powered on, the microcontroller detects it and records the current sensor values.
The values are then updated on the screen if it is daytime, and after recording a certain amount of data, it is sent over LoRa. This process allows for efficient and accurate data collection from the CO2 sensor.
Low power consumptionTo save power and achieve a 2-year battery life, we used a TPL5110 timer module. It allowed us to only turn on the CO2 sensor every 10 minutes. This reduced power consumption and increased battery life, making it ideal for long-term data collection without the need to recharge the LiPo battery. We also used two indoor solar panels which greatly helped to extend the battery life, by juicing up the device during daytime operations.
Sending data over LoRaWANTo send the data collected from the sensor to the LoRaWAN network, we encoded it to use the least amount of bandwidth and reduce power consumption.
The payload is encoded as following :
It consists of two bytes of "header" and N*8 bytes for all messages.
Header :
- The first byte indicates the number of messages that are sentThis is a two bytes unsigned short
- The second byte indicates the battery voltage at the time of the uploadThis is equal to (current_battery_voltage - 2.5) * 100For example 4.15V battery will send 0xA5
Messages :
- The first 4 bytes consists of the message timestamp in the Unix format in seconds (example)
- The temperature is sent as the following : (current_temperature + 25) * 10
- The humidity is sent as the following : current_humidity
- The CO2 is sent as the following : current_co2 / 10
- The motion is sent as the following : current_motion_probality * 15
In order to store the data, we needed to setup a server with databases. We choose to make a Java web server with the Spring Framework which would double as a REST API to collect data from the devices, and as a web server from users to access the data.
The server is containerized in a Docker compose and consist of the following parts :
More info about the backend server can be found in it's GitHub repository.Also, informations about the Docker compose can be found in the dedicated GitHub repository.
WebsiteFinally, users can access the devices data directely on the website. A convenient map shows the whole floor with colored indicators based on the last CO2 reading.
Users can then access the data by pressing the button and view a fully featured dashboard with every data coming from the device.
Comments