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.
-
Converting huge Offline Wippersnapper JSONL files to Excel or CSV
Set your python environment up first. Assuming you have python installed, and a healthy copy of pip, then these days it's best to setup a python virtual environment for each project, so search learn.adafruit.com for a guide how.
Get the converter here: https://github.com/tyeth/Adafruit-Wippersnapper-offline-mode-JSONL-data-converter
Once setup with a python virtual environment and inside the extracted zip (or cloned repository) install requirements:
pip install -r requirements.txtThen before running the converter, turn off + unplug the Wippersnapper Offline device. Remove it's SD card and insert into the computer, copy the logs off of the SD and into the converter folder. Finally insert the SD back into the offline logger and plug into the computer, then copy the config.json and wipper_boot_out.txt to the converter folder too.
Finally run the converter:
python jsonl_to_xlsx.py -r ./All .log files will be converted into excel files. If the data is more than 1million rows then it will be output as CSV instead. If you prefer CSV then add
--csv, and for a single merged output file then add the--mergedargument.You can run the converter without options for interactive mode, or
--helpargument to show help:
-
jq - now as a webservice! 🌍🎣🕸️ Filtering large JSON data
jq for all...?
If you've not heard of or used `jq`, then count yourself lucky, as it is the tool of choice for data scientists up a creek with no paddle... If you find yourself wresting a 2GB JSON file then you'll probably end up using jq to help. See more details of the jq command-line tool at https://jqlang.org/Using jq can be really quick and simple, but sometimes finding the right incantation to return a subset of the data can leave you feeling a bit like you've been learning FFMPEG (another great tool where I found myself deep in a tutorial one weekend).
Don't do it yourself, get AI to write that query!
Fortunately we live in the days of Large Language Models ("AI" LLMs), which like nothing more than answering humans need for the correct FFMPEG/jq arguments to solve some "critical" problem.
So don't feel like you need to learn the syntax, just throw your data and desired output format at the machines and ask for the jq syntax to achieve that!Here's an example where I threw a slightly truncated version of the 80kb json at chatGPT and asked for the output format I wanted: https://chatgpt.com/share/67c1c7a6-bf5c-8000-823c-d422593d2ed8
There's also a jq playground website, allowing you to submit your JSON and "query" or fetch the data from a website URL, and it runs entirely in the browser (WASM version of jq) at https://play.jqlang.org/
It's great, but not what I was looking for... I needed something that would allow a microcontroller with very little RAM (random access memory) to get some values from large JSON payloads, without having to download and process all the JSON data just to find a couple of values.
Microcontrollers are usually too underpowered to load a full web browser with javascript and WASM support, so ideally we need something more like a web-service that would allow a simple web request to trigger all the work and return the subset of data we're looking for.
-
Forward IO data to google sheets, using google forms (via 3rd party)
1. Create a new form at https://docs.google.com/forms/
2. Add some questions on the Questions tab, which use the Short Answer (simple values) or paragraph type (multi-line support).
3. On the Responses tab click the Link to Sheet button/link to set the responses to goto a sheet, create a new one or choose existing
-
3-Axis (X/Y/Twisty-Z + Button) Joystick (JH-D400B-MK4) remote control (CircuitPython)
https://github.com/tyeth/circuitpython-joystick-D400B-MK4/
A quick AI prompt here, dab of logging there, a blob of solder or two, followed by the realisation that the colour coded wires aren't coded...and hey presto, a joystick with twist and button to switch mode (driving forklift versus mast tilt/height control) or long press for the lights.
Display shows axis and mode, twist controls speed of motion/action, and serial prints too.
Next I'll add the connection to the forklift's remote interface (websocket), and possibly scraping the values from the input boxes on the human interface (web page).
I'd like it to be a bit more generic as to how the controller is configured for a target, but also avoid reinventing the wheel, so currently as a single use project it'll be hacky-as-can-be.
For now here's the basic code, adapt to your leisure.
-
My Chameleon3D MK4 MMU journey - The Open Source Dream?
Recently the Chameleon 3D Mk4 has been fully open sourced. I believe it was said because of the plentiful availability of multi-material units (MMU's) for 3d printers, along with a desire to receive new inspiration from open source contributors into the core design / product.
It's early days, the designs are published (3D models were already, but now the PCB (with easy JLCPCB ordering) and firmware. It's over at:
https://github.com/3DChameleon/3DChameleonMk4
The instructions are still in a form that ties to the kits, and mostly in video form, so there is a bit of assumed knowledge (like what parts you have). This will (no doubt) improve over time, as it's quite the undertaking to open source a project. Crucially the full pro version is effectively open sourced, and that includes a filament cutter!
Read more here: https://www.3dchameleon.com/forum/getting-started/open-source-files
-
ProfessorBoots Mini Forklift
This is a bit of a project diary / set of notes for myself, to log the variations on the Fork lift builds that I make / encounter. I don't want to take money from the mouth of another so I won't provide good instructions / support.
There's a free 3D Model on Printables of an RC fork lift, not that that's a new concept, but this maker Professor Boots has some lovely Remote Controlled (RC) models.
He takes requests in the youtube comments for the next model to be designed which is an interesting move.
The recent excavator and crane almost had me as they are really nice, but the models are free while parts lists and instructions are not (which is a fair/interesting model). The software is free though, so you "could" DIY.He has a skid-steer model (a beginner level RC model) that includes free instructions + BOM as an example of what paying for his workshop guides offers (like software guidance along with instructions, parts buying links, custom pcbs if needed, and general hand holding).
I've considered it a couple of times, but then this fork lift model dropped a few weeks ago, designed to be another beginner level model, and I was hooked (I love forklifts/diggers/tractors - my first word).
I decided to pay for the course in the future, but first, as it's meant to be beginner level and in theory understandable with just the model and youtube video, I decided to have a go without the instructions and just build one out of what I've got lying around...
From the video it looked like it has N20 motors for driving, servos for steering + forklift mast angle, and an ESP32 on a custom PCB with some nice stubby lithium rechargeable batteries.
After closer inspection there are 3 N20 motors (one per front wheel and one for mast height), but no idea what RPM required.
I decided to attempt to use these dollar motor drivers, along with some tiny esp board, but then I got all modular in my head and thought I wonder if Adafruit Feathers or even a doubler would fit.
Sadly the doubler is sooo close but the model would need trimming, however a feather would fit, probably stacked with a DC motor or servo featherwing.Then I tried the MG90S servos instead of the blue SG90 ones in the video.
And by tried I mean I imported the Main Body .STL file into OnShape (free cad online), and started importing things like servos and feathers to see how well they aligned in the model of the forklift body.
CAD was also a great way to see how some of the parts might fit together, but I decided to guess instead.It was too tight to use all the things I wanted, the doubler was a no, the AA batteries no, I could do AAA's or some random lipo to be decided in the future. Using continuous servos instead of N20 motors was also out without major body adjustment, so I decided to do a minor boolean operation for the MG90S as a steering servo and leave it at that (the main mast etc was printing at this point).
Test Fitting
Generally good, although not great, but maybe good enough with a tiny bit of cleanup. I should have used supports on some bits, and looking again at the video I can see the mast servo support blocks (above the N20 wheel motors) have been printed with supports.
First assembly of the mast I've used sewing thread, which lasted a few days and many cycles, but by the time I was on my umpteenth cycle of test fitting circuitry before soldering - it snapped. Since then I've grabbed some thin fishing line which I had bought for circuit board / making projects and threaded that up, it's a bit too thin (0.20mm 3.2kg) but I have another thicker size (0.25mm 5.0kg) that I may use for the second forklift.
I think for the first version I've decided it's the Adafruit MiniBoost 5V @1Amp TPS61023 to give the servos 5volts, and rely on the N20 motors running at whatever I give them (I purchased some 3V-6V version a while back and have 3 left) directly from the battery. The brain will be an Adafruit Feather ESP32 v1 "Huzzah32", which will supply the servo signals, and be connected to a DC Motor Featherwing to drive all the motors.
-
Replicating an Adafruit IO group + feeds many times
A user contacted support wondering how best to duplicate a group with a bunch of feeds inside.
They required 20 duplicate copies / groups, with the group name having an increasing number.
It's worth noting that Adafruit provide various libraries to make accessing the IO platform easier.
Find them on GitHub for python, arduino, circuitpython, and various unofficial libraries.On top of that there is an HTTP API which would probably be the easiest way (see the docs here).
The last thing is that various API endpoints for Adafruit IO actually support creating feeds, for example create a group then post data for multiple non-existant feeds to: https://io.adafruit.com/api/v2/
{{io_user}}/groups/{{group_name}}/data
with a payload similar to this: -
Set your sensor polling frequency to anything - WipperSnapper + API "testing" Adafruit IO
I work on Adafruit IO, and I've had this mischievous plan for a while to adjust my WipperSnapper no-code sensor devices to poll more frequently than the 30s minimum that the web interface offers, like maybe as low as 5seconds to avoid burning my toast (having recently tried measuring the particle emissions again but found it too infrequent).
So Saturday morning I was having a prod at the firmware (you can too as it's open source code) and watching the API calls in the network monitor to see where gets prodded when the user changes a sensor to read every 30s.
-
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/ ]
-
Using multiple WiFi network credentials in Adafruit IO WipperSnapper firmware
As of July 23rd 2024, we've added support into WipperSnapper for specifying backup wifi credentials, simply by adding an array of entries under the new key "alternative_networks" in your secrets file.
You can have up to 3 alternative/backup network configs, plus the original one. What original one? And what does it all look like? Well let's go through an example:
-
SerialFruit Connect - A bookmarklet to replace Adafruit BlueFruit Connect apps + Add WiFi/USB/BLE for all!
So what's this project for? Scott (CircuitPython Lead Developer a.k.a @tannewt on GitHub and Discord) has been working on ESP32 bluetooth in Circuitpython and I'm excited, so much so I wanted to test out the Bluefruit related projects in anticipation of the upcoming ESP support. I read a bunch and then thought surely we can do that with web workflow, or even web-BLE (bluetooth connections in the browser)...
Click a button in your browser and a magic panel appears on code.circuitpython.org or your web workflow circuitpython device. That panel expands to reveal all the same* screens and functionality as the Adafruit Bluefruit Connect mobile apps (plus extras), but accessible to WiFi users for the first time! *Soon there will be BLE and USB and WiFi support for all the screens/functions of the mobile app, but for now I decided to get started recreating John Parks "CircuitPython BLE Rover" which uses the Bluefruit Connect "ColorPacket" and "ButtonPacket" type of packets (the only ones I've tested so far).
Why that Guide? Well, I have an old toy tank that has been in need of repurposing for a while, and I just recently received the Crickit Featherwing (CRICKIT = Creative Robotics & Interactive Construction Kit) and that BLE Rover guide was one of the first guides that I found matching my need to quickly prototype some kind of robotic tank thing.
-
Using CIRCUP with Web-Workflow
Thanks to some hard work by Vladimir Kotal (@vladak)❤️, an open-source community contributor on GitHub who added this pull request, and thanks to our own CircuitPython wizard Tim (@foamyguy), there is now the ability to use
circupwith the web-workflow.I had a play by pulling from github last month as I was desperate. I had a device that was going to be left plugged into the mains, which was running out-of-date code and libraries (but otherwise functional), and so along the way fixed a couple of issues for Windows users or anyone needing libraries with nested folders.
Install
circup, at least version 1.6.1:To begin with we'll explore how install and to use it, then I'll take you through my specific example...
Install latest CIRCUP:
pip install circup --force[ --force forcefully overwrites / upgrades]
-
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.
-
Recreating Disabled Adafruit IO Feeds - after resubscribing/mistakes
This will delete and recreate all feeds that are disabled, except those that are part of WipperSnapper devices (you can now export those and then delete the device and re-import the exported JSON file).
You'll need the adafruit-io python library, which is normally installed with this command:
pip install adafruit-ioHowever I've modified the adafruit-io library to add the enabled flag, and it's not released yet so for now you'll want the following command instead:
pip install git+https://github.com/adafruit/Adafruit_IO_Python.git#add-enabled-attributeHere's the script:
-
Memento: Flicking USB ReadOnly/Write@Boot + Setting WiFi using QRCode
So you want your friends/family/strangers to enjoy the luxury of modern technology, scanning a QR-code to join a wifi network, but wait...you want to save that in
settings.tomltoo? Sheeesh, a tall order, lets get on with it then!We'll need to check a button at boot to decide if the Memento camera has write access to the flash drive, or the PC. Then we can update the
settings.tomlfile if it's writable, and either way we can offer to join the network listed in the QRcode.The code example can be found here:
https://github.com/tyeth/Adafruit_CircuitPython_PyCamera/tree/wifi-qrsetup/examples/qrio-update-wifiThere are two files, the
boot.pywhich handles the first load when the device is turned on or reset button is pressed. It prints a message to the screen and waits 2.5seconds before checking for the shutter button being held down, and then does the switching / flicking between read-only for the USB / PC, or read-only for the Memento camera (circuitpython). See here: https://github.com/tyeth/Adafruit_CircuitPython_PyCamera/blob/wifi-qrsetup/examples/qrio-update-wifi/boot.py