The Whole Thing In Python

[hsgw] built a macropad in Python, and that’s not a strange language to choose to program the firmware in these days. But that’s just the tip of the iceberg. The whole process — from schematic capture, through routing and generating the PCB, and even extending to making the case — was done programmatically, in Python.

The macropad itself isn’t too shabby, sporting an OLED and some nice silkscreen graphics, but the whole point here is demonstrating the workflow. And that starts with defining the schematic using skidl, laying out the board with pcbflow, which uses a bunch of KiCAD footprints, and then doing the CAD design for a case in cadquery, which is kind of like OpenSCAD.

The result is that the whole physical project is essentially code-defined from beginning to end.  We’re not sure how well all the different stages of the workflow play together, but we can imagine that this makes versioning a ton easier.  Coding a PCB is probably overkill for something simple like this — you’d be faster to lay it out by hand for sure — but it doesn’t really scale.  There’s definitely some level of complexity where you don’t want to be clicking an pointing, but rather typing. Think of this as the “hello world” to designing in code.

Some of the tools in the workflow were new to us, but if you’d like an in-depth look at cadquery, we’ve got you covered. [Tim Böscke]’s insane CPU made from 555 timers (yes, really) uses pcbflow. And if you’d like to dig back a bit into the origins of Python PCB design, this post introduces CuFlow, on which pcbflow was based.

GitHub ESP32 OTA Updates, Now In MicroPython Flavor

Wouldn’t it be great if you could keep all of your small Internet-connected hacks up to date with a single codebase? A couple of weeks ago, we wrote up a project that automagically pulls down OTA updates to an ESP32 from GitHub, using the ESP32 C SDK. [Pascal] asked in the comments, “but what about MicroPython?” Gauntlet thrown, [TURFPTAx] wrote ugit.pya simple library that mirrors all of the code from a public GitHub Python repo straight to your gizmo running Micropython.

[Damped] wrote in about Senko, another library that does something very similar, but by then [TURFPTAx] was already done. Bam! Part of the speed is that MicroPython includes everything you need to get the job done – parsing streamed JSON was the hard part with the original hack. MicroPython makes those sorts of things easy.

This is one of those ideas that’s just brilliant for a hacker with a small flock of independent devices to herd. And because ugit.py itself is fairly simple and readable, if you need to customize it to do your own bidding, that’s no problem either. Just be sure that when you’re storing your WiFi authentication info, it’s not publicly displayed. ([TURFPTAx], could I log into your home WiFi?)

What’s [TURFPTAx] going to be using this for? We’re guessing it’s going to be deploying code to his awesome Open Muscle sensing rigs. What will we be using it for? Blinky Christmas decorations for the in-laws, now remotely updatable without them having to even learn what a “repo” is.

Continue reading “GitHub ESP32 OTA Updates, Now In MicroPython Flavor”

Taking (Good) Pictures Of PCBs

Snapping pictures is not technically difficult with modern technology, but taking good photographs is another matter. There are a number of things that a photographer needs to account for in order to get the best possible results, and if the subject matter isn’t particularly photogenic to start with it makes the task just a little more difficult. As anyone who’s posted something for sale online can attest, taking pictures of everyday objects can present its own challenges even to seasoned photographers. [Martijn Braam] has a few tricks up his sleeve for pictures like this in his efforts to photograph various circuit boards.

[Martijn] has been updating the images on Hackerboards, an online image reference for single-board computers and other PCBs, and he demands quality in his uploads. To get good pictures of the PCBs, he starts with ample lighting in the form of two wirelessly-controlled flashes in softboxes. He’s also using a high quality macro lens with low distortion, but the real work goes into making sure the image is sharp and the PCBs have well-defined edges. He’s using a Python script to take two pictures with his camera, and some automation in ImageMagic to composite the two images together.

While we’re not all taking pictures of PCBs, it’s a great way of demonstrating the ways that a workflow can be automated in surprising ways, not to mention the proper ways of lighting a photography subject. There are some other excellent ways of lighting subjects that we’ve seen, too, including using broken LCD monitors, or you can take some of these principles to your workspace with this arch lighting system.

Play DOOM On Seven-Segment Displays

Getting DOOM to run on a computer it was never meant to run on is a fun trope in the world of esoteric retro computers. By now we’ve seen it run on everything from old NES systems to microwaves, treadmills, and basically anything with a computer inside of it. What we don’t often see are the displays themselves being set up specifically to run the classic shooter. This build might run the game itself on ordinary hardware, but the impressive part is that it’s able to be displayed on this seven-segment display.

