Skip to content

Instantly share code, notes, and snippets.

Avatar

George White stonehippo

View GitHub Profile
@stonehippo
stonehippo / notes.md
Last active May 19, 2022
Working notes for getting Seeed WIO Terminal WiFi & BLE working with CircuitPython
View notes.md

CircuitPython support for WiFi and Bluetooth LE on Seeed WIO Terminal

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 remoter procedure call (eRPC) library on the Arduino side. This is good news, because it means that there is a chance that the driver can be implemented in CP! In theory, this can be built

@stonehippo
stonehippo / wio-terminal-circuitpython.md
Last active May 10, 2022
Using CircuitPython modules to work with the Seeed Wio Terminal
View wio-terminal-circuitpython.md

Seeed Wio Terminal Circuitpython Modules

note: All of these examples have been test 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 cu

@stonehippo
stonehippo / arduino-cli_aliases.zsh
Created Jan 21, 2022
Arduino CLI shorthand aliases
View arduino-cli_aliases.zsh
# 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 Jan 17, 2022
Fixing CircuitPython Blinka displayio to work with the MCP2221A
View README.md

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
Created Jan 16, 2022
Zsh aliases for managing Ardupy
View README.md

Zsh aliases for Ardupy

Zsh aliases for an installation of Ardupy using a Python virtualenv set up using pyenv.

Aliases

Alias Command Notes
ardupy_enable enable Ardupy virtualenv
ardupy_disable disable Arupy virtualenv
@stonehippo
stonehippo / README.md
Created Jan 16, 2022
Zsh aliases for managing Ampy
View README.md

Zsh aliases for ampy

Zsh aliases for an installation of ampy using a Python virtualenv set up using pyenv.

Aliases

Alias Command Notes
ampy_enable enable ampy virtualenv
ampy_disable disable ampy virtualenv
@stonehippo
stonehippo / README.md
Last active Jan 16, 2022
Zsh aliases for managing access with the Adafruit MCP2221A breakout
View README.md

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 Nov 23, 2021
A trivial Arduino application showing delaying an event synchronously for some number of minutes
View minute_timer.ino
#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 Oct 29, 2021
Carved gourd/pumpkin flicker with an Arduino and NeoPixels.
View gourd.ino
// A simple pumpkin/gourd flicker light
// Written by 2021 George White (stonehippo@gmail.com)
// 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