Oct 162020
 

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.

 Posted by at 1:52 pm
Oct 092020
 

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!

 Posted by at 11:28 am
Oct 032020
 

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.

 Posted by at 10:48 pm
Oct 022020
 

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.

 Posted by at 1:04 pm
Sep 182020
 

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.

 Posted by at 11:57 am
Sep 112020
 

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.

 Posted by at 10:47 am
Sep 032020
 

When designing my new Touring Machine synth module, two things worry me: the analog I/O section (it must be pitch-accurate) and the user interface. The UI feels like a harder problem because I’m not sure what I want. For the analog part, I can lean on others (like Émilie and Thea) and that puts me at ease.

So to address the UI as its own thing, I made a little “knobtester” PCB that is the scale and layout of the upper third of the module. It contains all the things you put your fingers on: a rotary encoder w/ switch, two buttons, and two potentiometers. Just from the outset there are questions: Should the encoder have detents? What’s the spacing of the two pots so your fingers can grasp them? Should the pots have knobs or be trimmers? How tall do the tact switches need to be? Making the board physical answered some of these questions immediately (“yes”, “as much as possible”, “trimmers, maybe with micro knobs“, and “13mm”)

Here’s the board fresh off the Othermill.

 Posted by at 1:15 pm