Not long ago the old JamBox sitting in one of my office display case’s caught my eye.
After picking it up I noticed it used an ESP32 development board, so I had to flash it for ESPHome. I downloaded the PixelOperator8 font and uploaded it to my esphome/fonts folder in Home Assistant. Then I figured out the following YAML to get the buttons, potentiometers (knobs), and LED Matrix working.
After installing the YAML and installing the device to Home Assistant, here are the sensors in the device UI.
Screenshot
The device has a ton of inputs with the eight buttons and five knobs and the 8×32 LED Matrix can display text or maybe a simple graph. I haven’t thought of a good use for it though. Do you have any ideas?
ESP32 G -> CAN Board G -> RJ45 Pin 8 -> Capacitor stripe side
ESP32 3.3 -> CAN Board 3.3 -> Capacitor non-stripe side
ESP32 Pin 4 -> CAN Board TX
ESP32 Pin 5 -> CAN Board RX
CAN Board CANH -> RJ45 Pin 5
CAN Board CANL -> RJ45 Pin 4
Start with this YAML for your ESPHome device:
# Add your standard esphome, ota, api, and wifi sections here at the top
logger:
level: DEBUG
esp32:
board: esp32-c3-devkitm-1
framework:
type: esp-idf
canbus:
- platform: esp32_can
id: can
tx_pin: GPIO4
rx_pin: GPIO5
bit_rate: 125KBPS
can_id: 0x05
use_extended_id: false
on_frame:
- can_id: 0x000
can_id_mask: 0x000 # This catches EVERYTHING
then:
- lambda: |-
std::string res = "";
for (int i = 0; i < x.size(); i++) {
char buf[5];
sprintf(buf, "%02X ", x[i]);
res += buf;
}
ESP_LOGD("ALORAIR_FINDER", "Received ID: 0x%03X, Data: %s", can_id, res.c_str());
# ====== Periodic Polling to Request Status ======
interval:
- interval: 10s
then:
- canbus.send:
can_id: 0x123
use_extended_id: false
data: [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
This will test sending and receiving. After you flash the device and have it connected to the dehumidifier, open the ESPHome device log and look for lines like below.
If you see errors after the send or don’t receive messages back, try changing the bit_rate from 125 to 50, install, and recheck the logs.
If you do receive messages back, make note of the value after Received ID, which is 0x123 above. Then open up the ESPHome device’s YAML again and replace everything below type: esp-idf with the following.
If your ID was different than 0x123 (0x3b0 seems common), change the can_id under on_frame. Update mobile_app_YOUR_PHONE for your phone. Install this new code to the device. Go to Settings -> Devices & services -> ESPHome. If your device isn’t already listed, add it, and click through to see the entities. Hopefully you see the Controls and Sensors with data.
Try to toggle the power and change the setpoint. If it’s working, the dehumidifier should respond. Good luck! If all is working, I suggest adjusting your logging level to WARN. There is some stuff in the YAML to alert if the unit sends data that isn’t recognized, because there might be flags or statuses not implemented.
If you install the stack-in-card via HACS, here’s some YAML for your dashboard. Make sure to update the entity names to match what you have.
When we attended the Lions Thanksgiving game in 2024, we got these wristbands.
You’ve probably wore one at a game or concert or at least seen them on TV. When everyone at a venue wears one, they create cool lighting effects. They were still flashing when we got home that night and I took a video.
I’ve always wondered how they work. A few weeks ago I found them in a box and dove in. They’re made by a Canadian company called PixMob.
Inside the plastic case is a small circuit board powered by a couple of CR2032 coin cell batteries.
Some models work via Infrared (IR) and others by Radio Frequency (RF). Almost every remote control you’ve ever had uses either IR or RF. This board actually says RF on one of the battery contact points. After putting in new batteries I found RF captures on GitHub and used my Flipper Zero to broadcast the RF signals.
Pretty neat. I doubt I’ll ever do anything with them, but now I know how they work.’
One of our daily tasks is to clean out the cat litter boxes and we (on maybe I just wanted an excuse to automate part of the process!) run in to a couple of small problems:
We usually don’t know if the other has already cleaned them.
We obviously don’t want to forget.
Since I primarily took over this job, I’ve been using a daily reminder, but it’s on my iPhone nagging me all day, even though it’s set for noon. I only need a reminder when it doesn’t get done.
I thought of a solution with an ESPHome based device and Home Assistant. I used a WEMOS D1 Mini Lite, WEMOS OLED Shield, button, red LED, green LED, and 220 Ohm resistors. I connected everything on a breadboard for testing and then made it more permanent.
Key functionality:
During the day, the green LED will be lit if the litter boxes have been cleaned and the red LED if they need to be cleaned. If we’re walking by, green means keep going and red means stop here.
At night (8pm to 8am), the LEDs are off, unless the device is woken up.
Press the button to turn on the display and status LED if at night. The display shows the last time the litter was cleaned in one of three formats, depending on how long it’s been.
Today 1:23 PM
Yesterday 2:48 PM
2 days ago 11:00 AM
Press the button when the display is on to update the litter box last cleaned date and time. The LEDs flash to signify something is happening. The new date and time gets shown on the display.
After 30 seconds the display turns off.
At 4pm send a reminder to our phones if the litter boxes need to be cleaned.
In Home Assistant a toggle can disable the reminders. Useful when we’re on vacation.
I also added a couple of simpler helpers via Settings -> Devices & services -> Helpers:
Cat Litter Last Cleaned – Date and time
Cat Litter Reminders – Toggle
Finally, I added cards to a Home Assistant dashboard. See screenshots of the different states of each card below.
Here’s the dashboard YAML if you want it.
type: horizontal-stack
title: Cat Litter
cards:
- type: custom:mushroom-template-card
primary: >-
{% set last = states('input_datetime.cat_litter_last_cleaned') |
as_datetime %}
{% if last is none %}
Unknown State
{% else %}
{% set diff = (now().date() - last.date()).days %}
{% if diff == 0 %}
Cleaned Today
{% else %}
Needs Cleaning
{% endif %}
{% endif %}
icon: mdi:emoticon-poop
features_position: bottom
secondary: >-
{% set last = states('input_datetime.cat_litter_last_cleaned') |
as_datetime %}
{% if last is none %}
???
{% else %}
{% set diff = (now().date() - last.date()).days %}
{% if diff > 0 %}
{{ last.strftime('%b %-d') }} -
{% endif %}
{{ last.strftime('%-I:%M %p') }}
{% endif %}
color: |-
{% if is_state('binary_sensor.litter_needs_cleaning', 'on') %}
red
{% else %}
green
{% endif %}
tap_action:
action: more-info
icon_tap_action:
action: perform-action
perform_action: script.cat_litter_cleaned
target: {}
confirmation:
text: Are you sure you want to update the last cleaned date/time to now?
entity: input_datetime.cat_litter_last_cleaned
- type: custom:mushroom-entity-card
entity: input_boolean.cat_litter_reminders
name: Reminders
tap_action:
action: toggle
hold_action:
action: more-info
icon_color: amber
If we get a reminder, it looks like this. We can click I did it to update the date/time to now if we forgot to press the button on the physical device. With the automation set to run at 4pm, we should rarely see this though.
The final device lives right next to the waste bag dispenser I made. This way it’s easy to see the state and hit the button when cleaning out the litter. Here are photos in place with a few different states.
This project was so fun. Using Google Gemini for stuff like this makes it so much faster. I’ve had some of these microcontrollers and other parts for almost a decade so it’s nice to finally put them to use.
What other features or automations would you add to this? Have you built anything similar?
I picked up a 5m strip of adressable LEDs for my PyPortal device. The strip has 60 LEDs/m, which is double the density of the Neopixel strip I fried. To prevent future accidents, I tested improvements. Adding a 1,000 µF electrolytic capacitor protects the LEDs from a power spike and a 470Ω resister protects the first LED from data ringing.
Everything worked great, so I cut off a section of 62 LEDs. Then I worked on a little board and better wiring.
I didn’t trim the protoboard, so I could use the two holes to screw it to the undersize of my desk. This LED strip had an adhesive backing, which worked much better than the clips. I did a bit of cable management and also mounted the air quality monitor under the desk.
The code, which can be found on GitHub, got a bunch of small improvements:
Updated the LED count
Limited brightness to 50%, which is plenty and helps with power draw
Adjusted the pulse functionality to account for the brightness limit
Added a button to the interface which can be used to clear the LEDs
When filling a color, reset the LED params global, so an animation won’t play on the next loop
Tweaked the chase functionality to work better with the new LED density
Changed the button success animation so the loop continues sooner
I had Google Gemini help me some stuff. First was to update the PyPortal firmware and CircuitPython version. Then update the code to make it compatible with CircuitPython 10.03. I also made an interface for my dashboard where I can select the different commands and options to send to the device manually instead of typing them in through Developer Tools -> Actions in Home Assistant.
Here’s a new demo video, so you can see how it works and what the lighting looks like.
Of course, the real power still comes from automations, where something happening around the house triggers Home Assistant to send commands to the device. Time to work on more of those. Almost a year later and this project is finally where I hoped it would end up.
I’ll likely turn this into something that interfaces with my Home Assistant server to control different devices around my house.
The PyPortal has been sitting on a shelf ever since. Way back in February, it caught my eye, and I picked it up, not remembering what it’s capabilities were. Then I started upgrading IKEA air quality monitors and even made my own. Since I’m at the desk in my office a large portion of the week I thought I would make that 2019 prediction come true.
I could show a bunch of data on the screen and the PyPortal has a touchscreen, so I could display buttons for triggering things around the house. The device also has connectors for doing GPIO, so I got the idea of adding an LED strip, which I could use for notifications. I even had a meter long strip of Adafruit Mini Skinny NeoPixels I had bought in 2017 and never touched that would be perfect. I needed to buy a 2.0mm JST PH Connector kit in order to make a wire that would connect to the pack of the PyPortal. I ended up using a piece of Cat6 cable, even though I only needed 3 of the 8 wires inside.
All of this was done back in March. I quickly began having issues with the ethernet cable and the small JST connectors, so I put this post on pause. Figured it was time to finally fix this before the end of the year. While testing, I determined the LED strip got fried up at some point. It was probably some kind of short from the janky wire.
Here’s what my display looks like.
My favorite aspect of the project and code is being able to publish MQTT messages from Home Assistant, which the PyPortal listens for and reacts to. I can send various commands, such as fill:blue, which turns all of the LEDs blue, or whatever color I set. I have commands to chase a color from one side to the other, bounce a color from left to right and back to the left, pulse the entire strip, animate a rainbow, or set the brightness. Since I don’t have another strip of Neopixels, in order to create a demo video, I wired up a 24 LED circle. You’ll have to imagine the effects on the back of my desk, lighting up the wall.
I can manually send these MQTT messages as shown in the demo, but the real power comes from automations. For example, the LEDs automatically pulse blue when the washing machine is done and pink when the dryer is done.
With the different effects and color combinations, the possibilities are endless. What kind of automations would you run?
Over the years, I’ve seen many versions of a shop air filter, made from box fans and 20×20 inch furnace filters. A few years ago I picked up some old box fans on Facebook Marketplace and bought a pack of filters from Sam’s Club. They’ve been stacked in the corner.
It was finally time to build my air filter. I removed the back covers, feet, handles, and knobs from the fans. I got my first look at the switches inside, which are nearly identical.
I’d easily be able to wire the fans together, so I removed the switches and power cords.
I put together a frame from OSB, cut slots to feed the wires through, and screwed the box fans in.
Then I grabbed wood that had been salvaged from a pallet to construct a door.
On the back side, I used glue and brad nails to attach plywood rails. I also made tabs to hold the filters secure.
I attached the door with a couple hinges and made some notched tabs to hold the door shut.
A plastic screw container was a good side, so I used hot glue to secure the boards and then wired up all of the fan connections.
I’m not sure if I’ll ever use the button, but it allows me to cycle between the three speeds and turn it off. The three LEDs show which speed is currently running. The only thing I got wrong was reversing the low and high speeds, which was a quick fix in the ESPHome code. Speaking of the code, here’s mine.
I used Google Gemini to help and it had a great suggestion to track the run time and add a maintenance reminder when it was time to replace the filters.
In Home Assistant I created some automations. My dust collector uses a smart plug, so when it draws electricity, the air filter automatically turns on at high speed. When the dust collector turns off, the air filter continues to run for 15 minutes before turning off. If I had to remember to turn on the air filter all the time, it would rarely happen, so this is amazing.
I’m still on lifting restrictions for several weeks so Brandi helped me install the air filter on the ceiling.
In our basement we have a baby gate, which surprisingly keeps our cat out of the gym and golf sim areas.
Sometimes we forget to close the gate, so I needed a sensor to monitor its state. I still had the breadboard from the air quality monitor project, so it was quick to add a magnetic door switch and test things out with the D1 Mini clone.
I have extra sensors, so those were kept in the project and allowed me to get rid of the shitty DHT22 I added to the golf remote. Everything worked, but I want to save my last two D1 minis and use them for something with the screens I have for them. So I swapped in an Adafruit Feather HUZZAH ESP8266, which I got with AdaBox 3 or 4 in 2017 and made minor changes to the code.
I figured I might as well use one of the fancy Adafruit Perma-Proto boards I had, which makes soldering all of the connections much easier. As a bonus it was nearly a perfect fit for the case.
The magnetic switch and Si7021 will live outside the box, so those couldn’t get soldered yet. After connecting power I checked the ESPHome logs to make sure everything was working.
I cut holes in a project box, finished soldering, and used hot glue to secure the board..
I reversed the swing of the gate, placed my device, and attached the two sides of the magnetic switch to the gate.
In Home Assistant an automation runs whenever the stairs light is turned off to check the state of the gate. If it’s open, a notification is sent to our phones.
I’m enjoying these little electronics projects, and it feels good to finally put various parts to use.
I’ve had this Rigid shop vacuum, from Home Depot, for about 20 years.
At some point in the last year, the switch started having issues. The vacuum would only turn on if the switch was actually pressed in, instead of toggled. I’ve never seen that happen, but I’m guessing it was from the accumulation of dirt and dust getting inside the switch body. Then the switch wouldn’t even push in, so the vacuum wouldn’t run.
I figured it would be an easy switch replacement, so I removed a bunch of screws to take off the cover. Sure enough, the switch had two wires clipped on to it, and was held in place by the case.
I had a perfect replacement, salvaged from some device I don’t remember, in my collection of electronics parts.
It fit like a glove and the vacuum turned on as if it was brand new. I screwed the case back together and called it done.
The upgraded IKEA air quality monitors I did work great, but the LED indication isn’t great for a bedroom and the fan noise was annoying in my office. So I wanted to create a couple of my own devices for those locations. I used:
The SEN50 is a big upgrade over the PM sensors used in the IKEA devices and I used the Si7021 in place of the BME280 I had used because I think they’re a bit better. I soldered 47µF electrolytic capacitors from a big kit I’ve had (similar on Amazon) to the ENS150 modules to improve their power.
Then I attached 5 of the crimped wires to a 6P JST connector, which is what the SEN50 modules require. I’m note sure why buying the actual cable for these SEN50s are so expensive, but I got the entire JST kit for cheaper than a couple of the special cables.
All three sensors communicate with the microcontroller over I²C, so a breadboard test was easy to wire up. The SEN50 does require 5 volts instead of 3.3, so I’m glad I checked.
The ESPHome YAML code is very similar to the code used for the modified IKEA air quality monitors.
The project boxes had some standoffs on the bottom, which I snipped off and then sanded with a rotary tool. I pulled out my box of proto boards and found a size almost exactly double what I needed, so I cut out a sliver and ended up with a piece for each box. I also cut vent holes for the SEN50 sensors.
In order to get everything to fit I decided to put the microcontroller on the bottom of the board. After mocking things up I did all of the soldering. I was hoping to be able to mount everything with connectors so it could easily be taken apart, but there wasn’t enough room and I didn’t want bigger boxes.
I did some continuity testing along the way and everything worked when I connected power. With the boards ready I cut more access and ventilation holes in the boxes.
I soldered the Si7021 on to its wires outside of the enclosure so it wouldn’t be exposed to unnecessary heat and used hot gun to secure everything.
I’m really happy with how these turned out. Here’s a view of the office data on my Home Assistant dashboard.
This was definitely a project where I wished I had a 3D printer to design custom boxes. Some day, when I’m caught up on my project list and can give it proper attention. I know if I get one now I’ll spend a ton of time with it and neglect other projects in my pipeline.