Human-Interfacing Devices: The Descriptor Heist

Today, we’ll build our own input devices. And they will be easy to create and write firmware for, they will work perfectly, and they will be cross-platform. We can do that with help of the Human Interface Device (HID) standard, and by way of introduction, so that you never get confused by what a “descriptor” means, and we’ll build our own HID device — a Human Interface Device device. The way we build them won’t require reading specifications – instead, I’ll teach your how to steal HID descriptors from existing devices, tweak them for our purposes, and use them in our devices to harness the power of HID.

For decades now, it’s been possible to build a HID mouse or keyboard by using a library or two, and it’s been a godsend for hackers all around the world. However, these libraries are typically confined to a certain template and inflexible, and we hackers often go outside of what’s expected. HID allows for much more than a simple keyboard or a mouse. That’s why today we’re building a touchscreen – something not yet covered online or by libraries.

HID lets you build devices that are friendly. They don’t need drivers, they are plug and play, and they do what you expect them to do. At its core, the HID standard is as simple as is ubiquitous. You can tunnel HID over USB, Bluetooth, I2C, and modern-day operating systems support all three of these. Today, let’s go through the basics of HID, and then build a USB touchscreen out of a SPI-connected resistive touchscreen, with help of the usual RP2040+MicroPython combo. I will also give you a toolkit for how to debug a Human Interface Device device as thoroughly as possible – specifically on Linux, showing all the HID debug and introspection capabilities that Linux gives you. But it’ll work on Windows too through the beauty of standardization.

Continue reading “Human-Interfacing Devices: The Descriptor Heist”

Ballpoint Switch Is Oh-So Satisfying

Alright, here’s your quick and dirty hack for the day. The astute among you may recall [Peter Waldraff]’s bookshelf train build of a few days ago, and the fact that he used a switch made from a dead ballpoint pen to light up the scene. Fortunately, [Peter] wrote in to give us the details of this low-voltage sub-build, which you can see in the video after the break.

Essentially, [Peter] starts by making a shortened version of the pen. He modifies nearly every bit of it, including cutting down the ink cartridge, so if you try this, make sure the thing is all dried up first. Then, as he is screwing the point holder back on the barrel, he wraps elastic cord around the inside barrel in lieu of having sewing thread lying around. This cord along with some hot glue will hold a pair of paper clips to the sides of the point holder. When the pen is clicked into the writing position, it makes a connection between the paper clips and closes the circuit on whatever is wired into it.

What types of little hacks like this have gotten you through the build? Let us know in the comments, or better yet, write it up and drop us a tip. By the way, here is that bookshelf train build in case you missed it.

Continue reading “Ballpoint Switch Is Oh-So Satisfying”

Displays We Love Hacking: Parallel RGB

You might have seen old display panels, from 3″ to 10″, with 40-pin FFC connectors where every pin seems to be used for some data signal. We call these displays parallel RGB, or TTL RGB, or DPI, and you can find them in higher-power MCU, Raspberry Pi, and other Linux SBC projects. You deserve to know what to do with those – let’s take a look.

The idea is simple – this interface requires you to constantly send a stream of pixels to the display, and you need to send those pixels through a parallel bus. You can send up to 8 bits per color channel per pixel, which makes for 24 bits, and the 24-bit mode is indeed the standard, but in practice, many parallel RGB implementations don’t bother with more than 5-6 bits of color – two common kinds of parallel RGB links are RGB565 and RGB666. The parallel RGB interface is a very straightforward approach to sending pixels to your display, and in many cases, you can also convert parallel RGB to LVDS or VGA interfaces relatively easily!

If you’re new to it, the easiest way you can drive a parallel RGB display is from a Raspberry Pi, where the parallel RGB interface is known as DPI. This is how 800 x 480 display Pi HATs like the Pimoroni HyperPixel work – they use up almost all of the GPIOs on your Pi, but you get a reasonably high-resolution display with a low power footprint, and you don’t need any intermediate ICs either. FPGAs and some higher-grade MCUs also often have parallel RGB output capability, and surely, someone could even use the RP2040 PIO as well!

Throughout the last decade, parallel RGB has been used less and less, but you will still encounter it – maybe you’re working with an old game console like the PSP and would like to put new guts into it, maybe you’re playing with some tasty display that uses parallel RGB, or maybe you’d like to convert parallel RGB into something else while treating it with respect! Let’s go through what makes parallel RGB tick, what tools you have got to work with it, and a few tips and tricks. Continue reading “Displays We Love Hacking: Parallel RGB”

Turning A 1:150 Scale Model Car Into A Real Driving Car With Lights

Closing up the remotely controlled 1:150 scale model car. (credit: diorama111)

For many people having a miniature version of something like a car is already a miracle in itself, but there’s always the possibility to take matters a bit further, as YouTube channels like [diorama111] demonstrate. In this particular case, they took a 1:150 scale model of a Nissan Micra and installed a microcontroller, battery, remote steering and front, rear and indicator lights. Considering the 24.5 x 11.4 x 10.5 mm (LxWxH) size of the scale model, this is no small feat.

The original plastic bottom and wheels are removed, and replaced with a metal frame, as well as steerable front wheels that have a neodymium magnet attached to follow a metal guidance track that can be underneath the road surface. For the brains an ATtiny1616 MCU in QFN format is used to receive commands from the PIC79603 infrared receiver module and drive the motor attached to the rear axle via a DRV8210 motor controller IC. The remaining MCU pins are mostly used for turning the LEDs on the lights and signals on or off.

