Athena Instrument Panel — Hardware Wiring & Resistor Ladder Guide
This document provides a comprehensive technical reference for building and wiring the physical Athena Instrument Panel. It includes the complete Bill of Materials (BOM), the circuit design for reading a 12-position rotary switch via a single analog input pin, a system wiring diagram, and physical pinout assignments.
📦 1. Bill of Materials (BOM)
To build the hardware cockpit instrument panel, you need the following standard components:
| Component | Quantity | Description | Interface / Type | Typical I2C Address / Pin |
|---|---|---|---|---|
| Microcontroller | 1 | Arduino Uno R3 or Arduino Nano V3.0 | Central MCU | USB Serial (115200 bps) |
| LCD Display | 1 | 16x2 Character LCD Screen | 1602 LCD with PCF8574 Adapter | 0x27 (I2C) |
| Rotary Switch | 1 | 1-Pole 12-Position (1P12T) Switch | Selector Switch (e.g., Lorlin CK1049) | Pin A0 (Analog Ladder) |
| Magnetometer | 1 | LIS3MDL 3-Axis Digital Compass | Magnetic Field Telemetry | 0x1E (I2C) |
| Inertial Sensor | 1 | LSM6DSOX 6DoF Accel / Gyro | Pitch & Heel Angle Telemetry | 0x6A (I2C) |
| Power Switch | 1 | SPST Toggle Switch | Physical soft power toggle | Pin D2 (Digital Input) |
| Backlight Switch | 1 | SPST Toggle Switch | Screen backlight control | Pin D3 (Digital Input) |
| Resistors | 11 | 10kΩ 1% Metal Film Resistors | Ladder dividers (in series) | Inter-switch terminal spacing |
| Resistor | 1 | 10kΩ 1% Resistor | Pull-up resistor | Pin A0 to 5V (VCC) |
| Proto-board | 1 | Double-sided FR4 perfboard | Structural mounting / wiring hub | Ground / Power rails |
⚙️ 2. Rotary Switch Resistor Ladder Circuit Design
Microcontrollers have limited digital GPIO pins. Wiring a 12-position rotary switch using 12 digital pins would consume nearly all available IO on an Arduino Uno.
By utilizing an analog resistor ladder, we map the 12 positions to distinct voltage levels. The microcontroller reads the voltage via a single analog input (A0) using its 10-bit Analog-to-Digital Converter (ADC) which maps 0V - 5V to values 0 - 1023.
Resistor Ladder Schematic
5V (VCC)
|
[10k Pull-Up]
|
A0 --+--------------+---------------+---------------+ ... +
| | | | |
[ Pos 12 ] [ Pos 11 ] [ Pos 10 ] [ Pos 9 ] [ Pos 1 ]
| | | | |
Direct [10k] [10k] [10k] Direct
to VCC | | | |
+----[10k]------+----[10k]------+ ... +---- GND (0V)
- Connect a 10kΩ resistor between each adjacent terminal on the rotary switch (11 resistors total in series).
- Pin 1 of the switch is wired directly to GND (0V).
- Pin 12 of the switch is wired directly to VCC (5V).
- The Common Pole (center pin) of the switch is wired to Pin A0 on the Arduino.
- Connect a 10kΩ Pull-Up resistor between A0 and VCC (5V).
Voltage Divider & 10-bit ADC Mapping Table
When the switch is toggled, it taps into the series resistor chain at different points, forming a voltage divider:
| Switch Position | Total R to GND | Expected Voltage | ADC Target (0-1023) | Firmware Lower Boundary | Firmware Upper Boundary | Cockpit View Mapped |
|---|---|---|---|---|---|---|
| 1 | 0 Ω | 0.00 V | 0 | 0 | 45 | View 1: Tactical VMG |
| 2 | 10 kΩ | 0.45 V | 93 | 46 | 139 | View 2: Apparent Wind |
| 3 | 20 kΩ | 0.91 V | 186 | 140 | 232 | View 3: True Wind Heading |
| 4 | 30 kΩ | 1.36 V | 279 | 233 | 325 | View 4: Yacht Power Status |
| 5 | 40 kΩ | 1.82 V | 372 | 326 | 418 | View 5: Compass Heading |
| 6 | 50 kΩ | 2.27 V | 465 | 419 | 511 | View 6: Gyro Pitch & Roll |
| 7 | 60 kΩ | 2.73 V | 558 | 512 | 604 | View 7: Sail Configuration |
| 8 | 70 kΩ | 3.18 V | 651 | 605 | 697 | View 8: CRM Subscribers |
| 9 | 80 kΩ | 3.64 V | 744 | 698 | 790 | View 9: CRM Subscription Tier |
| 10 | 90 kΩ | 4.09 V | 837 | 791 | 883 | View 10: System Event Logs |
| 11 | 100 kΩ | 4.55 V | 930 | 884 | 976 | View 11: CAN-bus Status |
| 12 | Infinite | 5.00 V | 1023 | 977 | 1023 | View 12: Settings Overview |
🔌 3. Complete System Wiring Diagram
The instrument panel uses two physical buses:
- The I2C Bus (sharing SCL and SDA lines with pull-ups) for telemetry modules and the screen display.
- Discrete GPIO Pins for toggle switches and the analog ladder.
+-------------------+
| Arduino Uno |
| |
+5V (VCC) ------| 5V |
GND ------------| GND |
| |
[I2C SDA] ------| A4 (SDA) |
[I2C SCL] ------| A5 (SCL) |
| |
Rotary Common --| A0 (Analog Input) |
Power Switch ---| D2 (Digital Input)|
Light Switch ---| D3 (Digital Input)|
+-------------------+
| | | | |
+---------------------------+ | | | +--------------------------+
| | | | |
| +-------------------------+ | +------------------------+ |
| | | | |
+----+-----+--------+ +----------+---------+ +--------+-----+----+
| LCD Display | | LIS3MDL Compass | | LSM6DSOX Gyro |
| (Address 0x27) | | (Address 0x1E) | | (Address 0x6A) |
| | | | | |
| VCC GND SDA SCL| | VCC GND SDA SCL | | VCC GND SDA SCL|
+----+---+---+---+--+ +----+---+---+---+---+ +----+---+---+---+--+
| | | | | | | | | | | |
+---+---+---+-----------------+---+---+---+------------------+---+---+---+
| | | | | | | | |
VCC GND SDA VCC GND SDA VCC GND SDA
[!IMPORTANT] Since the LiquidCrystal LCD Screen, LIS3MDL Compass, and LSM6DSOX Gyro scope all share the same I2C Bus, they must be wired in parallel. If using long cables (over 1 meter / 3 feet), connect 4.7kΩ Pull-Up Resistors between SDA and VCC, and between SCL and VCC to ensure signal integrity against high water moisture.
📌 4. Microcontroller Pinout Assignment
Here is the exact pinout mapping for wiring the components onto an Arduino Uno or Nano:
| Arduino Pin | Component | Direction | Connection / Wiring Details |
|---|---|---|---|
| 5V | System VCC | Output | Connected to LCD VCC, LIS3MDL VIN, LSM6DSOX VIN, and Rotary Switch Position 12. |
| GND | System GND | Output | Connected to LCD GND, LIS3MDL GND, LSM6DSOX GND, and Rotary Switch Position 1. |
| A0 | Rotary Switch Common | Input (Analog) | Connected to center pole of Rotary Switch. Bridged to 5V via a 10kΩ Pull-Up. |
| A4 / SDA | Shared I2C Data Line | In/Out (Digital) | Wired in parallel to LCD SDA, LIS3MDL SDA, and LSM6DSOX SDA. |
| A5 / SCL | Shared I2C Clock Line | Output (Digital) | Wired in parallel to LCD SCL, LIS3MDL SCL, and LSM6DSOX SCL. |
| D2 | LCD Soft Power Switch | Input (Digital) | Wired to SPST Toggle Switch. Internal Pull-up active (INPUT_PULLUP). Toggles D2 to GND. |
| D3 | LCD Backlight Switch | Input (Digital) | Wired to SPST Toggle Switch. Internal Pull-up active (INPUT_PULLUP). Toggles D3 to GND. |
🛠️ 5. Troubleshooting & Diagnostics
The Arduino sketch features Active I2C Hardware Pings at startup to verify bus integrity without blocking:
- Bus Scan: On
setup(), the MCU pings addresses0x27,0x1E, and0x6Ausing non-blocking transmissions. - Graceful Bypass: If a component does not return status
0, its diagnostic flag is set toofflineand its query loops are entirely bypassed. - Serial Stream Alerts: The serial output immediately formats connection statuses:
- LCD offline:
"lcd":0 - Compass offline:
"cps":0(dashboard uses GPS stream fallback automatically) - Gyro offline:
"gyr":0(dashboard uses internal phone accelerometer fallback automatically)
- LCD offline: