Reverse Engineering A Keyboard Driver Uncovers A Self-Destruct Code

Should you be able to brick a keyboard just by writing a driver to flash the lights on it? We don’t think so either. [TheNotary] got quite the shock when embarking on a seemingly straightforward project to learn C++ on the x86-64 architecture with Windows and sent it straight to Silicon Heaven with only a few seemingly innocent USB packets.

The project was a custom driver for the XVX S-K80 mechanical keyboard, aiming to flash LED patterns across the key LEDs and perhaps send custom images to the integrated LCD. When doing this sort of work, the first thing you need is the documentation of the communications protocols. Obviously, this was not an option with a closed-source project, so the next best thing is to spy on the existing Windows drivers and see how they worked. Using Wireshark to monitor the USB traffic whilst twiddling with the colour settings, it was clear that communications were purely over HID messages, simplifying subsequent analysis. Next, they used x32dbg (now x64dbg, but whatever) to attach to the existing driver process and trap a few interesting Windows system calls. After reading around the Windows API, a few candidate functions were identified and trapped. This gave them enough information to begin writing code to reproduce this behaviour. Then things got a bit odd.

Continue reading “Reverse Engineering A Keyboard Driver Uncovers A Self-Destruct Code”

Lathe Outfitted With Electronic Gearbox

Running a metal lathe is not for the faint of heart. Without proper knowledge and preparation, these machines can quickly cause injury or destroy expensive stock, tools, or parts. The other major problem even for those with knowledge and preparedness is that some of their more niche capabilities, like cutting threads with a lead screw, can be tedious and complicated thanks to the change gear system found on some lathes. While these are useful tools for getting things done, [Not An Engineer] decided that there was a better way and got to work building an electronic gearbox to automate the task of the traditional mechanical change gear setup in this video.

What makes change gears so tricky is that they usually come as a set of many gears of different ratios, forcing the lathe operator to figure out the exact combination of gears needed to couple the spindle of the lathe to the feed screw at the precise ratio needed for cutting a specific thread pattern. It is possible to do this task but can be quite a headache. [Not An Engineer] first turned to an Arduino Nano to receive input from a rotary encoder connected to the shaft of the lathe and then instruct a motor to turn the feed screw at a set ratio.

The first major problem was that the Arduino was not nearly fast enough to catch every signal from the encoder, leading to a considerable amount of drift in the output of the motor. That was solved by upgrading to a Teensy 4.1 with a 600 MHz clock speed. There was still one other major hurdle to cross; the problem of controlling the motor smoothly when an odd ratio is selected. [Not An Engineer] used this algorithm to inspire some code, and with that and some custom hardware to attach everything to the lathe he has a working set of electronic change gears that never need to be changed again. And, if you don’t have a lathe at all but are looking to get started with one, you can always build your own from easily-sourced parts.

Continue reading “Lathe Outfitted With Electronic Gearbox”

Design And The Golden Rule

You often learn the golden rule or some variation of it as early as kindergarten. There are several ways to phrase it, but you most often hear: “Do unto others as you would have them do unto you.” While that’s catchy, it is really an aphorism that encourages us to consider the viewpoints of others. As people who design things, this can be tricky. Sometimes, what you want isn’t necessarily what most people want, and — conversely — you might not appreciate what most people want or need.

EDIT/1000

HP/1000 CC-BY-SA-3.0 by [Autopilot]
I learned this lesson many years ago when I used to babysit a few HP/1000 minicomputers. Minicomputer sounds grand, but, honestly, a Raspberry Pi of any sort would put the old HP to shame. Like a lot of computers in those days, it had a text editor that was arcane even by the standards of vi or emacs. EDIT/1000 couldn’t be sure you weren’t using a printing terminal, and the commands reflect that.

For example, printing a few lines around the current line requires the command: “/-2,L,5” which isn’t that hard, I suppose. To delete all lines that contain a percent sign, “1$ D/%/A/” assuming you don’t want to be asked about each deletion.

Sure, sure. As a Hackaday reader, you don’t find this hard to puzzle out or remember. But back in the 1980s, a bunch of physicists and chemical engineers had little patience for stuff like that. However, the editor had a trick up its sleeve.

Continue reading “Design And The Golden Rule”

Embossing Graphics By 3D Printing On Wood

Embossing (making raised shapes) and debossing (making sunken shapes) on 3D-printed surfaces is not a new idea; we do it all the time. [Cory] from Vancouver Hack Space was playing around with the 3D printing wood, and came up with the idea of creating raised tactile surfaces using a simple transfer process.

We don’t often try to print directly onto a wooden surface for various reasons, but [Cory] wanted to give it a go. They hoped to get some grain patterns to transfer to the surface, but as they say in the blog entry, the beauty of wood patterns is in the colouration, which doesn’t transfer. Next, they laser etched a logo into the wood surface to see how well that would transfer. It did create a discernable raised impression, but they forgot to mirror the image (oops!) and relevel the bed, so the results are less impressive than they could be. Still, it’s another useful technique to consider.

