• Skip to main content
  • Shop
  • Learn
  • Blog
  • Forums
  • IO
  • LIVE!
  • AdaBox
Adafruit Logo
0
  • Sign In | Create Account
  • Playground
  • Shop
  • Learn
  • Blog
  • Forums
  • IO
  • LIVE!
  • AdaBox
Sign In
0
Adafruit Logo
  • Learn Categories
    • 3D Printing
    • AdaBox
    • Adafruit Products
    • Arduino Compatibles
    • Breakout Boards
    • Circuit Playground
    • CircuitPython
    • CLUE
    • Community Support
    • Components
    • Crickit
    • Customer & Partner Projects
    • Development Boards
    • Educators
    • EL Wire/Tape/Panel
    • Feather
    • Gaming
    • Hacks
    • Internet of Things - IOT
    • LCDs & Displays
    • LEDs
    • Machine Learning
    • MakeCode
    • Maker Business
    • micro:bit
    • Microcontrollers
    • Programming
    • Raspberry Pi
    • Robotics & CNC
    • Sensors
    • STEMMA
    • Tools
    • Trellis
    • Wearables
    Explore, Groups to get your gears turning
    Explore
    Groups to get your gears turning
    Explore Groups
  • New Guides
  • Playground
squid_jpg Notes
Image for user squid_jpg

squid_jpg

