![](/assets/playground/adafruit_playground_1200x900-699010177a4a3fd6bac6bc31deae0bfa3eb9ea777ba62aaa5cbc1225bb45bfcc.jpg)
Adafruit Playground is a wonderful place to share what you find interesting. Have a cool project you are working on? Have a bit of code that you think others will find useful? Want to show off your electronics workbench? You have come to the right place.
Adafruit Playground is a safe place to share with the wonderful Adafruit community of makers and doers.
Click here to learn more about Adafruit Playground and how to get started.
-
CircuitPython and ChatGPT Code Interpreter Overview
GPT Code Interpreter allows you to run your own code on a GPT server. It's great for trying out simple functions. Did you know that you can upload your own interpreter and have GPT run it? It takes some work, but you can have GPT write code and tests, then run them on an actual CircuitPython interpreter. Not all the features are there, and you don't have access to any real hardware. This is highly experimental at this point. Difficulty level: Advanced.
Equipment
- CircuitPython interpreter binary
ports/unix
x86-64. Follow the instructions for Building CircuitPython. You need to build with the same GLIBC as Code Interpreter which is currently 2.31. I was able to build it using Debian 11 (bullseye). - The interpreter is named 'micropython' but it is CircuitPython.
- ChatGPT+ account: Code Interpreter is a plus feature.
Instructions
Follow these instructions to start a chat with access to your CircuitPython interpreter.
commands
should be entered directly into the chat.- Start a new ChatGPT 4 session.
- Attach your CircuitPython interpreter 'micropython'. Click the 'paperclip' to upload it.
- Use this command:
Please make /mnt/data/micropython executable.
- Use this code to check that the interpreter is working:
import sys print("Version:", sys.version) print("Platform:", sys.platform)
- Flex some Python skills:
Use introspection to list the features in the <os> module
How it Works
The code interpreter is like a Jupyter Notebook that GPT controls. When you ask it to run some code it writes the script and executes it as a notebook 'cell'. It adds an icon that allows you to view the script and the output.
For the CircuitPython interpreter it will embed the CircuitPython code in the cell as a string, then use the shell to execute the CircuitPython interpreter with the embedded script and capture the output. It can then interpret the output or return it to you directly.
It's pretty code-inceptiony and may take a while to figure out. Be sure to click on the icons to view the code and output for each 'cell'.
Observations
I'm still in awe that it even works. You will have to use some prompting to make sure it is running the interpreter and not just calculating the responses in some other way. It can use introspection to figure out which features are available and which are not present.
This is still very experimental at this point!
Conclusions
Building a CircuitPython interpreter that can run within GPT is an interesting and at times mind-bending exercise.
Code Interpreter could be a useful tool for testing different builds or even different versions of the CircuitPython core.
Future Work
- Figure out how to add library packages to Code Interpreter.
- Implement some hardware-in-software modules (fake temperature and humidity sensor, fake I2C and SPI peripherals, fake
board
with a few pins etc.) - Make the interaction traceable so we know if the interpreter is used or not.
- Wrap it in a GPT application.
- Figure out how to call it via the GPT API.
- CircuitPython interpreter binary
-
CB Microphone for your PC - Breaker Breaker any takers? Part one : Where's the mic?
"Breaker breaker , any takers? This is the the one and only Delchi hunting for bear on I-95 South , keeping that double nickel and keeping the sunny side up & the greasy side down! We gone!" 1
I was looking for some new gaming frontiers when I came across truck simulators! All the skill & thrill of a big rig from your PC. As with all simulators there are button boxes and realistic cockpits to buy, but one thing I didn't see was a CB radio mic! They expect us to use desktop mics, headsets or some other hoo-haw instead of the ol jabberjaw microphone! A little deeper digging showed that you can buy adapters, but they ranged from $180 to $300! ( Granted the $300 one is an awesome button box and has a lot of realistic controls along with the mCB mic.)
Well the first thing I did was say "Belgium" to that, and pulled Rolling Thunder across the room to my workbench and got to work. This was going to be a project that would work with Truck simulators, sub simulators and more! Grab that soldering iron, the wire clippers and that drill over there! It's time to start making!
Notes :
1. CB radio jargon was around long before IRC , and was its own language designed to obfuscate communication and have a grand ol time. "Handles" were common, and yes CB radio handles are where the hacking community got the term handles for hacker aliases!
Translation? Why not ?
- "Breaker breaker , any takers?"
- In cb radio ( less formal than ham radio ) it was common to ask permission before talking on an open channel. Calling for a "break" was like requesting permission to chime in , and was normally answered with "Go ahead breaker"
- "This is the the one and only Delchi"
- Handles were a point of pride and very often unique, but when they did collide they politely adjusted to be like "The New Orleans Joker " vs "The Chicago Joker" and so on.
- "hunting for bear on I-95 South"
- Truckers took great lengths to avoid being caught by the police in speed traps. "Smokey Bear" referred to the Smokey The Bear hat most often worn by police patrolling the interstates. If you were hunting for bear that meant you were on the lookout for police, and sometimes were asking for a "Smokey report" if anyone had seen any police. You usually followed this with the interstate you were on and the direction you were traveling and sometimes the mile marker you had passed most recently.
- "keeping that double nickel"
- This referred to the speed limit of 55 miles per hour that was enforced back then. Sadly there is no clever phrase for the 65 mph speed limit.
- "keeping the sunny side up & the greasy side down!"
- Multiple meanings here, but for the most part this meant keeping your truck upright ( sunny side was the cabin, greasy side was the road ). It was like wishing someone safe travels and no accidents.
- "We gone!"
- When a conversation ended people would signal this with a number of phrases like "we gone" , or "On the side". Sometimes it also included the "10-code" messages such as "10-10 Till I see you again"
Related Links :
- Truck Simulator
- Button Box
- 10- Code & other jargon
- "Breaker breaker , any takers?"
-
Retro blinkenlights: driving 4 charlieplex LED matrices I recently released another retrocomputer miniature that incorporates a handful of Adafruit boards so I thought that I'd share the details here.
The original Connection Machines were built in the late 80s and early 90s to provide a few thousand hyper-connected processors which at the time was rather unique. If you're interested, here's a wikipedia page about them.
My Patreon supporters vote for which miniatures I make and I was pretty happy when the Connection Machine was chosen. I was also happy to find that Adafruit sells pretty much exactly what I needed to make the blinking light panels:
Assembly requires me to solder the four matrix driver boards to the four LED matrix boards and then plugging in the Stemma QT cables between the QT Py and a chain of the driver boards.
Then I assemble these printed parts. The little C shaped parts on the lower left of this photo are what hold the two-board sandwich of the LED maxtrix board and the driver board.
Then I install CircuitPython on the QT Py and then load it with my code from Codeberg. There you'll find the default blinkenlights script but also a script that uses the network to fetch the time and then turn the Connection Machine into a clock. It took a bit of work to figure it all out so hopefully the code will be a handy starting point for similar projects.
Once everything is assembled I box it up and put it on my gumroad store.
I post pretty much every day about what I'm working on over on Mastodon at @[email protected] and for maker-y types of conversations I like that place much more than the other social media sites. Maybe I'll see you there!
-
When Black and White QRCodes don't work: Qualia Touch Example Dual QRCodes for Wifi + WebWorkflow A quick and dirty example of something I wanted for my devices, allowing inexperienced users to setup the device themselves, and once setup they can also remotely modify the code / download data.
Also always be sure which network it's on, the IP address, and have a handy way to jump on the same network.I plan to have this run on bootup for 10seconds before the main program runs (depending on network need etc). I may also alternate between this and the sensor data screens. Long term they'd all be pages/tiles in lvgl.
The main reason for this note, was the observation that Black and White QRcodes are too bright for my phone to read, and I had to change both colours to reduce the contrast as theoretically the brightness is already at 25mA minimum.
I pondered on less blue being the most effective, as it's almost treated like white by the phone. I settled on these colours that look incredibly dark rendered as HTML, while on screen look like mid-toned blue with strong backlight and black dotted coding QRcodes, but on camera look almost white and black and work much more reliably.
qr_color=
0x121212
(HTML #121212)qr_bg_color==
0x0000aa
(html#0000AA
) -
Hello Pi: Finding the IP Address of Headless Raspberry Pis (and Other Devices) The Problem:
A frequent problem I have when creating a new Raspberry Pi-based project is determining the IP address of the device. I am often working with Pi projects in a "headless" (no monitor) configuration using SSH to log in from a PC on the same LAN network. But to log in this way, I need the Pi's IP address, which sets up a chicken-and-egg problem that goes like this:
I want to connect (SSH) to a headless Raspberry Pi, but before I can do so, I first need to attach a monitor and keyboard to it to login locally and get its IP address (with 'ifconfig').
This is the very thing I would like to avoid since the system will ultimately be "headless". In truth, while it is only a minor inconvenience, it is one I'd like to do without. The more new RPi systems that you set up, the more tedious it is to pull out a monitor and keyboard to find the IP address of each one before you can begin remotely connecting to it over the LAN using SSH.
-
Sound for Qualia RGB666 I heard that you can do I2S audio with the Qualia RGB666 board, but I didn't find any instructions. Well, now you won't have the same problem. Let's get this thing beeping! This is a Dexter Starboard project, with assistance from ProtoEngineer
-
CircuitPython Animated GIFs on a Matrix Portal Playing animated GIFs was added to CircuitPython in early 2023 and I had successfully had them running on TFT displays and even to a monitor via HDMI. I recently setup my MatrixPortal and two 64x32 matrices that I had been using to show animated GIFs. But the MatrixPortal was running Arduino code.
Time for an update and to take the code from Using Animated GIF Files in CircuitPython and Creating Projects with-the CircuitPython MatrixPortal Library and smush them together to play animated GIFs on a MatrixPortal with CircuitPython. Both guides do a great job of explaining the details of their own area and the code here combines them both.
The first half of the code sets up the matrix on
DisplayIO
and the second half usesOnDiskGif
from thegifio
module to display the animated GIF.The code displays all GIFs found in the /gifs/ directory on the MatrixPortal. Each animated GIF will display for 30 seconds before moving to the next animation.
-
Symbols for synthio Objects In the process of learning to use CircuitPython synthio, it was a challenge to understand the myriad of possible connections between modules. As a result, project design notes and sketches became a rat's nest of entangled symbols and wiring. Although simple single-voice designs without filters or LFOs were easy to deploy and document, it became clear that there was more to discover inside the extensive versatility of synthio.
Perhaps a set of symbols with consistent notation (and color-coded arrows, of course) would be useful to further learn about synthio and to develop project conceptual diagrams.
Here's the beginning of some symbols for synthio objects with class properties and methods together with data types. Essential tools such as audiomixer and audiobusio are also included.
-
Using Android with CircuitPython Recently there was a PR merged into CircuitPython that allows for the mounting of a CIRCUITPY drive on an Android device. Previously this was not possible, so I wanted to try it out. For my testing, I used a Samsung Galaxy A13 phone running Android version 13. The board I used was a Circuit Playground Express running CircuitPython 9.0.0-alpha.4.
-
Extending the Talking HAL-9000, literally and figuratively Overview
I love this make of HAL-9000 from the Ruiz Bros:
-
ESP32-S3 MQTT Feather Weather This has been my main project since 2019 which started on the Adafruit Bluefruit Sense microcontroller with Arduino. I eventually ported it to Circuit Python... and I've never used Arduino since. There are many different versions of this project on my github that are either offline only, offline with GPS, offline & online, offline & online with MQTT.
The project I'm detailing today is offline & online with MQTT to AdafruitIO. This means if for whatever reason your WiFi goes down, OpenWeatherMap.org servers go down, or AdafruitIO goes down it will still display local sensor data and function in an offline capacity waiting patiently until communication is restored.
The display sits in front of my PC monitor and has been running 24/7 for about 3 years now. I've had a lot of time to debug all of the things that might cause it to crash, error, and gracefully fail in a never ending loop. It's not perfect but it's solidly coded.
-
Accurately Calculating Coordinated Mars Time with CircuitPython I'm currently working on a clock using a Qualia S3 board with a 4" 720x720 round display. The idea is to display an "analog" clock face on it. The clock will show your timezone on Earth and coordinated Mars time (MTC). In looking into MTC, I found the Mars24 Sunclock, which is a piece of desktop software from NASA that shows your local time, UTC time and then MTC.
-
Ultimate Omnifixo Pinecil Travel Case After watching this Tested video on YouTube showing of the Omnifixo helping hands, I decided to pick one up. I have found it incredibly useful when soldering small electronics. After a bit of use I decided to 3d print the case recommended in the video, but wasn't happy with it. I looked around for other designs, and found some better options, but still not exactly what I was looking for. So, decided to design my own.
With the included Pinecil soldering iron, solder, and brass sponge, this design carries everything I need to solder on-the-go.
-
BNo055 Sensor Calibration, User Position Orientation, and Tap Detection Overview
This page of notes was used to develop BNo055 9-DoF sensor algorithms for the PowerWash project and discusses three essential characteristics of the sensor.
First, the relative and absolute calibration of the sensor can be performed to improve initial sensor stability and positioning. Stand-alone sensor calibrator code is shown and was submitted to the sensor's CircuitPython driver library's examples folder. The sensor calibration procedure is not well described in existing documentation, so an update to the BNo055 ReadTheDocs page and the primary Learning Guide would be beneficial.
Next we'll talk about how to measure and adjust for user position orientation without changing the sensor's absolute position calibration.
Finally, since tap detection is not native to the BNo055 chip, an example of how to detect single and double-taps with the accelerometer component of the sensor is described.
Since the PowerWash project also included a Nunchuck controller, a brief discussion of tap detection for its slightly less-sensitive accelerometer is included.
-
A small snap-fit case for a QT Py/NeoPixel driver BFF combo Motivation
Currently I have around 18 WLED controller devices deployed around my apartment, most of them built using a NeoPixel Driver BFF and either the QT Py ESP32 Pico or the QT Py ESP32-C3 (currently the only QT Py boards I've been able to get to work with the standard WLED web firmware installer). The BFF series of boards is designed to be soldered back-to-back with the QT Py, but I often find it challenging to design mounting geometry on 3D printed cases for this configuration. To help fit my specific needs a little better, I decided to manually wire the boards together and build a snap-fit case to hold them. I borrowed the idea (and some of the geometry) for the snap-fit from the QT Py Snap Fit Case learn guide.
Any QT Py board can be used with this design, and you don't even *necessarily* have to use it for a lighting project. I've even used this case/configuration as a small driver for an IOT Relay using an ESP32-S2 QT Py from the signal and ground pins of the JST connector of the NeoPixel driver BFF (be aware though that this signal is shifted to 5V!).