Loading...

Dispatch to Owners #1: front panel, wifi, flashing, privacy

Hello dear owners of the CO2 monitors!

With these letters I intend to fill the gaps in the documentation which was available before or at the moment of you obtaining the devices.

Front panel

On all the devices (except for #101), there is a protective film on top of the transparent front panel. You can peel it for cleaner glossy look, or keep it if you want to not be saddened by future scratching, or you actually want the LED light to diffuse.

The original design intends to diffuse the ligth from LEDs, which means to have, ideally, a device-sized spot of ligth, instead of 4 small points of light. A way to manufacture that would be to either apply a frosting effect with the laser cutter, or to stick on a frosted film.

The original developer of this device, Oliver Seiler, explored both. The laser cutting shop he approached asked a high price for frosting effect because it takes a long time to process. So he used a stick-on film. That’s what I attempted, too, but due to shortage of time I had to cut the C-shaped film fragments by hand scissors, and I disliked how it turned out looking on the device due to lack of precision. It would also take extra time to apply, and I might have not been done by the time I had to travel to FOSDEM, literally on Friday! So I just throught: I have these cut front panels, they come with protective films on both sides from the manufacturer, I can just leave outer side film on, it will diffuse the light a bit, offer scratch protection without need for padding the cases in the box, and avoid extra assembly time!

Wi-Fi settings

The original firmware behaviour is that the monitor sets up a Wi-Fi access point, lets you connect to it and use a web interface and specify which Wi-FI network to connect to. The Wi-Fi credentials are then saved in an internal memory of ESP32 which are non-retrievable. I don’t know the details about this non-retrievability but the point is that stolen device doesn’t let the stealer the to your Wi-Fi network.

I wanted to avoid going through the web interface because I had 40 devices to set up, and FOSDEM Wi-Fi is open so there’s no secret. The original firmware uses a JSON config file which you can upload into it, but it didn’t have the parameters for Wi-Fi credentials. So I added parameters wifiSsid and wifiPassword. Unfortunately I also added a bug (yet unfixed) that if these parameters are missing in config.json, or are empty, the device crashes on boot, not showing any lights, and even to upload a new configuratiohn or firmware you have to do a sequence of button presses first. See the next section about the button pressing.

So you can make it work with your Wi-Fi the following ways:

Firmware & flashing

The primary location of the original Oliver Seiler’s firmware repository is

https://codeberg.org/oseiler/CO2Monitor/

(previously https://github.com/oseiler2/CO2Monitor/ , not going to be updated in future.)

There is his web flashing app:

https://oseiler.codeberg.page/CO2Monitor/

My firmware repository is at

https://forge.autkin.net/autkin/CO2Monitor

Right now there’s not much uniquely useful new stuff in my repo, so reflashing to Oliver’s firmware is quite OK.

Oliver remains involved with the project, so probably my firmware is not going to be a hard fork.

If you want to flash the firmware from the command line, here’s the sequence of commands.

You must have Python 3.10 - 3.13, 3.14 isn’t supported by PlatformIO (sic!) so if your system uses 3.14 or newer, you need to set up a virtualenv with an older Python, for example, using pyenv.

When you plug your monitor device into USB, it should come up as /dev/ttyACM0. Sometimes it can reappear as /dev/ttyACM1, so check and adjust your command lines, or drop the port argument and let PlatformIO brute force it (it just tries many others like /dev/ttyS0 which I don’t like).

python /usr/bin/pio run -t erase --environment esp32s3-basic-debug --upload-port /dev/ttyACM0 # optional
python /usr/bin/pio run -t upload --environment esp32s3-basic-debug --upload-port /dev/ttyACM0
PLATFORMIO_DATA_DIR=../my-datadir-with-config_json python /usr/bin/pio run -t uploadfs  --environment esp32s3-basic-debug --upload-port /dev/ttyACM0
# replug
python /usr/bin/pio device monitor --port /dev/ttyACM0

PLATFORMIO_DATA_DIR=../my-datadir-with-config_json is optional, it defaults to data/ which is there in the git repository.

If you just edit config.json from the repo and do uploadfs, your device will stop successfully reporting its readings to fosdem26-air.autkin.net, as MQTT credentials will be overwritten. Contact me for MQTT credentials for your device.

There is an uploadnobuild target which can be used instead of upload as argument value with -t, but for me it always resulted in non-functional device, I don’t know why.

If flashing fails with something like

...
File ".../CO2Monitor/venv313/lib/python3.13/site-packages/serial/serialposix.py", line 708, in _update_rts_state
  fcntl.ioctl(self.fd, TIOCMBIC, TIOCM_RTS_str)
  ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 71] Protocol error
*** [uploadfs] Error 1

then you need the buttons pressing sequence to make the device enter the state in which it will accept flashing. This state seems to be called “bootloader mode”.

Privacy

Clearly public dashboard with measurements of owners’ private homes/offices is inappropriate. In principle everybody can deploy the same backend bundle (Mosquitto, Node Red, InfluxDB, Grafana) for themselves, but of course we can do better and be collaborative. I presume at least some of you would be interested in me hosting a separate private instance of this stack for them.

There are some small tricks I am considering, like cloning the current backend setup, making one a frozen publicly-accessible instance with readings just from the FOSDEM days, and the other with restricted access for the device owners.

Please bear with me while I’m taking time to do anything at all in this regard.

Outro

I felt like the air at FOSDEM wasn’t too terrible, and the stuffiest air and the most coughing was in the morning tram. I had a couple of masks with me, but I got so mentally overloaded that I haven’t ever unpacked them. Luckily, I got no FOSDEM flu or anything this time.