Impedance Mismatch

There are a few classic physics problems that it can really help to have a mental map of. One is, of course, wave propagation. From big-wave surfing, through loudspeaker positioning, to quantum mechanics, having an intuition for the basic dynamics of constructive and destructive interference is key. Total energy of a system, and how it splits and trades between kinetic and potential, is another.

We were talking about using a bike generator to recharge batteries on the Podcast last night, and we stumbled on a classic impedance mismatch situation. A pedaling person can put out 100 W, and a cell phone battery wants around 5 W to charge. You could pedal extremely lightly for nearly three hours, but I’d bet you’d rather hammer the bike for 10 minutes and get on with your life. The phone wants to be charged lightly — it’s high impedance — and you want to put out all your power at once — you’re a low impedance source.

The same phenomenon explains why you have to downshift your internal combustion automobile as you slow down. In high gear, it presents too high an impedance, and the motor can only turn so slowly before stalling. This is also why all vibrating string acoustic instruments have bridges that press down on big flat flexible surfaces, and why horns are horn shaped. Air is easy to vibrate, but to be audible you want to move a lot of it, so you spread out the power. Lifting a heavy rock with human muscle power is another classic impedance mismatch.

If these are fundamentally all the same problem, then they should all have similar solutions. The gear on the bike or the car, the bridge on a cello, the flared horn on the trumpet, and the lever under the boulder all serve to convert a large force over a short distance or time or area into a lower force over more distance, time, or area.

Pop quiz! What are the common impedance converters in the world of volts and amps? The two that come to my mind are the genafsbezre and the obbfg/ohpx pbairegre (rot13!). What am I missing?

Our Favorite Things: Binary Search

You might not think that it would be possible to have a favorite optimization algorithm, but I do. And if you’re well-versed in the mathematical art of hill climbing, you might be surprised that my choice doesn’t even involve taking any derivatives. That’s not to say that I don’t love Newton’s method, because I do, but it’s just not as widely applicable as the good old binary search. And this is definitely a tool you should have in your toolbox, too.

Those of you out there who slept through calculus class probably already have drooping eyelids, so I’ll give you a real-world binary search example. Suppose you’re cropping an image for publication on Hackaday. To find the best width for the particular image, you start off with a crop that’s too thin and one that’s too wide. Start with an initial guess that’s halfway between the edges. If this first guess is too wide, you split the difference again between the current guess and the thinnest width. Updated to this new guess, you split the differences again.

But let’s make this even more concrete: an image that’s 1200 pixels wide. It can’t get wider than 1200 or thinner than 0. So our first guess is 600. That’s too thin, so we guess 900 — halfway between 600 and the upper limit of 1200. That ends up too wide, so we next guess 750, halfway between 600 and 900. A couple more iterations get us to 675, then 638, and then finally 619. In this case, we got down to the pixel level pretty darn fast, and we’re done. In general, you can stop when you’re happy, or have reached any precision goal.

[Ed note: I messed up the math when writing this, which is silly. But also brought out the point that I usually round the 50% mark when doing the math in my head, and as long as you’re close, it’s good enough.]

What’s fantastic about binary search is how little it demands of you. Unlike fancier optimization methods, you don’t need any derivatives. Heck, you don’t even really need to evaluate the function any more precisely than “too little, too much”, and that’s really helpful for the kind of Goldilocks-y photograph cropping example above, but it’s also extremely useful in the digital world as well. Comparators make exactly these kinds of decisions in the analog voltage world, and you’ve probably noticed the word “binary” in binary search. But binary search isn’t just useful inside silicon. Continue reading “Our Favorite Things: Binary Search”

Make It Compatible

I’m probably as guilty as anyone of reinventing the wheel for a subpart of a project. Heck, sometimes I just feel like working on a wheel design. But if that’s the path you choose, you have to think about whether or not it’s important that others can replicate your project. The nice thing about a bog-standard wheel is that everyone has got one.

The case study I have in mind is a wall-plotter project that appeared on Hackaday this week. It’s a really sweet design, and in many ways would be an ideal starter project. I actually need a wall plotter (for reasons) and like a number of the choices made. For instance, having nearly everything, including the lightweight geared steppers on the gondola makes it easy to install and uninstall — you just pin up the timing belt from which it hangs and you’re done. Extra weight on the gondola helps with stability anyway. It’s open source and based on the Arduino libraries, so it should be easy enough to port to whatever microcontroller I have on hand.

But the image-generation toolchain is awkward, involving cutting and pasting into a spreadsheet, which generates a text file in a custom plotting micro-language. Presumably the designer doesn’t know about Gcode, which is essentially the lingua franca of moving machines, or just didn’t feel like implementing it. Where in Gcode, movement commands are like “G1 X100 Y50”, this device expects “draw_line(0,0,100,50)”. They’re essentially equivalent, but incompatible.

I totally understand that the author must have had a good time thinking up the movement commands and writing the spreadsheet that translates SVG files into them. I’ve been there and done that! But if the wall plotter spoke Gcode instead of its own dialect, it would slot instantly into any number of graphics processing workflows, which would make me, the potential user, happier.

When you are looking at reinventing the wheel, think about your audience. If you’re the only person likely to see the project, go ahead and scratch whatever itch you’ve got. You’ll learn more that way. But if you want to share the project with as many people as possible, adhering to the most widely used standards is a good choice for your users, even if it is less fun than dreaming up your own movement language.

The Light Guide Hiding In Your Extrusion

