Retrotechtacular: Critical Code Reading, 70s Style

Anyone who has ever made a living writing code has probably had some version of the following drilled into their head: “Always write your code so the next person can understand it.” Every single coder has then gone on to do exactly the opposite, using cryptic variables and bizarre structures that nobody else could possibly follow. And every single coder has also forgotten the next part of that saying — “Because the next person could be you” — and gone on to curse out an often anonymous predecessor when equally inscrutable code is thrust upon them to maintain. Cognitive dissonance be damned!

It’s a tale as old as time, or at least as old as programming has existed as a profession. And by 1975, poorly written code was enough of a problem that an outfit called Edutronics put together the animated gem Critical Program Reading: Structuring an Unstructured Program. It’s apparently Part 1 of a larger series on structured programming techniques, and comes to us by way of [Alec Watson], host of Technology Connections on YouTube, by way of his second channel, the delightfully named Technology Connextras.

The film’s three minimally animated characters, each of whom could have been the villain in an episode of Scooby Doo, are tasked by a stern-sounding narrator to analyze a fragment of pseudocode that’s written in a concoction of COBOL, PL/1, and a bunch of other languages. The code is a hot mess, but our heroes muddle through it line by awful line, making it more readable by guessing at more descriptive variable names, adding structured elements, and making logical changes to improve the program’s flow. The example code is highly contrived, to be sure, but the business logic becomes much clearer as our team refactors the code and makes it far more approachable.

For as much as languages have changed since the 1970s, and with all the progress we’ve made in software engineering, the lessons presented in this film are still surprisingly relevant. We loved a lot of the little nuggets dropped along the way, like “Consistency aids understanding,” and “Use symbols in a natural way.” But we will take exception with the statement “Wrong means poor structure” — we’ve written seen plenty of properly structured code that didn’t work worth a damn. We also enjoyed the attempt at socially engineering a less toxic work environment: “Use tact in personal criticisms.” If only they could learn that lesson over at Stack Overflow.

It’s not clear where [Alec] found this 16-mm film — we’d sure like to hear that story — but it’s a beauty and we’re glad he took the time to digitize it. We’re consistently amazed at his ability to make even the most mundane aspects of technology endlessly fascinating, and while this film may be a bit off from his normal fare, it’s still a great find. Continue reading “Retrotechtacular: Critical Code Reading, 70s Style”

A White-Light Laser, On The Cheap

Lasers are known for the monochromatic nature of their light, so much so that you might never have thought there could be such a thing as a white laser. But in the weird world of physics, a lot of things that seem impossible aren’t really, as demonstrated by this dirt-cheap supercontinuum laser.

Of course, we’re not experts on lasers, and certainly not on non-linear optics, so we’ll rely on [Les Wright]’s video below to explain what’s going on here. Basically, a “supercontinuum” is just the conversion of a monochromatic source to a broader spectral bandwidth. It’s a non-linear optical process that’s usually accomplished with expensive bits of kit, like photonic crystal fibers, which are optical fibers with an array of tiny air-filled holes running down their lengths. Blast a high-intensity monochromatic laser down one end, and white light comes out the other end.

Such fibers are obviously fantastically expensive, so [Les] looked back in the literature and found that a simple silica glass single-mode fiber could be used to produce a supercontinuum. As luck would have it, he had been experimenting with telecom fibers recently, so along with a nitrogen laser he recovered from a Dumpster, he had pretty much everything he needed. The final setup uses the UV laser to pump a stilbene dye laser, which shoots a powerful pulse of 426 nanometer light into about 200 meters of fiber, and produces a gorgeous supercontinuum containing light from 430 nm to 670 nm — pretty much the entire visible spectrum.

It’s great to see projects like this that leverage low-cost, easy-to-source equipment to explore esoteric physics concepts.

Continue reading “A White-Light Laser, On The Cheap”

Machine Learning Makes Sure Your LOLs Are Genuine

There was a time not too long ago when “LOL” actually meant something online. If someone went through the trouble of putting LOL into an email or text, you could be sure they were actually LOL-ing while they were typing — it was part of the social compact that made the Internet such a wholesome and inviting place. But no more — LOL has been reduced to a mere punctuation mark, with no guarantee that the sender was actually laughing, chuckling, chortling, or even snickering. What have we become?

To put an end to this madness, [Brian Moore] has come up with the LOL verifier. Like darn near every project we see these days, it uses a machine learning algorithm — EdgeImpulse in this case. It detects a laugh by comparing audio input against an exhaustive model of [Brian]’s jocular outbursts — he says it took nearly three full minutes to collect the training set. A Teensy 4.1 takes care of HID duties; if a typed “LOL” correlates to some variety of laugh, the initialism is verified with a time and date stamp. If your LOL was judged insincere – well, that’s on you. See what you think of the short video below — we genuinely LOL’d. And while we’re looking forward to a ROTFL verifier, we’re not sure we want to see his take on LMAO.

Hats off to [Brian] for his attempt to enforce some kind of standards online. You may recall his earlier attempt to make leaving Zoom calls a little less awkward, which we also appreciate.

Continue reading “Machine Learning Makes Sure Your LOLs Are Genuine”

Squeezing A Minimalist 6502 Retrocomputer Onto A Single Breadboard

Over the years, and especially lately, we’ve seen tons of single-board retrocomputer builds. That’s fine with us — the more, the merrier. But they all start to run together a bit, with little to distinguish between them. Not so this about-as-compact-as-possible 6502 computer that fits on a single breadboard.

