Pratt Parsing For Algebraic Expressions

Parsing algebraic expressions is always a pain. If you need to compute, say, 2+4*2, the answer should be the same as (2 + (4 *2)), not ((2 + 4) * 2) — in other words, the right answer is 10, not 12. The classic way to do this is to use two stacks and a table of precedences for the operators. However, [Martin Janiczek] prefers to use Pratt Parsers and wants to show you how they work.

The parser is named after [Vaughn Pratt]. The algorithm works with a table of precedence where operators with higher precedence have higher numbers. It then builds a left and right portion of a string, using recursion. So if you consider 2+4*2, you wind up, on the first pass, with (2+ parse(4*2)). The second parse returns a full expression to produce: (2+(4*2)).

Continue reading “Pratt Parsing For Algebraic Expressions”

Cooling Paint You Can Actually Make

[NightHawkInLight] has been working on radiative sky paint. (Video, embedded below.) That’s a coating that radiates heat in the infrared spectrum at a wavelength that isn’t readily absorbed or reflected by the atmosphere. The result is a passive system that keeps materials a few degrees cooler in direct sunlight than an untreated piece in the shade. That sounds a bit like magic, but apparently the math checks out.

Continue reading “Cooling Paint You Can Actually Make”

Adding Smart Watch Features To Vintage Casio

[Matteo] has been a fan of the Casio F-91W wristwatch virtually since its release in 1989. And not without good reason, either. The watch boasts reliable timekeeping and extremely long battery life thanks to a modern quartz crystal and has just about every feature needed in a watch such as an alarm and a timer. And, since it’s been in use since the 80s, it’s also a device built to last. The only thing that’s really missing from it, at least as far as [Matteo] was concerned, was a contactless payment ability.

Contactless systems use near-field communication (NFC) to remotely power a small chip via a radio antenna when in close proximity. All that’s really required for a system like this is to figure out a way to get a chip and an antenna and to place them inside a new device. [Matteo] scavenges the chip from a payment card, but then builds a new antenna by hand in order to ensure that it fits into the smaller watch face. Using a NanoVNA as an antenna analyzer he is able to recreate the performance of the original antenna setup in the smaller form factor and verify everything works before sealing it all up in a 3D-printed enclosure that sandwiches the watch.

There are a few reasons why using a contactless payment system with a watch like this, instead of relying on a smartwatch, might be preferential. For one, [Matteo] hopes to explore the idea that one of the physical buttons on the watch could be used to physically disable the device to reduce pickpocketing risk if needed. It’s also good to not have to buy the latest high-dollar tech gadget just for conveniences like this too, but we’ve seen in the past that it’s not too hard just to get these systems out of their cards in the first place.

The Chess Computer From 1912

Who was [Leonardo Torres Quevedo]? Not exactly a household name, but as [IEEE Spectrum] points out, he invented a chess automaton in 1920 that would foreshadow the next century’s obsession with computers playing chess.

Don’t confuse this with the infamous Mechanical Turk, which appeared to be a chess computer but was really a guy hiding inside a fake chess computer. The Spanish engineer’s machine really did play a modified end game. The chessboard was vertical, and pegs represented pieces. There were mechanical arms to move the pegs. The device actually dates back to 1912, with a public demonstration in Paris in 1914. Given [Quevedo’s] native language, the machine was called El Ajedrecista.

Continue reading “The Chess Computer From 1912”

A man in a dark shirt stands at a podium in front of a projector screen with the text "50% OF US CAR TRIPS" in white above yellow text saying "1 HUMAN < 3 MILES". The screen is flanked by decor saying "Supercon" in white on a black background.

Supercon 2022: Bradley Gawthrop Wants You To Join The PEV Revolution

During the 20th Century, much of the western world decided that motor vehicles were the only desirable form of transportation. We built our cities to accommodate cars through parking, stop lights, and any number of other infrastructure investments so that you could go get milk and bread in style. In the US, 50% of automobile trips are less than three miles and have only one occupant. [Bradley Gawthrop] asked if there might be a more efficient way to do all this? Enter the Personal Electric Vehicle (PEV).

