These Bit Twiddling Tricks Will Make Your Coworkers Hate You

In the embedded world, twiddling a few bits is expected behavior. Firmware is far enough down the stack that the author may care about the number of bits and bytes used, or needs to work with registers directly to make the machine dance. Usually these operations are confined to the typical shifting and masking but sometimes a problem calls for more exotic solutions. If you need to descend down these dark depths you invariably come across the classic Bit Twiddling Hacks collected by [Sean Eron Anderson]. Here be dragons.

Discussions of bit math are great opportunities to revisit Wikipedia’s superb illustrations

Bit Twiddling Hacks is exactly as described; a page full of snippets and suggestions for how to perform all manner of bit math in convenient or efficient ways. To our surprise upon reading the disclaimer at the top of the page, [Sean] observes that so many people have used the contents of the page that it’s effectively all been thoroughly tested. Considering how esoteric some of the snippets are we’d love to know how the darkest corners found use.

The page contains a variety of nifty tricks. Interview content like counting set bits makes an early appearance.  There’s more esoteric content like this trick for interleaving the bits in two u16’s into a single u32, or rounding up to the next power of two by casting floats. This author has only been forced to turn to Bit Twiddling Hacks on one occasion: to sign extend the output from an unfortunately designed sensor with unusual length registers.

Next time you need to perform an operation with bitmatch, check out Bit Twiddling Hacks. Have you ever needed it in production? How did you use it? We’d love to hear about it in the comments.

Be Anyone Or Anything With Facial Projection Mask

In the market for a low-poly change to your look? Hate the idea of showing up for a costume party only to find out someone is wearing the same mask as you? Then this face changing front-projection mask may be just the thing for you.

To be honest, we’re not sure just how much [Sean Hodgins]’ latest project has to do with cosplay. He seems to be making a subtle commentary about dealing with life in the surveillance state, even though this is probably not a strategy for thwarting facial-recognition cameras. [Ed Note: Or maybe it’s just Halloween?]

The build consists of a Raspberry Pi and a pico projector of the kind we’ve seen before. These are mated together via a custom PCB and live inside a small enclosure that’s attached to the end of a longish boom. The boom attaches to the chin of 3D-printed mask, which in turn is connected to the suspension system of a welding helmet. Powered by a battery pack and controlled by a smartphone app, the projector throws whatever you want onto the mask – videos, effects, even images of other people. Even with some Photoshop tweaks to account for keystone distortion from the low angle of projection, there’s enough distortion that the effect is more artistic than masquerade. But honestly, having your face suddenly burst into flames is pretty cool. We just wonder what visibility is like for the wearer with a bright LED blasting into your eyes.

As a bonus, [Sean] has worked this build into a virtual treasure hunt. Check out 13thkey.com and see what you can make from the minimal clues there.

Continue reading “Be Anyone Or Anything With Facial Projection Mask”

CNC Machine Most Satisfyingly Mills Double-Sided PCBs

We know that by this point in the development of CNC technology, nothing should amaze us. We’ve seen CNC machines perform feats of precision that shouldn’t be possible, whether it be milling a complex jet engine turbine blade or just squirting out hot plastic. But you’ve just got to watch this PCB milling CNC machine go through its paces!

The machine is from an outfit called WEGSTR, based in the Czech Republic. While it appears to be optimized for PCB milling and drilling, the company also shows it milling metals, wood, plastic, and even glass. The first video below shows the machine milling 0.1 mm traces in FR4; the scale of the operation only becomes apparent when a gigantic toothbrush enters the frame to clear away a little swarf. As if that weren’t enough, the machine then cuts traces on the other side of the board; vias created by filling drilled holes with copper rivets and peening them over with a mandrel and a few light hammer taps connect the two sides.

Prefer your boards with solder resist and silkscreening? Not a problem, at least judging by the second video, which shows a finished board getting coated with UV-cure resist and then having the machine mill away just the resist on the solder pads. We’re not sure how they deal with variations in board thickness or warping, but they sure have it dialed in. Regardless of how they optimized the process, it’s a pleasure to watch.

At about $2,600, these are not cheap machines, but they may make sense for someone needing high-quality boards with rapid turnaround. And who’s to say a DIY machine couldn’t do as good a job? We’ve seen plenty of them before, and covered the pros and cons of etching versus milling too.

Continue reading “CNC Machine Most Satisfyingly Mills Double-Sided PCBs”

Get Your PCBs Made At The Mall

As we’ve seen with some recent posts on the subject here at Hackaday, there seems to be a growing schism within the community about the production of PCBs. Part of the community embraces (relatively) cheap professional fabrication, where you send your design off and get a stack of PCBs in the mail a couple weeks later. Others prefer at home methods of creating PCBs, such as using a CNC, laser engraver, or even the traditional toner transfer. These DIY PCBs take some skill and dedication to produce, but the advantage is that you can have the board in hand the same day you design it. But there may be a third option that seems to have slipped through the cracks.

