Skip to content

Blog

The CircuitPython Show Year One

As 2022 comes to a close and I look back at the first year of The CircuitPython Show, I just wanted to say thank you.

Thanks to everyone who listened to the podcast, was a guest, or left a review. The support I received was phenomenal - thank you!

After wrapping up season 2 a few weeks ago, the show will return in 2023.

Next CircuitPython Projects Up

I couldn’t resist the recent holiday sales and I bought a few parts for my next two CircuitPython projects.

First up, is re-creating my Pi-Dial project using CircuitPython on a microcontroller instead of a Raspberry Pi and Python. This project controls Zone 2 of my home theater receiver, which is my home office.

Parts used include: * ESP32-S3 microcontroller (because it has WiFI and I already had a couple on hand) * 4 key NeoKey (used to change the inputs, such as CD, Phono, or Tuner and mute) * 1 Rotary encoder (to change the volume) * 1 2ā€ TFT screen

I already had a prototype working with the NeoKey and rotary encoder using the ESP32-S3. CircuitPython can send serial commands to my Denon receiver and I can do all of the functions I need, including changing the volume, inputs, and muting or unmuting the receiver.

For an enclosure, I’m going to use repurpose the WalkMP3rson project from Adafruit and 3D print a retro Walkman style player. I’ll need to modify it to permanently add the USB-C cable for power as it won’t be battery operated.

The biggest thing I have to learn is displayio. I don’t have any experience using displays in CircuitPython, but I’m excited because the WalkMP3rson project has a bunch of code I’ll be able to re-use.

Work in progress on the breadboard

My second project will be an IoT sensor to detect when I’m running low on water softener salt. I purchased a Time of Flight sensor that can measure the distance and connects to an ESP32-S2 Feather. It will then report back via MQTT the current measurement. I’m already running Home Assistant and I’ll set it up to report the measurement daily to my dashboard. I’ve used MQTT in one other project, but I’ve never integrated with Home Assistant. The biggest challenge so far is finding a 3D printed case that can hold both the Feather and a battery.

Those should keep me busy for a while. At least over holiday break!

Introducing The Bootloader

Having just passed the six month anniversary of The CircuitPython Show, I’ve decided to start a new podcast!

Introducing The Bootloader.

I’m teaming up with Tod Kurt and together we’re going to bring you a few interesting things we found around the web. We’ll each share up to three things, each one for a few minutes, but no more than five. That should keep the show right around a half hour, which is optimal.

The three things can be almost anything. It could be a news item, we could share a project we came across or following, we might highlight a maker and their work, or we could talk about a product we love (or hate). It could be news, it could be something older that’s new to us. Hopefully you’ll find it interesting, too.

