Hardware Journey: Building the pikoAQI Prototype
Intro
I want to make an hardware project, I have no technical skill about hardware and electronics. So I started this project to learn along the way. I know the AI will be able to help me.
The project is a wearable/portable air quality sensor. I choose this project because I had the need for one, and it's not too complex in a way that there is no need to R&D some sensors as they already exist, but not too easy to do as i have multiple feature that need to work all together, in a compact form and low power consumption.
Ordering the prototype parts
To get started I explained to claude (the AI) my project and he helped me brainstorm and choose the electronics components.
Here's my first order from the electronic shop:
Component | Description | Price |
---|---|---|
NodeMCU ESP32 | Main microcontroller board | 11,92 € H.T |
Screen E-Ink 2,13'' TF060 | Low-power e-ink display | 16,58 € H.T |
GPS module TEL0094 | Location tracking module | 15,50 € H.T |
Logic level converter | Logic level converter | 3,29 € H.T |
Air sensor SDS011 | Air quality sensor (PM2.5/PM10) | 29,12 € H.T |
Sensor BME280 SKU27347 | Temperature/pressure/humidity sensor | 10,42 € H.T |
Sensor BME680 PIM357 | Environmental sensor with VOC detection | 22,00 € H.T |
Component Selection Rationale:
- ESP32: Selected as an entry-level yet capable microcontroller with built-in WiFi/Bluetooth, compact size, and sufficient processing power for production use.
- E-ink Display: Chosen for its extremely low power consumption - only requires power during screen updates, maintains image when powered off.
- GPS Module: Basic GPS functionality for location tracking.
- Air Quality Sensor (SDS011): Capable of detecting particulate matter (PM2.5, PM5, PM10) in the air.
- BME280/BME680 Sensors: For measuring temperature, pressure, humidity, and volatile organic compounds (VOCs).
Working with the E-ink screen
First part I started to test and use is the E-ink screen, The one I ordered as no technical documentation but only an Arduino exemple. I gave it to cursor as context and he was able to make it work in my code. The screen communication works with the SPI protocol, the ESP32 board is supposed to have builtin SPI implementation, but i wasn't able to make it work with the screen. So i kept the custom SPI implementation that was provided in the documentation exemple.
The problem with the E-Ink screen is the refresh rate, it's very slow, a full change of the screen can take up to 2s.
The screen have 2 mode, a "partial update" one and a "full refresh" one. The partial update one is of course faster as it don't have to flush the entire screen.
I was able to take adventage of that to make a "fast" refresh mode, using partial update.
How my "fast" mode works :
- Partial update a "full white screen" to flush the current image
- Partial update paint the new image i want to display
Some ghosting might apear on the screen, but the fast mode can be use only to the use cases where ghosting is not a problem.
Benchmarks :
- Full refresh : 2seconds
- "Fast" refresh : 1.1seconds
Learnings :
- There is different mode to display an image ( partial update / full update )
- E-ink screen are slow to render content
- This screen migh fit my needs, but i can probably find cheaper and faster.
- I need to understand what native SPI is not working with it
Working with the GPS
Working with the GPS was much more easier, claude knew how to plug it, and the documentation was providing TinyGPS++ Lib.
Also the physical LED on the GPS chip was making debugging easier ( POWER and PPS ) as my first try the GPS wasn't powered correctly ( wire issue ) I was confused at first of why i didn't go any location data from it, but i learned that the GPS need to sync first, on the first startup it might take a long time. ( more than 5minutes) for me it took more, but it's most lickely because my room don't have a strong signal.
The PPS LED blink exactly one time per second ONCE the GPS is sync ( FIX ). Very easy way to debug and understand that the reason why i didn't got any location data wasn't a code issue but that the GPS needed to sync
The GPS that i ordered was a 10Hz capable GPS ( normal gps are 1HZ ) and made for flying drones applications. I don't need such high performance GPS, what i need is strong accuracy even inside buildings. And cheaper. I'll make sure to order a better one for my needs on the next prototype
Learnings :
- GPS can take time to sync during cold start ( multiple minutes for cold start to 30s+ for warm starts )
- I don't need a 1~10Hz refresh rate GPS ( as I'm not building a plane or fast moving device )
- I need a gps that work better for indoor uses.
- I need to look for a cheaper and more powerfull alternative
Working with the BME680 ( air sensor )
I had hard time being able to communicate with the sensor, cursor wasn't able to make a good implementation that worked, even with exemple. Lucky for me a company made a library for that specific sensor so i was able to use it. It's called AdaFruit, they have alot of lib for differents sensors. Pretty usefull.
The VOC sensor needs to be calibrated, and on the early usages it's will fluctuate, so the values will only be reliable after the first 48hours of usage, this will probably be hard to integrate into my devices as customers won't be able to easely calibrate it. I'll need to make it work paired with other sensor to validate the data.
Learnings :
- The VOC sensor needs to be calibrated, not sure yet how i'll manage to to this on the end user side, maybe i'll only use it to monitor variations.
Battery
I've searched for Lipo or li-Ion battery, the form factor of Lipo cells is much better. and it's what is currently used on wearable device where size and weight is important, like computer and phones.
But from what i've seen most Lipo batteries are 3.7V, and the ESP32 controller that i'm using is expecting 5V.
I could "boost" the current but it's added complexity and power inefficiency.
Also working with battery can be dangerous, as they are very sensitive to physical damages, and lipo cell can burst in flames if they are pierced, overheated, over discharged, ect ect.
So for now i'm using a normal portable battery that have a USBC cable.
Here a photo of the final build :
Learnings
- Most of small Lipo are producing 3.7V
- Safety normes and rules are important when working with batteries
Software implementation
I've been playing with the software implementation, and data synchronisation management.
The goal is to have the ESP32 acting as a bluetooth BLE ( low energy ) server, and have a client on my computer to retrieve the data. At first i wasn't even able to uploade my code to the microcontroller as it was too big, after searching on the internet i've discovered that the default BLE library was not lightweight at all and was using 75% of the available FLASH memory. I've switch to the Nim BLE implementation, that is approx 50% lightweight. At the cost of only supporting BLE and not classic bluetooth ( good thing as i'm not planning to implement normal bluetooth )
Stay tuned for more updates as I continue working on the pikoAQI wearable sensor!