GPIO pin assignments
Wiring conventions
All eight switches share a common ground bus on the perfboard. One leg of every switch connects to that ground rail; the other leg connects to its assigned GPIO pin. Because the firmware callspinMode(..., INPUT_PULLUP) for every input, the ESP32’s internal pull-up resistors hold each line at HIGH when the switch is open. Pressing a switch pulls that GPIO directly to ground, reading LOW. This means:
- Unpressed = HIGH
- Pressed = LOW
The 6-bit chord encoding
Each Braille dot maps to a single bit position in an unsigned 8-bit integer. Dot 1 occupies bit 0 (the least-significant bit), and dot 6 occupies bit 5. When you press a key, the firmware sets the corresponding bit; dots you do not press leave their bits at zero. After the 180 ms chording window closes, the resulting value is a compact 6-bit number that uniquely identifies the chord and can be compared against the dictionary in constant time.
The function that builds this value from the six GPIO readings is reproduced below exactly as it appears in the firmware:
readChord() — reading all 6 dot pins
if statement checks whether its GPIO is LOW (pressed) and, if so, ORs the corresponding power-of-two bitmask into the accumulator chord. The function returns 0 if no dots are held, and a value between 1 and 63 (0b000001 – 0b111111) for any combination of pressed dots.
Pressing dots 1 and 4 together produces a chord value of
0b001001 — bit 0 set for dot 1, and bit 3 set for dot 4. In English mode this resolves to the letter ‘C’; in Bangla mode it resolves to the consonant চ (cha) under the Bharati Braille standard.