OpenRPNCalc: Custom scientific RPN calculator based on STM32
Reverse Polish Notation (RPN) is a popular method for representing mathematical expressions. In this notation, the operator symbol comes after the operands in contrast to the Polish notation, where the operators are placed preceding the operands. For example, the Polish notation for the addition of 2 and 5 is 2+5, while in reverse Polish notation, it is represented as 2 5 +. RPN is suited for lengthy calculations, and this notation leads to faster calculations. This is because the RPN calculators do not need expressions to be parenthesized. Therefore, to perform a typical calculation, fewer operations need to be performed. In addition, the RPN calculator users make fewer mistakes than the other type of calculator users.
Anton Poluektov, a Physicist from France, recently posted his custom open-source scientific RPN calculator. It is based on an STM32 microcontroller and can operate on a 3V CR2032 lithium battery for around a year. Anton says that the hardware is inspired by the SwissMicros DM42 calculator, but it has been designed from scratch. He further adds to it,
“Firmware-wise, however, there is no intention to simulate programmable HP series. Instead, I aim to create a device that fits my everyday needs at work, with a preprogrammed set of functions that are, possibly, rarely or never available in the commercial calculators.”
The device has an STM32L476RG ultra-low-power microcontroller. The microcontroller consists of a high-performance ARM Cortex-M4 32-bit RISC core operating at a frequency of up to 80 MHz. The STM32 microcontroller features high-speed memories (1MB flash memory and 128kB of SRAM) and an integrated LCD driver making it suitable for usage in calculators. The display is the Sharp 400×240 pixel monochrome LS027B7DH01 Memory LCD module. It is a TFT-type display with high longevity. The keyboard uses light-touch tactile switches from Panasonic, and the device runs from the 3V CR2032 lithium battery like most modern calculators. Anton mentions that it is sufficient to provide power to the calculator for around one year of operation.
The calculator includes the following features:
- Reverse Polish notation with 4-element stack.
- Double-precision arithmetic operations.
- “Standard” scientific calculator functions (trigonometric, logarithms, exponentiation, square root, and power).
- Error function (erf) and its inverse (erfinv).
- Fixed, scientific (SCI), and engineering (ENG) display modes (including SI prefixes in ENG mode), variable 3-10 digits precision.
- Calculations with uncertainties using error-propagation formulas (UNCERT mode). This is one of the unique features of the OpenRPNCalc which is very rarely present in firmware-based calculators.
- Low power consumption (40-50 uA in standby mode with LCD on).
Anton recently also added relativistic kinematics functions, gamma and log gamma functions, and conversion between degrees and radians.
The casing is made of four 3D printed parts (top, bottom, keypad, and the switch spacer). The top and bottom are held together by snap-fit joints and the buttons are labeled with a simple printed sticker paper.
The source code, schematics, and 3D-printed case design files are released under an open license and can are available at GitHub.