In Praise Of RPN (with Python Or C)

HP calculators, slide rules, and Forth all have something in common: reverse polish notation or RPN. Admittedly, slide rules don’t really have RPN, but you work problems on them the same way you do with an RPN calculator. For whatever reason, RPN didn’t really succeed in the general marketplace, and you might wonder why it was ever a thing. The biggest reason is that RPN is very easy to implement compared to working through proper algebraic, or infix, notation. In addition, in the early years of computers and calculators, you didn’t have much to work with, and people were used to using slide rules, so having something that didn’t take a lot of code that matched how users worked anyway was a win-win.

What is RPN?

If you haven’t encountered RPN before, it is an easy way to express math without ambiguity. For example, what’s 5 + 3 * 6?  It’s 23 and not 48. By order of operations you know that you have to multiply before you add, even if you wrote down the multiplication second. You have to read through the whole equation before you can get started with math, and if you want to force the other result, you’ll need parentheses.

With RPN, there is no ambiguity depending on secret rules or parentheses, nor is there any reason to remember things unnecessarily. For instance, to calculate our example you have to read all the way through once to figure out that you have to multiply first, then you need to remember that is pending and add the 5. With RPN, you go left to right, and every time you see an operator, you act on it and move on. With RPN, you would write 3 6 * 5 +.

While HP calculators were the most common place to encounter RPN, it wasn’t the only place. Friden calculators had it, too. Some early computers and calculators supported it but didn’t name it. Some Soviet-era calculators used it, too, including the famous Elektronika B3-34, which was featured in a science fiction story in a Soviet magazine aimed at young people in 1985. The story set problems that had to be worked on the calculator.

Continue reading “In Praise Of RPN (with Python Or C)”

Hackaday Links Column Banner

Hackaday Links: May 28, 2023

The Great Automotive AM Radio War of 2023 rages on, with the news this week that Ford has capitulated, at least for now. You’ll recall that the opening salvo came when the US automaker declared that AM radio was unusable in their EV offerings thanks to interference generated by the motor controller. Rather than fixing the root problem, Ford decided to delete the AM option from their EV infotainment systems, while letting their rolling EMI generators just keep blasting out interference for everyone to enjoy. Lawmakers began rattling their sabers in response, threatening legislation to include AM radio in every vehicle as a matter of public safety. Ford saw the writing on the wall and reversed course, saying that AM is back for at least the 2024 model year, and that vehicles already delivered without it will get a fix via software update.

Continue reading “Hackaday Links: May 28, 2023”

A Reverse Polish Calculator For Your Keychain

As the smartphone has eaten ever more of the gatgets with which we once surrounded ourselves, it’s with some sadness that we note the calculator becoming a less common sight. It’s with pleasure then that we bring you [Nekopla]’s keychain calculator, not least because it’s a little more than a conventional model. This is a calculator which uses Reverse Polish Notation, or RPN.

A full write-up in Japanese (Google Translate link) carries an impressive level of detail about the project, but in short, it takes an Arduino Pro Micro, an array of keys, and an OLED display, and packages them on a couple of fiberglass prototyping boards in a sandwich between laser-cut Perspex front and rear panels.

The RPN notation is what makes it especially interesting,a system in which where you might be used to writing 2+2=  to get 4, in RPN you would write 2 2 + . It allows the use of much simpler code with a stack-based architecture than that used in a conventional calculator. It’s a system that’s usually the preserve of some pretty exclusive machines, so it’s great to see on something with more of the toy about it.

If RPN interests you, then you might like to read our look at the subject, and even feast your eyes on the teardown of a vintage 1975 Sinclair RPN calculator.

Walnut Case Sets This Custom Arduino-Powered RPN Calculator Apart From The Crowd

How many of us have an everyday tool that’s truly unique? Likely not many of us; take a look around your desk and turn out your pockets, but more often than not, what you’ll find is that everything you have is something that pretty much everyone else on the planet could have bought too. But not so if you’ve got this beautiful custom RPN calculator in a wooden case.

This one comes to us from [Shinsaku Hiura], who generally dazzles us with unique mechanical clocks and displays. This calculator solves a more practical problem — the dearth of RPN calculators on the market with the correct keyboard feel, specifically with the large keys and light touch he desired. Appropriately, the build started with a numeric keypad, which once liberated of its USB interface was reverse-engineered to figure out how the matrix was wired. Next up, a custom PCB to connect the keypad to an Arduino and a 20×4 LCD display was milled up, while a test case was designed and printed to check fitment. The final case was milled from a block of solid walnut and fitted with an acrylic window, for a sharp look with clean lines and pleasing colors.

