Calculator Project Guide


  • Set SW1's Role to "Key: 2nd/Mode"
  • Set SW1's Role Details to "Matrix ROW0/COL0. Dedicated mode key toggles numbers, equations, symbols, and text multi-tap modes."
  • Set SW1's Human Interface to "2nd/Mode"
  • Set SW2's Role to "Key: 1 abc"
  • Set SW2's Role Details to "Matrix ROW0/COL1. Number 1; text mode cycles a/b/c."
  • Set SW2's Human Interface to "1 abc"
  • Set SW3's Role to "Key: 2 def"
  • Set SW3's Role Details to "Matrix ROW0/COL2. Number 2; text mode cycles d/e/f."
  • Set SW3's Human Interface to "2 def"
  • Set SW4's Role to "Key: 3 ghi"
  • Set SW4's Role Details to "Matrix ROW0/COL3. Number 3; text mode cycles g/h/i."
  • Set SW4's Human Interface to "3 ghi"
  • Set SW5's Role to "Key: +"
  • Set SW5's Role Details to "Matrix ROW0/COL4. Addition operator; 2nd inserts sin()."
  • Set SW5's Human Interface to "+"
  • Set SW6's Role to "Key: -"
  • Set SW6's Role Details to "Matrix ROW0/COL5. Subtraction/minus operator; 2nd inserts cos()."
  • Set SW6's Human Interface to "-"
  • Set SW7's Role to "Key: Backspace"
  • Set SW7's Role Details to "Matrix ROW0/COL6. Deletes previous character."
  • Set SW7's Human Interface to "Backspace"
  • Set SW8's Role to "Key: 4 jkl"
  • Set SW8's Role Details to "Matrix ROW1/COL0. Number 4; text mode cycles j/k/l."
  • Set SW8's Human Interface to "4 jkl"
  • Set SW9's Role to "Key: 5 mno"
  • Set SW9's Role Details to "Matrix ROW1/COL1. Number 5; text mode cycles m/n/o."
  • Set SW9's Human Interface to "5 mno"
  • Set SW10's Role to "Key: 6 pqr"
  • Set SW10's Role Details to "Matrix ROW1/COL2. Number 6; text mode cycles p/q/r."
  • Set SW10's Human Interface to "6 pqr"
  • Set SW11's Role to "Key: × / x"
  • Set SW11's Role Details to "Matrix ROW1/COL3. Multiply operator; 2nd inserts graph variable x."
  • Set SW11's Human Interface to "× / x"
  • Set SW12's Role to "Key: ÷"
  • Set SW12's Role Details to "Matrix ROW1/COL4. Division operator; 2nd inserts log()."
  • Set SW12's Human Interface to "÷"
  • Set SW13's Role to "Key: ("
  • Set SW13's Role Details to "Matrix ROW1/COL5. Left parenthesis."
  • Set SW13's Human Interface to "("
  • Set SW14's Role to "Key: )"
  • Set SW14's Role Details to "Matrix ROW1/COL6. Right parenthesis."
  • Set SW14's Human Interface to ")"
  • Set SW15's Role to "Key: 7 stu"
  • Set SW15's Role Details to "Matrix ROW2/COL0. Number 7; text mode cycles s/t/u."
  • Set SW15's Human Interface to "7 stu"
  • Set SW16's Role to "Key: 8 vwx"
  • Set SW16's Role Details to "Matrix ROW2/COL1. Number 8; text mode cycles v/w/x."
  • Set SW16's Human Interface to "8 vwx"
  • Set SW17's Role to "Key: 9 yz space"
  • Set SW17's Role Details to "Matrix ROW2/COL2. Number 9; text mode cycles y/z/space."
  • Set SW17's Human Interface to "9 yz space"
  • Set SW18's Role to "Key: ^"
  • Set SW18's Role Details to "Matrix ROW2/COL3. Exponent operator; 2nd inserts sqrt()."
  • Set SW18's Human Interface to "^"
  • Set SW19's Role to "Key: ="
  • Set SW19's Role Details to "Matrix ROW2/COL4. Equals/evaluate expression."
  • Set SW19's Human Interface to "="
  • Set SW20's Role to "Key: Graph"
  • Set SW20's Role Details to "Matrix ROW2/COL5. Graph/evaluate plotted expression."
  • Set SW20's Human Interface to "Graph"
  • Set SW21's Role to "Key: Clear"
  • Set SW21's Role Details to "Matrix ROW2/COL6. Clear current input or line."
  • Set SW21's Human Interface to "Clear"
  • Set SW22's Role to "Key: 0"
  • Set SW22's Role Details to "Matrix ROW3/COL0. Number 0; 2nd inserts comma."
  • Set SW22's Human Interface to "0"
  • Set SW23's Role to "Key: ."
  • Set SW23's Role Details to "Matrix ROW3/COL1. Decimal point; 2nd inserts pi."
  • Set SW23's Human Interface to "."
  • Set SW24's Role to "Key: Enter"
  • Set SW24's Role Details to "Matrix ROW3/COL2. Accept expression/character or submit."
  • Set SW24's Human Interface to "Enter"
  • Set SW25's Role to "Key: Up"
  • Set SW25's Role Details to "Matrix ROW3/COL3. Navigation up."
  • Set SW25's Human Interface to "Up"
  • Set SW26's Role to "Key: Down"
  • Set SW26's Role Details to "Matrix ROW3/COL4. Navigation down."
  • Set SW26's Human Interface to "Down"
  • Set SW27's Role to "Key: Left"
  • Set SW27's Role Details to "Matrix ROW3/COL5. Cursor/navigation left."
  • Set SW27's Human Interface to "Left"
  • Set SW28's Role to "Key: Right"
  • Set SW28's Role Details to "Matrix ROW3/COL6. Cursor/navigation right."
  • Set SW28's Human Interface to "Right"
