A high-performance, feature-rich engineering calculator built using MicroPython, an ESP32, and an SSD1306 OLED display. It supports everything from basic arithmetic to calculus, matrix operations, and function graphing.
The calculator is divided into several specialized modes, accessible via a dedicated menu system:
-
Standard Calculator: Basic arithmetic with support for trigonometry (
sin,cos,tan), logarithms (log,ln), powers, and roots. -
Graphing Mode: Visualizes functions on a Cartesian plane with auto-scaling.
-
Calculus Suite: * Numerical Integration: Uses Simpson's/Trapezoidal logic to find the area under a curve.
-
Slope (Derivative): Calculates the instantaneous rate of change at a point .
-
Algebraic Solvers:
-
Equation Solver: Solves Quadratic (exact) and Cubic (Newton-Raphson method) equations.
-
System of Equations: Solves linear systems.
-
Matrix Operations: Calculate Determinants and Inverses for matrices.
-
Base Converter: Convert between Binary, Octal, Decimal, and Hexadecimal.
-
Scientific Features: * Shift-key functionality for secondary commands.
-
Memory registers (M+, M-, Recall, Clear).
-
History scrolling to revisit previous calculations.
- Microcontroller: ESP32 (NodeMCU or similar).
- Display: SSD1306 I2C OLED (128x64).
- Keypad: 7x5 Matrix Keypad (Customized layout).
- Firmware: MicroPython (v1.19 or newer recommended).
| Component | ESP32 Pin |
|---|---|
| I2C SCL | GPIO 22 |
| I2C SDA | GPIO 21 |
| Row Pins | 33, 25, 26, 27, 14, 12, 13 |
| Col Pins | 18, 19, 32, 5, 23 |
- Prepare the ESP32:
Ensure your ESP32 is flashed with the latest MicroPython firmware. You can use Thonny IDE or
esptool.py. - Install Libraries:
You need the
ssd1306.pydriver. You can install it via Thonny (Tools -> Manage Packages) or download it manually and upload it to your ESP32. - Upload the Code:
- Download the
main.pyfrom this repository. - Upload
main.pyto the root directory of your ESP32.
- Run: Restart your ESP32. The "RAMAN CALCULATOR v2" splash screen should appear.
- Navigation: Use the UP/DOWN arrows to scroll through the Mode Menu. Press "=" or RIGHT to select a mode.
- Shift Operations: Press the SHIFT key to toggle secondary functions (e.g., changing
sintoasinorlogtoln). - Editing: Use the LEFT/RIGHT arrows to move the cursor within an expression. Use "←" for backspace (it is smart enough to delete entire functions like
math.sin(at once). - Exiting Modes: Press the MODE button at any time to escape a sub-mode and return to the selection menu.
main.py: The core application containing the display engine, keypad driver, and mathematical logic.ssd1306.py: (External dependency) The I2C OLED driver.
Feel free to fork this project, report bugs, or submit pull requests. I am particularly interested in:
- Implementing System of Equation solvers.
- Optimizing the OLED refresh rate for smoother graphing.
- Adding complex number support to the standard calculator mode.
| Resource | Link |
|---|---|
| GitHub Repository | RMNO21/ESP32-Calculator |
| Online Simulator | Interactive Wokwi Simulation |
Note: The Wokwi simulator is a great way to test the keypad logic and OLED display rendering directly in your browser before assembling the physical hardware.
