Adafruit Playground is a wonderful place to share what you find interesting. Have a cool project you are working on? Have a bit of code that you think others will find useful? Want to show off your electronics workbench? You have come to the right place.
Adafruit Playground is a safe place to share with the wonderful Adafruit community of makers and doers.
-
Pinned by CGrover
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.
-
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
-
The Feather Isolator: A Hardware Troubleshooting Device
When troubleshooting serial bus communications like I2C, UART, or SPI, it can be handy to disconnect a chip select or data line to isolate external devices. Once isolated, the data can be viewed on a logic analyzer or oscilloscope to determine if the SPI or UART signal outputs are really connected to inputs or when examining the effects of multiple pull-up resistors on I2C. The Feather Isolator was designed to individually disconnect a Feather's pin with a switch to help with the troubleshooting effort.
-
An Almost Free Non-Destructive Soldering Jig
I just couldn't bring myself to use the standard practice of soldering pins onto breakout boards using a solderless breadboard in spite of the recommendations and endorsements of some famous solder artists. I would cringe thinking that the heat would eventually warp the plastic portion of the board. It is a solderless breadboard after all.
Fortunately, after placing many Adafruit orders over the years, I had build up quite a collection of free half-sized Perma-Proto breadboards. The solution for creating a non-destructive soldering jig became obvious. Stack four Perma-Proto PCBs together, use a couple of M3 nylon screws and nuts, and place some rubber feet on the bottom. Voilà!
Sadly, the Perma-Proto board is no longer offered as a free product promotion. That's okay; I still have enough in the inventory for many future projects. And coasters. I have coasters.
-
WaveStore: Create a Library of synthio Voices
The arbitrary waveform capability along with ADSR envelopes and filters has made it very easy to create custom musical voices with synthio. And if you use an additive synthesis tool like WaveBuilder, you'll begin to quickly amass quite a few custom musical voices as you experiment with the nearly infinite number of oscillator combinations.
Hearing Voices
Up to this point, I've been keeping track of the numeric specifications for WaveBuilder oscillators and synthio.Envelopes in project code or scribbled on a note pad. That means that when building a new project that needs to use a previously created voice, I'll cut and paste the voice definition code into the new project. The process works, but isn't ideal. What if a synthio musical voice could be loaded from a collection in a file folder, kind of like working with a font file?
So a concept for the WaveStore project began to develop. Here are the initial requirements.
- Library File Management -- We'll make it easy at first and just work with a collection stored on an SD card. No need to tax the brain to conjure up a way to write to the CircuitPython root directory just yet. After creating and storing a voice to a file, we'll manually copy the files from the SD card in order to use and share between projects.
- Files -- In the spirit of keeping it simple, only files representing waveforms and envelopes will be created. Those objects form the fundamental elements of a musical voice. Perhaps we can add filters and other effects later.
-
Library File Names -- Waveforms will be stored in a standard wave file with a
.wav
extension, thanks to the awesome Adafruit_CircuitPython_Wave library. Envelopes and filters definitions will be stored in plain text files with.adsr
and.fltr
extensions but will transform to synthio.Envelope and synthio.BiQuad objects when retrieved. - Icons -- Imagine being able to select a musical voice waveform or envelope by touching a screen icon. Functions will be provided to save and retrieve bitmap images of waveforms and envelopes as well as capturing the contents of an entire screen. We'll start with 64x64 pixel bitmaps created by WaveViz. A graphical frequency response representation of a bi-quad filter's coefficients is in the works but is a bit beyond today's skillset. There's a potential workaround, but I'd rather derive it directly from the numbers. Hoping for an epiphany soon.
In the future, more features will likely be added to WaveStore such as support for filters and on-screen icon buttons -- as my experience and Python skill set grows. What would you add?
-
WaveViz: Plot a synthio Wave Table or Envelope
WaveViz is a CircuitPython class to create a positionable
displayio.TileGrid
graphics widget from asynthio.waveform
wave table orsynthio.Envelope
object (or any one-dimensional list for that matter). The class also makes the underlying bitmap and palette objects available for other uses such as saving the widget to an image file. -
Symbols for synthio Objects
In the process of learning to use synthio, it was a challenge to understand the myriad of possible connections between modules. As a result, project design notes and sketches became a rat's nest of entangled symbols and wiring. Although simple single-voice designs without filters or LFOs were easy to deploy and document, it became clear that there was more to discover inside the extensive versatility of synthio.
Perhaps a set of symbols with consistent notation (and color-coded arrows, of course) would be useful to further learn about synthio and to develop project conceptual diagrams.
Here's the beginning of some symbols for synthio objects with class properties and methods together with data types. Essential tools such as audiomixer and audiobusio are also included.
-
Output Eurorack Control Voltage (CV) Signals from synthio
This note describes a method to output Eurorack CV (control voltage) signals from synthio using the PCM510x I2S DAC.
Rather than employing CV-like object controls such as Envelope and LFO to only adjust the parameters of other synthio objects, it would be useful to also control physically external devices such as the CV inputs of Eurorack modules. To do that we'll need to configure the synthio.Note object to ignore its typical behavior as an oscillator. Oh, and it would be handy to have an I2S DAC on-hand with a DC-coupled output that's capable of positive and negative output voltage that can be connected to a Eurorack module.
Here's the test setup:
- Create a Note.waveform (wave shape table) object containing the maximum wave value (16-bit signed). This is an array filled with a single value that acts like a fixed DC voltage.
- Set the Note wave shape oscillator frequency to an arbitrary value such as 440Hz. The frequency value is unimportant since the oscillator waveform output will simply be a fixed value.
- Define a synthio.LFO object to output the LFO signal. If outputting an ADSR envelope is desired, define a synthio.Envelope object.
- Create a synthio.Note object where the amplitude parameter is controlled by the ADSR envelope or LFO.
- "Press" the note to output the ADSR envelope or LFO signal from the I2S DAC.
Instead of the I2S DAC, CV output signals can be created in this manner using audiopwmio and audioio to use PWM or analog DAC output pins. Boards like the QT PY RP2040 and Grand Central M4 Express could be used for PWM or analog DAC outputs. Keep in mind that, unlike the 0 volt baseline of the I2S DAC, the baseline of a PWM or analog DAC signal is biased to approximately +1.65 volts.
-
PCM510xA I2S Stereo DAC Breakout
An I2S stereo audio DAC with an internal master clock PLL and a charge pump for direct-coupled ground-centered audio output.
-
AS7341 TV Backlight Proof-of-Concept
Overview
The TV Backlight illuminates the wall behind the TV display to reduce eye strain. The backlight extends the background of the screen image by watching the color near an edge of the display. To reduce distraction, the color and brightness are integrated over time to avoid sudden changes.
The project code reads the AS7341 spectrometer sensor's eight visible light channels to determine the backlight target color. Using a Euclidean "color distance" comparison, the backlight color is slowly changed to match the target color, within a specified tolerance.
The spectrometer sensor settings are adjusted for relatively low display light levels. The sensor's internal amplifier gain is set to maximum and the integration step and time values are adjusted to maintain a moderately fast conversion rate. Also, rather than just analyzing red, green, and blue components, all eight visible light channels are used to increase the accuracy and resolution of color measurements.
In this configuration, just one of the sensor's channels can reach a count value of near 13k, producing a composite 8-channel resolution that approaches 8x1032 color combinations, much larger than the 17x106 (24-bit) color resolution of the NeoPixel strip. A color count to RGB converter helper reads the three primary color sensor channels, scales the count, and produces an RGB888 (24-bit) color value that's compatible with NeoPixels.
To assist in finding a position near the TV screen for the sensor, the Feather M4's on-board NeoPixel mimics the readings in real-time, albeit at a slightly lower brightness than the illumination strip NeoPixels.
Documents
Test video: https://youtu.be/yFqbalF0FGw
Next Steps
- Build a camouflaged enclosure and vertical mounting wands for the NeoPixel strips.
- Investigate animating the NeoPixel strip color change.
- For home security, enable the NotFlix (Fake TV) code when the TV display is dark for 5 minutes or more.
-
BNo055 Sensor Calibration, User Position Orientation, and Tap Detection
Overview
This page of notes was used to develop BNo055 9-DoF sensor algorithms for the PowerWash project and discusses three essential characteristics of the sensor.
First, the relative and absolute calibration of the sensor can be performed to improve initial sensor stability and positioning. Stand-alone sensor calibrator code is shown and was submitted to the driver library's examples folder. The sensor calibration procedure is not well described in existing documentation, so an update to the BNo055 ReadTheDocs page and the primary Learning Guide would be beneficial.
Next we'll talk about how to measure and adjust for user position orientation without changing the sensor's absolute position calibration.
Finally, since tap detection is not native to the BNo055 chip, an example of how to detect single and double-taps with the accelerometer component of the sensor is described.
Since the PowerWash project also included a Nunchuck controller, a brief discussion of tap detection for its slightly less-sensitive accelerometer is included.
-
IoT Wind Chimes using synthio
A CircuitPython project for indoor "windless" garden chimes that play along with the outdoor wind speed.
-
MatrixPortal Board Twister (HUB75 Adapter)
Requirement: Place an RGB display panel with an attached MatrixPortal in a shadow box.
Problem: The MatrixPortal sticks out.
Solution: Spin it around with a custom OSHPark AfterDark board. -
Wind Chime Repair
We live in a breezy area that abuses flags, wind socks, and our patio garden wind chime collection. To keep the collection of wind chimes working, we are always looking for better materials for the annual chime repair ritual.
We recently ditched the UV-resistant nylon fishing line that was usually used for repairs. Despite the UV rating, the nylon line would decay in the sun after a few months. We tried something new (to us) this season; replaced the nylon line with 1/32” stainless steel cable and aluminum crimp ferrules. We're expecting it to stay strong and last a great deal longer.
For lightweight loads such as the hangers for individual chime tubes, the ferrules were sliced in half with a utility knife. The cable was cut to length and ferrules were crimped in place using a ratcheting crimping pliers' 28AWG die. The crimping pliers (Adafruit PID#1213) have a combination die for 28AWG, so only the larger portion of the die was used. Crimping pliers designed specifically for this purpose are available.
Stainless steel cable and ferrules from Amazon
-
Ibanez FL9 Service Guide
The Ibanez FL9 Flanger Service Guide was compiled from a collection of original and obsolete information to create a useful guide for maintaining this unique guitar pedal. Credit must be given to the authors of the original 1980s era Service Manual NO. 002 that was used as a template for this updated guide.
-
PaletteFader
A CircuitPython Community Bundle color palette and list brightness setter and normalizer tool.