I always had a good liking towards apocalyptic movies, and how people survived them using bare minimal tools. More specifically I was interested in how people would communicate long distance. I had long before made a concept using NRF24 and Arduino for satisfying my curiosity. But Meshtastic Caught my eye one day. It was perfect, decentralized, supports mesh, can handle a large number of sensors and input devices. So long I had looked for an opportunity to develop one. It came in form of the Meshtastic Smart Citizen Project. I always have been a big fan of running. (Not running away, please) and so I thought of pairing them to make a community sourced map of AQI for runners to plan their best route. I did live in Delhi NCR which happens to be one of the top 10 polluted cities in the world and so it had an actual function to my idea as well. Thankfully I was selected. I was given a kit containing
- Sensirion SEN66
- Sensirion SEN5X
- Adafruit PMSA003I Air Quality Breakout
- XIAO ESP32S3 & Wio-SX1262 Kit for Meshtastic & LoRa
- Seeed Studio Expansion Board Base for XIAO with Grove OLED - IIC, Uart, Analog/Digital
- Grove - Temperature, Humidity, Pressure and Gas Sensor for Arduino - BME680
I decided to go ahead with Sn66, Xiao Kit and Expansion board. For the GPS part I went ahead with Adafruit Ultimate GPS FeatherWing which I had laying around doing nothing.
Unfortunately, When I applied for the project, the timeline was perfectly when I had plenty of time but due to unavailability of inventory I got the actual kit late, and so it did mess up my schedule. I had to travel a lot and was busy preparing for the Empower Conference and Purple Festival in Goa. Both are places where I had to be presenting my teams product prototypes. So I never got to finish the work in the said time but Oscar from the Fablab team was so helpful that he gave me 5 more days to get something done. That plus my determination to finish the project is gonna keep me working on the project well beyond what I am submitting. So I am gonna split my work into three parts
- Part 1: The Core Driver for Sen6X.
- Part 2: Integration of Sen6X into Meshtastic
- Part 3; Creation of dashboard for AQI mapping
Now, Sensirion had their own library at Github (https://github.com/Sensirion/arduino-i2c-sen66/) but they were quite specific to SEN66 and they had different library for SEN68. One of the thing I liked about meshtastic was how seamlessly they integrated the supported sensors. So I wanted my driver to be automatically detecting the actual sensor version among the family and act accordingly. And so I started reading through the datasheet. some of the things that stood well are the requirement of
- Keeping track of when certain functions are called as their effect lasted longer, such has fan cleaning, starting measurement, and large delay can wreak havoc in many threaded systems and I am not a big fan of delay
- Different sensors had varying ability to detect certain Air Quality parameters (I will use AQI as short henceforth)
- ensuring a State machine, thankfully it is implemented in the Meshtastic directly. So that we will see in second part
- Seriously understanding the calibration parameters, cleaning schedules etc
- The SEN6X had to be mounted in a specific way to make sure it is reading the ambient parameters and not the parameter of air inside the enclosure
I was on the move a lot so, I did not like to carry around a bunch of devices tethered by rope. So I went ahead and 3D Printed a box to carry them safely. Also, if I am gonna implement it during running, I need to have a box. So the first thing I did was to 3D Print a case for it.
Next, to make I focus on the driver, I decided to write it using a fresh independent project which I will call it as SEN6X Core, I will use a wrapper Driver (Sen6xSensor) to use this core driver into to feed data into the TelemetrySensor system of Meshtastic. Once tested well, if needed, I will absorb the Core driver into the Sen6X sensor.
So, I have accordingly uploaded the Sen6X Core library into the github repo. Take a look at it. Will discuss further with the fablab team to start the second part. There will be continuous update to this repo.
Comments