Converting Pixel Art for Matrix Portal

“The spice must flow”

I tried my hand at pixel art and discovered I cannot do it. But I wanted to honor Justin in a pixel arty way, so I instead tried my hand at converting some of his pixel art for display on a 32×64 RGB LED matrix driven by a Matrix Portal driving. This wasn’t so easy. First, scaling down the already abstracted ~250×250 pixel images to something around 32×64 doesn’t look right if you use normal resize techniques: the results are too fuzzy. Thankfully ImageMagick has an “–adaptive-resize” option that preserves the sharp color transitions of pixel art. Secondly, most of his art was relatively 1:1 square in proportion but the LED matrix is a 2:1. This means some editorial cropping of the images to keep the most salient parts visible. Not an easy task when every pixel counts. I hope I did them justice.

More Spoooky CircuitPython Circuits

Here’s two more “Spoooky CircuitPython Circuits” using the QT Py board and purposefully small programs, part of my QT Py Tricks series. Go there for the source code. The first circuit is a pair of OLED displays arranged like eyes. Behind a mask it looks really good!

The second circuit is the old trick of using capacitive touch sensors in an analog proximity mode. The result can be pretty twitchy and highly dependent on environment and power supply, but it looks good on camera! :-) And in a more defined use (like on a PCB) can give repeatable results, like the “analog” A input on my TrinketTrigger Eurorack module.

Spoooky CircuitPython Circuits!

After using Python for a decade, I’ve decided to finally get better at it. I think diving into CircuitPython will be a nice scaled-down universe to learn to write concise “Pythonic” code. For hardware I’m using Adafruit’s new QT Py board and CircuitPython’s new ESP32-S2 support. And for a theme this month I want to do “spooky circuits”, sort of a callback to my Spooky Arduino class from 2006.

I’ve been working on a “QT Py Tricks” page on github, where I’m cataloging for myself how to do basic microcontroller things in CircuitPython, in the even more reduced footprint that the QT Py and Trinket M0 boards provide (they don’t have the extra flash space that enables about half of CircuitPython’s abilities, e.g. see the support matrix)

Here’s two of the spooky projects I have so far: a tiny fire simulation and a scary servo eyeball. For the code, check out the QT Py Tricks page. Stay tuned for more!

Prevent annoying Mac ._ files on CIRCUITPY

Example: Unzip & Download files to CIRCUITPY

The entire process in a single session, using a neopixel example:

% unzip adafruit-circuitpython-bundle-6.x-mpy-20201003.zip
% xattr -cr adafruit-circuitpython-bundle-6.x-mpy-20201003
% cd adafruit-circuitpython-bundle-6.x-mpy-20201003
% cp lib/{neopixel.mpy, adafruit_pypixelbuf.mpy} /Volumes/CIRCUITPY/lib
% cp examples/neopixel_simpletest.py /Volumes/CIRCUITPY/code.py

(Or like JP suggests in the comments, you can use “cp -X” to not copy extended attributes: e.g. cp -X /examples/neopixel_simpletest.py /Volumes/CIRCUITPY )

Background

On the Mac, the OS stores a bunch of different meta information about files inside those files. These are called “Extended Attributes” or “xattrs”. If you copy a file on a Mac to a thumbdrive or network share that doesn’t support extended attributes, macOS attempts to convert those xattrs to a plain file format. That’s what the ._ and .DS_Store files are.

These files are normally just an annoyance, but for CircuitPython devices with little flash storage space, like the Trinket M0 or QT Py, it can be a real problem. So here’s some tips.

Treat files as contaminated and No Finder

If you have a folder on your Mac with files you want to copy to the CIRCUITPY drive, do not use the Finder to copy the files. Or to look at the directory those files are in. Or to look at the CIRCUITPY drive. Instead you must use the command-line. Any time the Finder shows you files, it may recreate these xattrs or the ._ files on CIRCUITPY.

See extended attributes with xattrs

The system tool xattrs lets you examine extended attributes. For instance, let’s say you just downloaded and unzipped the latest CircuitPython library bundle. In the Terminal, you can run xattr -r on the directory to see all attributes on all files in that directory. The example below shows how they all have the quarantine attribute set because it’s a file downloaded from the Internet.

% xattr -r adafruit-circuitpython-bundle-6.x-mpy-20201003
adafruit-circuitpython-bundle-6.x-mpy-20201003/VERSIONS.txt: com.apple.quarantine
adafruit-circuitpython-bundle-6.x-mpy-20201003/examples/lsm303_simpletest.py: com.apple.quarantine
adafruit-circuitpython-bundle-6.x-mpy-20201003/examples/is31fl3731_pillow_numbers.py: com.apple.quarantine
[...]

Delete extended attributes with xattrs

You can delete these attributes on all files in a directory with one command. Copy the files immediately after doing so before the Finder recreates them.

% xattr -cr adafruit-circuitpython-bundle-6.x-mpy-20201003

Remove existing ._ files with dot_clean

If you accidentally copied files without using xattr -c or otherwise have ._ files. You can delete them by hand or use the system tool dot_clean to remove them from the whole drive:

% dot_clean /Volumes/CIRCUITPY

Any time it feels you’re running low on CIRCUITPY disk space, check to see it’s not full of these dang meta info files.

Most of the stuff about xattr came from this nice post by JayRizzo on StackOverflow.

Eurorack diversion: PT2399 Karaoke delay module hack

I’ve not been working on my Touring Machine Eurorack modular synth module, but I have been hacking a bit in that space. Back in 2019 John Park and I saw the Waveform Magazine DIY PT2399 delay module article. I got the parts and half-assembled mine, but the build guide was pretty vague in some areas so I just left it. This week I picked it up again and got it working!

The PT2399 chip is a weird little beast but is very cheap for a delay unit. The ebay listing for a fully-built PCB with preamps and jacks is <$9 (and forms the basis for the Waveform module).

Some quick hacks on it and it turns into a usable Eurorack delay module that’s also noisy and distorty, which can be fun. Here’s a little demo video of it in action:

Also to make it more usable with Eurorack-level audio signals, I added a 10k trimpot to the input jack, before the “mic2” input, kind of like the pic below. It provides you with a much more usable range on the “wet” knob before it distorts.

Touring Machine First PCBs!

Last week I submitted PCBs to be fabbed and got them back this week. They look pretty good! I’ve not soldered anything down yet but the footprints are all good except for the rotary encoder mounting holes. The Eagle part I used has them at 2.05mm but they need to be 2.4mm. I need to track down where I got that footprint because it’s clearly wrong. In the next few days I’ll be soldering it up in sections and testing them out. On the UI front, I’ve been using my “knobtester” board and a small neopixel strip to explore UI thoughts. It’s been fun. But otherwise not much movement on this project, so please enjoy this little chill jam I did instead of working on it, and ostensibly part of the “30 sounds” effort.

TouringMachine connector test

One of the benefits of having a easily-generated CAD model of a PCB with components, it becomes possible to test possible interference and clearance of connectors and cables. In this case I was worried the Eurorack power cable (2×5 IDC connector) might interfere with the micro-USB plugged into the ItsyBitsy M4. So far looks good. So I sent the board to fab and should have some to play with next week.