What Are PEVs?

PEVs are a nascent part of the transportation mix that fall under the wider umbrella of “micromobility,” including scooters, bikes, skateboards, and the like. The key differentiator here is that they are at least partially electrically-driven. [Gawthrop] walks us through several of the different types during his Supercon 2022 talk, but since they are all small, electric powered devices for transporting one or two people, they can trace their lineage back to the infamous Segway Human Transporter.

Using an electric motor or two connected to a controller and batteries, the overall system complexity for any of these devices is quite low and ripe for the hacking. Given the right tools and safety precautions, anyone should be able to crack a PEV open and repair or tinker with it. As with many things in life, the real story is more complicated.

As [Gawthrop] notes, many a hacker has said, “I wish I’d been able to be involved in X before…” where X equals some technology like home automation and it’s before it got creepy or dystopian in some manner. He exhorts us that the time to be in on the ground floor with PEVs is now. Continue reading “Supercon 2022: Bradley Gawthrop Wants You To Join The PEV Revolution”

3D Printing Food Hack Chat

Join us on Wednesday, July 5 at noon Pacific for the 3D Printing Food Hack Chat with Ellie Weinstein!

In the right hands, food goes beyond mere sustenance and becomes a work of art. We’ve all seen examples — the carefully crafted blends of flavors, the quality ingredients expertly cooked, the artful platings that make a dramatic presentation at the table. But where the artistry really seems to take off is with desserts, which pastry chefs and confectioners can take to the next level with edible sculptures of chocolate and other sweets that can tower dramatically over the table.

join-hack-chatThat’s all well and good for the haute cuisine set, but what about the rest of us? We can’t all have the talent and drive needed to produce edible art, so perhaps we can leverage technology to help us out. That’s just one of the rationales behind food 3D printing, which is what we’ll be exploring with Ellie Weinstein. She’s the CEO of Cocoa Press, where they’re bringing chocolate 3D printing to the mainstream. It’s not as easy as you might think — there are plenty of nuances and engineering challenges when you’re trying to print chocolate or any other kind of food. Make sure you stop by and check it out; it’s sure to be a treat.

Our Hack Chats are live community events in the Hackaday.io Hack Chat group messaging. This week we’ll be sitting down on Wednesday, July 5 at 12:00 PM Pacific time. If time zones have you tied up, we have a handy time zone converter.

A Commodore 128 with a video capture device attached

Hacking The Commodore 128 To Capture Almost Real-Time Video

Although watching and editing videos may be among the primary tasks of many PCs today, it wasn’t that long ago that working with video required powerful processors and expensive video capture hardware. Even in the 1980s, home computer users were looking for ways to connect video sources to their Commodores and Ataris despite their hardware limitations. [Cameron Kaiser] has a mid-1980s consumer-grade video capture device, which he has managed to turn into an almost real-time video capture system.

A distorted video image on a C128's monitor
Allowing the graphics chip to interrupt the CPU mid-capture results in a severely distorted image

His work revolves around a device called “ComputerEyes”, a 1984-vintage hardware interface that made it possible to connect a composite video source to a home computer. The limitations of mid-1980s CPUs meant that it took around six seconds for the computer to do a quick scan of a single video frame, or a multiple of that if you wanted a higher-quality image. Another limitation, at least on Commodore machines, was that the screen had to be turned off during video capture – otherwise, the video chip would interrupt the CPU halfway through the process, causing it to lose its synchronization with the video source.

[Cameron] however, plugged his ComputerEyes into a Commodore 128. This machine, largely designed by Hackaday contributor [Bil Herd], has an unusual hardware architecture consisting of two different CPUs and, crucially, two separate video chips. The primary 8564 “VIC-II” graphics chip is used to keep compatibility with existing Commodore 64 programs, while the secondary 8563 “VDC” is mainly aimed at newer high-resolution text-based software. The VDC is also much more independent from the main system bus than the VIC-II, allowing it to display an image without disturbing the CPU.

More after the break.

Continue reading “Hacking The Commodore 128 To Capture Almost Real-Time Video”