Build Log: SCD41 CO2 Sensor

CO2 concentration is a proxy for how well a space, especially an enclosed one, is ventillated. To this end I build a quick-n-dirty CO2 sensor using a SCD41 breakout board from pimoroni and bits and pieces I had in the workshop.

Took the opportunity to practice making enclosures, especially for an irregularly shaped circuit. The enclosure was designed in FreeCAD by taking a picture of the circuit then importing it as a reference image. After correct for scale the designed enclosure was reasonable accurate, needing only some small tweaks to dimensions to correct forperspective distortion. The result was then 3D printed on my FF Creator Pro.

The enclosure provides openings for a button (currently unused), a "cage" for the CO2 sensor, display and micro-USB port.

In addition to practicing painting techniques, I also wanted to try new ways of "labelling" my projects. Water-slide decals are widely used in model kits, and it turns out you can buy blank sheets with which to make your own decals with! I picked a cheap'ish option off Amazon. Just search for "water slide decal clear laser". Once they arrived it was a simple matter of designing the decals in inkscape, printing it out and cutting them to size. To complete the build, a plastic primer was applied, followed by colour coats, then a clear coat was applied, followed by the decal, followed by 2 more layers of clear coat.

Overall quite happy with the outcome! Could have done more sanding before applying paint to hide the layer lines better and the a matte coat I think would have worked better. Nonetheless the decal idea worked out well and I think it will be my goto - a big improvement over permanent markers.


Unexpected Latency in Tinyproxy

I love tinyproxy, it is simple to setup and more than enough for my needs. Recently however I noticed that some clients were experiencing unexpected long delays when doing something as simple as curl google.com. After some sleuthing, I tracked it down to the fact I had

LogLevel Info

in my config. When this is set tinyproxy produces log entries such as

CONNECT   Mar 28 08:46:41 [7023]: Connect (file descriptor 7): [unknown] []

the [unknown] is due to tinyproxy attempting and failing to resolve the connecting IP into a hostname. It is this attempt to map IP to hostname that is causing the latencies observed. To resolve this I added offending IP to /etc/hosts some-host-name

with the above entry the latency went away and the log entries now look like

CONNECT   Mar 28 20:39:49 [6879]: Connect (file descriptor 7): some-host-name []

Conda and Slow Proxies

The default conda connect timeout is 9.15 seconds (no idea why this is, seems to have been the case from day one). If the proxy is slow, e.g. it is in another country or AWS region, this timeout can be triggered and conda will prematurely close the connection.

To diagnose this issue, attempt 

curl https://repo.anaconda.com/pkgs/main/linux-64/current_repodata.json

with proxies enabled. If that works then increase the connect timeout as follows

conda config --set remote_connect_timeout_secs 30

conda should now be able to update and install new packages etc.


Installing python package arcgis in conda on Apple Silicon

 In order to install the arcgis package in conda, you have to specify the architecture osx-64 otherwise the package will not be found. This works because MacOS will capable of running x86_64 code on Apple Silicon processors - that is how efficient they are!


conda install -c esri/osx-64 arcgis 

In fact to make everything else work you need to add the channels with architecture specified exactly, e.g. conda-forge/osx-64, esri/osx-64 and defaults/osx-64. Otherwise packages will be installed with a mix of architectures and appears not to be able to find each other.