Embossing is the process by which braille sheets. This DIY braille encoder is pretty sweet. Of course the process can be simply decorative. Here’s how to use a laser cutter to create your own embossing seals. The traditional way to emboss paper for a fancy effect was to use embossing powder to selectively change the properties of drying paper. But how can you make the stuff for cheap?

Switching Regulators: Mistake Fixing For Dummies

Some time ago, while designing the PCB for the Sony Vaio replacement motherboard, I went on a quest to find a perfect 5 V boost regulator. Requirements are simple – output 5 V at about 2A , with input ranging from 3 V to 5 V, and when the input is 5 V, go into “100% duty” (“pass-through”/”bypass”) mode where the output is directly powered from the input, saving me from any conversion inefficiencies for USB port power when a charger is connected. Plus, a single EN pin, no digital configuration, small footprint, no BGA, no unsolicited services or offers – what more could one ask for.

As usual, I go to an online shop, set the parameters: single channel, all topologies that say “boost” in the name, output range, sort by price, download datasheets one by one and see what kind of nice chips I can find. Eventually, I found the holy grail chip for me, the MIC2876, originally from Micrel, now made by Microchip.

MIC2876 is a 5 V regulator with the exact features I describe above – to a T! It also comes with cool features, like a PG “Power good” output, bidirectional load disconnect (voltage applied to output won’t leak into input), EMI reduction and efficiency modes, and it’s decently cheap. I put it on the Sony Vaio board among five other regulators, ordered the board, assembled it, powered it up, and applied a positive logic level onto the regulator’s EN pin.

Immediately, I saw the regulator producing 3 V output accompanied by loud buzzing noise – as opposed to producing 5 V output without any audible noise. Here’s how the regulator ended up failing, how exactly I screwed up the design, and how I’m creating a mod board to fix it – so that the boards I meticulously assembled, don’t go to waste.

Some Background… Noise

Continue reading “Switching Regulators: Mistake Fixing For Dummies”

Mothbox Watches Bugs, So You — Or Your Grad Students — Don’t Have To

To the extent that one has strong feelings about insects, they tend toward the extremes of a spectrum that runs from a complete fascination with their diversity and the specializations they’ve evolved to exploit unique and ultra-narrow ecological niches, and “Eww, ick! Kill it!” It’s pretty clear that [Dr. Andy Quitmeyer] and his team tend toward the former, and while they love their bugs, spending all night watching them is a tough enough gig that they came up with Mothbox, the automated insect monitor.

Insect censuses are valuable tools for assessing the state of an ecosystem, especially insects’ vast numbers, short lifespan, and proximity to the base of the food chain. Mothbox is designed to be deployed in insect-rich environments and automatically recognize and tally the moths it sees. It uses an Arducam and Raspberry Pi for image capture, plus an array of UV and visible LEDs, all in a weatherproof enclosure. The moths are attracted to the light and fly between the camera and a plain white background, where an image is captured. YOLO v8 locates all the moths in the image, crops them out, and sends them to BioCLIP, a vision model for organismal biology that appears similar to something we’ve seen before. The model automatically sorts the moths by taxonomic features and keeps a running tally of which species it sees.

Mothbox is open source and the site has a ton of build information if you’re keen to start bug hunting, plus plenty of pictures of actual deployments, which should serve as nightmare fuel to the insectophobes out there.

A Guide To Laser Cutting Metal, If You’ve Got The Cash

While many of us now have laser cutters — either a K40-style machine or one of the newer high-output diodes — you probably don’t have one that cuts metal. True, some hobby lasers now offer IR laser heads with modest power to engrave metal. The xTool S1, for example, accepts a 2 W IR laser as an option, but we doubt it would cut through anything thicker than foil. However, there are a growing number of fiber and carbon dioxide lasers that can cut metal at semi-reasonable prices, and [All3DP] has a primer on the technology that is worth a read.

According to the post, CO2 lasers are less expensive but require gas assist, can’t work with shiny metals well, and are finicky because of the mirrors and glass tube inside. Fiber lasers cost more, but don’t need gas, work on more materials, and have fewer parts that need maintenance or may be prone to damage. There are other kinds of lasers, but the post focuses on these, the most common ones.

Machines that can cut metal aren’t cheap. They start at about $10,000. However, prices are dropping and we remember when $10,000 would buy you what would today be a terrible oscilloscope, so maybe there’s hope for an impulse-buy metal-cutting laser one day.

It isn’t that diode lasers can’t cut metal at all, but the results are not terribly useful. What would you rather have? A metal cutter or a metal 3D printer?