Skip to main content

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:

ComponentQuantityDescriptionInterface / TypeTypical I2C Address / Pin
Microcontroller1Arduino Uno R3 or Arduino Nano V3.0Central MCUUSB Serial (115200 bps)
LCD Display116x2 Character LCD Screen1602 LCD with PCF8574 Adapter0x27 (I2C)
Rotary Switch11-Pole 12-Position (1P12T) SwitchSelector Switch (e.g., Lorlin CK1049)Pin A0 (Analog Ladder)
Magnetometer1LIS3MDL 3-Axis Digital CompassMagnetic Field Telemetry0x1E (I2C)
Inertial Sensor1LSM6DSOX 6DoF Accel / GyroPitch & Heel Angle Telemetry0x6A (I2C)
Power Switch1SPST Toggle SwitchPhysical soft power togglePin D2 (Digital Input)
Backlight Switch1SPST Toggle SwitchScreen backlight controlPin D3 (Digital Input)
Resistors1110kΩ 1% Metal Film ResistorsLadder dividers (in series)Inter-switch terminal spacing
Resistor110kΩ 1% ResistorPull-up resistorPin A0 to 5V (VCC)
Proto-board1Double-sided FR4 perfboardStructural mounting / wiring hubGround / 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)
  1. Connect a 10kΩ resistor between each adjacent terminal on the rotary switch (11 resistors total in series).
  2. Pin 1 of the switch is wired directly to GND (0V).
  3. Pin 12 of the switch is wired directly to VCC (5V).
  4. The Common Pole (center pin) of the switch is wired to Pin A0 on the Arduino.
  5. 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 PositionTotal R to GNDExpected VoltageADC Target (0-1023)Firmware Lower BoundaryFirmware Upper BoundaryCockpit View Mapped
10 Ω0.00 V0045View 1: Tactical VMG
210 kΩ0.45 V9346139View 2: Apparent Wind
320 kΩ0.91 V186140232View 3: True Wind Heading
430 kΩ1.36 V279233325View 4: Yacht Power Status
540 kΩ1.82 V372326418View 5: Compass Heading
650 kΩ2.27 V465419511View 6: Gyro Pitch & Roll
760 kΩ2.73 V558512604View 7: Sail Configuration
870 kΩ3.18 V651605697View 8: CRM Subscribers
980 kΩ3.64 V744698790View 9: CRM Subscription Tier
1090 kΩ4.09 V837791883View 10: System Event Logs
11100 kΩ4.55 V930884976View 11: CAN-bus Status
12Infinite5.00 V10239771023View 12: Settings Overview

🔌 3. Complete System Wiring Diagram

The instrument panel uses two physical buses:

  1. The I2C Bus (sharing SCL and SDA lines with pull-ups) for telemetry modules and the screen display.
  2. 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 PinComponentDirectionConnection / Wiring Details
5VSystem VCCOutputConnected to LCD VCC, LIS3MDL VIN, LSM6DSOX VIN, and Rotary Switch Position 12.
GNDSystem GNDOutputConnected to LCD GND, LIS3MDL GND, LSM6DSOX GND, and Rotary Switch Position 1.
A0Rotary Switch CommonInput (Analog)Connected to center pole of Rotary Switch. Bridged to 5V via a 10kΩ Pull-Up.
A4 / SDAShared I2C Data LineIn/Out (Digital)Wired in parallel to LCD SDA, LIS3MDL SDA, and LSM6DSOX SDA.
A5 / SCLShared I2C Clock LineOutput (Digital)Wired in parallel to LCD SCL, LIS3MDL SCL, and LSM6DSOX SCL.
D2LCD Soft Power SwitchInput (Digital)Wired to SPST Toggle Switch. Internal Pull-up active (INPUT_PULLUP). Toggles D2 to GND.
D3LCD Backlight SwitchInput (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:

  1. Bus Scan: On setup(), the MCU pings addresses 0x27, 0x1E, and 0x6A using non-blocking transmissions.
  2. Graceful Bypass: If a component does not return status 0, its diagnostic flag is set to offline and its query loops are entirely bypassed.
  3. 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)