Compiling Four Billion If Statements

With modern tools, you have to try very hard to do something stupid, because the tools (rightly) recognize you’re doing something stupid. [Andreas Karlsson] can speak to that first hand as he tried to get four billion if statements to compile.

You may ask what state space requires four billion comparisons to evaluate? The answer is easy: the range of an unsigned 32-bit integer. The whole endeavor started with a simple idea: what if instead of evaluating whether an integer is even or odd with a modulo or bit mask, you just did an if statement for every case? Small ranges like 0-10 are trivial to write out by hand, but you reach for more automated solutions as you pass 8 bits and move towards 16. [Andreas] wrote some Python that outputs a valid C program with all the comparisons. For 16 bits, the source only clocks in at 130k lines with the executable less than 2 MB.

Of course, scaling to 32 bits is a very different problem. The source file balloons to 330 GB, and most compilers barf at that point. Undeterred, [Andreas] modified the Python to output x86_64 assembly instead of C. Of course, the executable format of Windows (PE) only allows executables up to 4 GB, so a helper program mapped the 40 GB generated executable and jumped into it.

What’s incredible about this whole journey is how performant the program is. Even large numbers complete in a few seconds. Considering that it has to thrash 40 GB of an executable through memory, we can’t help but shake our heads at how even terrible solutions can work. We love seeing someone turn a bad idea into an interesting one, like this desoldering setup.

PCB Design Review: HAB Tracker With ATMega328P

Welcome to the Design Review Central! [VE3SVF] sends us their board, and it’s a HAB (High Altitude Balloon) tracker board. It’s got the venerable ATMega28P on it, a LoRa modem and a GPS module, and it can be powered from a LiIon battery. Stick this board with its battery onto a high-altitude balloon, have it wake up and transmit your coordinates every once in a while, and eventually you’ll find it in a field – if you’re lucky. Oherwise, it will get stuck hanging on a tree branch, and you will have to use a quadcopter to try and get it down, and then, in all likelihood, a second quadcopter so that you can free the first one. Or go get a long ladder.

The ATMega328P is tried and true, and while it’s been rising in price, it’s still available – with even an updated version that sports a few more peripherals; most importantly, you’re sure to find a 328P in your drawer, if not multiple. Apart from that, the board uses two modules from a Chinese manufacturer, G-Nice, for both GPS and Lora. Both of these modules are cheap, making this tracker all that more accessible; I could easily see this project being sold as a “build your own beacon” kit!

Let’s make it maybe a little nicer, maybe a little cheaper, and maybe decrease the power consumption a tad along the way. We’ll use some of the old tricks, a few new ones, and talk about project-specific aspects that might be easy to miss.

Continue reading “PCB Design Review: HAB Tracker With ATMega328P”

Tech In Plain Sight: Theodolites

We take it for granted that you can look at your phone and tell exactly where you are. At least, as exact as the GPS satellites will allow. But throughout human history, there has been a tremendous desire to know where here is, exactly. Where does my farm end and yours start? Where is the border of my city or country? Suppose you have a flagpole directly in the center of town and a clock tower at the edge of town. You know where they are precisely on a map. You also know how tall they are. What you need is a theodolite, which is an instrument that measures angles very precisely.

Continue reading “Tech In Plain Sight: Theodolites”

You’ve Probably Never Considered Taking An Airship To Orbit

There have been all kinds of wild ideas to get spacecraft into orbit. Everything from firing huge cannons to spinning craft at rapid speed has been posited, explored, or in some cases, even tested to some degree. And yet, good ol’ flaming rockets continue to dominate all, because they actually get the job done.

Rockets, fuel, and all their supporting infrastructure remain expensive, so the search for an alternative goes on. One daring idea involves using airships to loft payloads into orbit. What if you could simply float up into space?

Continue reading “You’ve Probably Never Considered Taking An Airship To Orbit”

IRCB S73-7 Satellite Found After Going Untracked For 25 Years

When the United States launched the KH-9 Hexagon spy satellite into orbit atop a Titan IIID rocket in 1974, it brought a calibration target along for the ride: the Infra-Red Calibration Balloon (IRCB) S73-7. This 66 cm (26 inch) diameter inflatable satellite was ejected by the KH-9, but failed to inflate into its intended configuration and became yet another piece of space junk. Initially it was being tracked in the 1970s, but vanished until briefly reappearing in the 1990s. Now it’s popped up again, twenty-five years later.

As noted by [Jonathan McDowell] who tripped over S73-7 in recent debris tracking data, it’s quite possible that it had been tracked before, but hidden in the noise as it is not an easy target to track. Since it’s not a big metallic object with a large radar cross-section, it’s among the more difficult signals to reliably pick out of the noise. As can be seen in [Jonathan]’s debris tracking table, this is hardly a unique situation, with many lost (XO) entries. This always raises the exciting question of whether a piece of debris has had its orbit decayed to where it burned up, ended up colliding with other debris/working satellite or simply has gone dark.

For now we know where S73-7 is, and as long as its orbit remains stable we can predict where it’ll be, but it highlights the difficulty of keeping track of the around 20,000 objects in Earth orbit, with disastrous consequences if we get it wrong.

Hackaday Links Column Banner

Hackaday Links: February 4, 2024

Things may not have gone as planned last week for the flying cellphone on Mars, but just because Ingenuity‘s flying career is over doesn’t mean there’s no more work to do. NASA announced this week that it’s going to try a series of “wiggle” maneuvers on Ingenuity‘s rotors, in an attempt to get a better look at the damage to the blade tips and possibly get some clues as to what went wrong. The conjecture at the moment seems to be that a large area of relatively featureless terrain confused the navigation system, which uses down-facing cameras to track terrain features. If the navigation program couldn’t get a bead on exactly how far above the ground it was, it’s possible the copter came in too hard and caused the rotor tips to dig into the regolith. There seems to be some photographic suggestion of that, with what looks like divots in the ground about where you’d expect the rotor tips to dig in, and even scraps of material that look out of place and seem to be about the same color as the rotor blades. All this remains to be seen, of course, and we’re sure that NASA and JPL are poring over all available data to piece together what happened. As much as we hate to say goodbye to Ingenuity, we eagerly await the post-mortem.

Continue reading “Hackaday Links: February 4, 2024”

Parachute Drops Are Still A Viable Solution For Data Recovery From High Altitude Missions

Once upon a time, when the earliest spy satellites were developed, there wasn’t an easy way to send high-quality image data over the air. The satellites would capture images on film and dump out cartridges back to earth with parachutes that would be recovered by military planes.

It all sounds so archaic, so Rube Goldberg, so 1957. And yet, it’s still a viable method for recovering big globs of data from high altitude missions today. Really, you ask? Oh, yes indeed—why, NASA’s gotten back into the habit just recently!

Continue reading “Parachute Drops Are Still A Viable Solution For Data Recovery From High Altitude Missions”