Skip to content

CanAirIO is a citizen science initiative. We are developing a mobile application that is able to set a PM2.5 or CO2 sensors, and other related sensors, as a fixed station using WiFi or mobile station with an smartphone by using a Bluetooth connection.

License

Notifications You must be signed in to change notification settings

hapklaar/canairio_firmware

 
 

Repository files navigation

Build Status PlatformIO ViewCount Liberapay Status Telegram Group

CanAirIO firmware

CanAirIO Community

Citizen science project with mobile and fixed sensors for measuring air quality (PM 2.5 or CO2) using low-cost sensors and smartphones. Built with a ESP32 module board interfaced with an CanAirIO Android client app.

Features

  • Super easy web installer, via Chrome or Edge
  • Mobile station (via Bluetooth LE for tag GPS variables)
  • Fixed station, (using only your WiFi)
  • Fast WiFi credentials provisioning via Bluetooth
  • Automatic firmware OTA updates (stable/testing channels)
  • Share mobile tracks via mobile.canair.io or CanAirIO app
  • Home Assistant integration, discovery and multisensor support
  • Share your fixed station quickly via Anaire Cloud
  • Separated sensors layer for improve support of new sensors
  • Multiple boards and sensors support with only one firmware

Boards supported

The last release of CanAirIO Device supports the next boards:

Firmware Name Boards supported Display Guide and schematics
TTGO_TDISPLAY TTGO T-Display eTFT CanAirIO Bike
TTGO_T7 TTGO T7, D1Mini, ** OLED 64x48 CanAirIO v2.1
M5STICKCPLUS M5StickC Plus eTFT CanAirIO in M5StickC Plus
M5ATOM M5Atom Lite OLED I2C
ESP32DevKit ESP32DevKit, NodeMCU V3, ** OLED 128x64 HacksterIO
TTGO_TQ TTGO TQ Builtin OLED TTGO_TQ board
WEMOSOLED WemosOLED and similar boards OLED 128x64 ESP32 OLED board
HELTEC ESP32 Heltec board OLED 128x64

** is possible that the current firmware supports more boards and sensors. Also you can choose the sensor brand or type on the CanAirIO Android app.

Installation alternatives

We have different alternatives for load the current firmware. In order of complexity they are:

Via CanAirIO Web Installer (RECOMMENDED)

If you already have a ESP32 board, you can test our CanAirIO firmware on one click, with our web installer:

video_2021-11-13_23-36-10

Via CanAirIO loader

You will able to install the last version of CanAirIO firmware with internet updates via a simple Arduino sketch that it will doing all for you, you only need to use the official Arduino IDE or Arduino Droid app for Android for load this simple sketch. Please follow the instructions here or follow the next YouTube video guide for Android OTG installation alternative.

Via binaries

You can download the last firmware version in releases section. Download the last production release from assets section, for example:

releases assets

please uncompress the zip file and connect your CanAirIO device to your USB and execute the next command for upload the firmware to your model board, for example to a TTGO_T7 board you should run the next commands:

Linux and MacOSx

unzip canairio_rev414_20190829.zip
cd canairio_installer
./install.sh canairio_TTGO_T7_rev839.bin

Note: you need python2 or python3 with pyserial in your system.

Windows

Please read the Espressif Uploader section in the main documentation for details to load the firmware via the oficial Espressif Download Tool in Windows.

OTA WAN updates

CanAirIO has two channels for remote OTA updates of your device, production channel and development channel. With that you don't need again install the firmware for any update, all here is automatic and you only need have WiFi enable on your device for receive this firmware updates.

If you want the last testing updates, please choose in the previous step the development firmware (zip file with dev name), and upload it to your board.

OTA LAN alternative

After USB binary installation, you will able to send OTA updates to any board supported, like this:

./install.sh ota canairio_d1mini_rev414_20190829.bin

Also you can specify the IP address:

./install.sh ota canairio_xxx.bin 192.168.1.10

More details and options of CanAirIO Installer here

Via PlatformIO (Compiling on Linux, Mac or Windows)

Please install first PlatformIO open source ecosystem for IoT development compatible with Arduino IDE and its command line tools (Windows, MacOs and Linux). Also, you may need to install git in your system.

For the default board TTGO_TDISPLAY (CanAirIO Bike), clone and upload firmware via USB cable:

git clone https://github.com/kike-canaries/canairio_firmware
cd canairio_firmware
pio run --target upload

For a specific firmware for example for a TTGO-T7 board, only change the last line for:

pio run -e TTGO_T7 --target upload

Building Installer

You can build CanAirIO Installer zip package with all binaries of all board flavors running the next command:

./build all && ./build installer

The directory output is in: releases/installer
Also the binaries flavors directory: releases/binaries/

More details and options of CanAirIO Installer here

Troubleshooting

If you have some issues with Bluetooth library internals, or libraries issues, please upgrade all frameworks and tools on PlatformIO:

pio update
sudo pio upgrade
pio lib update

And maybe clean all caches:

pio run -t clean
rm -rf .pio

If you want clear all ESP32 preferences and flash variables in your board, please execute before:

./install.sh erase /dev/ttyUSB0

Supporting the project

If you want to contribute to the code or documentation, consider posting a bug report, feature request or a pull request.

When creating a pull request, we recommend that you do the following:

  • Clone the repository
  • Create a new branch for your fix or feature. For example, git checkout -b fix/my-fix or git checkout -b feat/my-feature.
  • Run to any clang formatter if it is a code, for example using the vscode formatter. We are using Google style. More info here
  • Document the PR description or code will be great
  • Target your pull request to be merged with devel branch

Also you can consider make a donation, be a patron or buy a device:

NOTE: Supporting our Citizen Science Initiative many people be able to fight for air quality rights in many countries with this kind of problems. More info in CanAir.IO

For our supporters, patrons or donors, we will send the preview versions of our coming versions:

CanAirIO CO2 and CanAirIO Mini box

CanAirIO CO2 and Mini

CanAirIO device HOWTO guide

We have some build guides with different alternatives, please visit our CanAirIO documentation.

Building Guide

Soldering Guide (some improvements)

Box STL files


** W A R N N I N G **

The full updated and last versions for all box versions, are in the official repository because it is more easy for handling the versions than Thingiverse. This page it is only a guide.


TODO

  • Enable/Disable APIs from App
  • Locatitation settings via Bluetooth
  • Sensors manager is now a library (CanAirIO Sensorlib)
  • Auto detection of PM sensors (see sensorlib doc)
  • CO2 sensors in chart
  • OTA updates (LAN and WAN) (dev/prod, see releases for details)
  • Multiple variables in chart (C02,PM2.5,Hum,Temp,etc)
  • Map of each recorded track in details
  • InfluxDB schema (by geohashes)
  • New pax counter variable (People around the device)
  • WiFi SSIDs scanner for have a choose list of it in the app
  • Pax counter disable/enable
  • Home Assistant integration (with zero-config)
  • Anaire cloud integration (Automatic time series of your station)
  • Sensor community alternativa for fixed stations
  • Anonymous authentication

About

CanAirIO is a citizen science initiative. We are developing a mobile application that is able to set a PM2.5 or CO2 sensors, and other related sensors, as a fixed station using WiFi or mobile station with an smartphone by using a Bluetooth connection.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 82.1%
  • C 13.0%
  • Shell 3.9%
  • Other 1.0%