In the video the miniscule RC car is driven around a course with traffic lights, which gives a good impression of how this could be used in a large scale model of a city, with a hidden rail system to determine car routes. As for keeping the 30 mAh Li-Po battery charged, there’s a charge port on the bottom, but at these low current rates you could have hidden conductive charging points throughout the route as well, assuming you can fit a small enough charging coil in this little space.

(Thanks to [Keith Olson] for the tip)

Continue reading “Turning A 1:150 Scale Model Car Into A Real Driving Car With Lights”

Printed Centrifugal Dust Separator Stays On Budget

Anyone who’s ever spent time in a woodworking shop knows how much dust is produced when cutting, sanding, and so on. [Tim] of Pilson Guitars was looking to outfit his shop with centrifugal dust separators to combat the problem, which are supposed to remove over 99% of the sawdust particles right out of the air. Unfortunately, they can cost thousands of dollars. So he decided to try making his own.

Centrifugal dust separator design, by Tim at Pilson Guitars.
Centrifugal dust separator design, by Tim at Pilson Guitars.

Using a clear PVC tube and 100 hours of printing on his Prusa i3 MK3, his CAD file had come to life, ready to use the power of centrifugal air to leave just enough fine dust in the output port to have a HEPA filter handle the remainder. Unfortunately, initial testing showed that a single dust separator filtered out far less than 90%, and even adding a second unit bumped that up to only 94.2%. Still impressive, but this would clog up a HEPA filter in no time. Thus [Tim] had a second try at it, after a range of helpful comments to the first video.

Changes included a different design for the impeller blades to improve the vortex, as well as attempting to run the system in series. Sadly more issues cropped up, with apparently the air also seeking a way via the collection bins that has [Tim] rethinking more aspects of the design. He has made the design files (STEP and more) available on GitHub for perusal by the community and hopefully some constructive input on how to DIY such dust separation system.

Over the years, we’ve seen many different approaches to the problem of dust collection. We’ve covered other 3D printed solutions if your printer is looking for something to do, but if you’d prefer something a little more low-tech, this traffic cone dust separator is particularly clever.

Continue reading “Printed Centrifugal Dust Separator Stays On Budget”

World’s First Precision Lathe: Indispensable When Constructing The Antikythera Mechanism

The precision lathe with the hooks, the bowstring, and vise visible as material is being processed. (Credit: Clickspring)

We commonly tend to associate lathes with the Industrial Revolution, when metalworking shifted largely from blacksmiths to machinists, but the use of lathes is much older than that. As [Chris] over at the Clickspring YouTube channel demonstrates in a recent video, small precision lathes were exceedingly common in the Ancient World. Not only is there ample historical evidence of them being used as far back as 1300 BCE in Ancient Egypt, but they’re also the most optimal way to get perfectly round pins and other, more intricate shapes that would be an absolute nightmare to create with just some metal files and chisels.

In the video, [Chris] uses two metal hooks, bent in a ninety-degree angle and clamped down in a vise, tapering towards each other into points. A bow string around a round piece of wood is used to bootstrap a more permanent retention element and bushing for the bow string as it is drawn over the wood to rotate it. Subsequent material that has to be worked on in the lathe is then clamped between the two points. This way, using basic materials that have been around for thousands of years and some muscle power, it’s possible to create a small lathe that can be used to create perfectly symmetrical shapes, such as those used in the construction of the Antikythera Mechanism, which [Chris] has been rebuilding for the past years, using only period-correct tools. He’s learned a lot about the mechanism in the process.

Continue reading “World’s First Precision Lathe: Indispensable When Constructing The Antikythera Mechanism”

Using Local AI On The Command Line To Rename Images (And More)

We all have a folder full of images whose filenames resemble line noise. How about renaming those images with the help of a local LLM (large language model) executable on the command line? All that and more is showcased on [Justine Tunney]’s bash one-liners for LLMs, a showcase aimed at giving folks ideas and guidance on using a local (and private) LLM to do actual, useful work.

This is built out from the recent llamafile project, which turns LLMs into single-file executables. This not only makes them more portable and easier to distribute, but the executables are perfectly capable of being called from the command line and sending to standard output like any other UNIX tool. It’s simpler to version control the embedded LLM weights (and therefore their behavior) when it’s all part of the same file as well.

One such tool (the multi-modal LLaVA) is capable of interpreting image content. As an example, we can point it to a local image of the Jolly Wrencher logo using the following command:

llava-v1.5-7b-q4-main.llamafile --image logo.jpg --temp 0 -e -p '### User: The image has...\n### Assistant:'

Which produces the following response:

The image has a black background with a white skull and crossbones symbol.

With a different prompt (“What do you see?” instead of “The image has…”) the LLM even picks out the wrenches, but one can already see that the right pieces exist to do some useful work.

Check out [Justine]’s rename-pictures.sh script, which cleverly evaluates image filenames. If an image’s given filename already looks like readable English (also a job for a local LLM) the image is left alone. Otherwise, the picture is fed to an LLM whose output guides the generation of a new short and descriptive English filename in lowercase, with underscores for spaces.

What about the fact that LLM output isn’t entirely predictable? That’s easy to deal with. [Justine] suggests always calling these tools with the --temp 0 parameter. Setting the temperature to zero makes the model deterministic, ensuring that a same input always yields the same output.

There’s more neat examples on the Bash One-Liners for LLMs that demonstrate different ways to use a local LLM that lives in a single-file executable, so be sure to give it a look and see if you get any new ideas. After all, we have previously shown how automating tasks is almost always worth the time invested.