As for the calculator itself, the demo below shows it going through its paces. The code is clever because it leverages the minimal number of keys available by hiding all the scientific and engineering functions behind a “secret silver key” that was once the equals key and obviously not needed in RPN. Hats off to [Shinsaku] for a handsome and unique addition to his desk.

Continue reading “Walnut Case Sets This Custom Arduino-Powered RPN Calculator Apart From The Crowd”

Soviet Scientific Calculator Gives Up Its Cold War-Era Secrets

Say what you want about Soviet technology, but you’ve got to admit there was a certain style to Cold War-era electronics. Things were perhaps not as streamlined and sleek as their Western equivalents, but then again, just look at the Nixie tube craze to see where collectors and enthusiasts stand on that comparison.

One particularly interesting artifact from the later part of that era was the lovely Elektronika MK-52 “microcalculator”. [Paul Hoets] has done a careful but thorough teardown of a fine example of this late-80s machine. The programmable calculator was obviously geared toward scientific and engineering users, but [Paul] relates how later versions of it were also used by the financial community to root out banking fraud and even had built-in cryptographic functions, which made encrypting text easy.

[Paul] has put together a video of the teardown, detailing the mostly through-hole construction and the interesting use of a daughter-board, which appears to hold the high-voltage section needed to drive the 11-character VFD tube. The calculator appears to be very well cared for, and once reassembled looks like it would be up for another ride on a Soyuz, where once it served as a backup for landing calculations.

We love the look of this machine and appreciate [Paul]’s teardown and analysis. But you say that the Cyrillic keyboard has you stumped and you need a bilingual version of the MK-52? That’s not a problem.

An Open-source Scientific RPN Calculator

Why reach for a bland, commercially available calculator when you be using a model that employs RPN (Reverse Polish Notation) in its calculations and be a custom build all at the same time? The kids may have colour TFTs and graphing functions, but your keyboard has no equals sign, and that means something.

Unfortunately for RPN enthusiasts, the RPN calculator is a little on the rare side. Since classic models from the 1970s and ’80s are rather pricey, [Anton Poluektov]’s just build his own called the OpenCalc. This glorious specimen is an open hardware RPN calculator with more than a nod to the venerable Hewlett Packard HP42 in its design.

At its heart is an STM32L476 low-power ARM processor and a Sharp Memory LCD, all on a PCB clad in a 3D-printed case you’d have been proud to own in the 1980s. It runs from a CR2032 which is more than can be said for some modern styles of calculator, and it gives the user everything you could wish for in a scientific calculator. The key legends are a set of printable stickers, which when printed on self-adhesive laser film prove durable enough to last. All the resources can be found in a GitHub repository, so if RPN is your thing there’s nothing to stop you building one for yourself.

If RPN interests you, it’s a subject we’ve looked at in greater detail in the past.

Another Kind Of “Bare Metal”: 6502 Computer Powers RPN Calculator

[Mitsuru Yamada] states that one of the goals for this 6502 computer build was to make it strong enough to survive real-world usage. In that regard alone we’d call this a success; the die-cast aluminum enclosures used are a little blast from the past and lend a nice retro industrial look to the project. The main chassis of the computer fairly bristles with LEDs and chunky toggle switches for setting the data and address busses. The interior is no less tidy, with the 6502 microprocessor — date code from 1995 — and associated support chips neatly arranged on perf board. The construction method is wire wrapping, in keeping with the old-school look and feel. Even the hand-drawn schematic is a work of art — shades of [Forrest Mims].

As for programming, this machine is as low-level as it gets. Nothing but 6502 machine language here, entered manually with the toggle switches, or via an externally programmed ROM. The machine can only address 1k of memory, a limit which the code to support the RPN calculator add-on [Yamada] also built brushes up against, at 992 bytes. The calculator keypad has a 20-key matrix pad and an eight-digit dot-matrix LED display, and can do the four basic operations on fixed-point binary-coded decimal inputs. The brief video below shows the calculator in action.

We love the look of this build and we’re eager to see more like it. We’ve seen a ton of 6502 builds from discrete chips lately, and while we love those too, it’s nice to see one of the big old DIPs put back in action for a change.

Continue reading “Another Kind Of “Bare Metal”: 6502 Computer Powers RPN Calculator”