You can subscribe to the podcast on all major platforms or via RSS (we'll be on Google Podcasts soon, but just add the RSS to your podcast app), follow us on Twitter, watch us on Youtube, or visit our website.

Give us a listen and watch the trailer here!

Six Months of The CircuitPythonShow

Today marks six months since the first episode of The CircuitPython Show dropped.

(Of course I haven’t blogged much about the show since then…)

I’m not even sure where to start. I think the show has found its groove now. From the feedback I’ve received, people seem to like the shorter interview format rather than the longer interviews the first few episodes featured.

It’s been pretty cool having the opportunity to meet and chat with community members on the show. I hope that comes through in the episodes as the big goal for the show is to highlight those in the community and get to know them in a different way than just their CircuitPython contributions.

In other news, I switched podcast hosts last week and went all in on Zencastr, which I already used for recording. This coming Monday’s episode will be the first episode distributed by them, so cross your fingers.

Thank you to everyone who has listened, told a friend, or guested on the show. I especially appreciate the comments and feedback about the show, keep ā€˜em coming! And don't forget to subscribe in your favorite podcast app...

SilverSaucer completed!

Just like that, I crossed the finish line and SilverSaucer.com is finished. I wasn’t planning on finishing it so quick after my blog post, but on Friday it just clicked and the ā€œOn this dayā€ feature was completed in just a few hours.

I always thought the ā€œOn this Dayā€ feature was a pipe dream. I had no idea how I was going to tie a Discogs release to MusicBrainz and then import that date. But after discovering the discodos app a few weeks ago and working with the database having clicked last week, I was able to finish it up after discovering a key feature: the LIKE operator in SQL and SQLAlchemy.

``` today = pendulum.today(tz="America/Chicago") print("Today: ", today, today.month, today.day)

if today.month < 10: search = "0" + str(today.month) + "-" + str(today.day) else: search = str(today.month) + "-" + str(today.day)

async with db_session.create_async_session() as session: query = ( select(Album) .filter(Album.mb_release_date.like(ā€œ%ā€ + search)) .order_by(Album.mb_release_date) ) print(query)

results = await session.execute(query)
query_results = results.scalars()

The Pendulum library comes to the rescue again as it is still my favorite way to work with datetime objects.

This returns a list of rows from the database where the results are today’s date, not including the year. (There is one bug related to 6/18 I can’t track down where it displays a different result - but not both - when an order_by is added to the query).

I’m pretty happy with how everything has turned out. I’ll probably do a couple more blog posts about the project, including reviewing the project goals.

It feels weird to be done. Not necessarily elation, not relief, just weird.

June 2022 SilverSaucer Update

As usual, I haven’t blogged my progress on SilverSaucer and I’ve had some major progress since January.

First, I did follow-up on that blog post by switching from a MatrixPortal with a 64x64 LED to a PyPortal Titano.

Liz Phair's self titled album displayed on a PyPortal

In FastAPI, I did two things. I added a service that uses the Pillow library to convert the image from the Discogs image URL to a small bitmap that the PyPortal can use.

The second thing is that sends a message using the MQTT protocol. The PyPortal is watching for that message, and when received displays the Bitmap like above.

async def get_discogs_image(release_image_url):
    image_dl = requests.get(release_image_url, stream=True).raw
    download = Image.open(image_dl)
    download.save('static/img/album-art/image_600.jpg')

    img = Image.open('static/img/album-art/image_600.jpg')
    img.quantize(colors=16, method=2)
    smol_img = img.resize((320, 320))
    convert = smol_img.convert(mode="P", palette=Image.WEB)
    convert.save('static/img/album-art/image_300.bmp')


async def publish_image(image_url):
    client = mqtt.Client()
    client.username_pw_set(config.mqtt_user, config.mqtt_pw)
    client.connect("mqtt.silversaucer.com", 1883)
    client.publish("albumart", "Ping!")
    client.disconnect()

That was a pretty big breakthrough to get hardware working with the website back in April or May.

I then spent early last week playing with a command-line tool called discotools. I help with a little of the documentation in the python3-discogs-client library and one of the co-maintainers wrote discodos for DJs to catalog their collection. It also has the ability to match Discogs Release ID to MusicBrainz ID and using it I was able to get about half (or 400) of my MusicBrainz IDs assigned into the database. (Which is a different story about doing unnatural things with tables).

Then in the last week or so, everything has started to come together. Last week I was struggling with understanding the different kind of objects database queries could return. I was having a hard time understanding and differentiating between scalar, scalars, one_or_none, and lists. That finally clicked and in a couple of days I had re-written the random results page to mostly use the database and the page load time went from about 10 seconds down to about 2 seconds, a huge improvement. After the initial database import, which takes forever as Discogs rate limits you to one request per second, the play-album page uses the database for all information except the genres and tracklist, which are still called using the Discogs API. It turns out that the Discogs API is very slow when querying an object in your personal collection. If you do a general query on a public release object, it’s way faster. The combination of those two things led to the speed improvement.

From there I was able to quickly re-factor the play-single method to match the play-album, so I can randomly return an EP or single to play. Understanding the database query, I also added a list result to the admin page showing a list of all releases that don’t have an associated MusicBrainz ID. Last night in just hours I created the template with form and the get and post methods to manually enter the ID and store it in the database.

I also wrote a method that for the existing database entries that have the MusicBrainz ID, to query the MusicBrainz API and get the release date for that album. It worked, but the dates the API has stored include the year, year and month, and year, month and date, which is what I really want. But just like that, over half the work to build the ā€œOn this Dayā€ feature has been done and I just need to manipulate the dates above to get the one I want.

The finish line is in site.

March 2022 Update

I’ve been hip deep in podcast related stuff for the last two months, but with the first two episodes out I can come up for air.

I don’t know what good looks like yet, but I’m happy with the reception the show has received. The YouTube comments have been nice (what?!) and I’ve received some compliments here and there.

I did build a complete website for FastAPI in that time. It was useful to go through the Talk Python training again and it helped me gain a (slightly) better grasp of asyncio. All the code to manage the episodes (add, edit, and view) is my code. I still need to get a better handle on SQLAlchemy and how and what type the results are returned as, but it’s working. I’m sure I missed some type hints, too, and I’m really enjoying working with those, though I need some better discipline.

All season one episodes are now recorded and edited and will be released over the next four weeks. Season 2 is in the planning stage and I’ve invited all the guests, and we’ll start recording in just a couple of weeks. I’m enjoying meeting folks from the community, it definitely gets me out of comfort zone and I’m learning a ton.

And don't forget to subscribe to the show - add this RSS feed to your app in your favorite podcast app.

The CircuitPython Show Progress

I’m about ten days away from the first episode of The CircuitPython Show dropping. Saying I’m a nervous wreck right now might be an understatement.

Five of the six episodes have been recorded and sent off to the sound engineering to make them sound good. (I’m using the same sound engineer as Talk Python to Me, how about that for a referral?!). I’ve received one of the episodes back and it sounds good. I shared it with my best friend, who agreed, and he’s not even in to CircuitPython and microcontrollers. Paying for sound production is worth it to level the audio and remove all those ā€œUmmsā€ and pauses is worth every penny.

I’ll be posting each episode on YouTube and I’m doing the editing for that. In other words, it will be a much more of a rough cut on YouTube and I recommend listening to the show as a podcast.

I’ve already learned a lot in just a few episodes. This TedX talk sums it well: ā€œShut up and get out of the wayā€. I just need to let the guests talk and I need to remove the extra words. The other big thing I need to work on is the ending, it’s… a little abrupt, let’s just say.

I would say every episode has gone really well. The guests have been engaging and the conversation has just flowed.

The website is pretty much done. I can edit the episode details, show notes, and transcripts and store them all in a database. I can edit them, but still having some issues with how it updates the edits. I’ve built the site using FastAPI and the Talk Python training course. I went to Talk Python’s office hours last week, which helped me a ton, and I may need to visit one more time to get this last thing done.

There’s no hurry to getting some of the features up as it’s all behind the scenes stuff, but it would be nice to cross that off the list.

The only other big chunks of work are going through each episode to create the show notes and check the transcripts and also to create and edit the videos for each episode to put up on YouTube. And no, I’m still not used to the sound of my own voice.

What, you haven't subscribed to the show yet in your favorite podcast app? Just add this RSS feed to your app and you'll be ready when the first episode drops in just over a week..

The Podcast Has Been Submitted

CircuitPython Show on PocketCasts

I mentioned in my blog post introducing the podcast that I had a lot to do to get the podcast ready. I may have underestimated the amount of work, but progress is being made! The podcast was submitted to all of the major podcast networks today, including PocketCasts (my personal player of choice), Google, Apple Podcasts, and everywhere you'd expect to listen to a show. If you want to add the show manually to your podcast player, here is the link.

This is the thirty second teaser trailer that shares some of the guests who will joining me in Season 1 of the show.

The biggest way to help the show right now is to subscribe to the link or search for the show in your favorite podast player (when it appears), and if you like what you hear after the show debuts, please consider writing a review.

More to come soon!

Silver Saucer Progress (January 2022)

When I’m not doing something podcast related, I’m still trying to find time to code.

With the football games in the background, I was able to build off my last post, which would convert an image to Bitmap if I had it.

I made sure I had it today. Using the requests library, I implemented the ability to go get the photo and pass it to Pillow to conversion. The process looks like this:

  1. Request image URL location from Discogs via the authenticated API
  2. Get the request object and write it to disk
  3. Use the object to pass it to Pillow, which converts and saves it.

It was easier than I expected. I have two things to do:

  1. Only download the image if I’m the one logged in
  2. I was only to save it in the default directory, I need to store the the images in the static directory.

I’m not 100% sure the project is going to work. Technically, it will work. But I should really be about 12 feet away from the LED matrix to see the display in the right light. Currently I’m about three feet away and it doesn’t look the best. Looking around my home office, there isn’t a great place put it. I also need to learn how to take better pictures of LEDs.

Those two things plus wiring up MQTT equals done. Getting close now. The pictures look much better in person.

Sugar's Copper Blue album artwork displayed on a 64 by 64 matrix

Sugar's Copper Blue album standing up  next to itself displayed on a 64 by 64 matrix