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.
-
No-Code "EnSmartening" an IKEA FÖRNUFTIG Air Purifier - V1 Reuse existing PCB+Dial
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)
-
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.
-
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.
-
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. -
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.
-
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
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!).
-
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.
-
Two-hand Mouse
Background
I have an older laptop that has a trackpad, but it is not clickable. You have to use the buttons below it. It is quite awkward in general, more so for drag and drop operations. Let's build some alternative mouse buttons to help. With this project you can move the mouse with your usual hand and click with your other hand. This guide covers USB HID Mouse, Debounce, and NeoKeys.
-
Electric Fireplace Teardown and Upgrade with WLED
I just moved into a new neighborhood. On my morning walk I discovered the best "neighborhood score" of my whole life: a brand-new electric fireplace, still in the box, with a "free" sign on it, sitting at my neighbor's curb. I snagged it immediately. I've been eyeing these since I saw one at the State Fair a while back. They produce a really cool flame-like effect, and also include a heater module.
Apparently my neighbors were getting rid of it because it "beeps from time to time". Well, being the DIY hacker that I am, I decided to crack it open and see if I could disable the beep, and also upgrade the LED strips inside while I was in there.
-
macOS: Built-In Support for USB-Serial Chips
macOS provides built-in support for some USB-to-serial converter IC's. Built-in support was added at various times for different chips. In the versions of macOS before support for a particular chip appeared, a manufacturer-supplied driver needs to be installed.
I rolled some old Macs back to their original versions, and then rolled them forward, one version at a time, to test support support for three different families of USB-to-serial chips. I tested by attempting to upload firmware to ESP32 chips using esptool.py.
Summary
FTDI FT232x chips have working built-in support starting in Mojave, macOS 10.14. Specifically, a cable using a FT232RL was tested.
Silicon Labs (Silabs) CP210x chips have working built-in support starting in Catalina, macOS 10.15. Specifically, support for CP2104 was tested on an Adafruit Feather HUZZAH32.
WCH CH9102F chips have working built-in support starting in Ventura, macOS 13. Specifically, an Adafruit Feather ESP32 V2 with the CH9102F was tested.
Tested macOS Versions
Not every combination was tested, since I knew which versions did not have support and did not re-test old versions.
High Sierra - macOS 10.13
Only Python 2 is available in the original installation, so Python 3.11 was manually installed from python.org.
NO - FTDI did not work properly, though it appeared as
/dev/cu.usbserial-AL0157X9
.NO - CP2104 does not appear at all.
NO - CH9102F appears as
/dev/cu.usbmodemNNN
, but does not work properly with esptool.py.Mojave - macOS 10.14
Only Python 2 is available in the original installation, so Python 3.11 was manually installed from python.org.
YES - FTDI with esptool.py works. It appeared as
/dev/cu.usbserial-AL0157X9
.NO - CP2104 did not work, I believe (my notes are incomplete).
NO - CH9102F
Catalina - macOS 10.15
Has Python 3.8.
YES - FTDI works.
YES - CP2104 starts working in this version, appearing as
/devcu.usbserial-NNNNNNNN
.NO - CH9102F does not work properly. Only
esptool.py chip_id
works.Big Sur - macOS 11
Same as Catalina.
Monterey - macOS 12
Python 3.9.6
Same as Catalina.
Ventura - macOS 13
YES - FTDI works.
YES- CP2104 works.
YES - CH9102F starts working in this version. It appears as
/dev/cu.usbserial-NNNNNNNN
. Note the change fromusbmodem
tousbserial
from Montery to Ventura.Sonoma - macOS 14
Same as Ventura. All work.
References
-
Jar of Virtual Fireflies
We all love the subtle, intermittent glow produced by fireflies in the summertime. Each firefly produces its own unique visual pattern in response to the signals given off by its neighbors. Running through the yard trying to catch them is a quintessential Summer activity for young (and not-so-young) children. Kids will often collect them and put them in a jar to bring in the house to enjoy the light show that the fireflies produce before releasing them to go on their merry, little ways.
This project attempts to replicate the beauty and ambience created by a Mason jar of fireflies. But unlike the "real thing", this virtual jar of fireflies can be enjoyed year-round without having to capture and maintain the little buggers.
Note: This is a cross-post of the project I posted on hackaday.io at: ( https://hackaday.io/project/193890-virtual-jar-of-fireflies ). The majority of the components in the project are from Adafruit, so I thought I'd include it here as well.
-
pixel peace
A sign for all times
-
ProtoEngineer's Guide to the Guide
Title
Pick your title wisely.
Introduction
In this section, you should aim to:
- Capture Interest: Start with an engaging opening sentence or question to draw readers in.
- Explain the Purpose: Briefly describe what your guide is about and what readers will learn.
- Set Expectations: Mention the target audience and the level of difficulty (beginner, intermediate, etc.).
- Motivate the Reader: Highlight the benefits or exciting aspects of what you’re going to cover.
For example, if your guide is about building a specific electronic project using CircuitPython, you might start with something like this:
"Have you ever wanted to create your own electronic gadget that can interact with the world around it? In this guide, we'll walk you through building a [specific project], a perfect blend of coding and electronics that will sharpen your skills in CircuitPython. Whether you're a beginner or have some experience, this guide will offer valuable insights and hands-on experience with real-world applications."
Now, let's move on to the "Background" section.
Background
In the Background section, you should aim to:
- Provide Context: Offer some historical or technical background relevant to your topic.
- Explain Key Concepts: Introduce and briefly explain any essential concepts or terms that are necessary for understanding the guide.
- Establish Relevance: Explain why this topic is important or useful for the reader.
For instance, if your guide is focused on a specific application of CircuitPython, you might include:
- A brief overview of what CircuitPython is and its significance in the world of microcontrollers.
- How the project or topic you’re covering fits into the larger context of electronics or coding.
- Any specific events or developments that have made this topic particularly relevant or interesting at the current time.
An example paragraph might be:
"CircuitPython is a version of Python designed to run on tiny computers called microcontrollers, making it a perfect tool for creating interactive electronic projects. This guide focuses on [specific project or topic], a project that showcases how CircuitPython can bring electronics to life. With the increasing popularity of DIY electronics and the accessibility of tools like CircuitPython, understanding these concepts has never been more relevant for hobbyists and professionals alike."
Next, we'll draft the "Equipment" section.
Equipment
In the Equipment section, you should aim to:
- List Necessary Items: Clearly enumerate all the tools, components, and materials required for your project or topic.
- Provide Details: Offer specific details such as model numbers, sizes, or capacities when relevant.
- Suggest Alternatives: If applicable, mention alternatives for some items to accommodate different availability or budget constraints.
For example, if your guide is about a CircuitPython-based project, your list might include:
- Specific microcontroller board (e.g., Adafruit Feather M4 Express)
- Sensors or actuators relevant to the project (e.g., temperature sensor, LEDs)
- Power supply (e.g., batteries, USB cable)
- Additional tools or materials (e.g., soldering iron, breadboard, jumper wires)
- Software requirements (e.g., latest version of CircuitPython, specific libraries)
An example entry could be:
"To embark on this exciting journey, you'll need an Adafruit Feather M4 Express, which serves as the brain of our project. Alongside this, you'll require a DHT22 temperature sensor, a small breadboard, and some jumper wires for connections. Don't forget a USB cable to power your board! If you don’t have a DHT22, a similar temperature sensor will suffice, though you may need to adjust the code accordingly. Ensure you have the latest version of CircuitPython installed on your board, along with the necessary libraries which we'll discuss in the Instructions section."
Now, let's proceed to the "Instructions" section.
Instructions
In the Instructions section, your goal is to provide clear, step-by-step guidance for the reader to follow. Here’s how you can structure it:
- Sequential Steps: Break down the process into individual, numbered steps. Each step should be concise and direct.
- Detailed Explanation: Provide enough detail in each step so that even a beginner can follow along without confusion.
- Visual Aids: If possible, include images, diagrams, or screenshots to visually support the instructions.
- Code Snippets: For any coding involved, include code snippets and explain what each part does.
For instance, if your guide is about a CircuitPython project:
- Step 1: Setting Up the Microcontroller: Explain how to install CircuitPython on the microcontroller and how to prepare the development environment.
- Step 2: Assembling the Hardware: Detail how to connect the sensors and other components to the microcontroller.
- Step 3: Writing the Code: Guide the reader through writing the CircuitPython script. Break down the code into smaller sections and explain each part.
- Step 4: Testing and Debugging: Provide tips on how to test the setup and debug common issues.
An example step could be:
*"Step 3: Writing the Code: Now, let's bring our project to life with some code. Open your code editor and create a new Python file. First, we'll import the necessary libraries:
import board
,import adafruit_dht
. Next, initialize the sensor by addingsensor = adafruit_dht.DHT22(board.D4)
. This line sets up our DHT22 sensor connected to pin D4. Now, write a loop to read temperature and humidity data from the sensor and print it out. Here's a snippet to get you started: ..."After completing the Instructions, we will move on to the "Observations" section.
Observations
In the Observations section, focus on:
- Documenting Results: Describe what kind of results or output should be expected when following the instructions.
- Analyzing Behavior: Offer insights into why certain results occur, especially if they might not be intuitive.
- Encouraging Exploration: Suggest ways the reader might experiment or modify the project to observe different outcomes.
For example, if your guide is about a CircuitPython sensor project:
- Expected Results: Describe what the output of the sensor should be under normal circumstances. For instance, "Upon successfully running the script, the temperature and humidity readings from the DHT22 sensor will be displayed on your console at regular intervals."
- Understanding the Data: Explain any interesting patterns or anomalies that might be observed in the data. For example, "You may notice that the humidity readings fluctuate more than temperature. This is typical due to environmental factors such as airflow or nearby objects."
- Experimentation Ideas: Propose some variations they could try, like "Try placing the sensor in different environments – like near a window or in a closed cabinet – and observe how the readings change. This can help you understand the sensor's sensitivity and range."
Next, let's proceed to the "Conclusions" section.
Conclusions
In the Conclusions section, your goal is to:
- Summarize Key Points: Briefly recap the main objectives and findings of your guide.
- Reflect on the Learning Experience: Share what you or a reader should have learned or gained from completing the project.
- Encourage Further Exploration: Suggest additional projects, further reading, or areas of exploration related to your topic.
For instance, if your guide is about a project in CircuitPython:
- Project Recap: Summarize the main achievements of the project, such as successfully integrating a sensor with CircuitPython and interpreting its data.
- Learning Highlights: Reflect on the skills and knowledge gained, like understanding how to read sensor data with CircuitPython and the basics of electronic circuitry.
- Next Steps: Suggest how this project could be a stepping stone to more complex projects, or recommend resources for deepening knowledge in specific areas, such as advanced CircuitPython programming or exploring different types of sensors.
An example conclusion might be:
"In completing this project, you've not only learned how to integrate a DHT22 sensor with CircuitPython but also gained practical skills in reading and interpreting sensor data. This experience lays a solid foundation for diving into more complex electronics projects. Consider exploring projects that involve multiple sensors or add data logging capabilities to your current setup. For further learning, check out [relevant resources or books on advanced CircuitPython techniques]."
After drafting the Conclusions, we'll move on to the "Troubleshooting" section.
Troubleshooting
The Troubleshooting section is crucial for helping readers overcome common obstacles they might encounter. Here's how to structure it:
- List Common Issues: Identify frequent problems or errors that may arise during the project.
- Provide Solutions: Offer clear, step-by-step solutions or workarounds for each issue.
- Encourage Problem-Solving: Give tips on how to approach and solve unexpected problems independently.
For a CircuitPython project, this might include:
- Hardware Connection Issues: Describe what to check if the microcontroller is not responding or if the sensor data is not being read correctly. For example, "Ensure all wires are securely connected and the sensor is correctly wired to the specified pins on the microcontroller."
- Software and Code Errors: Address common coding mistakes or errors, such as syntax errors or library issues. For instance, "If you encounter a 'ModuleNotFoundError', make sure you have installed all the required CircuitPython libraries."
- Sensor-Specific Troubleshooting: Offer advice specific to the sensor or components used, like handling sensitivity or calibration issues.
An example troubleshooting tip could be:
"If the temperature readings seem off, first check that the sensor is not placed near heat-generating devices. Calibration might also be necessary for more accurate readings. Refer to the sensor's datasheet for specific calibration instructions."
Finally, after completing the Troubleshooting section, we will focus on the "Credits" section.
Credits
In the Credits section, it's important to acknowledge and give due credit to all the resources, individuals, or communities that contributed to your guide. Here’s how you can approach it:
- Reference Sources: List any books, articles, online resources, or tutorials that you referred to while creating your guide.
- Acknowledge Contributions: If anyone assisted you with the project, whether through advice, testing, or feedback, mention their contributions.
- Credit Community Resources: If you used any open-source code, libraries, or drew inspiration from community projects, make sure to acknowledge these sources.
For a CircuitPython project, this might include:
- Referencing Adafruit Resources: If you used any Adafruit libraries or followed any Adafruit tutorials, give them credit. For example, "This project was built using Adafruit's CircuitPython libraries, particularly for the DHT22 sensor."
- Acknowledging Individual Contributors: If fellow hobbyists, friends, or online community members provided help or inspiration, mention them by their preferred names or usernames.
- Open Source Acknowledgments: If your project includes open-source code that isn't your own, cite the original authors and provide links to the source.
An example of a credit entry might be:
"Special thanks to the Adafruit community for the extensive resources and tutorials, which were invaluable for this project. I’d also like to acknowledge [Username] from the CircuitPython forum for their insightful suggestions on optimizing sensor readings. This guide also utilizes open-source code from [Source], originally authored by [Author's Name]."
With the completion of the Credits section, your guide is now fully fleshed out! You can now review it, make any necessary edits or additions, and then prepare it for publishing on Adafruit Playground. Remember to keep the language clear and engaging to ensure it's accessible to a wide range of readers.
Credits (for real)
Dexter created the outline for this note.
ProtoEngineer, a GPT application, wrote this note.
Chat about this note, or the Adafruit Playground in general, on the #show-and-tell channel of the Adafruit Community Discord. Visit https://adafru.it to join!
-
CircuitPython Helpers Project
Maybe It's Just Me
As I work on different projects I find myself implementing similar things across projects. This has led to a lot of copy/paste work. Which in turn leads to having to update multiple projects when I find an issue or improvement.
So I decided to start a helpers project. It is essentially a set of wrapper classes that I can use across projects.
What's In The Big Pink Box?
I've just started to build this project and have started with the ones that were in use with my current projects. I plan to add more as I move to other projects.
- time_lord.py
- Provides a time singleton that supports RTC if desired
- Currently does not support using SPI and Network to get the time (maybe in a later release)
- local_logger.py
- Provides a logging singleton that supports adding/removing different handlers and accessing files on your SD card
- rotating log files is currently incomplete
- local_mqtt.py
- Provides an MQTT singleton that uses SSL by default
- Supports publishing independently or via the MQTTHandler in adafruit_logging
Any Gotchas?
I have done my best to keep all the helpers independent. I didn't want to force anyone to use local_logger just to use the time_lord wrapper.
The responsibility use the helpers together falls to the program.
How Does it Work?
I clone this project into the project in which I want to use the wrappers. From there I just copy the wrappers I'm using to my microcontroller.
Example code - implementing time_lord.py without using a real-time clock:
...
import socketpool
import wifi
import time_lord
...
pool = socketpool.SocketPool(wifi.radio)
my_time = time_lord.configure_time(pool)
...Example code - implementing local_logger with time_lord and a real-time clock:
...
import rtc
import socketpool
import wifi
import time_lord
import local_logger
...
pool = socketpool.SocketPool(wifi.radio)
rtc = RTC() # using a QTPY ESP32 Pico
my_time = time_lord.configure_time(pool, rtc)
my_log = local_logger.getLocalLogger(use_time=True)
...Example code - implementing local_mqtt with local_logger without time_lord:
...
import local_mqtt
import local_logger
...
my_log = local_logger.getLocalLogger()
my_mqtt = local_mqtt.getMQTT(use_logger=True)Where To Get the Project
You can find the project on Github
Please feel free to contribute!
- time_lord.py