Friday Hack Chat: CircuitPython With Adafruit Engineers

What the heck is CircuitPython? Get that question answered along with many more during this Friday’s Hack Chat. Three engineers from Adafruit join us as [Ladyada], [Tony DiCola], and [Scott Shawcoft] lead a CircuitPython discussion at Noon PST on 1/27/17.

CircuitPython is Adafruit’s new extension on the MicroPython codebase. It adds support for SAMD21 processors in MicroPython and reworks the API for better support across platforms and better documentation. Does this still sound like jibberish? The Python programming language has been extended to microcontrollers. CircuitPython is furthering that work and this Hack Chat is the perfect opportunity to talk with the people who are doing that work. They will also be doing a giveaway of five CircuitPlayground m0 Express boards (brand new, not yet released hardware).

Don’t miss this Hack Chat! Here’s a handy web tool to help convert Friday, January 27 at noon PST to your local time.

Here’s How to Take Part:

join-project-team-message-buttons
Buttons to join the project and enter Hack Chat

Hack Chats are live community events that take place in the Hackaday.io Hack Chat group messaging. Visit that page (make sure you are logged in) and look for the “Join this Project Button” in the upper right. Once you are part of the project, that button will change to “Team Messaging” which takes you to the Hack Chat.

You don’t have to wait for Friday, join Hack Chat whenever you like and see what the community is currently talking about.

A USB dongle is shown connected to a laptop computer. A text box in the lower right corner says "PECKUS is running in DEBUG mode, it is 3x faster in non-DEBUG mode."

A Presence-sensing Drive For Securely Storing Secrets

When we hear about flash drives in the context of cybersecurity, we tend to think of them more as threats than as targets. When you’re using flash drives to store encryption keys, however, it makes sense to pay more attention to their security. [Juergen] designed the PECKUS (Presence Enforcing Crypto-Key USB-Storage) with this specifically in mind: a few-kilobyte storage device that only unlocks if the owner’s Bluetooth device is in the vicinity.

[Juergen] needed to store an infrequently-used keyfile on an air-gapped system, and commercial encrypted flash drives were rather expensive and left much to be desired in terms of usability. Instead, he designed a CircuitPython custom firmware for MakerDiary’s nRF52840 micro development kit, which provided a BLE-capable system in the form of a USB dongle.

After flashing the firmware to the board, the user sets it up with a particular Bluetooth device and a file to be stored; after writing the file during setup, it cannot be rewritten. Before reading from the device, the user must pair the previously-set device with the board and press a button on the board, and only then does the device appear to the computer.

The limited amount of storage space means that this device will probably only serve its intended purpose, but in those cases, it’ll be handy to have an open-source and inexpensive protected storage device. [Juergen] notes that attackers could theoretically defeat this system by desoldering the microcontroller from the board and extracting the memory contents from the its storage, but if you have enemies that resourceful, you probably won’t be relying on a $20 board anyways.

We’ve previously seen a few flashdrives cross these pages, including one meant to self-destruct, and one made from a rejected microSD card.

Hardware Built For Executing Python (Not Pythons)

Lots of microcontrollers will accept Python these days, with CircuitPython and MicroPython becoming ever more popular in recent years. However, there’s now a new player in town. Enter PyXL, a project to run Python directly in hardware for maximum speed.

What’s the deal with PyXL? “It’s actual Python executed in silicon,” notes the project site. “A custom toolchain compiles a .py file into CPython ByteCode, translates it to a custom assembly, and produces a binary that runs on a pipelined processor built from scratch.” Currently, there isn’t a hard silicon version of PyXL — no surprise given what it costs to make a chip from scratch. For now, it exists as logic running on a Zynq-7000 FPGA on a Arty-Z7-20 devboard. There’s an ARM CPU helping out with setup and memory tasks for now, but the Python code is executed entirely in dedicated hardware.

The headline feature of PyXL is speed. A comparison video demonstrates this with a measurement of GPIO latency. In this test, the PyXL runs at 100 MHz, achieving a round-trip latency of 480 nanoseconds. This is compared to MicroPython running on a PyBoard at 168 MHz, which achieves a much slower 15,000 nanoseconds by comparison. The project site claims PyXL can be 30x faster than MicroPython based on this result, or 50x faster when normalized for the clock speed differences.