Now, when you do the math, it seems like there’s no way that [Anders Nielsen] would have been able to fit even a minimal chipset onto a standard solderless breadboard. The 40-pin 6502 alone takes up nearly two-thirds of the connections available; add in equally large but necessary chips like the 6522 interface adapter, ROM and RAM chips, and some support ICs, and one breadboard isn’t going to cut it. Luckily, some frugal engineers at MOS back in the 70s came up with the 6507, a variant on the 6502 in a 28-pin DIP. The other key to this build is the 6532 RAM-I/O-timer chip or RIOT, which puts a tiny amount of RAM and some IO lines on a single 40-pin DIP. Along with a 28-pin ROM, a 14-pin hex inverter, and a little crystal oscillator, the entire chipset just barely fits on a single breadboard.

But what can this minimalist 6502 actually do? As you can see in the video below, anything a 555 timer can do, and maybe a little bit more. That’s not a dig, of course — [Anders] actually calls out his initial blinkenlight application as a little more than a glorified 555, and actually comes up with a marginally more complex application just to prove the point. The interesting part here is dealing with the constraints imposed by the limited resources available on this machine.

We’re looking forward to whatever comes next for this clever build. It’s hard to see how some of the plans [Anders] has for it will still fit on a single breadboard, though — these things tend to spread out as they go.

Continue reading “Squeezing A Minimalist 6502 Retrocomputer Onto A Single Breadboard”

Reverse Engineering Saves Weller With A Wonky LCD From The Trash Pile

There’s nothing more satisfying than finding a broken piece of gear in the trash and bringing it back to life. Satisfying, but also potentially more time-consuming — someone tossed it for a reason, after all. Figuring out what that reason is and finding a way to back it better is where the fun — and the peril — are.

Luckily, some pieces of equipment have a relatively short list of well-known failure modes, a fact that [Lauri Pirttiaho] relied on for this fix of an old Weller WD1 soldering station. The unit, sporting the familiar light blue Weller livery and more than a few scratches and dings, had an LCD that was DOA. Typically it’s the driver that’s the problem here, but [Lauri]’s diagnosis revealed it was the LCD module itself that was bad.

With OEM replacements being basically unobtainium at this point, the fix was to intercept the data heading from the driver to the old LCD and send it to a new, easily sourced 16×2 character LCD display. This began with an inspection of the display controller’s datasheet, and a bit of probing of the old display to find out which segments and backplanes map to which pins. A little bit of case modding allowed the new display to fit, the old controller chip was removed, and a PIC16 went into its place, in a tidy nest of Kapton tape and bodge wires. The PIC does the job of translating the original display, which had a fair number of custom icons and symbols, into sensible text-based equivalents and sending them to the 16×2 via I2C. The video below shows the hack in action; it honestly looks like it could have come from the factory like that.

The nice thing here is that [Lauri]’s fix applies to a whole range of Weller stations, so if you find one in the trash, you might be able to resuscitate it. Failing that, you could always roll your own Weller from (more-or-less) scratch.

Continue reading “Reverse Engineering Saves Weller With A Wonky LCD From The Trash Pile”

Hackaday Links Column Banner

Hackaday Links: December 25, 2022

Looks like it’s lights out on Mars for the InSight lander. The solar-powered lander’s last selfie, sent back in April, showed a thick layer of dust covering everything, including the large circular solar panels needed to power the craft. At the time, NASA warned that InSight would probably give up the ghost sometime before the end of the year, and it looks like InSight is sticking to that schedule. InSight sent back what might be its last picture recently, showing the SEIS seismic package deployed on the regolith alongside the failed HP3 “mole” experiment, which failed to burrow into the soil as planned. But one bad experiment does not a failed mission make — it was wildly successful at most everything it was sent there to do, including documenting the largest marsquake ever recorded. As it usually does, NASA has anthropomorphized InSight with bittersweet sentiments like “Don’t cry, I had a good life,” and we’re not quite sure how we feel about that. On the one hand, it kind of trivializes the engineering and scientific accomplishments of the mission, but then again, it seems to engage the public, so in the final rinse, it’s probably mostly harmless.

Continue reading “Hackaday Links: December 25, 2022”

This WiFi Signal Strength Meter Ain’t Afraid Of No Ghosts

The original Ghostbusters movie is a classic that’s still delivering nearly 40 years after its release — just let that sink in for a minute. Almost every aspect of the film, from hand props to quotes, is instantly recognizable, even to people who haven’t based their lives on the teachings of [Venkman], [Stantz], and [Spengler]. To wit, we present this PKE meter-style WiFi scanner.

Of course, [Kevin McAleer]’s project is strictly in the “Just for Fun” category. But that doesn’t mean it’s not at least somewhat useful. The design is pretty close to the original PKE meter, with a little bit of creative license taken to make it easier to build. Guts include a Raspberry Pi Pico W and a generous 320×240 LCD display. The body of the meter is entirely 3D printed; design files are of course available. The meter’s arms are geared together to move with a single hobby servo.

On the software side, [Kevin]’s GUI lets users see a list of WiFi hotspots in the area and select one from the list. From there, the position of the arms is determined by the RSSI for the hotspot, similar to how the prop was supposed to indicate the proximity to a spook, specter, or ghost. There’s perhaps a bit of a missed opportunity by not adding LEDs to the arms, but we’ll let that slide.

The video below has full design and build details, but fair warning that it’s a bit on the long side. That’s probably just a reflection of how much work [Kevin] put into this, though. Of course, you may rather build a PKE meter that “actually” detects ghosts, in which case we’ve got you covered.

Continue reading “This WiFi Signal Strength Meter Ain’t Afraid Of No Ghosts”