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.
-
Faster SD writes with ESP32 and SDIO Better SD write performance is probably a common goal. My project uses the Adafruit SD Micro SDIO breakout, the Adafruit OV5640 Camera breakout and the Unexpected Maker ESP32S3 feather in a compact stack (with a custom PCB to connect them) that fits in a GoPro waterproof case. I want GoPro-like video recording but with BLE time synchronization and start/stop functions with multiple cameras. It's like a GoPro but it's not, it's a NoPro!
I'm programming with the Arduino IDE and using the SD_MMC library. The ESP32S3 has an SDIO interface with programmable pins, which the library supports. But for the longest time, I could only get sustainable write speeds of 150-200 kilobytes per second. I'm using a Sandisk Extreme V30 32GB which should get 30MB/s. For the frame rates and resolution I want, I need about 3MB/s.
I initially played with the file system buffer size but never got consistent results. I might occasionally get a few frames written at target speeds but never a whole video. So I set my code aside and started from scratch to explore how to get better speed.
There definitely seemed to be a dependence on file buffer size as well as on the size of data being written. So I tried lots of combinations and got the same results - usually about 150-200 kB/s but occasionally over 3MB/s.
But I had noticed a pattern of good performance when the write lengths were certain powers of 2 so I tried multiples of 512 bytes and got much better speeds. With a file buffer size of 4096 and data sizes over 75kB I could get consistent speed over 3MB/s, just what I need. 4096 also gets consistent small writes at over 1MB/s. Buffer sizes of 8192 and greater actually worked worse.
-
RGB Matrix Word Clocks I was looking for a clock that would tell the time in words rather than just hands (analog) or numbers (digital). I found a few for sale on places like Amazon and eBay, but none of those particularly stood out, so I decided to create a customizable one myself.
I designed and built two variants. Both use the same RGB matrix panel. Both use CircuitPython on the ESP32-S3, but one uses the Matrix Portal S3, and the other uses a standalone Feather ESP32-S3 with an Adafruit RGB Matrix Featherwing Kit. The Matrix Portal version requires no soldering; the Feather version requires some simple soldering. I will show both here.
The text is left justified, vertically centered on the display and each line is in a random color which changes every time the minute changes. Since you control the CircuitPython code, you can change this formatting any way you choose, e.g. same color lines, individually horizontally centered lines, etc.
Common Hardware
-
It's Koozie-licious! (3D Printing) If you have a lot of koozies and are looking for a custom way to store and access them, this koozie holder might just be for you.
My niece requested a koozie holder for her home so I designed and printed this for her. I've made it so it's configurable.
The text that you see in the photos is what is in the STL.
What can be configured?
- Height - You may want bigger or smaller!
- Width - current is for what I think of when I hear "koozie"
- Depth - see above
- Text
- Font
- Size
- Depth
- Spacing
- One side print or both
- You can also download the source code and change up anything about it
Details of this print
- 3D Printer: FlashForge Adventurer 4
- Filament: 3D Printlife Recycled PLA, color: Night
- Supports: Yes
- Nozzle temp: 220c
- Print bed temp: 55c
- Raft: No
- Ironing: Yes - This may be specific to the FlashForge slicer but it puts a smoother finish on the piece
- Total print time: ~57 hours
Where to get it
Photo shoot!
-
Space War - A game for the MagTag # Space War - Magtag
This started out as Star Trek in BASIC written by Mike Mayfield in 1972. It was completely text based, designed to run a teletype for input and output. As did any number of computer programmers at the time, I grabbed a copy and changed and enhanced it. Eventually renaming it to Space War so I didn't have to keep all the Star War references. I don't have any of the original listings. There very well may have never been a complete hardcopy listing. A listing at 10 characters per second on roll paper wasn't something you did often.Eventually, I converted a version to Fortran to run on an IBM mainframe on a CRT that had an addressable cursor. A while ago, I did find a listing of that version (data 1977). And I had an extra MagTag that I wanted to try doing something more interactive than display the weather, or motivational quotes. My first thoughts were that it should be pretty easy to port the Fortran over to Python.
I make no claims that this is a 'port', or 'conversion' of that Fortran program. That program was a convoluted mess of GOTOs and GOSUBs and clever Fortran hacks (and a serious lack of comments). About all I actually
saved were the instructions and the program flow.The MagTag is actually much more powerful than that GE265 or the IBM so I wasn't worried about the program size. There are two issues that I had to spend most of my time on.
1) There is no keyboard on the MagTag. Just 4 buttons. So "typing in" a command was out of the question. And if one button is used for "Next" and one for "Cancel" that meant only two left for commands.
2) The second issue was the eInk display. More specifically, the refresh rate is approximately 3 seconds between changes. So you really can't give feedback whena button is pressed. This was a real challenge when the commander needed to enter a four digit coordinate to warp to.
There are addon's that could easily attach to the Magtag to address these. But I wanted to be able to play it on a "stock" Magtag with no additional components.
And I added some comments.
I think it turned out pretty good. Though there are still some things left to implement.
https://github.com/vrtisworks/Space-War---Magtag
-
Desktop Multifunction Device: Clock Here is the first sketch: a simple clock.
This script provides a simple digital clock display on the Feather ESP32-S2 TFT. The time is updated every 0.1 seconds, and the display shows a circle and the current time in a specified font. Built on the Desk of Distress.
Next Steps:
Temperature and Humidity (ADT7410)
-
SPI on D10-13 using Metro RP2040 and 2.8" TFT Touch Shield v2 ( ADA# 1651 ) My current project requires an ST powerSTEP motor driver UNO R3 shield with the Adafruit Metro RP2040 requiring SPI on the normal D10-13 pins. I am also using the AdaFruit 2.8" TFT Touch Shield in the alternate configuration with SPI on D11-13. Getting these to work turned out a little painful, as SPI on D10-13 doesn't work out of the box. I had used the ST powerSTEP motor shield in other Arduino UNO projects, and was caught by surprise when it's D10-13 SPI didn't work with the Metro RP2040.
Required is a simple hardware hack to swap pins D10 and D13 on the UNO R3 connectors. I did this with some extra headers with D10 and D13 broken out and swapped with blue wires to the Metro RP2040 pins on the back of the board.
The Arduino board files for the Metro RP2040 required enabling SPI1 since D10-13 can not be used with SPI0 on the RP2040, and swapping the D10 and D13 pin configuration to match the hardware header hack.
in rp2040/3.6.2/variants/adafruit_metro/pins_arduino.h, set:
// SPI1
#define PIN_SPI1_MISO (12u)
#define PIN_SPI1_MOSI (11u)
#define PIN_SPI1_SCK (10u)
#define PIN_SPI1_SS (13u)#define SPI_HOWMANY (2u)
in rp2040/3.6.2/variants/generic/common.h, change:
static const uint8_t D10 = (13u); // swapped D10 and D13 at pin headers
static const uint8_t D13 = (10u); // swapped D10 and D13 at pin headersUsing TouchPaint to verify the SPI hardware and configuration hacks, required changing the initialization to SPI1.
Adafruit_ILI9341 tft = Adafruit_ILI9341(&SPI1, TFT_DC, TFT_CS)
I had rewritten TouchPaint to add calibration for the touch function, since the software defined touch values worked very poorly with my board. The touch points with a small X and Y didn't pick up, leaving a good sized unusable area in that corner, and along the all the edges. Lowering the touch pressure from 300 to 100 got the full screen area touch working, but there was a several mm mis-registration between the pen contact, and the drawn pixels. I also cleaned up static defines to use the calibration values, returned hardware values, and dynamic pallet size based on an array of pallet colors.
The debug serial prints for calibration need to be moved below the two calibration calls for debugging. i just moved them into a single ifdef.
-
Desktop Multifunction Device: Hardware Would you like to have a desktop clock, weather station, dice roller, timer, etc? This project describes a hardware solution you can use. It is based on a TFT Feather and a Feather Doubler board, with a Temperature and Motion Wing.
Equipment:
- ESP32 Feather with TFT display: There are several to choose from.
-
Temperature Motion Wing which includes:
- ADXL343 triple-axis accelerometer
- ADT7410 precision temperature sensor
- FeatherWing Doubler is the 'frame' of the device.
-
Female Headers for the Doubler:
- Use the black ones included in the pack OR
- Color Headers in your choice of colors.
- Use the black ones included in the pack OR
-
Sound Reactive Neopixel Brass Bell Cover I'm in a radical marching band called Brass Your Heart, and I wanted to make our instruments light up when we play them. I started this project by making one for my friend who plays a marching baritone. Below is a mostly step by step process for how I made them using: sewable neopixels, conductive thread, snaps, a Gemma M0, and an electret microphone.
Step One:
The diameter of the baritone measured 26 inches, so I used tailor's chalk to draw the outer circle you see here. Then I drew another circle, about an inch in for the lights, so that the neopixels and the conductive thread is far away from the metal of the instrument. I also make 8 markings where the neopixels would go and started to sew them into position with regular black thread.
-
No-Code "EnSmartening" an IKEA FÖRNUFTIG Air Purifier - V1 Reuse existing PCB+Dial This project was a personal desire to put Adafruit IO through it's paces, and see how far I could go in recreating a project designed for ESPHome + Home Assistant. Traditionally I would have assumed it was too complex for the Actions and Dashboard of Adafruit IO if I used a Wippersnapper device, instead relying on Node-RED to string things together, but now that I work on the WipperSnapper project I was curious how far it had come / could go.
The basic idea was to take a £60 "dumb" air purifier with a 3-speed dial (£70 with carbon filter) and add a WiFi micro-controller, so that it can be switched on and the speed controlled according to the values sent from a separate Air Quality sensor (Particulate Matter <2.5µm), and a user-adjustable control panel hosted as an Adafruit IO Dashboard.
Is this another silly idea / tribute to insanity, by needlessly bolting the internet and a subscription service to a device, which usually degrades performance and adds built-in obsolescence (not to mention a 22second boot-time)?
Well maybe, or maybe it's just a way of providing people with alternatives, but either way it involves Adafruit IO as an alternative to Home-Assistant / Node-RED or the official IKEA smart-hub + smart devices, and Adafruit's open-source IOT firmware called WipperSnapper as an alternative to ESPHome.
It's possible to use on the free-plan on Adafruit IO (you do NOT need IO+), or offline with a little coding, so I don't feel bad about suggesting it...
Here's a demo video of it in action: (Adafruit IO Dashboard on left, WipperSnapper device page on right, Speed dial of Air Purifier + Wind Sock on Picture-in-Picture video)
-
WipperSnapper Plant Grow Light My mom has two Christmas Cactus plants that have been doing really well for the past few months. However, with winter arriving she had been struggling to find a spot where they were getting enough light. I offered to build her a grow light using DotStar LEDs since they have a color temperature of 6000K, which these particular plants respond to. I decided to use WipperSnapper so that the lights could turn on and off on a schedule and it would be easy to troubleshoot remotely.
I designed up a wooden box in Fusion360. It was designed to be made with 1/2" plywood.
-
Raspberry Pi Stats Display The 3D printed insert can be found here: https://www.printables.com/model/710601-pi-5-official-case-active-cooler-insert-small-came
To get the display to show stats, first install blinka by following the guide here: https://learn.adafruit.com/circuitpython-on-raspberrypi-linux/installing-circuitpython-on-raspberry-pi
Assuming you created a python virtual environment in /home/pi/env path, run the following commands:
cd ~
source ./env/bin/activate
pip install adafruit-circuitpython-ssd1306
Now create your python file called stats_display.py in the /home/pi directory.
Please try running the command:
vcgencmd measure_clock arm
If your output does not start with frequency(0)= then you will need to change the line:
Freq = Freq.replace('frequency(0)=', '')
to match the start of your output in the code file above.
Now try to run the code by calling:
python ./stats_display.py
If the display is working, we can now run this as a service at start up.
-
RP2040 CW Keyer Adafruit Feather RP2040
Noel J Petit, WB0VGI
This project expands on a keyer developed in 2020 using a previous microcontroller and touch sensitive sensors. Keyers should have:
Touch pads for dash and dot
Push buttons for preprogrammed messages (CQ, RST, etc)
Rotary encoders to adjust keying rate
The Adafruit Feather RP2040 has interfaces and a library of code for all three of the above. The advantage of the Feather RP2040 controller over previous microcontrollers is that the 2040 has touch sensitive pins on the controller itself. This means that minimal external devices are needed as most of the control is provided by software. Touch pins were programmed to control dot and dash. Touch control lines need to sense detection over a given time and not sense multiple detection as the key is touched and removed. This “debouncing” is difficult to do in hardware, but the language we use, CircuitPython provides deboucing for touch panels and switches.
In early 2021, the Raspberry Pi Foundation introduced the RP2040 microcontroller chip. They produced a microcontroller board and Adafruit expanded on that board with a Feather Board. The Feather is specifically made to interface with external devices. Adafruit immediately expanded its library of CircuitPython functions for the Raspberry Pi Pico RP 2040. As a microcontroller, the RP 2040 is not meant to have a fully functional operating system with files and interfaces to things like keyboards and mice. The microcontroller is designed to run one program and interface with many different kinds of inputs and outputs (digital, analog, I2C, SPI, USB…).
Keyers provide services to CW operators for an easier life. Most modern transceivers include an internal electronic keyer that uses either the straight key or dual paddle key to key the transmitter. Timing of the dots and dashes depends on the operator (for the straight key) or the radio's internal keyer (for the paddles). In addition to character timing, some radios include the ability to store messages such as 'CQ CQ CQ DE WB0VGI'. My particular Yaesu FT-897’s include dual paddle dots and dashes timing but cannot store messages. Additionally, to change the keying speed, the Yaesu must stop sending, choose one of the menus, change the speed and then continue the CW conversation. I found this challenging and slow. Programmable keyers allow you to change CW speed while sending and to send preset messages with a touch of a button.
To perform these tasks, a microcontroller is needed. The computer is the Raspberry Pi Foundation’s Feather RP2040 -- a small computer built around a dual-core Arm Cortex-M0+ processor with 264KB internal RAM and support for up to 16MB of off-chip Flash. This is a 32-bit computer running at about 133 Mhz. This small computer is built to run small devices with a language called Circuit-Python (CP). CP is a subset of the python language to talk to and display many digital and analog data sources. Included on the RP2040 are pins that can be digital inputs or outputs (high or low voltage), some analog pins (converted to or from binary numbers).
Figure 1
The RP2040 Keyer uses these touch sensitive pads as inputs to key the transmitter with dots and dashes. An additional rotary encoder increases or decreases the CW sending speed. This means I can adjust the speed without having to stop conversing For touch sensors, all that is needed is a small piece of copper coated PC board glued to a metal plate (in this case another PC board) When touched, the output is a high logic value.
Figure 2
The Feather RP2040 Keyer is built in an aluminum Bud Box with the Feather computer on a small breadboard (this allows for changes as needed). The key sticks out the middle on a piece of copper two-sided circuit board soldered to a base piece of circuit board that fits in the top of the Bud Box. One circuit board for the base is 4” x 2 ¾” and bolted to the top of the Bud Box. The key extension is 4 ½” x 2” and soldered perpendicular to the base PC board. The key extension must be notched to fit the edge of the bud box. External capacitive touch pads are wired to the RP2040 with 28 gauge wire and message/speed selection via push button switches atop the Bud Box (see figure 2 and 3).
Capacitive touch keying takes some time to get used to. For the traditional paddle key, the paddles move back and forth and you feel the motion toward the dot or dash. For capacitive touch you must touch the surface to activate the key and remove you finger from the touch pad to stop the dot or dash. You do not get the sensation of moving the key and you must completely be off the touch pad to turn it off. I am still getting used to it. Capacitive touch pads in figure 2 are used as the dot and dash keys. Note that the Bud Box is not heavy enough to be a comfortable key. My MFJ dual paddle key weighs 2.5 pounds, but the Bud box and its circuitry only weighs about 10 ounces. The solution is use heavy washers or other weights in the removable U shaped bottom of the keyer. I have the box up to about 1.5 pounds and it is quite comfortable.
Figure 3
Your laptop/desktop programs the Feather with a simple editor called MU. The MU editor can, edit python files, check python files for correctness, load or store files onto the Feather , and monitor the output from the Feather. Normally the output appears as either interface pins (digitally on or off) or output is the result of program steps such as the python print() statement. Only one program runs on the Feather and it is called "code.py" but it can have many subprograms called from code.py. Once loaded onto the Feather, "code.py" runs and the results are seen on the serial screen of MU. Since the memory on the Feather is non-volatile flash, as long as the Feather has power it will run code.py but without power, the Feather remembers the program and restarts code.py upon power up. Figure 4 is the layout of the inside of the keyer. Beneath the power connector on the left is the Feather and its breadboard. To the right are two 1/8” sockets for keying the transmitters. A toggle switch between them selects the radio to be keyed.
Figure 4
The schematic is simple. The Feather receives power from the USB-C connector or an external supply of 5 volts. I chose both to use up some of the plug-in supplies in my collection. 220 uf and 0.01 uf capacitors filter the supply’s input. RF will get into the 5 Volt DC input so you may need ferrites or repositioning of the wires to prevent the Feather from chaos. Inputs are pins A2-A3 for the rotary encoder, D25 and D9 for the pre-programmed messages, D5 and SCL for the Dash and Dot. The output pin D11 lights an LED on key. Output pin D12 is goes low to key the transmitter. The circuit is wired with wire wrap 28 gauge wire. Cut pins from wire wrap sockets to use as wire wrap terminals on the breadboard. The SPDT switch on the output determines which radio is keyed. This avoids changing the mode of the radio when satellite up and down links are reversed.
Figure 5
A Feather starts life as a simple microcontroller that expects and executable file of type .UF2 as its operating system. You can download .UF2 files from the Adafruit site and see that the device works correctly. When plugged into a laptop/desktop the Feather appears as one of the disk drives on your PC. To do your own programming, load the latest version of Circuit-Python onto the Feather with just a drag and drop. Once loaded, the Feather expects a python program named code.py. The MU editor will load and store programs for the Feather from then on. All the details are available on the Adafruit learning pages.
Additionally, the Feather has many libraries for multiple devices. These libraries are available from Adafruit as a bundle of about 300 files. You will need some libraries listed in the “import’ statements at the beginning of the Python Code. Also, libraries from Adafruit provide interface to all sorts of things: temperature, magnetic field, displays, humidity, servo motors, LED’s, acceleration (which way is up?) and so on. Download the library .zip file and extract all of the libraries into a directory on your laptop/desktop. When you need a library, drag it from your laptop/desktop’s library to the “lib” folder on the Feather.
Before coding the keyer, you can program and test the Feather without connecting the Feather to any peripherals (how's that for cool?). Connect your laptop/desktop computer to the Feather through a USB to USB C adapter and watch the Feather light up. Follow the instructions for set up of the Feather at the Adafruit.com learning pages. This puts in Circuit-Python, downloads and starts the MU editor for you. Get sample python programs from Adafruit's pages as well. Sample code for the Feather Touch and Digital keyers are at links below. Be sure to change the names of the files to code.py to run them on the Feather . I keep the names descriptive on my PC but change them to code.py on the Feather.
A rotary encoder changes the CW speed up and down. The other two push buttons on top of the keyer provide preprogrammed messages. In my case, one is CQ and the other a standard 599 response. The dash and dot keys are inactive during the message.
Once programmed, the Feather can run with just a power supply connected on the Feather side of the box. It automatically starts the code.py program when powered up. 1/8" coaxial connectors on the keyer side connect to the key inputs of the radios.
The parts list has specific Digikey and Adafruit numbers. Everything except U1 – the Feather RP2040 can be substituted for whatever you have in the shop. Resistors, capacitors, and diodes of anywhere near these specifications will work just fine. Capacitive touch pads are made from cut pieces of copper printed circuit board. I found that smaller touch pads work best. The Dot and Dash pads are 5/8” x 3/8” to be very responsive. Keep the pads small as their percentage change in capacitance is more than a large pad when touched. This may require some experimentation.
References:
Adafruit.com Learning Page: https://learn.adafruit.com/adafruit-qt-py
Adafruit.com Products: https://www.adafruit.com/
Sample Program for RP2040 Touch: https://bit.ly/37aWhse
Sample Program for RP2040 Digital: https://bit.ly/373RZTp
Parts List
Chassis Bud CU-3006-A Digikey 377-1093-ND
Printed Circuit Board (10” x 8”) Digikey 182-1017-ND
Mini Breadboard Digikey 1471-1522-ND or Adafruit Product ID 4539
J1-J3 (1/8” jacks) Digikey 889-1821-ND
D1 Diode 1N4004 (any will do) Digikey 1N4004GOS-ND
C1 0.01 uf disc Digikey 1255PH-ND
C2 220 uf @ 6.3 VDC Electrolytic Digikey P829-ND
R1,2 100 ohm ½ watt Digikey 100H-ND
R3,4 10K ohm ½ watt Digikey 1MH-ND
S1,2 Push Button Digikey EG1930-ND
L1 Red LED Digikey L513HD
S1 SPDT Switch Digikey 2368-54-302PC-ND
U1 Feather RP2040 Adafruit Product ID 4884
X1 Rotary Encoder Adafruit Product ID 377
P1 5 VDC USB-C Supply Adafruit Product ID 4298
USB-A to USB-C cable Adafruit Product ID 4472
Figure Captions
Figure 1 – Adafruit Feather RP2040 microcontroller
Figure 2 – Adafruit Feather RP2040 Digital Keyer with push buttons for messages, rotary encoder for CW speed and external capacitive touch sensors for dots and dashes
Figure 3 – Adafruit Feather RP2040 Pin out diagram
Figure 4 – Adafruit Feather RP2040 mounted on Mini Breadboard inside the keyer
Figure 5 – Adafruit Feather RP2040 schematic
-
Building a LEGO Case for Your Projects The first step is to get BrickLink Studio 2.0. This CAD program is intuitive to use, includes almost all bricks available, and features to test your model strength, render 3D visuals of it, view what parts you use and even generate instructions on how to build your model. This is not a guide on how to use Studio 2.0, but it includes a built in tutorial that makes getting started a breeze.
John Park wrote an excellent guide Lego Set Lighting. I used this guide to light up the LEGO Christmas Tree (set #40573) making the candles flicker away. My problem was how do I hide the electronics running everything.
I had the idea to design and build a LEGO model in the shape of a present, but the question was how.
It turns out there is an easily accessible CAD program and method of ordering parts (maybe too easy!).
-
Microchip sample orders! Today I ordered some component samples from Microchip!
Many component companies offer free samples.
Microchip is very friendly for sample orders. Others like TI may request that you buy the parts.
I ordered a ATTINY84A-PU and a MCP2221A from Microchip.
Sample orders are for prototyping and are not to be resold.
In many cases, email domains like gmail.com and yahoo.com are not accepted.
You may get lucky though. :)
If you want, you can attempt to order component samples from Microchip at this link:
(Make sure you have the complete part number.)
https://www.microchipdirect.com/samples
Please don't abuse component samples. -
WaveBuilder: Construct a synthio Wave Table from a List of Oscillators A study to produce a CircuitPython helper library to construct a synthio.waveform wave table object from a list of fundamental and overtone frequencies, amplitudes, and wave shapes (sine, square, triangle, saw, noise).
The WaveBuilder class currently resides in its GitHub repository and can be found in the CircuitPython Community Bundle. The update utility circup can also be used to install cedargrove_wavebuilder.
The objective was simple. Create a realistic approximation of a wind chime sound. Use synthio to stack up a collection of sine wave Note objects starting with the fundamental frequency and mix in a few unique overtones, each with its appropriate volume level. Use the same ADSR envelope for all notes and voilà, we've got a pretty good chime sound. That worked nicely. Let's try to synthesize another voice.