Python has never been the most real-time of languages, but efforts like this attempt to push it this way. The aim is that it may finally be possible to write performance-critical code in Python from the outset. We’ve taken a look at Python in the embedded world before, too, albeit in very different contexts.

Continue reading “Hardware Built For Executing Python (Not Pythons)”

EclairM0

EclairM0, The Pocket Notepad

Roughly the size of a Tic Tac container, this project packs a punch in a compact package. [Matt] sent in this beautifully documented pocket device that brings back great memories of texting on early cellphones.

The EclairM0’s firmware is written in TinyGo, a language he hadn’t used before but found perfect for a microcontroller project where storage space is tight. The 14-button input mimics early phone keypads, using multi-tapping and combo key presses to offer various functions. The small SSD1306 OLED display is another highlight. Building on an earlier CircuitPython project, [Matt] optimized the screen’s performance, speeding up its response time for a snappy user experience. The battery picked was only 3 mm thick, however the protection circuity on the battery added another 2 mm so he moved that protection circuity to the main PCB itself to keep it as thin as initially planned.

Weighing just 15 grams, this lightweight device runs on a SAMD21 microcontroller, which supports USB host functionality. This allows the EclairM0 to act as a keyboard, mouse, or even USB peripherals. Housed in a 3D-printed case, the entire project is open-source, with design and firmware files available on GitHub.

We love small handheld projects around here and this well-documented, fun pocket device is no exception, if you want your own he has a page dedicated to helping you build a EclairM0.

Continue reading “EclairM0, The Pocket Notepad”

Supercon 2024: Yes, You Can Use The Controller Area Network Outside Of Cars

Ah, the CAN bus. It’s become a communication standard in the automotive world, found in a huge swathe of cars built from the mid-1990s onwards. You’ll also find it in aircraft, ships, and the vast majority of modern tractors and associated farm machines, too.

As far as [Randy Glenn] is concerned, though, the CAN bus doesn’t have to be limited to these contexts. It can be useful far beyond its traditional applications with just about any hardware platform you care to use! He came down to tell us all about it at the 2024 Hackaday Supercon.

Continue reading “Supercon 2024: Yes, You Can Use The Controller Area Network Outside Of Cars”

Illustrated Kristina with an IBM Model M keyboard floating between her hands.

Keebin’ With Kristina: The One With The SEGA Pico Keyboard

It’s been a minute since I featured a tiny keyboard, and that’s okay. But if you want to get your feet wet in the DIY keyboarding community, making a little macro pad like [Arnov Sharma]’s Paste Pal is a great place to start.

A macro pad with five switches and a small OLED display.
Image by [Arnov Sharma] via Hackaday.IO
This is a follow-up to his original Paste Pal, which only had two buttons for copy and paste plus an OLED display. This updated version does three more things thanks to a total of five blue (!) switches. The selected command shows up on the screen so you know what you’ve done.

Right now, [Arnov] has the Paste Pal set up to do Copy, Paste, Enter, Scroll Up, and Scroll Down, but changing the assignments is as easy as updating a few lines of code.

Paste Pal Mk. II is at heart a Seeed Xiao SAMD21, which in this case is programmed in Arduino. If you want to make things easier on yourself, you could program it in CircuitPython instead, although [Arnov] includes the Arduino code in his excellent build guide.

Continue reading “Keebin’ With Kristina: The One With The SEGA Pico Keyboard”

A Bluetooth mouse in ring form.

Updated Mouse Ring Does It With A Joystick

Have you ever wished for easy mouse controls to go along with your VR headset experience? Or maybe you just want a cooler way to mouse in general. In any case, look no further than [rafgaj78]’s Bluetooth Mouse Ring project.

Side view of a Bluetooth mouse in ring form.This is version two, which of course comes with several improvements over version one. The biggest change is from tactile buttons to a joystick input. [rafgaj78] also did away with the power switch, using deep-sleep mode instead. Version two is easier to assemble and offers improved ergonomics, as well as a range of ring sizes.

Like the first version, this ring runs on a Seeed Xiao nRF52840 and is programmed in CircuitPython. There are two modes to choose from. In one mode, the joystick does left and right mouse click and wheel up and down, while the push action recovers the micro from deep sleep. In the other mode, the joystick axis is a mouse pointer mover, and you push down to left click.

We really like this sleek design, and [rafgaj78] has great instructions if you want to build your own. This isn’t the first cool mouse ring we’ve seen, and it certainly won’t be the last.