There should be a line of jokes that start “A physicist and an engineer walk into a bar…”. In my case I’m an engineer and my housemate is a physicist, so random conversations sometimes take interesting turns. Take the other day for example, as one does when talking she picked up a piece of aluminium extrusion that was sitting on our coffee table and turned it over in her hands. It has a hole down its centre and it’s natural to peer down it, at which point her attention was caught by the appearance of a series of concentric rings of light. Our conversation turned to the mechanism which might be causing this, and along the way took us into cameras, waveguides, and optical fibres.

The light reaching us after traveling along a straight narrow tube should at a cursory glance be traveling in a straight line, and indeed when I point the extrusion out of my window and look down it I can see a small segment of the tree in the distance I’ve pointed it at. It didn’t take us long to conclude that the concentric rings were successive reflections of the light coming into the end hole from off-centre angles.

In effect, the extrusion is a pinhole camera in which the image is projected onto the inside of a cylinder stretching away from the pinhole rather than onto a flat piece of film, and we were seeing the successive reflections of the resulting distorted image as they bounced to and fro down the tube towards us. It’s likely the imperfect mirror formed by the aluminium wall allowed us to see each image, as light was being diffused in our direction. Adding a piece of tape with a small pinhole at the end accentuated this effect, with the circles becoming much more sharply defined as the projected image became less blurry. Continue reading “The Light Guide Hiding In Your Extrusion”

How Small Is Too Small?

Not a rhetorical question! This week we consider the most micro microcontroller: the HC32L110. It’s the new title holder of the smallest ARM Cortex M0+ part. But could you actually use it?

MCU is the black thing that’s smaller than the capacitor.

I remember way back, when I first learned to solder surface-mount components. It was fiddly at first, but nowadays I don’t use through-hole components unless someone’s twisting my arm. And I still do my soldering myself — down to 0603 really isn’t all that bad with an iron, and below that, there’s always the heat plate. My heat plate has also gotten me through the two times I’ve actually needed to put down a ball-grid-array part. It wasn’t as bad as I had feared, honestly.

So maybe it’s time for me to take the BGA plunge and design a board or two just to get more familiar with the tech. I probably won’t dive straight into the deep end, like the featured chip here with 0.35 mm ball pitch, but rather stick with something that the cheap PCB services can easily handle. My experience tells me that the best way to learn something is just to test it out.

Now, off to go part shopping in the middle of a chip crisis! Wish me luck.

Human Power, Past And Future

We will assume you’ve seen The Matrix — it was from 1999, after all. The surprise, at the end, was that humans were being used as human batteries to power a civilization of intelligent machines. But aside from just putting out some heat, the idea does have some precedent. After all, humans powered machines like mills, sewing machines, and pumps for centuries before there were good alternatives.

History

Galley ship
Reconstruction of a squadron of ancient Greek galley ships.

Early machines used hand cranks, treadwheels, treadles, and even pedal power to harness energy from humans. Consider, for example, an ancient galley ship with many oarsmen providing an engine. This wasn’t a great use of human power. An oarsman on a galley used his arms and back but didn’t much use his legs. The legs, though, have larger muscles and are often stronger. A pedal boat or racing shell would have been much more efficient, but without mass production of strong metal parts, it would have been difficult to build and maintain such machines in ancient times.

There was a time when pedals or treadles operated lots of machines from sewing machines to lathes. There were even old radios able to transmit and receive with no external power thanks to pedals as late as the 1940s.

Continue reading “Human Power, Past And Future”

You Break It, We Fix It

Apple’s AirTags have caused a stir, but for all the wrong reasons. First, they turn all iPhones into Bluetooth LE beacon repeaters, without the owner’s permission. The phones listen for the AirTags, encrypt their location, and send the data on to the iCloud, where the tag’s owner can decrypt the location and track it down. Bad people have figured out that this lets them track their targets without their knowledge, turning all iPhone users into potential accomplices to stalkings, or worse.

Naturally, Apple has tried to respond by implementing some privacy-protecting features. But they’re imperfect to the point of being almost useless. For instance, AirTags now beep once they’ve been out of range of their owner’s phone for a while, which would surely alert the target that they’re being tracked, right? Well, unless the evil-doer took the speaker out, or bought one with the speaker already removed — and there’s a surprising market for these online.

If you want to know that you’re being traced, Apple “innovated with the first-ever proactive system to alert you of unwanted tracking”, which almost helped patch up the problem they created, but it only runs on Apple phones. It’s not clear what they meant by “first-ever” because hackers and researchers from the SeeMoo group at the Technical University of Darmstadt beat them to it by at least four months with the open-source AirGuard project that runs on the other 75% of phones out there.

Along the way, the SeeMoo group also reverse engineered the AirTag system, allowing anything that can send BLE beacons to play along. This opened the door for [Fabian Bräunlein]’s ID-hopping “Find You” attack that breaks all of the tracker-detectors by using an ESP32 instead of an AirTag. His basic point is that most of the privacy guarantees that Apple is trying to make on the “Find My” system rely on criminals using unmodified AirTags, and that’s not very likely.

To be fair, Apple can’t win here. They want to build a tracking network where only the good people do the tracking. But the device can’t tell if you’re looking for your misplaced keys or stalking a swimsuit model. It can’t tell if you’re silencing it because you don’t want it beeping around your dog’s neck while you’re away at work, or because you’ve planted it on a luxury car that you’d like to lift when its owners are away. There’s no technological solution for that fundamental problem.

But hackers are patching up the holes they can, and making the other holes visible, so that we can at least have a reasonable discussion about the tech’s tradeoffs. Apple seems content to have naively opened up a Pandora’s box of privacy violation. Somehow it’s up to us to figure out a way to close it.