Skip to content

Instantly share code, notes, and snippets.

@stonehippo
stonehippo / ssd1306_I2C_setup.py
Last active January 7, 2025 22:50
Basic setup of an SSD1306-based I2C display using CircuitPython Display
import board
import displayio
import terminalio
import adafruit_displayio_ssd1306
from adafruit_display_text import label
from adafruit_displayio_layout.layouts.grid_layout import GridLayout
# release any displays that have already been set up
displayio.release_displays()
@stonehippo
stonehippo / pseudo-screamer.ino
Created August 8, 2022 02:19
A quick test of the screamer
#define SOUND_TRIGGER 9 // the pin attached to a trigger on the sound FX board
void setup() {
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
// set up the pin for the sound trigger, including pulling it high
pinMode(SOUND_TRIGGER, OUTPUT);
digitalWrite(SOUND_TRIGGER, HIGH);
@stonehippo
stonehippo / printrbot_simple_maker_modern_marlin.md
Last active July 31, 2025 17:13
Installing modern Marlin firmware on a PrintrBot Simple Maker 1405

Installing a modern Marlin firmware on PrintrBot Simple Maker 1405

note: I created a repo with the firmware I generated at the time I wrote this gist. If you want to see the config, try out the firmware, or have a go at building your own, you can check it out at https://github.com/stonehippo/printrbot_simple_maker_1405_firmware

The first 3D printer I acquired is a PrintrBot Simple Maker, a little 3D printer kit from the early days of DIY RepRap. I've had this little mostly plywood printer for years, and it taught me a lot about additive manufacturing and 3D design. I have updated and upgraded it multiple times, and like a robotic Ship of Theseus, I've replaced enough components that it's fair to say the device I'm using now is barely the same machine I put together the first time I opened that box of parts. The extruder now is a pretty nice aluminum unit (the second metal version I've installed) and a far cry from the laser-cut plywood assembly I started with. The chassis was upgraded from the origina

@stonehippo
stonehippo / wio_terminal_cricuitpython_rtl_support_notes.md
Last active December 1, 2024 22:22
Working notes for getting Seeed WIO Terminal WiFi & BLE working with CircuitPython

CircuitPython support for WiFi and Bluetooth LE on Seeed WIO Terminal

I won't be updating this gist any longer. Updated versions of these notes can be found here.

Context

The Seeed WIO Terminal is generally supported by CircuitPython, but there is no implementation for access to the WiFi or Bluetooth LE networking functions on the board. After taking a look at the Arduino support for these features, I can see that the RealTek RTL8720D is set up to be driven by a UART connection from the SAMD51 that acts as the main controller for the WIO Terminal. In other words, the RTL8720D is set up as a co-processor, similar to the ESP32 in Adafruit's Airlift modules.

The UART driver is based on an [embedded remote procedure call (eRPC) libr

@stonehippo
stonehippo / wio-terminal-circuitpython.md
Last active December 1, 2024 19:15
Using CircuitPython modules to work with the Seeed Wio Terminal

Seeed Wio Terminal Circuitpython Modules

note: All of these examples have been tested with the latest version of CircuitPython, which as of this writing was 7.2.4. Some of these examples may require tweaks in older or later versions, due to change in the drivers.

The Seeed Wio Terminal is a nifty connected device development kit. Built around a SAMD51 Cortex-M4 microcontroller and a Realtek RTL8720DN for WiFi and Bluetooth, plus an integrated display and a collection of handy sensors, the Wio Terminal is a great platform for IoT and smart device development.

One of the nice things about the Wio Terminal is the number of options available for developement platforms. You can choose the long-time hardware hacking favorite Arudino, MicroPython or Ardupy, an interesting blend of MicroPython and Arduino. And there's support for my

@stonehippo
stonehippo / arduino-cli_aliases.zsh
Created January 21, 2022 13:04
Arduino CLI shorthand aliases
# Arduino CLI shortcuts
# Compile and upload; add the USB port to the end or it will error
# Arduino Uno
alias ac-uno="arduino-cli compile -b arduino:avr:uno -u -p"
# Arduino Pro or Pro Mini, at 3.3v/8MHz or 5v/16Mhz
alias ac-pro-8mhz="arduino-cli compile -b arduino:avr:pro:cpu=8MHzatmega328 -u -p"
alias ac-pro-16mhz="arduino-cli compile -b arduino:avr:pro -u -p"
@stonehippo
stonehippo / README.md
Last active January 17, 2022 01:52
Fixing CircuitPython Blinka displayio to work with the MCP2221A

Fixing CircuitPython Blinka displayio to work with the MCP2221A

Dependencies

  • Adafruit CircuitPython Blinka, configured to work with the MCP2221A breakout
  • Adafruit CircuitPython Blinka DisplayIO
  • Adafruit CircuitPython Display Text
  • Adafruit CircuitPython Bitmap Font

Issues to address

@stonehippo
stonehippo / README.md
Last active January 16, 2022 23:12
Zsh aliases for managing access with the Adafruit MCP2221A breakout

Zsh aliases for Adafruit MCP2221A breakout

The AdafruitMCP2221A breakout is a handy little board for adding peripherals to a computer via USB. It provides UART, similar to a standard USB to serial interface, and adds GPIO, ADC, DAC, and I2C. This means you can use your computer to directly read sensors or control devices directly, without using a microcontroller.

Adafruit has added support for the MCP2221A to the CPython port of CircuitPython (Blinka). This means that you get a nice Python interface to work with all sorts of fun stuff.

The aliases in this gist reflect some settings that are needed in my MacOS setup to work with the MCP2221A breakout. I am using the now-default zsh, supplemented by the excellent Oh My Zsh, so I put this file in OMZ's custom location, $ZSH_CUSTOM.

For more information on the breakout, and getting it set up with Windows, MacOS, and Linux, check out

@stonehippo
stonehippo / minute_timer.ino
Created November 23, 2021 13:20
A trivial Arduino application showing delaying an event synchronously for some number of minutes
#define SECOND 1000 // 1 sec = 1000 millseconds
#define MINUTE 60 * SECOND // 60 sec = 1 minute
void setup() {
Serial.begin(115200);
randomSeed(analogRead(0)); // choose a pseudo-random starting seed
}
void loop() {
WaitForNMinutes();
@stonehippo
stonehippo / gourd.ino
Created October 29, 2021 21:28
Carved gourd/pumpkin flicker with an Arduino and NeoPixels.
// A simple pumpkin/gourd flicker light
// Written by 2021 George White ([email protected])
// This code is in the public domain
//
// I built this to power a little carved gourd for a company function.
// I ran it on an Adafruit Trinket 3.3V with two NeoPixels dots, but it
// should work on pretty much any Arduino-compatible board. The main
// thing you'd have to change it the PIXEL_PIN.
#define PIXEL_PIN 0