Shallow Thoughts : tags : circuitpython

Akkana's Musings on Open Source Computing and Technology, Science, and Nature.

Thu, 30 Apr 2026

How to Re-initialize a Stuck ESP32 (in CircuitPython)

I designed my particulate air quality sensor project around Adafruit's PyPortal. It uses a ESP32 coprocessor for networking.

Unfortunately, the ESP32 is a little flaky. It tends to lose track of the network after an hour or so:

ESP32 not responding
Traceback (most recent call last):
  File "code.py", line 182, in 
  File "adafruit_requests.py", line 725, in post
  File "adafruit_requests.py", line 649, in request
  File "adafruit_connection_manager.py", line 331, in get_socket
  File "adafruit_connection_manager.py", line 248, in _get_connected_socket
  File "adafruit_connection_manager.py", line 61, in connect
  File "adafruit_esp32spi/adafruit_esp32spi_socketpool.py", line 114, in connect
  File "adafruit_esp32spi/adafruit_esp32spi.py", line 899, in socket_connect
  File "adafruit_esp32spi/adafruit_esp32spi.py", line 801, in socket_open
  File "adafruit_esp32spi/adafruit_esp32spi.py", line 422, in _send_command_get_response
  File "adafruit_esp32spi/adafruit_esp32spi.py", line 378, in _wait_response_cmd
  File "adafruit_esp32spi/adafruit_esp32spi.py", line 292, in _wait_for_ready
TimeoutError: ESP32 not responding

I tried re-initializing the network, but it didn't help: re-initializing always died with Timed out waiting for SPI char and SCK in use.

There are lots of people asking about this on the net, but I couldn't find a discussion that actually had a solution for how to re-initialize a stuck ESP32. So I asked Claude. I know, AI, eww ... but Claude seems to have access to CircuitPython code and discussions that Google doesn't index, so sometimes it's the best way to find out how to solve CircuitPython problems. It took a couple of iterations (each requiring a few hours of testing, since it typically takes an hour or so before the network stops working), but we got there. Here's what seems to work for me.

Read more ...

Tags: ,
[ 10:10 Apr 30, 2026    More hardware | permalink to this entry | ]

Fri, 17 Apr 2026

Particular: A Particulate Air Quality Sensor

We're thinking about replacing our ancient fireplace with a modern wood stove. There are lots of reasons, but one is that the house smells smoky when we use the fireplace (which is pretty much every night in winter), and I can't help wondering what all that smoke is doing to my lungs.

Dave insists that the smoke all gets sucked up the chimney and I shouldn't worry about it. I tried to look it up, but it seems like there's hardly any published research on that (or maybe I was just choosing the wrong search terms).

[a boxy blue air quality sensor in a crate made out of popsicle sticks, with a microcontroller with screen on top] But why not actually measure it? I've occasionally wanted a particulate matter sensor anyway; we get a lot of wildfire smoke here in New Mexico most summers (sometimes from local fires, sometimes from as far away as California or Canada) and sometimes the air quality can get pretty bad.

Of course you can buy ready-to-go air quality sensors. But what's the fun in that, when you can make your own for about half the price? (If you don't count the value of your time, that is.)

Read more ...

Tags: , ,
[ 15:09 Apr 17, 2026    More hardware | permalink to this entry | ]

Fri, 19 Dec 2025

A Homebuilt CO2 Meter as a Virus Risk Proxy

[A sensor and small microcontroller, connected by a cable, sitting on pink anti-static bubblewrap. The microcontroller is also plugged in to a USB cable and a battery; it has a built-in display that reads: CO2: 470 ppm, Temp: 77F, Hum: 18%, BAT 65%] Despite most of the world deciding that COVID is over, I continue to be cautious about it. (My one bout of COVID resulted in congestive heart failure which I'm still dealing with, so I'm fairly anxious not to get it again.)

That means that I'm cautious about indoor gatherings. Some places say they've upgraded their ventilation, but can you believe them? I've long read about people using CO2 meters as a proxy, to tell you how well the air is circulating and how high the virus load might be in a crowd, and I've wanted to get one of my own.

You can buy CO2 meters, of course. But making a custom one sounds so much more fun! Reading Wired's story about New Zealand's Kawaiicon cybersecurity convention that provided CO2 trackers inspired me to finally order some parts.

Read more ...

Tags: , , ,
[ 18:06 Dec 19, 2025    More hardware | permalink to this entry | ]

Tue, 09 Dec 2025

Installing CircuitPython on a Gemma M0

(On Linux.)

[a microcontroller the size of a qyarter, plugged in to a light string wound through a blue knit cap] I wrote previously about my difficulties installing CircuitPython on an ESP32 Feather.

When I ordered the Feather, I ordered a bunch of other stuff too, including a tiny wearable microcontroller that's sold specifically for MicroPython: a Gemma M0.

Again, I had trouble getting MicroPython working, but the Gemma's problem was quite different.

Read more ...

Tags: , ,
[ 18:13 Dec 09, 2025    More hardware | permalink to this entry | ]

Thu, 04 Dec 2025

Installing CircuitPython on an ESP32 Reverse Feather TFT

[A small microcontroller with a built-in display reading CO2: 470ppm and some other stuff, plugged into a USB-C cable] (On Linux, natch.)

I've been wanting to play around with CircuitPython for ages. I like Python, I like microcontrollers, what's not to like? Quite a while back, I even ordered a Feather M0 for that — but I didn't do my research, ordered the wi-fi version and it turned out that's the one Feather M0 that can't run CircuitPython.

This time I checked more carefully before ordering, and got a processor that for sure claimed to run CircuitPython.

Read more ...

Tags: , , ,
[ 13:58 Dec 04, 2025    More hardware | permalink to this entry | ]