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.
-
Babel - Let's make some Alien words!! Here's another silly NeoTrinkey project - let's make some alien words!
babel.py - generates "alien" words using a set of rules for Wookie, Klingon, Vulcan, Mando'a and Romulan.
ncount.py - blinks numbers
Touching pad #1 toggles between the five languages, and blinks the number (1..5) for the language choice. Each language defines a set of consonants, vowels and an array of word patterns (V for vowel, C for consonant, v 50% chance for a vowel, c 50% chance for consonant). When you touch pad #2, a list of words (random quantity, 1 to 10) is created following the rule sets. The rule sets were created using known words from those languages.
Change the variable REPL to direct the output: True means the program prints to the repl, False sends the output to the keyboard.
Example output:
Wookie: OUWA ROR HOH AROOAUW HOUW WOH ORAUW ORUUUUR WOR OWOUOOR
Klingon: laq noegh tSyIm DIyS mI Ho jaab
Vulcan: su tuai tiustoa het' tiy k' t
Mando'a: ary reara 'hr syc tmn cor khc
Romulan: ihf ki'vh ies lu'm m'ih ih eenh hieh uek
Note: These are generated words, and only by coincidence match vocabulary in any real lexicons.
For fun you can replace my rule sets for any other alien or fantasy language you wish to create.
There's a hoopy frood who really knows where his towel is. -
Stuff My Dog Said (via AdafruitIO) Inspiration
This project is an extension of the original doggy buttons project where I'll be showing how to make a public dashboard that publishes everything my dog says. This project is just one example of how to extend the features of my doggy buttons and perhaps one of the silliest IOT devices ever made. If you want to know about the buttons themselves, see the original project writeup.
With a project like this, it's also important to think about privacy. I don't want my dog making it possible to tell when we're away from home, so I'll also show how to add a delay so that activity is only published once it's sufficiently stale.Setup Challenges
User Space vs Admin Space
The first version of my program was kicked off by
/etc/rc.local
on boot, but this had the side effect of running the program asroot
. That was fine for my original project, but I had followed best practice and not usedsudo
whenpip3 install
ing the Python libraries needed for loading data to AdafruitIO. If I logged in to run the program as my user, it would end when I logged off butroot
no longer had all the Python libraries needed to run.Lennart (Binary Labs) suggested the simple and elegant solution of adding
sudo -u MY_PI_USERNAME
before the command that would launch my code in/etc/rc.local
. This allows the program to be run as my user without having to login and was much simpler and cleaner than the other solutions I was considering.Concurrency
The first version of my code simply added a call to
aio.send_data(...)
in the same loop that processed button presses, but I quickly discovered that the upload process could take 3 - 4 seconds leading to very delayed sounds when more then one button was pressed. Things like "water outside walk later" became "water ... outside ... walk ... later". This was starting to confuse my dog because the sounds weren't immediately connected with the button presses and would sometimes sound when she had gone to push something else entirely because the button "wasn't working".To fix this it was going to be necessary to introduce separate queues, one for playing sounds that could respond quickly, and one for uploading button presses that could slowly upload data to AdafruitIO in the background.
-
Getting QWIIC thru window, door, etc. A few hours ago, I saw an announcement of a new Adafruit product #5961, connecting Stemma QT/Qwiic connector to a breadboard.
I quickly realized that by having two of these, with headers soldered on (consider using right-angle headers for this), one can use "Flat Flexible Cable" ("FFC") AF04-5-ND from Digi-Key, along with Digi-Key crimp-on connectors 609-3512-ND, to connect something like a sensor on one side of a door/operating window/etc to a microcontroller on the other side.
The FFC is MUCH thinner than a normal Stemma QT/Qwiic cable, or indeed any sort of "ribbon" cable I've seen in my nearly 60 years of "doing" electronics, so the FFC is MUCH better at getting through doors/windows/etc. You may be familiar with FFC in a custom form (often called Flexible Printed Circuits) for connectors on various small displays.
I should mention that those "crimp on" connectors can be a tad bit ornery to get on. I usually find that a largish pair of "pump" pliers to do the ''crimping' and another pair of pliers to "convince" the side pieces to close will do the trick. Also, if you have a sensor exposed to the weather, you might want to consider adding some conformal coating (though the device and connections before applying the coating, and if your sensor includes humidity and/or barometric pressure, be sure to protect the "sensor hole" from the coating.
One instance of this that I've used the FFC for is a sensor outside a window while keeping an ESP-8266 safely on the window sill. I also have sensors inside both the fridge section and freezer section of my side-by-side with an ESP-8266 on top of the unit. (A fridge would make a pretty good Faraday Cage, so WiFi inside the fridge probably wouldn't work.)
-
NeoPixel Stick and Pi Pico Need to add a simple diagnostic display to a Pico project? Or perhaps you want a quick and easy NeoPixel light show? Let's see what we can do!
Equipment
-
Reading Pixels from the RA8875 Driver Board Intro to the RA8875 Driver Board for Circuit Python
The Adafruit RA8875 driver in Circuit Python does not currently support displayio. You must use read/write registers with a barebones ra8875 graphics library. The current feature set and how it is used is only for very advanced users.
You can draw a bmp image and overlay text but you'll quickly find that's about all you can do with it. There are only 2 examples provided and the driver board is unlike any other display device for Circuit Python. Any knowledge you have of displayio does not transfer over to this board; the RA8875 is unique.
The interest of using an 800x480 bare display with Circuit Python is typically due to the sheer size of it but it should come with fair warning: You must be capable of programming with circuit python from scratch without displayio.
The bits and bytes of binary color
Since the RA8875 can only display a maximum of 16-bit color; the 24-bit image must be converted to 16-bit (color565).
The RA8875 stores color information in its memory with 2 bytes (2 pairs of 8 bits). Here is a binary representation of how it stores the color. 11111111 00000000 There are 8 bits in 1 byte.
However the RA8875 actually stores them in what is known as swapped color565. Each first byte must be swapped with the 2nd. This is not some type of color conversion error. These are the direct reads from the memory addresses for the stored colors.
-
Using GPIO on Arduino. Hi. today i`m going to show you how to use the GPIO or pins on Arduino it doesn't matter witch one as long as it has GPIO.
First jumper weirs:
-
About I've been doing the hobbies of coding and circuit boards for three years now, I use Adafruit a lot and would love to help other people with the same hobbies on here with fun projects and useful info. I will be doing small and large guide projects. I will make sure to add all of the crucial info and extra detail to make it easier. thanks.
needed components during my tutorials:
led`s and resistors, transistors, capacitors
3d printed software or cnc soft-where.
basic circuit boards and device to code them with Arduino ide or mu editor.
That`s all! thank you for your time.
-
The Necrochasm: Pushing the Prop-Maker RP2040 to its limit! This is a project that was years in the making, I went through many iterations that failed one way or the other. However, the final project was only started about a few months ago. It's great to see this project realized at last! The trigger really works, it has the appropriate sound effects, it has two firing speeds, and a "virtual ammo" system that you replenish by physically removing and reinserting the cartridge. So, where did it all begin?
The initial step of the process was to design the 3D printable case, which I did in blender. I found someone who extracted a model of the Necrochasm from the game itself and went to work sculpting out the finer details, hollowing out the interior, and adding LED areas. I also took this time to log into Destiny, and use my in-game Necrochasm to record the proper sound effects.
I exported the resulting pieces from blender to fusion 360 where I added the hardware mounting features. My vision for this prop was to have one area where most of the electronics were stored. This trapezoidal area at the bottom-front of the prop looked like it had the most storage capacity.
-
CG-35: A Retro RPN Calculator The CG-35 is a CircuitPython emulation of the Hewlett Packard HP-35 Scientific Reverse-Polish Notation (RPN) calculator designed for the Adafruit ESP32-S3 Feather and 3.5-inch TFT FeatherWing capacitive touch display. The calculator consists of a 10-digit LED-like display backed-up with 20-digit internal calculation precision.
This emulation reproduces the HP-35 calculator's v2.0 firmware where the change sign (CHS) key is active only after digit entry has begun. And because of the
udecimal
andutrig
classes, calculation accuracy of monadic, dyadic, and trigonometric functions was improved. As an added bonus not present on the original calculator, a status message will appear just below the primary display when a calculation error is encountered.The calculator's graphical layout was designed to mimic the aspect ratio of the original calculator -- that's why the left and right sides of the display screen were left empty. However, to provide a more reliable touch screen experience, the keys are somewhat proportionally larger than the original.
This project was inspired by Jeff Epler's DIY Desktop Calculator with CircuitPython project and Jeff's work to create CircuitPython versions of
udecimal
andutrig
. Thank you Jeff!GitHub Repository: https://github.com/CedarGroveStudios/CG-35_Calculator
Primary Code Module
The primary code module
cg_35_calculator.py
, imported bycode.py
, instantiates the display, plots the calculator case and buttons, and implements all calculator operational processes. This module uses a state machine design with the following named states:- IDLE -- Display results or wait for input
-
C_ENTRY -- Coefficient entry (keys:
0
-9
,.
,CHS
,EEX
) -
E_ENTRY -- Exponent entry (keys:
0
-9
,.
,CHS
) -
STACK -- Stack management (keys:
ENTER
,CLR
,CLX
,STO
,RCL
,R
,x<>y
,π
) -
MONADIC -- Monadic calculator functions (keys:
LOG
,LN,
e^x
,√x
,ARC
,SIN
,COS
,TAN
,1/x
) -
DYADIC -- Dyadic calculator functions (keys:
x^y
,-
,+
,*
,÷
) - ERROR -- Calculation error
The calculator's display precision and internal calculation precision are specified using the variables
DISPLAY_PRECISION
andINTERNAL_PRECISION
. Although the internal precision exceeds that of the original HP-35 calculator, it is recommended to keep the existing default settings of 10 digits and 20 digits, respectively, to avoid rounding errors.The variable
DEBUG
can be use to provide additional internal register status via the REPL. This boolean variable defaults toFalse
(no additional register status). -
Using Multiple WiFi Access Points with CircuitPython Introduction:
If you have the need your WiFi project to operate at various locations with different WiFi SSID/PASSWORD settings at each location, read on. If you are using an MCU with built-in WiFi that CircuitPython 9.0.0 or later supports, there may be a solution to your issue.
Overview of the project:
This article will provide you with two tools to get you started.
- A code.py defined function (def) that will cycle through the WiFi networks defined in settings.toml. It will also show a sorted list of available WiFi access points found locally.
- A sample settings.toml to get you started.
- There are additional functions and features that will be covered as we go along.
- There will be a description of how each function works and interacts.
Why would you need multiple WiFi SSIDs in IoT projects?:
Let’s say you have a project that you must develop at home, show friends how it works at your bridge club, test it under various situations, and demonstrate its features to a customer. Having all the SSIDs and PASSWORDs predefined and having your project cycle through them without your intervention, except the first time you add them, would speed things up.
Prerequisites:
The system requirements are simple. An MCU with built-in WiFi that is supported by Circuit Python 9.0.0 or newer. My tests were run on a Raspberry Pi Pico W. All the libraries are built into CP 9.x.x that the sample code.py needs. They are: import os, wifi, random, binascii. The additional libraries used by the diagnostic code are import time, board, digitalio, ipaddress, supervisor, microcontroller and are also built-in.
If your MCU is listed at the web site below, your board is probably supported.
https://docs.circuitpython.org/en/latest/shared-bindings/wifi/index.html
Click on Available on these boards for a full listing. Considering the length of the boards listed, I have not tested, nor can I guarantee this code will work with any or all of them.
Upload the code and configuration:
To test if this program will work on your MCU (listed above), load CircuitPython 9.0.0 or newer, copy the code.py and settings.toml files to your board. Then startup REPL and see what is happening. It should cycle through the 10 SSID/PASSWORD pairs preloaded into settings.toml and fail at each one and move on to the next.
If you get wifi not found/defined, this program will not work because CP 9.x.x does not support your board. The AdaFruit Forum experts will have to address this.
Replace one of the test sites listed in settings.toml with your local WiFi SSID and PASSWORD then watch what happens. The program should pick a random site and cycle through to your site and connect. It will wait 10 seconds then reboot and pick a random site and cycle again. Then change the IP address in line 116 and verify that your MCU can ping a known good local site.
This should work out-of-the-box. If yours doesn’t, contact me on the AdaFruit Forum, @blakebr.
Conclusion:
I hope this utility helps you in making your programs more bulletproof while connecting to WiFi. I am looking forward to your real-life testing and improving this utility with your input.
I suggest you place the code snippet below someplace in your program to periodically test that the WiFi connection is still good.
-
Touchscreen TFT & SDCard with the Raspberry Pi Pico W The goal for this project is to get the display, touch screen, and sd card working on the Pi Pico by calibrating the touchscreen and printing the contents of the sdcard to serial console.
Learning how to share multiple SPI peripherals reduces the amount of pins you need which can increase the amount of available pins for other uses. A SPI bus is very similar to an I2C bus except the SPI peripheral has a unique chip select pin assigned to it. I find it easier to think of the chip select pin as a SPI address pin. You can only have 1 address per device with I2C and the same holds true with SPI devices except the address is a physical pin.
Because SPI peripherals require a physical pin you will be limited to how many you can have based on how many free pins your microcontroller has. What SPI lacks in chain ability it makes up for with speed.
- I2C devices are half-duplex
- SPI devices are full duplex
Because SPI communication is twice as fast as I2C it makes far more sense to use SPI for displays and sd cards! Don't get me wrong, I2C definitely has its place for uses such as:
- temp sensors
- optical sensors
- 7-Segment displays
- 14-Segment displays
- small 16x9 matrix LED modules
- Neopixel strips
- and chaining a ton of devices on 1 bus without the limitation of physical pins per device.
When it comes to needing faster communication for a display that has 480x320 (153,600 total) pixels or sd card reading & writing for a single device that's where the SPI protocol outperforms I2C.
I recently worked on a project with a Raspberry Pi Pico that needed to have a Touchscreen TFT & SD Card. That's actually 3 peripherals because the touchscreen controller chip requires pins too. In the majority of scenarios when you have a SPI touchscreen you actually have 2 SPI devices, the display and the touchscreen.
In the Raspberry Pi Pico pinout diagram there are 2 separate SPI buses. SPI0 and SPI1. SPI0 peripherals cannot communicate with peripherals on the SPI1 bus and vice versa. A peripheral would be anything on the SPI protocol such as a display, sdcard, temp sensor, etc... They are highlighted below with magenta labels. Please notice that each SPI bus is prepended with SPI0 or SPI1.
Here is the wiring setup using an Adafruit Proto Picow Doubler. The doubler offers a maximum of 3 input headers per physical pin. That means you can share up to 3 SPI devices per pin with their doubler. This is a very handy feature as I didn't have to use a breadboard to prototype this project, very cool. The reset button also came in handy during prototyping. If you have a Pi Pico I highly recommend getting one of these. They're like Feather doublers but for the Pico.
-
IKEA Förnufig Air Purifier V2 - Custom fan speed controller + Blinkenlights Basic premise:
Add lights (speed / noise / air-purity indicators, or needless dotstar+neopixel love), use small board to receive tachometer input and drive 24V fan PWM signal from particle sensor, along with new inputs for noise level. Plus show off Blockly based programming on Adafruit IO, and update as and when the new maths functions become available, but for now write a quick CircuitPython version that illustrates all the desired functionality (to port to Adafruit IO).Semi-finished code: - Functionally capable but no reactive light use, rainbow:
[Reproduced from https://github.com/tyeth/Ikea_ItsyBitsyEsp32_Air_Purifier/ ] -
Wippersnapper - Sensirion SEN55 Particulate/VOC/NOx sensor - Plus an educational saga in the quest for a case... Wippersnapper
For those not in the know, WipperSnapper is Adafruit's plug-and-play firmware, which runs on their IO (think IOT) platform, offering free* data history(feeds) with graphs, dashboards, and automatic actions/triggers (along with integrating with other platforms like IFTTT). There is a paid upgrade for longer history, unlimited devices, SMS alerts, etc.
I love it because it's super quick and easy to test a sensor works, and to just get some data recording quickly.
Goto a web-page, flash over usb, add sensors via control panel (feeds + graphs are automatic), done.
Under the hood it's an arduino sketch, so adding additional sensors via github pull requests is surprisingly easy (I've added a few because it makes my future tasks easier).
For this project I'm testing the Sensirion SEN55, which senses Nitrous Oxides (NOx), Volatile Organic Compounds (VOCs), with temperature and relative humidty as a reference (uses SGP40/41 inside), and measures particle counts at <1.0 micron, <2.5, <4.0, and <10.0 micron. The other models of this sensor have less features (SEN54: no NOx, SEN50: no NOx/VOC/Relative Humidity+Temp - only Particulate Counts).
From the standard drivers(arduino/Pi) created by Sensirion we can retrieve the typical particle size, along with the raw particle counts (or in SI units ug/m3), the temperature and humidity, and then two indexes for NOx and VOC.
The NOx index has a baseline of 1.0, and if you hide the sensor under an upside down saucepan and use a lighter under the saucepan before sealing it back up then you will see a rise in the NOx index and then a return to baseline (1).
The VOC index is instead based at 100. You can detect VOC events from many things, the human breath can even be a source. I tested mine with a jar of clear nail varnish, but anything which you can smell, or smells chemically, is probably going to affect the sensor.Connectivity-wise, it uses I2C, or other methods (UART?) which are as yet unpublished. The connector requires a JST-GHR 1.25mm 6 Pin compatible cable. The development kits include such a cable, but are heavily marked up cost-wise, like an additional 150% (£50 for kit, £20 for bare sensor). I advise getting a bare version with an additional cable from elsewhere (coolcomponents have a cable under £2). There is also a Grove connector version from seeedstudio.
-
Hiking Masterpiece Overview
Welcome to the Adafruit guide on creating a stunning Badger Mountain themed art piece! In this guide, we'll show you how to bring your artistic vision to life using the powerful Feather RP2040 microcontroller, along with an array of components including audio jacks, buttons, and LED strips.
Circuit Diagram
-
Github Desktop CRLF to LF PowerShell Workaround The Windows Github Desktop program is an easy to use Git GUI for Windows users and it works great in most situations. However, it has a notorious history of converting every file in a Git repository checkout/clone to all CRLF (Windows Style) line endings. Line endings are also known as EOL's (End of Line).
To make line endings visible in Notepad++ go to
View > Show Symbols > Show End of Line
Here's an example of what CRLF's look like when made visible.
All Github Desktop had to do is add a preference option to checkout and commit with LF only. No such option exists. This behavior is not present in any other Git based tool so this is a problem unique for Windows Github Desktop users. There are workarounds published online that include changing an environment variable and global git config. That workaround only works for 1 session, as soon as you close Github Desktop it will promptly ignore your previous changes. There are hundreds of issues filed about this in the Github Desktop repo over the past decade with no real solution.
There has to be a way to fix this!