Getting Started

Adafruit Playground is a wonderful and safe place to share your interests with Adafruit's vibrant community of makers and doers. 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.
The goal of Adafruit Playground is to make it as simple as possible to share your work. On the Adafruit Playground users can create Notes. A note is a single-page space where you can document your topic using Adafruit's easy-to-use editor. Notes are like Guides on the Adafruit Learning System but guides are high-fidelity content curated and maintained by Adafuit. Notes are whatever you want them to be. Have fun and be kind.
Click here to learn more about Adafruit Playground and how to get started.
-
A PyDOS Handheld I was looking to try out my new Adafruit Feather RP2350 and I remembered I had the Solder Party Keyboard Featherwing.
The Keyboard Featherwing is a handy device: it is about the same size as a BlackBerry phone with the same alphanumeric keyboard and a 2.6" 320x240 color display. Plug in a Feather board as the "brains" and you have a portable system.
Alas, one has to program the Feather, preferably with CircuitPython, to use the keyboard, display, and other features. Solder Party has example code snippets for those features. But what about something more holistic, more like a computer with input and output?
I found two solutions that were perfect: PyDOS and Beryllium OS. Both are built on top of CircuitPython.
PyDOS emulates MS-DOS commands used on PC compatible computers. And Beryllium OS, formerly ljinux, acts as a Linux-like computer. Neither are binary compatible (they cannot run native DOS or Linux binaries) but their commands and interactions emulate those operating systems.
This Playground Note will show you how I built my PyDOS handheld in short order.
There are two videos, one from Adafruit Show and Tell and another for Tom's Hardware The PiCast.
Preparing the Feather
Solder male pin headers onto the Feather RP2350. You could use long pin stacking headers to add a FeatherWing, but that would create quite a stack on the back.
See this guide page for soldering details:
-
Pumpkins vs Skeletons Game for CircuitPython This is a game about skeletons, pumpkins, and a catapult having a Spooky experience under the full moon. If you've thought about making a game in CircuitPython but aren't sure where to start, this project might be a useful source of ideas.
Charging a Pumpkin
This is how it looks when you hold the USB gamepad's A button to charge up a pumpkin.
-
Keyboard Featherwing Messenger powered by LVGL Several years ago Solder Party released the Keyboard Featherwing, a PCB that combines a Blackberry keyboard, a 320x240 TFT resistive touchscreen display, a 5-input DPAD, 4 tactile buttons, a microSD card reader, and more, all driven by an Adafruit Feather board of your choice. Eventually these were discontinued, I'm assuming because of the difficulty of sourcing the increasingly rare Blackberry keyboards. I didn't know what I wanted to do with them at the time, but I knew I was gonna want to do something with them at some point, so I ordered several of them before the stock was depleted.
One popular use for the Keyboard Featherwing has been to pair them with LoRa radio transceivers, to create a set of "Doomsday Messengers". These are devices that are able to send short text messages to each other using radio signals, sort of like walkie-talkies, but for text messaging. This makes sense: with the tactile keyboard, huge display, and instant compatibility with the Feather ecosystem (including the ability to use rechargable LiPo batteries), the Keyboard Featherwing practically seems designed for the use case!
I hacked together a quick demo a few years ago allowing for very basic communication between the devices, and then promptly lost interest. I wanted to write firmware that allowed for robust, reliable communication between the devices, but I also wanted something offering some of the affordances of a modern smartphone UI. If you've ever worked on UI for microcontrollers, you probably realize there are a lot of challenges. One of those challenges can be figuring out how to write a custom, complex UI with just the basic drawing functions provided by the commonly available drawing libraries. While possible, it can be really cumbersome once you start to want more modern UI features, such as widgets, scrolling, animation, multi-screen interfaces, and so on. Another challenge is implementing all of that in a performant way, given the limited speed and memory of most microcontrollers. At the time, I wasn't sure how I was to accomplish this without pulling my out my hair, so the project was put on the back burner.
Recently I decided to dig these up and give it another shot. I still wasn't sure exactly how I was going to do it, but I did have a concrete feature set in mind:
- The ability to send encrypted, reliable messages between two paired devices using LoRa technology
- The ability to pair each device with any other device using the same hardware and firmware, via a settings screen (i.e., no re-compilation needed to pair devices)
- The ability to modify and persist device settings and a small message history across power cycles
- Granular battery monitoring; specifically the ability to see the percentage of battery life remaining at any given time
- Heavy focus on physical controls, using the touchscreen to supplement the UI only where practical and/or necessary (if you aren't familiar with any of my previous projects, I'm a huge fan of physical controls)
Which Feather?
-
E-Ink Countdown in CircuitPython with Custom Stand Along the way I learned a few things:
- How to take an Adafruit PCB design in Eagle format and import the board outline all the way into FreeCAD for locating dimensions and features
- How to make my code robust against transient errors like network errors
- How to make my code deep sleep for the right length of time
There are also a few things this code demonstrates that are less common knowledge:
- Using fonts from the font bundle
- Using the datetime module for arithmetic on dates & times
- Increasing reliability by re-trying operations that can fail
- Reducing battery usage by deep sleeping and avoiding connecting to WiFi
This project uses FreeCAD & KiCAD, both of which are Open Source software that are free to download & use.
Parts Needed
Code & Installation
I recommend using Adafruit circup to install the needed libraries for projects. Here's what you need to do:
- Install circup on your desktop computer
- Enable the "fonts bundle" by running this command (just once, circup remembers this setting):
circup bundle-add adafruit/circuitpython-fonts
- Copy code.py to your CIRCUITPY drive (Download it via the "raw" link at https://gist.github.com/jepler/b2c020a6caa65a31297053b7216fcc15)
- Run the following command to auto-install required libraries:
circup install -a
You'll also want to configure wifi on your device using settings.toml. For lower power usage, configure WIFI_SSID and WIFI_PASSWORD options. For web workflow but higher power usage, configure CIRCUITPY_WIFI_SSID and CIRCUITPY_WIFI_PASSWORD options.
-
Create a Looping Apple Shortcut for Sending Data to itsaSnap Recently I've been experimenting with Apple Shortcuts to interface with the new itsaSnap app. This app lets you interface with Adafruit IO feeds on your phone. With Apple Shortcuts, you can get data from your phone to Adafruit IO. You can, for example, send health data, weather data, even encoded photos.
One topic that comes up in Apple Shortcuts is not being able to easily create an automated Shortcut that loops. For example, having data be sent every 30 minutes. There is a time automation, but you have to setup an automation instance for every time you need the Shortcut to run.
I wanted to figure out a way to do this and found a helpful post on the Apple Shortcuts subreddit that describes using alarms as a workaround. I normally avoid Reddit but that particular subreddit has had very helpful posts with folks sharing their Shortcuts and tips for folks to accomplish what they're looking for.
Flow Chart
I've adapted the suggested Shortcut from the subreddit post a bit. I've found that wrapping my head around the logic can be a little tricky, so here is a visual explainer before we get into building out the Shortcuts.
-
Feather TFT Clock with Gamepad Input This clock project uses USB gamepad input to control its time setting menu. The display uses TileGrid sprites that I made in Krita. The code demonstrates how to use timers and a state machine to build an event loop with gamepad input, I2C real time clock IO, and display updates.
Overview and Context
This clock is a step along the way on my quest towards learning how to build little games and apps in CircuitPython. The look for the display theme is about digital watches and alarm clocks from the 80's and 90's.
Some of the technical bits and pieces from this project that you might be able to reuse in your own projects include:
Menu system for manually setting time and date
USB gamepad input system with edge-triggered button press events and repeating timer-triggered button hold events
Data-watch style display theme with three display areas: 20 ASCII characters at the top, an eight digit 7-segment clock display in the middle, and another 20 ASCII character display at the bottom
Main event loop with gamepad button polling, real time clock polling, state machine updates and display updates
-
Orrery: Put a solar system in your pocket! For hundreds of years, the clockwork orrery has been a way to demonstrate the movement of planets around the sun - as Wikipedia describes them: "An orrery is a mechanical model of the Solar System that illustrates or predicts the relative positions and motions of the planets and moons, usually according to the heliocentric model. "
It occurred to me that, the circular display of ten neopixels on the Circuit Playground might be a way to make a different kind of orrery... so I did. My programs are in this repository and consist of three programs:
-
orrery.js - Javascript/Makecode version for the Circuit Playground (https://makecode.com/_EHeh61h4Dcvo for the Makecode IDE version)
-
orrery.py - Circuit Python version for the Circuit Playground (copy to code.py on the device)
-
neo-orrery.py - Circuit Python version for the NeoTrinkey - again, copy to code.py on the device (you didn't think I'd leave the NeoTrinkey out did you?)
I opted to just do Mercury, Venus, Earth and Mars - adding more planets was too cluttered, plus the relative speeds of the inner planets are easier to see.
All versions start by showing Mercury (pale white), Venus (yellow), Earth (green) and Mars (red) as neo pixels moving at their relative speeds around the sun - from Mercury the fastest to Mars the slowest.
Each can switch to a random setting, changing the color and speeds of the four planets.
Makecode version: "A" stops/starts motion, "B" sets up a random solar system, and "Shake" resets to defaults.
Circuit Python Playground version: "B" sets up a random solar system and "A" resets to defaults
Circuit Python NeoTrinkey version: Touch pad #2 to get a random solar system and pad #1 to reset to defaults
NOTE:
The mechanics of the simulation are simple. Each program has a loop that increments a counter for each "planet." There is a table of periods for each planet, an integer that is 100 times the length of the planet year, so, for example, Mercury's period is 22 and Earth's is 100. When a planet's counter reaches the value of its period, the counter is cleared and the planet's position is advanced one position.
A small orrery showing Earth and the inner planets -
-
LED Pixel Mapping with WLED and LEDLabs Hello, my name is Erin St Blaine and I love making things that light up.
When I'm not writing tutorials for the Adafruit Learning System, I spend my time creating beautiful things, and exploring the meeting of art and technology whenever I get the chance. Over the last several years I've been focusing on creating larger scale LED artwork, home decor and chandeliers. I started out using Arduino with FastLED and learned to code the hard way, but nowadays there are so many software packages out there that I've been learning and exploring them. This article is about my experience of LED mapping my newest chandelier commission using WLED, PixelBlaze and LEDLabs.
What is Pixel Mapping?
Pixel mapping is a technique used to control and program individual LEDs or pixels within a lighting display, allowing each light to be addressed and manipulated independently. By mapping out the exact location of each pixel in a 2D or 3D space, artists and designers can create intricate patterns, animations, and effects that synchronize with the physical layout of the lights. This method is essential for creating dynamic, visually stunning displays, as it enables precise control over color, intensity, and timing across complex setups like LED walls, chandeliers, and sculptures.
A pixel map is needed when the LED layout is not precisely rectangular. Basically, a pixel map forces a non-rectangular shape into a rectangle that can be divided into rows and columns so the animations lay out correctly in the physical space.
My first foray into pixel mapping was making an LED Festival Coat using WLED. This was a fairly straightforward map -- the layout was generally rectangular, with just a few "holes" in the rectangle to account for -- I needed the map to fill in the arm hole areas so that my animations would look even across the whole coat. I used WLED for this, and found it to be a little mind-bending and tricky even with a simple map.
After the success of that project I decided to give mapping my chandelier a try. The chandelier is shaped like a hot-air balloon with eight spokes and no rectangles at all. This looked to be a challenge but I knew the end result could be absolutely stunning if I succeeded.
-
The Highway 12 Band SFX Machine Deadline: We need it tonight
We have just eight hours until our classic rock band rehearsal session tonight, and we need some pre-recorded sound effects for three songs. The required sound effects (SFX) playback machine should be super easy to use, powered by a battery, and have a stereo output for the band’s PA system. Sound quality is important, but since the sound effect recordings aren’t actual music, we can be flexible with the bit rate to save space on the storage.
The band retired six years ago and, at the time, it didn’t seem like there would be a reunion tour. So, I stripped the old sound effects machine (the FXM-8 shown above) for parts and gave it a new life. The old unit used a special SFX board (Adafruit #2220) with .ogg sound files stored on-board. It worked and sounded good, but it was a pain to update the files. The simple and obvious FXM-8 tactile interface was also pretty cool in hindsight.
And of course, the band’s plans changed. They asked us to come out of retirement and play one more gig.
So, we’re going to need a new SFX machine.
-
Using a Motorola Atrix Dock with a Raspberry Pi Computer 2024 Version Rock an Old Atrix Screen/Keyboard/Trackpad Dock Like It's 2012
Back in 2012, folks were getting their first Raspberry Pi single board computers. They initially used a monitor or television, a USB keyboard and a USB mouse, most often items they might of had around the house. This worked fine but it was far from portable. Folks wanted something a bit more laptop-like to develop on the go.
Enter surplus Motorola gear. Motorola made the Atrix line of cell/mobile phones they marketed as dual use as portable phone and computer. To make it a computer, you used a dock which looked like a laptop but had no processor, only USB and HDMI connections. Such docks were being sold wholesale at $60 each.
Folks used a combination of Far Eastern cables and adapters to connect the micro connections on the dock to the full size connectors on the Pi. As you can see below, two adapters and three cables were used. Some guides talked about splicing cables. Here is one guide from Instructables.
The setup worked faily well. Most often the adapters to the Atrix were too big, so some filing of the plastic was needed to get the cables to go on without interferring with each other. It was a slick setup but it could be fragile.
Over time, most folks moved on from using this solution as the Atrix dock supply dried up and new Pi models came along.
The 2024 Atrix Solution
I got my Atrix Dock out to use with a Pi 5 for Adafruit's Show and Tell. Things had changed since the Pi 1 when now using a Pi 5. The one full size HDMI connector is now a pairt of microHDMI connectors. There are more USB ports on the Pi 5.
I wanted a solution with no adapters and no trimming of the plug housings. I went on to Amazon (US) and through brute force (Amazon search is not the most robust) found the following cables:
-
Air Quality Monitor for the Feather RP2040 Remixing the guide from the Ruiz brothers: https://learn.adafruit.com/aqi-case/overview and retrofitting it for the Feather RP2040 & the Adafruit FeatherWing OLED - 128x32 OLED Add-on For Feather
The OLED is quite limited in colors & the Feather RP2040 has a single LED available. Given these constraints this is what I was able to achieve.
All the text on the third row are my own interpretations of the values of each of the categories. Here's an example of how I assigned a text value to the data around the PM2.5 data.
def rate_pm25(pm25_data): if pm25_data <= 12: pm25_color = green pm25_extra = "OK" elif pm25_data <= 35: pm25_color = yellow pm25_extra = "MID" else: pm25_color = red pm25_extra = "BAD" return pm25_color, pm25_extra
-
Sparkle Specs firmware for Adafruit LED Glasses driver Do you have a pair of Adafruit LED Glasses? Have you noticed there is a ton of cool examples and starter projects out there for them? Have you ever wished you didn't have to juggle installing different projects in order to use each one? Do you want to use a Wii Nunchuck for wireless game-like controls? Would you like to also be able to use the Adafruit Bluefruit Connect app to do things like change colors or other settings? Did you ever wish those settings would be saved, even when you turn the glasses off? Do you wish you could install it by simply dragging and dropping a file?
Motivation/Goals
I wrote a bare-bones demo a few years ago using the Wii Nunchuck to control an adaptation of the classic Adafruit roboface project, played with it for a few minutes, and then promptly forgot about it. I recently rememberedI had the glasses kit, and with Halloween around the corner I thought it would be fun to wear them this year, sporting a more robust firmware than my original demo.
I wanted to have a small suite of different modes available to use, and be able to control them wirelessly. The first part of the project was building a small adapter I could use to allow my Nunchuck to pair and communicate with my glasses using Bluetooth Low Energy. With that complete, it was time to write the firmware for the glasses. I wanted the firmware to have the following features:
- It should have the ability to pair with the BLE nunchuck adapter and use the nunchuck for wireless control
- It should have the ability to connect to the Adafruit Bluefruit Connect app to change colors and other settings
- The glasses should still work well even without some form of wireless control
- It should have modes that take advantage of the built-in accelerometer and microphone on the glasses driver board
- It should have an application/firmware architecture that makes it simple to add new modes in the future.
- Optionally, it should have the ability to connect an EEPROM breakout to the remaining Stemma QT port on the other side of the glasses to save changed settings, even when the glasses are powered off.
-
NeoTrinkey RRPN Calculator (The extra "R" is for "Ridiculous") It is NOT true that I lay awake at night thinking of odd things to do with the NeoTrinkey*....
That said, here's a project I've been thinking about for a while - making an RPN calculator (well more of an adding machine) with the NeoTrinkey.
The project code is here and consists of two CircuitPython modules, babbage.py (renamed to code.py when in use) and a helper module, ncount.py.
One of the great features of the NeoTrinkey is the four neopixels - they provide a very flexible output display. Considering the range of colors you could present with the neopixels, you could easily represent any number from 0 to 999 (assuming ten colors). For this project, we're sticking to binary and using the ncount.py function binnum(color, number) - it will display the values from 0-15, using the neopixels:
Given a number, binnum(color,num) will display the binary value from 0-15 (for zero all pixels are set to faint white; otherwise the pixels are set to color for the value of num.).
So... how to use this for a calculator?
I defined an array to be a stack, then set four states for the calculator: wait, enter, add, subtract, and pop.
To toggle between states, one touches the#1 pad. When you do you'll see the current state appear (and clear) with the color "gold.":
-
Feather TFT Gamepad Tester with Sprites This demonstrates a visual USB gamepad tester using using an Adafruit USB Host FeatherWing, an ESP32-S3 TFT Feather, and sprites created in Krita.
Video Demo
-
Super Basic RGB Matrix Driver Example The other day I decided to level up my understanding of how these popular "HUB75" style RGB LED matrices work. So I sat down with the intent to write the most basic bit bang example I could come up with. Here I share the resulting code, written in CircuitPython.
There are plenty of Google discoverable write ups on these that go into lots more detail, discussing the shift registers, scan lines, etc. It's worth reading a few of those first. We found these to be useful:
- Everything You Didn't Want to Know About RGB Matrix Panels - A good write up with some nice animations by Nick Poole at Sparkfun who needed to also understand how these work to modify an Arduino library for an unsupported panel type.
- RGB LED Panel Driver Tutorial - read the "Theory of Operation" section.
- Driving a 64*64 RGB LED panel with an FPGA - read everything up to "Driving the matrix".
There's also a brief description in the Adafruit Learn System here:
These discussions can quickly get a bit complex, since there are a lot of pieces that work together in concert. However, there are a lot of things that are redundant. For example, how each red/green/blue LED is controlled is the same. Also, the matrices are typically split into upper and lower halves, but each is updated in the same way - R1/G1/B1 for the upper half, R2/G2/B2 for the lower half. So to keep things as simple as possible, this example does the following:
- Only use a single color
- Only work with the upper half of the matrix
This greatly reduces the total number of pins needed. It also really helps focus on the basic way in which data is moved into the matrices. By using just the upper half, the R2, G2, B2 pins can be left unused. And by focusing on just one color, we can use any one of R1, G1, or B1.
A Feather RP2040 was used with the following pin connections (Feather to Matrix):
- 13 to R1 (or G1 or B1 - your choice!)
- SCK to CLK
- MOSI to LAT
- MISO to OE
- A0 to A
- A1 to B
- A2 to C
- A3 to D
- GND to GND
There's nothing special about these pin choices - any digital pins could be used.
The matrix used was an Adafruit 32x32 4mm pitch panel (PID 607).