u/squid_jpg
Badges
9

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.

  • Pinned by squid_jpg
    Image for user squid_jpg
    By squid_jpg

    Guide: Zapper Lights/Sound mod

    If you grew up with a Nintendo Entertainment System, you probably remember playing games like Duck Hunt that used the Nintendo Zapper "light gun". The Zapper used a clever technique that depended on the game being displayed on a Cathode Ray Tube, or CRT television. These days, CRTs are rare, and are often prized collectors items among retro gaming enthusiasts. Since these Zappers don't work on modern TVs, most people don't have much use for them anymore. So, why not convert it into a toy/prop that lights up and plays sounds?

    Overview

    This project uses a Prop-Maker Feather RP2040 to repurpose the the Zapper's iconic shell and clicky trigger mechanism into a prop/toy that uses a NeoPixel for a "muzzle flash", a speaker to play sound effects, and 3D printed parts to contain the electronics. The code is written in CircuitPython, and sounds can be changed or added by dragging and dropping files with no code changes required!

    hero.jpeg
    Save
  • Image for user squid_jpg
    By squid_jpg

    Universal BLE Remote with Keyboard Featherwing

    Overview

    One of the coolest things about Solder Party's Keyboard Featherwing is its versatility. While it offers a fully-featured hardware package all on its own, the ability to pair it with any Feather board allows it to be extended to do pretty incredible things. In this project, I'm pairing it with a Feather nRF52840 Express to create a universal Bluetooth Low Energy (BLE) keyboard/mouse/remote control, programmed in CircuitPython.

    Using the nRF52840, CircuitPython has the ability to send BLE keyboard, mouse, and consumer control HID events to control a host device, such as a computer. This firmware combines the ability to send all 3 event types from a single device in an easily configurable way, adding another layer of versatility!

    Some possible applications:

    • Control a laptop connected to a TV remotely, with physical keyboard and full mouse support
    • Control an Apple TV, including navigation. Use a physical keyboard when searching!
    • Remotely trigger the camera shutter on iPhone/iPad
    • Use the 9 programmable buttons to make a BLE "macro pad"
    • Practically anything that could benefit from a BLE keyboard, mouse, and/or consumer control remote

    Another nice thing about the nRF52840 for this application is its excellent energy efficiency. When using a 2000mAh LiPo battery, I've been able to get between 70-80 hours of active use on a single charge! The Keyboard Featherwing's built-in on/off switch allows extending the battery life even further.

    Firmware Features

    • Compact physical keyboard makes it easy to type wirelessly on device like laptops/desktops, Raspberry Pis, or anything else that can connect to BLE keyboards.
    • Touch screen behaves as a trackpad/mouse when connected to a host device that supports pointer devices.
    • 4 activity presets, selectable through an on-screen preferences menu. Further configuration is possible by connecting device to a computer via USB and editing the configuration files in the user directory.
      • Each activity allows you to customize the 4 function buttons and the 5-way direction button (D-BUTTON) to send keyboard, consumer control, and mouse button events
    • Adjustable display/keyboard/NeoPixel brightness
    • Adjustable primary user interface color
    • Power-saving feature: auto-dim keyboard, screen, and NeoPixel after 30 seconds of inactivity, significantly increasing battery life.
    • Battery voltage monitoring and "needs charge" indicator.
    hero.jpeg
    Save
  • Image for user squid_jpg
    By squid_jpg

    Guide: Build a WiFi Matrix Keypad Remote

    Circuit Diagram

    The diagram below provides a general visual reference for wiring of the components once you get to the Assembly page. This diagram was created using the software package Fritzing. Note that we will be using all available GPIO pads on the QT Py, so there will be a good bit of soldering involved.

    Overview

    Modern electronics are capable of incredible things. Even the simplest gadgets now have clocks, gyroscopes, radios, GPS, touch screens, literally anything you can imagine, built right in. Sometimes though, the devices that are capable of doing several things don't do all of them particularly well. Touch screens are often bolted onto things that really don't benefit from them, or even worse, detract from the experience. Anyone who has accidentally grazed the touch panel on an Apple TV remote while grasping for it in the dark knows exactly what I'm talking about. Sometimes I just want to have a remote with a few simple buttons I can press to make things happen, and that's it!

    Most of the lights in my apartment are WiFi-connected, and offer MQTT capability. I took advantage of this and set up a local MQTT broker (https://mosquitto.org/) on a Raspberry Pi 4 wired to an old Apple Airport router/hub I had lying around (my internet provider makes me use their router for my internet). Now, it's easier than ever to control my lights...from a browser. Or some phone interface. Or an app. Wait a second...each of those still requires multiple steps just to get me to the point where I can actually control anything. And I probably still have to use a touch screen. Leading me back to my original point, and thus the motivation for the imaginatively named:

    WiFi Matrix Keypad Remote

    I've been a DIY remote control enthusiast for almost as long as I've been hacking around with microcontrollers (at least a few years now). One thing that I've found really hard to source as a hobbyist is good, pre-made button panels intended to be mounted into a small space, such as a remote control. So far, one of my favorite sources for a dense panel of decent quality, inexpensive buttons are these old-school 3x4 matrix keypads:

    common-parts-sliced.png
    Save
  • Image for user squid_jpg
    By squid_jpg

    Guide: Build a 'MiniMarquee' WiFi Text Scroller

    Materials

    The following parts are used to build the MiniMarquee:

    • QT Py ESP32-S2
    • IS31FL3741 13x9 PWM RGB LED Matrix
    • 50mm Stemma QT cable
    • Black LED acrylic, 2-3 mm thick, cut to 41mm x 29mm
    • 4 M2x12 nylon screws and nuts
    • Little rubber feet
    • Nitto double-sided adhesive tape (or other tape with similar adhesive strength)
    • 2 1-ounce wheel weights (optional)

    Installing Firmware

    The MiniMarquee's firmware is written for Arduino in PlatformIO. There are two ways to install the firmware onto the QT Py ESP32-S2:

    1. Drag-and-drop UF2 installation
    2. Build source code and install onto device

    The UF2 method is recommended, as it is very simple and does not require downloading any additional software or dealing with any code at all. However, if you wish to customize your MiniMarquee's firmware, you'll need to go for option 2 and build it from source.

    assembly-1a.jpeg
    Save
  • Image for user squid_jpg
    By squid_jpg

    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?

    lora-upright.jpeg
    Save
  • Image for user squid_jpg
    By squid_jpg

    Wii Nunchuck USB Adapter

    I have a confession to make: I don't love playing video games with a keyboard. While the keyboard/mouse combo is the preferred input method for most PC gamers, I find my left hand often gets cramped using WASD-based keyboard input, and wish for a more ergonomic input method sometimes.

    I had an idea to make a simple adapter to map Wii Nunchuck input into keyboard events a game would recognize. I figured I could map the Nunchuck's analog stick to keyboard events for movement, and could map the two digital buttons on the Nunchuck to other keys while I was at it.

    This setup would allow me to use the Nunchuck to partially or entirely replace input from my keyboard.

    Overview

    This no-solder adapter is built with either a QT Py RP2040 or a Trinkey QT2040 microcontroller, coupled with a Wii Nunchuck breakout board connected by a Stemma QT cable. The firmware, written in CircuitPython 9, translates Wii Nunchuck analog stick and button events to keyboard events. Thanks to CircuitPython, customization is easy, allowing you to make changes to the generated key events any time. So far, I have used this adapter for games like XCOM-2, FTL: Faster Than Light, and Half-Life 2!

    I've included 2 build variants here, one for those with access to a 3D printer, and one for those without. The QT Py build uses a 3D printed case for mounting the QT Py and the Nunchuck breakout board. The Trinkey QT2040 build takes advantage of the identical screw hole placing on the Trinkey and the Nunchuck breakout adapter board, using a handy standoff mounting kit to make a nice tidy little USB-A adapter.

    case-with-pcbs.jpeg
    Save
  • Image for user squid_jpg
    By squid_jpg

    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.
    fact-or-fiction-glasses.jpg
    Save
  • Image for user squid_jpg
    By squid_jpg

    Building a "Top-Secret" lunchbox

    Recently I introduced my current project, which I've been calling the "Top-Secret Lunchbox", on Adafruit's Show and Tell stream. I wrote this playground to go into more detail about how I built it.

    I mentioned in the stream that it took me about a week to design and build the lunchbox, but that's a pretty generous estimate that does not tell the entire story. For starters, it does not include writing any code beyond basic hardware bring-up (the game code is essentially an entire other project). It also doesn't account for the fact that this is my third attempt at such a project, building on roughly three months of prior learning and experimentation. I was able to reuse many solutions from that experience, including designs for 3D-printed panel mounts for various hardware. This allowed me to make more informed choices and reduced the amount of time needed for learning and experimentation.

    The short time frame also belies that this is a fairly complex gadget for a hobbyist project. It uses most of the hardware features of the RP2040 Propmaker Feather, as well as all of the available GPIO (except for the servo output, which I did actually consider using at one point for something like a haptic motor). It required designing and printing several parts for basic assembly. It required a lot of soldering, and some "clever" solutions to some interesting challenges.

    Given the overall complexity, and the fact that I was still "winging it" on several aspects of the project, this article will describe more "how I did it" than "how you should do it". I will provide as much detail as I can about the entire process, including designing, printing, wiring, and assembly. I will also provide CircuitPython source code for a full working game! You can find a walkthrough of the game at the end of this article.

    enclosure-box-sliced.jpeg
    Save
  • Image for user squid_jpg
    By squid_jpg

    Wii Nunchuck BLE Adapter

    Overview

    A few years ago I got this nifty LED glasses kit in an Adabox. The kit comes with a specially-designed nRF52840 BLE microcontroller to drive the LEDs wirelesslly with Bluetooth Low Energy. I wanted to build a simple controller that I could pair with it for easy use, without having to dig out my phone and use an app, so I built a an adapter to essentially convert a Wii Nunchuck into a wireless Bluetooth controller.

    This controller doesn't strictly have to be used to control LED glasses though. You can use it to control virtually any gadget with BLE capabilities. The Nunchuck features 2 buttons, an analog stick, and an accelerometer, so it makes a capable and handy input device for many tasks. Since it uses a Feather nRF52840 Express, you can program it in Arduino or CircuitPython to behave just how you want!

    Difficulty: Intermediate. Some soldering is required.

    Parts

    • Feather nRF52840 Express 
    • Wii Nunchuck adapter breakout
    • Mini on/off push-button switch
    • 400 mAh Li-Po rechargeable battery
    • Black 2.5mm nylon standoff screw kit
      • 4 M2.5 6mm screws
      • 4 M2.5 6mm male-to-female hex standoffs
      • 8 M2.5 hex nuts
    • Wii Nunchuck controller
    hero.jpeg
    Save
  • Image for user squid_jpg
    By squid_jpg

    Easy Helldivers II Stratagem Macros for RP2040 Macropad

    If you've been playing the awesome new co-op game Helldivers 2, you'll be familiar with the "stratagem" gameplay mechanic in which you summon various weaponry from airborne and satellite craft. This mechanic requires you to hold down a key/button to activate the stratagem input mode, while entering a sequence of directional key input.

    Often during the game I tend to get overstimulated in the middle of a heated battle and my mind goes completely blank when trying to recall the one of the myriad codes I need to use to summon the effect I want. Even though the game UI displays them, it's still pretty hectic to precisely enter the sometimes lengthy codes when a giant scorpion is trying to rip my head off. To help spread liberty and democracy in the most efficient way possible, I thought I'd try to see if I could set up some stratagem macros using the awesome MACROPAD Hotkeys project from Phillip Burgess. NOTE: For simplicity, this particular setup mimics keyboard input, so until I hear otherwise I'm assuming this only works on the PC version of Helldivers II.

    Custom Code

    It took a few tries to figure out how to set up the macros so that the game would consistently accept them. Thankfully, the MACROPAD Hotkeys project is incredibly versatile and I was able to do this using the built-in features of the project without having to modify any of the core code. The main factors involved in getting this to work seemed to be:

    1. After pressing the stratagem input button, a significant delay was needed before the game would accept the directional input. I'm assuming this is due to needing to wait for the UI to fully present in-game before allowing further input. With experimentation it seems like the smallest delay possible is about 0.4 seconds.
    2. Each directional key needed to be pressed for a certain duration. The smallest duration I've tried for this so far is 0.05 seconds.
    3. A small delay is needed after each direction key is released. The smallest duration I've tried for this so far is 0.05 seconds.

    In the /macros folder on my macropad CIRCUITPY drive, I created a new file named helldivers-2.py. Since I anticipate changing this file frequently as I progress through the game, I wanted to make it as simple as I could to add/edit new macros, so that I could even edit them in real-time as I played the game. To make this a little easier, I wrote a bit of custom code at the top of the file.

    IMG_4746_Large.jpeg
    Save
  • Image for user squid_jpg
    By squid_jpg

    Custom ANO Fidget Firmware

    Awhile back Adafruit featured a story on their blog about a really cool fidget toy built using a rotary encoder and a NeoPixel-compatible LED ring. I loved the idea so much that I wanted to make my own version, and spent a few days designing my own with parts I had on-hand. As it turns out, I wasn't the only one: the Ruiz Brothers built an incredibly stylish take on this idea using an ANO rotary encoder and published an excellent learn guide for it!

    While there are physical differences between the two versions, the hardware is similar enough that I wanted to write a CircuitPython firmware that would work their version as well as mine. I wanted the firmware to have multiple modes, with the ability to add more in the future as ideas came to me. Ideally it would be something others could build on as well.

    Update: You can see a live demo of the firmware running on the Ruiz brothers' fidget toy in this episode of 3D Hangouts

    memory-game.jpeg
    Save
  • Image for user squid_jpg
    By squid_jpg

    Extending the Talking HAL-9000, literally and figuratively

    3D files and (lack of) code

    You can find the 3D files for the modified HAL parts, as well as the case for the QT Py on Printables. The wiring is pretty basic; in addition to the wiring from the learn guide, I wired one of the RP2040 Feather's UARTs to the headphone (TX, RX, GND) jack, and the other to a 4-pin JST connector (5V, GND, TX, RX) with a few inches of wire. A corresponding JST connector is soldered on to the QT Py, with the 5V and GND wires connected to the battery power pads on the bottom of the board, and the TX/RX wires connected to the corresponding RX/TX pins.

    I did not post any code for this as it is highly specific to my situation, however, to be honest, none of the code is particularly special. I used the CircuitPython MQTT learn guide to figure out how to get connected to my local MQTT network, and the CircuitPython essentials guide to work out how to use the UART (for communication) and PWM (for animating the LED).

    Overview

    I love this make of HAL-9000 from the Ruiz Bros:

    hal-9000-w.jpeg
    Save
  • Image for user squid_jpg
    By squid_jpg

    HAL9000 Sample Code Tweaks

    I've been working on building the updated HAL9000 using the Propmaker Feather, and tweaked the code a bit to add a couple of features. Mainly:

    • Animate the LED using a slow pulse animation when HAL9000 is "idle" (in other words, not playing a sound)
    • Shuffle the list of wave files, and keep track as we play our way through them; then, once we've reached the end, re-shuffle the list and start over. This prevents the same sound repeating over and over, which the current approach is prone to. It also ensures you'll hear every sound if you keep pressing the button (until the list eventually has to repeat).

    I ordered a decal to use instead of 3D printing the "HAL9000" label, so I'm waiting on that before I post the photos of my build, but in the meantime, here's my updated code if anyone is interested (you'll need to add the adafruit_ticks.mpy library to your lib folder in order to use this).

     

     

    Save
Search

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.

    • Contact Us
    • Tech Support Forums
    • FAQs
    • Shipping & Returns
    • Freebies
    • Terms of Service
    • Privacy & Legal
    • Website Accessibility
    • LLMs.txt
    • About Us
    • Press
    • Educators
    • Distributors
    • Jobs
    • Gift Cards
    "In considering any new subject, there is frequently a tendency, first, to overrate what we find to be already interesting or remarkable; and, secondly, by a sort of natural reaction, to undervalue the true state of the case, when we do discover that our notions have surpassed those that were really tenable"
    Ada Lovelace
    Adafruit Logo
    A Minority and Woman-owned Business Enterprise (M/WBE)