This build makes extensive use of multiplexers to drive enough seven-segment displays to use as a passable screen. There are 1152 seven segment digits arranged in a 48 by 24 array, powered by a network of daisy-chained MAX7219 chips. A Python script running on a Raspberry Pi correlates actual image data with the digit to be displayed on each of the segments, and the Raspberry Pi sends all of that information out to the screen. The final result is a display that’s fast enough and accurate enough to play DOOM in a truly unique way.

There is much more information available about this project on their project page, and they have made everything open source for those who wish to follow along as well. The project includes more than just the ability to play DOOM, too. There’s a built-in video player and a few arcade programs programmed specifically to make use of this display. Perhaps one day we will also see something like this ported to sixteen-segment displays instead of the more common seven-segment.

This Found-Sound Organ Was Made With Python And A Laser Cutter

Some readers will no doubt remember attaching a playing card to the front fork of their bicycle so that the spokes flapped the card as the wheel rotated. It was supposed to sound like a motorcycle, which it didn’t, but it was good, clean fun with the bonus of making us even more annoying to the neighborhood retirees than the normal baseline, which was already pretty high.

[Garett Morrison]’s “Click Wheel Organ” works on much the same principle as a card in the spokes, only with far more wheels, and with much more musicality. The organ consists of a separate toothed wheel for each note, all turning on a common shaft. Each wheel is laser-cut from thin plywood, with a series of fine teeth on its outer circumference. The number of teeth, as calculated by a Python script, determines the pitch of the sound made when a thin reed is pressed against the spinning wheel. Since the ratio of teeth between the wheels is fixed, all the notes stay in tune relative to each other, as long as the speed of the wheels stays constant.

The proof-of-concept in the video below shows that speed control isn’t quite there yet — playing multiple notes at the same time seems to increase drag enough to slow the wheels down and lower the pitch for all the notes. There appears to be a photointerrupter on the wheel shaft to monitor speed, so we’d imagine a PID loop to control motor speed might help. That and a bigger motor that won’t bog down as easily. As for the sound, we’ll just say that it certainly is unique — and, that it seems like something [Nicolas Bras] would really dig.

Continue reading “This Found-Sound Organ Was Made With Python And A Laser Cutter”

A Spreadsheet For The Python Hacker

You can write a Python program or use a Jupyter Notebook to do almost anything. But you can also get a lot of things done quickly using a spreadsheet. Grist is a “hacker’s” spreadsheet that merges these worlds. It looks like a spreadsheet, but underneath are SQLite tables and the formula language is Python.

The code is open source and if you want it hosted, there are free and paid plans. You can even try it out without even logging in and either start with a blank screen or use a template. You can see an introductory video below.

Continue reading “A Spreadsheet For The Python Hacker”

Ethersweep: An Easy-To-Deploy Ethernet Connected Stepper Controller

[Neumi] over on Hackaday.IO wanted a simple-to-use way to drive stepper motors, which could be quickly deployed in a wide variety of applications yet to be determined. The solution is named Ethersweep, and is a small PCB stack that sits on the rear of the common NEMA17-format stepper motor. The only physical connectivity, beside the motor, are ethernet and a power supply via the user friendly XT30 connector. The system can be closed loop, with both an end-stop input as well as an on-board AMS AS5600 magnetic rotary encoder (which senses the rotating magnetic field on the rear side of the motor assembly – clever!) giving the necessary feedback. Leveraging the Trinamic TMC2208 stepper motor driver gives Ethersweep silky smooth and quiet motor control, which could be very important for some applications. A rear-facing OLED display shows some useful debug information as well as the all important IP address that was assigned to the unit.

Control is performed with the ubiquitous ATMega328 microcontroller, with the Arduino software stack deployed, making uploading firmware a breeze. To that end, a USB port is also provided, hooked up to the uC with the cheap CP2102 USB bridge chip as per most Arduino-like designs. The thing that makes this build a little unusual is the ethernet port. The hardware side of things is taken care of with the Wiznet W5500 ethernet chip, which implements the MAC and PHY in a single device, needing only a few passives and a magjack to operate. The chip also handles the whole TCP/IP stack internally, so only needs an external SPI interface to talk to the host device.

Continue reading “Ethersweep: An Easy-To-Deploy Ethernet Connected Stepper Controller”