I wired the existing 28 pushbuttons as a compact 4×7 ESP32 matrix and labeled them with beginner-friendly calculator/text-entry roles, including SW1 as the dedicated 2nd/Mode key. I could not complete the OLED replacement/layout/review steps because the workspace is currently out of execution credits and further project manipulation is blocked.
Remaining work: update the keypad firmware map document to the final 28-key layout, replace or rewire the display to the required I2C OLED on IO21/IO22 if possible, place the 28 switches in a clean 4×7 calculator grid, put the ESP32 antenna at the board edge, and run the final layout/review pass.

Keypad Firmware Map
This project uses a 6x6 pushbutton matrix for the graphing calculator keypad. Rows are driven one at a time by the ESP32 and columns are read as inputs using pull-ups in firmware.
ESP32 GPIO assignment

Table


Matrix netESP32 pin
ROW0IO13
ROW1IO14
ROW2IO16
ROW3IO17
ROW4IO18
ROW5IO19
COL0IO25
COL1IO26
COL2IO27
COL3IO32
COL4IO33
COL5IO34
The OLED is connected separately on I2C: SDA = IO21, SCL = IO22, with 3V3 and GND.
Key map

Table


SwitchMatrixLabelFirmware purpose
SW1ROW0,COL02nd/ModeDedicated mode toggle for numbers, math symbols, and multi-tap letters
SW2ROW0,COL11 abc1 or a/b/c by repeated taps in text mode
SW3ROW0,COL22 def2 or d/e/f by repeated taps in text mode
SW4ROW0,COL33 ghi3 or g/h/i by repeated taps in text mode
SW5ROW0,COL4+Addition
SW6ROW0,COL5BackspaceDelete previous character
SW7ROW1,COL04 jkl4 or j/k/l
SW8ROW1,COL15 mno5 or m/n/o
SW9ROW1,COL26 pqr6 or p/q/r
SW10ROW1,COL3-Subtraction/minus
SW11ROW1,COL4(Left parenthesis
SW12ROW1,COL5)Right parenthesis
SW13ROW2,COL07 stu7 or s/t/u
SW14ROW2,COL18 vwx8 or v/w/x
SW15ROW2,COL29 yz space9 or y/z/space
SW16ROW2,COL3xMultiply operator or graphing variable x
SW17ROW2,COL4^Exponent
SW18ROW2,COL5GraphGraph/evaluate equation
SW19ROW3,COL00Number 0
SW20ROW3,COL1.Decimal point
SW21ROW3,COL2=Equals/evaluate
SW22ROW3,COL3÷Division
SW23ROW3,COL4ClearClear current input
SW24ROW3,COL5EnterAccept expression/character
SW25ROW4,COL0UpNavigation up
SW26ROW4,COL1DownNavigation down
SW27ROW4,COL2LeftCursor left
SW28ROW4,COL3RightCursor right
SW29ROW4,COL4sinSine function
SW30ROW4,COL5cosCosine function
SW31ROW5,COL0tanTangent function
SW32ROW5,COL1logLogarithm; use 2nd/mode for ln
SW33ROW5,COL2sqrtSquare root; use 2nd/mode for square
SW34ROW5,COL3MenuCalculator menu/settings
SW35ROW5,COL4ShiftCapital letters/alternate entry
SW36ROW5,COL5SpaceText-entry space helper
Multi-tap behavior
Use SW1 as the mode key. In text mode, repeated presses on a number key cycle through its assigned letters, and the current character is confirmed after about a 700 ms pause. For example, SW2 cycles a -> b -> c when pressed repeatedly in text mode.
Firmware scanning note
Recommended scan loop: set all rows inactive, drive one row active, read the six columns, debounce for about 20 ms, then advance to the next row. IO34 is input-only, so it is assigned as a column input, not a row output.
  • ESP32 GPIO assignment

  • Key map

  • Multi-tap behavior

  • Firmware scanning note