[Virgil] writes in with a very interesting method of producing professional looking prototype PCBs that doesn’t involve weeks of waiting for the results, nor does it require any complicated techniques or specialized equipment. In this method, a UV printer is used to deposit your mask directly onto the copper clad board, which you then etch with whatever solution you like. Don’t have a UV printer you say? No worries, there’s probably somebody at the mall that does.

As [Virgil] explains, the little kiosks at the mall which offer to personalize items for customers generally use a UV printer which allows them to shoot ink on nearly any material. Instead of asking them to put a logo on the back of your phone, you’ll just be asking them to put the vector file of your mask, which you can bring along on a USB flash drive, onto the bare copper board. They may tell you they can’t guarantee the ink will stick to the bare copper, but just tell them you’re willing to take the risk. It’s one of those situations in which your money will be glad to speak on your behalf.

After the UV printer does its thing, the mask might be somewhat fragile. [Virgil] likes to wrap the boards in plastic for the ride home to make sure they don’t get damaged. Then it’s a quick dunk in the etching solution followed by a rinse and some isopropyl alcohol to get the remainder of the UV ink off. The results really do speak for themselves: nice sharp lines with exceptionally little manual work.

We’ve covered some relatively easy ways of quickly producing nice PCBs at home, as long as you don’t mind spending a couple hundred US dollars to get the hardware together. This seems to be the best of both worlds, though it does have the downside of requiring you speak with another human. We’d love to hear from any readers who give this particular method a shot.

Continue reading “Get Your PCBs Made At The Mall”

Three Ways To Etch Snazzy Brass Nameplates

It’s the little touches that make a project, and a nice nameplate can really tie a retro build together. Such badges are easy enough to make with a CNC machine, but if you don’t have access to machine tools you can put chemistry to work for you with these acid-etched brass nameplates.

The etching method that [Switch and Lever] uses to get down to brass plaques will be intimately familiar to anyone who has etched a PCB before. Ferric chloride works as well on brass as it does on copper, and [Switch and Lever] does a good job explaining the chemistry of the etching process and offers some tips on making up etching solution from powdered ferric chloride. But the meat of the video below is the head-to-head test of three different masking methods.

The first method uses a laser printer and glossy paper ripped from a magazine to create a mask. The toner is transferred to the brass using an office laminator, and the paper removed with gentle rubbing before etching. For the other two candidates he uses a laser engraver to remove a mask of plain black spray paint in one case, or to convert special laser marking paint to a mask in the other.

We won’t spoil the surprise as to which gave the best results, but we think you’ll be pleased with how easy making classy nameplates can be. You can also use electrolytic methods for a deeper etch, but we think acid etching is a little more approachable for occasional use.

Continue reading “Three Ways To Etch Snazzy Brass Nameplates”

This Mask Will Make You A Psycho

Videos games are a cornucopia of project ideas well-suited to the talents of makers and hackers, and Halloween is as good a time as any to show them off! Reddit user [Tavarin], a huge fan of the Boderlands video games, whipped up a plaster mask — replete with glowing eyes — of one of the game’s signature enemies: the Psycho.

[Tavarin]’s secret to forming comfortable plaster masks is to open his jaw while the wrap is setting  — that way he’ll be able to talk without breaking the mask off his face. Hot gluing in and modifying a 60mm PC fan and a pair of lenses meant that the only thing standing between him and a lot of sanding to shape the mask’s details was a few layers of thick plaster mix.

Continue reading “This Mask Will Make You A Psycho”

Keep The Peace In The Bedroom With A Snore Stopping Sleep Mask

Despite what my wife says, I have absolutely no evidence that I snore. After all, I’ve never actually heard me snoring. But I’ll take her word for it that I do, and that it bothers her, so perhaps I should be a sport and build this snore-detecting vibrating sleep mask so she can get a few winks more.

Part wearable tech and part life hack, [mopluschen]’s project requires a little of the threadworker’s skill. The textile part of the project is actually pretty simple, and although [mopluschen] went with a custom mask made from fabric and foam shoulder pads, it should be possible to round up a ready-made mask that could be easily modified. The electronics are equally simple – an Arduino with a sound sensor module and a couple of Lilypad Vibe boards. The mic rides just above the snore resonating chamber and the vibrators are right over the eyes. When your snore volume exceeds a preset threshold, the motors wake you up.

Whether this fixes the underlying problem or just evens the score with your sleep partner is debatable, but either way there’s some potential here. And not just for snore-correction – a similar system could detect a smoke alarm and help rouse the hearing impaired. But if the sewing part of this project puts you off, you should probably check out [Jenny List]’s persuasive argument that sewing is not just for cosplayers anymore.