Skip to content

Instantly share code, notes, and snippets.

@dglaude
dglaude / code.py
Created May 16, 2021 00:11
Hidden Mouse Jiggler
import time
import board
import digitalio
import storage
import usb_hid
from adafruit_hid.mouse import Mouse
import usb_cdc
#usb_hid.enable(devices=(usb_hid.MOUSE,)) ###AttributeError: 'module' object has no attribute 'MOUSE'
@dglaude
dglaude / code.py
Created May 10, 2021 13:39
Thermal camera mono-source multiple platform
### Thermal camera mono-source multiple platform:
###
### On a FeatherWing Keyboard:
### 'FeatherS2 with ESP32S2'
### 'Adafruit Feather RP2040 with rp2040'
###
### With build in screen:
### 'Adafruit CLUE nRF52840 Express with nRF52840'
### 'Adafruit Matrix Portal M4 with samd51j19' + 32x64 Matrix
### If a 64x64 matrix (or two time 32x64) then the following
@dglaude
dglaude / code.py
Last active May 10, 2021 22:11
MLX90640 + FeatherWing Keyboard bilinear upscalling and displayio pixel stretching with Feather RP2040 and Feather S2
### MLX90640 + FeatherWing Keyboard bilinear upscalling and displayio pixel stretching
### Feather RP2040: Reach 4x bilinear x2 pixel doubling
### Feather S2: Reach x5 bilinear x2 pixel doubling
### Detect what Feather is in use and adapt
# Input is 32x24
# Make use of ulab for fast math operation on matrix
# Split ulab operations to minimise memory consumption by temporary variable
#from bbq10keyboard import BBQ10Keyboard, STATE_PRESS, STATE_RELEASE, STATE_LONG_PRESS
@dglaude
dglaude / scale_x5_x2.py
Last active May 10, 2021 22:12
WIP: Thermal Camera++ FeatherS2 + FeatherWing Keyboard + MLX90640 + ulab x5 bilinear scaling + x2 displayio scaling
from bbq10keyboard import BBQ10Keyboard, STATE_PRESS, STATE_RELEASE, STATE_LONG_PRESS
from adafruit_stmpe610 import Adafruit_STMPE610_SPI
import adafruit_ili9341
import adafruit_sdcard
import digitalio
import displayio
import neopixel
import storage
import board
import time
@dglaude
dglaude / scale_x4_x2.py
Created May 2, 2021 22:55
WIP: Thermal Camera++ FeatherS2 + FeatherWing Keyboard + MLX90640 + ulab x4 bilinear scaling + x2 displayio scaling
from bbq10keyboard import BBQ10Keyboard, STATE_PRESS, STATE_RELEASE, STATE_LONG_PRESS
from adafruit_stmpe610 import Adafruit_STMPE610_SPI
import adafruit_ili9341
import adafruit_sdcard
import digitalio
import displayio
import neopixel
import storage
import board
import time
@dglaude
dglaude / alternative_64_colours.py
Last active May 10, 2021 22:13
mlx90640 thermal camera on CLUE with x2 bilinear scaler using ulab + x3 with displayio scale
### mlx90640_scalex2_clue.py + 64
### same as mlx90640_scalex2_clue.py but with 64 colours rather than 32 => need one optimisation on memory size.
import time
import board
import busio
import adafruit_mlx90640
import displayio
import terminalio
@dglaude
dglaude / code_2x.py
Last active January 16, 2024 06:36
ulab 2x, 3x image upscaling in CircuitPython
# Double size upscaling of an array by @v923z
import ulab
n = 4 # input size, the thermal sensor is 8x8
b = ulab.array(range(n * n)).reshape((n, n)) # dummy data for testing
a = ulab.zeros((2*n-1, 2*n-1)) # the upscaled image
# Some magic by @v923z
a[::2,::2] = b
a[1::2,::2] = 0.5 * (b[:-1,:] + b[1:, :])
@dglaude
dglaude / mapping_Physical_to_BMC.py
Created April 3, 2021 22:43
Having Physical Pin number for the Pi under Blinka
#GPIO_P1 = 3V3
#GPIO_P2 = 5V
GPIO_P3 = D2
#GPIO_P4 = 5V
GPIO_P5 = D3
#GPIO_P6 = GND
GPIO_P7 = D4
GPIO_P8 = D14
#GPIO_P9 = GND
GPIO_P10 = D15
@dglaude
dglaude / ico2.py
Created March 26, 2021 21:14
CO2 sensor on small OLED controled by an RP2040.
#
# Strongly inspired by https://learn.adafruit.com/i-vote-d-pin/code
# Made by Collin Cunningham
# With other fonts and basic code from the scd30 CO2 sensor.
#
import board
import time
from adafruit_debouncer import Debouncer
import digitalio
@dglaude
dglaude / notes.md
Created March 23, 2021 21:34
Option for a CO2 sensor with CircuitPython

Feather selection

FeatherS2 => StemmaQT connector for the sensor and Wifi to upload the measurement to Adafruit.io Feather nRF52840 => StemmaQT connector for the sensor and BLE to broadcast the values Feather STM32 => StemmaQT connector and SD card reader Feather M4 => no StemmaQT connector, no SD card, would require an FeatherWing AirLift to upload the measurement to Adafruit.io

FeatherWing

Adalogger FeatherWing => Has RTC and microSD card reader