Shallow Thoughts : : hardware
Akkana's Musings on Open Source Computing and Technology, Science, and Nature.
Thu, 30 Apr 2026
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: hardware, circuitpython
[
10:10 Apr 30, 2026
More hardware |
permalink to this entry |
]
Fri, 17 Apr 2026
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).
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: hardware, circuitpython, python
[
15:09 Apr 17, 2026
More hardware |
permalink to this entry |
]
Fri, 19 Dec 2025
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: maker, hardware, python, circuitpython
[
18:06 Dec 19, 2025
More hardware |
permalink to this entry |
]
Sun, 14 Dec 2025
(With a cheap imperfect tool)
I've written about the several neat boards I recently ordered from Adafruit.
But when I ordered,
I was confused about which connectors were which, and didn't end up
ordering all the connectors I needed.
Adafruit calls the connectors they use "Stemma", and (I realized too late)
they have a helpful page called
What is Stemma?
explaining the different connectors.
I had ordered several of the small ones, "Stemma QT",
more technically a 4 Pin JST SH, which were perfect for connecting a
Feather board to a CO2 meter.
But I hadn't realized that the bigger board, the PyPortal,
needs a larger connector also called Stemma,
more technically a JST PH.
It turned out to be hard to find JST PH connectors with wires already
attached ("pigtails") and what I found were impressively expensive in
lots of two or three. I imagine I might want a fair number of JST PH,
especially the 2-connector type used for batteries.
So I ordered a boxed assortment of 2, 3 and 4-pin JST PH connectors
and a crimp tool.
Read more ...
Tags: hardware, maker, electronics
[
13:34 Dec 14, 2025
More hardware |
permalink to this entry |
]
Tue, 09 Dec 2025
(On Linux.)
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: hardware, python, circuitpython
[
18:13 Dec 09, 2025
More hardware |
permalink to this entry |
]
Thu, 04 Dec 2025
![[A small microcontroller with a built-in display reading CO2: 470ppm and some other stuff, plugged into a USB-C cable]](https://shallowsky.com/blog/images/hardware/PXL_20251202_161750086c.jpg)
(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: hardware, python, circuitpython, maker
[
13:58 Dec 04, 2025
More hardware |
permalink to this entry |
]
Thu, 27 Feb 2020
An automatic plant watering system is a
project that's been on my back burner for years.
I'd like to be able to go on vacation and not worry about
whatever houseplant I'm fruitlessly nursing at the moment.
(I have the opposite of a green thumb -- I have very little luck
growing plants -- but I keep trying, and if nothing else, I can
make sure lack of watering isn't the problem.)
I've had all the parts sitting around for quite some time,
and had tried them all individually,
but never seemed to make the time to put them all together.
Today's "Raspberry Pi Jam" at Los Alamos Makers seemed like
the ideal excuse.
Sensing Soil Moisture
First step: the moisture sensor. I used a little moisture sensor that
I found on eBay. It says "YL-38" on it. It has the typical forked thingie
you stick into the soil, connected to a little sensor board.
The board has four pins: power, ground, analog and digital outputs.
The digital output would be the easiest: there's a potentiometer on
the board that you can turn to adjust sensitivity, then you can read
the digital output pin directly from the Raspberry Pi.
But I had bigger plans: in addition to watering, I wanted to
keep track of how fast the soil dries out, and update a
web page so that I could check my plant's status from anywhere.
For that, I needed to read the analog pin.
Raspberry Pis don't have a way to read an analog input.
(An Arduino would have made this easier, but then reporting to a
web page would have been much more difficult.)
So I used an ADS1115 16-bit I2sup>C Analog to Digital
Converter board from Adafruit, along with
Adafruit's
ADS1x15 library. It's written for CircuitPython, but it works
fine in normal Python on Raspbian.
It's simple to use. Wire power, ground, SDA and SDC to the appropriate
Raspberry Pi pins (1, 6, 3 and 5 respectively). Connect the soil
sensor's analog output pin with A0 on the ADC. Then
# Initialize the ADC
i2c = busio.I2C(board.SCL, board.SDA)
ads = ADS.ADS1015(i2c)
adc0 = AnalogIn(ads, ADS.P0)
# Read a value
value = adc0.value
voltage = adc0.voltage
With the probe stuck into dry soil, it read around 26,500 value, 3.3 volts.
Damp soil was more like 14528, 1.816V.
Suspended in water, it was more like 11,000 value, 1.3V.
Driving a Water Pump
The pump also came from eBay. They're under $5; search for terms like
"Mini Submersible Water Pump 5V to 12V DC Aquarium Fountain Pump Micro Pump".
As far as driving it is concerned, treat it as a motor. Which means you
can't drive it directly from a Raspberry Pi pin: they don't generate
enough current to run a motor, and you risk damaging the Pi with back-EMF
when the motor stops.
Instead, my go-to motor driver for small microcontroller projects is
a SN754410 SN754410 H-bridge chip. I've used them before for
driving
little cars with a Raspberry Pi or
with
an Arduino. In this case the wiring would be much simpler, because
there's only one motor and I only need to drive it in one direction.
That means I could hardwire the two motor direction pins, and the
only pin I needed to control from the Pi was the PWM motor speed pin.
The chip also needs a bunch of ground wires (which it uses as heat
sinks), a line to logic voltage (the Pi's 3.3V pin) and motor voltage
(since it's such a tiny motor, I'm driving it from the Pi's 5v power pin).
Here's the full wiring diagram.
Driving a single PWM pin is a lot simpler than the dual bidirectional
motor controllers I've used in other motor projects.
GPIO.setmode(GPIO.BCM)
GPIO.setup(23, GPIO.OUT)
pump = GPIO.PWM(PUMP_PIN, 50)
pump.start(0)
# Run the motor at 30% for 2 seconds, then stop.
pump.ChangeDutyCycle(30)
time.sleep(2)
pump.ChangeDutyCycle(0)
The rest was just putting together some logic: check the sensor,
and if it's too dry, pump some water -- but only a little, then wait a
while for the water to soak in -- and repeat.
Here's the full
plantwater.py
script.
I haven't added the website part yet, but the basic plant waterer
is ready to use -- and ready to demo at tonight's Raspberry Pi Jam.
Tags: raspberry pi, programming, python, maker
[
13:50 Feb 27, 2020
More hardware |
permalink to this entry |
]
Fri, 17 Aug 2018
Over the years I've picked up a couple of cellphone stands as
conference giveaways. A stand is a nice idea, especially if you
like to read news articles during mealtime, but the stands I've
tried never seem to be quite what I want. Either they're not
adjustable, or they're too bulky or heavy to want to carry them
around all the time.
A while back, I was browsing on ebay looking for something better
than the ones I have. I saw a few that looked like they might be
worth trying, but then it occurred to me: I could make one pretty
easily that would work better than anything I'd found for sale.
I started with plans that involved wire and a hinge -- the hinge so
the two sides of the stand would fold together to fit in a purse or
pocket -- and spent a few hours trying different hinge options.I
wasn't satisfied, though. And then I realized: all I had to do was
bend the wire into the shape I needed. Voilà -- instant
lightweight adjustable cellphone stand.
And it has worked great. I've been using it for months and it's much
better than any of the prefab stands I had before.
Bend a piece of wire
I don't know where this wire came from: it was in my spare-metal-parts
collection. You want something a little thinner than coathanger wire,
so you can bend it relatively easily; "baling wire" or "rebar wire"
is probably about right.
Bend the tips around
Adjust the curve so it's big enough that your cellphone will fit in
the crook of the wires.
Bend the back end down, and spread the two halves apart
Adjust so it fits your phone
Coat the finished stand with rubberized coating (available at
your local hardware store in either dip or spray-on varieties)
so it won't slide around on tables and won't scratch anything.
The finished product is adjustable to any angle you need -- so you
can adjust it based on the lighting in any room -- and you can fold
the two halves together to make it easy to carry.
Tags: hardware, hack, maker
[
12:06 Aug 17, 2018
More hardware |
permalink to this entry |
]