โšก

Master Wiring & Breadboard Guide

1:1 Physical Workbench Layout • Pin-by-Pin Hookup • Optical โž” Pico โž” Pi
๐Ÿ“Œ Point of Truth Synchronization: All pin mappings and bring-up steps on this page are strictly synchronized with the Hardware Installation & Testing Guide.
Open Interactive Checklist →
Wiring Sub-Mode:

๐Ÿงช 1-Sensor Direct Bring-Up Hookup (Single Sensor Only)

The simplest way to start: connect 1 optical mouse sensor directly to your Pico 2WH using 6 Female-to-Female Dupont wires.

PHASE 1 POINT OF TRUTH
OPTICAL MOUSE SENSOR 1 PMW3360 (Pins 1 → 8 Top-to-Bottom) Pin 1: VCC (3.3V) Pin 2: MIS (MISO) Pin 3: MOS (MOSI) Pin 4: SCL (SCK) Pin 5: SS (CS) Pin 6: MOT (N/C) Pin 7: GND Pin 8: RS (N/C) RASP PI PICO 2WH (FLIPPED ON DESK) Left Row: Power • Right Row: SPI GPIOs LEFT PIN ROW (POWER) Pin 38: GND Pin 37: 3V3_EN (OPEN) Pin 36: 3V3_OUT • Connects to Sensor Power (Pins 1 & 7) RIGHT PIN ROW (SPI) GP2 (Pin 4) SCK GP3 (Pin 5) MOSI GP4 (Pin 6) MISO GP5 (Pin 7) CSn DESK 1:1 PHYSICAL HOOKUP Sensor Left • Pico Flipped • Left Row: Red & Orange Power • Right Row: 4 SPI Lines

๐Ÿ“‹ 1-Sensor Exact Pinout Table (Desk Orientation Point of Truth)

Sensor Physical Pin # Sensor Silkscreen Pico Header Location Pico Physical Pin # Wire Color Function & Notes
Pin 1 (Top) VCC LEFT Row (3V3_OUT) Pin 36 ๐Ÿ”ด Red 3.3V Power from Pico (Do NOT connect to Pin 37)
Pin 2 MIS RIGHT Row (GP4 RX) Pin 6 ๐Ÿ”ต Blue Master In Slave Out (Data from Sensor)
Pin 3 MOS RIGHT Row (GP3 TX) Pin 5 ๐ŸŸข Green Master Out Slave In (Data to Sensor)
Pin 4 SCL RIGHT Row (GP2 SCK) Pin 4 ๐ŸŸก Yellow SPI Serial Clock (2 MHz)
Pin 5 SS RIGHT Row (GP5 CSn) Pin 7 ๐ŸŸฃ Purple Slave Select / Chip Select #1 (Active LOW)
Pin 6 MOT Not Connected — — Motion Interrupt Flag (Optional, polling used)
Pin 7 GND LEFT Row (GND) Pin 38 ๐ŸŸ  Orange Common Ground Reference
Pin 8 (Bottom) RS Not Connected — — Hardware Reset (Internal pull-up, leave open)

โœ… Tested & Validated Hardware Script (sensor_test.py)

Matches the exact desk pinout above (Left Row 3V3/GND, Right Row GP2-GP5 SPI). Paste into Thonny and click Run.

import time
from machine import Pin, SPI

# Exact pins matching the 1:1 desk wiring layout:
PIN_SCK  = 2  # GP2 (Pin 4) -> Yellow wire (Sensor Pin 4 SCL)
PIN_MOSI = 3  # GP3 (Pin 5) -> Green wire  (Sensor Pin 3 MOS)
PIN_MISO = 4  # GP4 (Pin 6) -> Blue wire   (Sensor Pin 2 MIS)
PIN_CS   = 5  # GP5 (Pin 7) -> Purple wire (Sensor Pin 5 SS)
# Power: Red wire (Sensor Pin 1 VCC) -> Left Row Pin 36 (3V3_OUT)
# Ground: Orange wire (Sensor Pin 7 GND) -> Left Row Pin 38 (GND)

cs = Pin(PIN_CS, Pin.OUT, value=1)
spi = SPI(0, baudrate=2_000_000, polarity=1, phase=1,
          sck=Pin(PIN_SCK), mosi=Pin(PIN_MOSI), miso=Pin(PIN_MISO))

def write_reg(reg, val):
    cs.value(0)
    time.sleep_us(10)
    spi.write(bytes([reg | 0x80, val]))
    time.sleep_us(30)
    cs.value(1)
    time.sleep_us(35)

def read_reg(reg):
    cs.value(0)
    time.sleep_us(10)
    spi.write(bytes([reg & 0x7F]))
    time.sleep_us(160)  # t_SRAD turnaround delay
    val = spi.read(1)[0]
    time.sleep_us(5)
    cs.value(1)
    time.sleep_us(20)
    return val

# 1. Reset SPI port
cs.value(1); time.sleep_ms(10)
cs.value(0); time.sleep_ms(2); cs.value(1); time.sleep_ms(10)

# 2. Power-up Reset command (0x5A to register 0x3A)
write_reg(0x3A, 0x5A)
time.sleep_ms(60)

# 3. Flush motion registers pipeline
for r in [0x02, 0x03, 0x04, 0x05, 0x06]:
    read_reg(r)
time.sleep_ms(10)

# 4. Check IDs
prod_id = read_reg(0x00)
rev_id  = read_reg(0x01)
print(f"๐Ÿ“ฆ Product ID: 0x{prod_id:02X} | Revision ID: 0x{rev_id:02X}")
print("๐ŸŽฎ Live Tracking Active - Swipe surface over sensor:")

while True:
    motion = read_reg(0x02)
    squal  = read_reg(0x07) # Surface quality (0-255)
    if motion & 0x80:
        dx_l = read_reg(0x03)
        dx_h = read_reg(0x04)
        dy_l = read_reg(0x05)
        dy_h = read_reg(0x06)
        
        dx = (dx_h << 8) | dx_l
        if dx >= 32768: dx -= 65536
        dy = (dy_h << 8) | dy_l
        if dy >= 32768: dy -= 65536
        print(f"๐Ÿ“ dX: {dx:+6d} | dY: {dy:+6d} | SQUAL: {squal:3d}")
    time.sleep_ms(20)

๐Ÿ“‹ Step-by-Step 5-Minute Hookup Sequence

1
Connect 3.3V Power & Common Ground (Shared Bus)
Plug a Red jumper from Pico Pin 36 (3V3_OUT) into Breadboard Row 5. Plug both sensors' VCC into Row 5.
Plug a Black jumper from Pico Pin 38 (GND) into Breadboard Row 10. Plug both sensors' GND into Row 10.
โš ๏ธ Danger: Never connect to 5V (VBUS / VSYS).
2
Connect SPI0 Clock & Data Lines (Shared Bus)
SCK (Yellow): Pico Pin 24 (GP18) โž” Row 15 โž” Sensor 1 SCK & Sensor 2 SCK.
MOSI (Blue): Pico Pin 25 (GP19) โž” Row 20 โž” Sensor 1 MO & Sensor 2 MO.
MISO (Green): Pico Pin 21 (GP16) โž” Row 25 โž” Sensor 1 MI & Sensor 2 MI.
3
Connect Dedicated Chip Select Lines (Direct Jumpers)
Sensor 1 CS (Orange): Plug Sensor 1 SS / CS directly into Pico Pin 22 (GP17).
Sensor 2 CS (Purple): Plug Sensor 2 SS / CS directly into Pico Pin 26 (GP20).
4
Unpowered Multimeter Beep Test (Before USB Plug-in!)
Put your multimeter in continuity mode. Touch one probe to Row 5 (3.3V) and one probe to Row 10 (GND).
โœ… Must be SILENT (high resistance). If you hear a continuous beep ($0\,\Omega$), you have a short circuitโ€”do NOT plug in USB!
5
Plug in USB & Run Automated Diagnostics
Plug the Pico into your computer/Pi with the Micro-USB cable, then run: python software/globe_doctor.py
It will query SPI register 0x00 (Product ID), verify 0x42, and test the lens optical focus!

๐Ÿ›๏ธ Ziggurat Dial โž” Raspberry Pi 4 Direct Interface

The Camera Module 3 Wide connects via the 50cm CSI ribbon cable. The center plunger button connects directly to GPIO 17 & GND.

DIRECT HOST CSI + GPIO
๐Ÿ›๏ธ 5-TIER ZIGGURAT DIAL Passive Mechanical Chassis • 40mm Pyramid ๐Ÿ“ท Raspberry Pi Camera Module 3 Wide 12MP NoIR • 45ยฐ Internal Mounting Cradle ๐Ÿ”˜ Center [PRINT] Plunger Button Omron D2F-01 / TASTER 9308 ๐Ÿ“ RASPBERRY PI 4 / 5 Main Linux Host • systemd Daemon CSI Camera Port (15-Pin) GPIO 17 (Physical Pin 11) GND (Physical Pin 9) 50cm CSI Ribbon

๐Ÿ“ท Raspberry Pi 4 + Camera Module 3 Master Bring-Up Protocol

DESK VERIFIED
1. Ribbon Direction on Pi 4 CAMERA Port:

• Silver Metal Pins: Face towards the Micro-HDMI ports.
• Blue Plastic Stiffener: Faces towards the 3.5mm Audio Jack & USB ports.
• Port Location: Center slot between HDMI 1 and Audio Jack (do NOT use DISP port).

2. Ribbon Direction on Camera Module 3:

• Silver Metal Pins: Face towards the front (Lens side).
• Blue Plastic Stiffener: Faces towards the back (PCB rear).
• Lock Latch: Pull black collar up ~1mm, insert ribbon straight, push collar flat.

3. Critical CSI Rule — No Hotplug:

โš ๏ธ CSI cameras CANNOT be hot-plugged!
If inserted while powered, the kernel disables the bus and outputs ERROR: no cameras available until you run sudo reboot.

๐Ÿ’ป Remote SSH Login & Instant 3-Step Verification Protocol:
# 1. Connect from Laptop Terminal / PowerShell:
ssh raspberryben@192.168.2.107     # (Password: claude1234)
# (Or by mDNS):
ssh raspberryben@raspberrypi.local

# 2. Test Live Autofocus Video Stream (5 seconds):
rpicam-hello -t 5000

# 3. Capture 12MP Ring Snapshot:
rpicam-still -o ring_test.jpg --autofocus-mode auto

# 4. Check Pico 2WH USB Optical Data Stream:
ls -l /dev/ttyACM*
python3 -c "import serial; s=serial.Serial('/dev/ttyACM0', 115200); [print(s.readline().decode().strip()) for _ in range(10)]"

๐Ÿ“œ 58mm Thermal Receipt Printer โž” Raspberry Pi 4 (TTL UART & Power)

Connects via Pi 4 hardware UART (GPIO 14/15) with dedicated external 5Vโ€“9V (โ‰ฅ2A) power and Common Ground.

TTL UART + EXT PSU
โšก EXTERNAL POWER SUPPLY 5V โ€“ 9V DC (โ‰ฅ 2.0A) Dedicated High-Current Rail VCC (+) GND (-) ๐Ÿ“œ 58mm THERMAL PRINTER Embedded CSN-A2 / QR701 Baud: 9600 / 19200 (TTL 3.3V/5V) VH / VCC GND TXD RXD ๐Ÿ“ RASPBERRY PI 4 / 5 40-Pin GPIO Header (UART0) Pin 6 • GND (Masse) Pin 8 • GPIO 14 (TXD0 / Serial TX) Pin 10 • GPIO 15 (RXD0 / Serial RX) โš ๏ธ Pin 2 / 4 (Pi 5V Power) NICHT AM PI ANSCHLIESSEN! +5V..9V (High Current) COMMON GND (Masse) TX โž” Pi RXD0 (Pin 10) RX โž” Pi TXD0 (Pin 8)
Drucker Pin Verbindung zu Raspberry Pi 4 Pin (GPIO) Hinweise & Sicherheitsregeln
GND (Masse) Masse von Netzteil UND Pi 4 Pin 6 (GND) Zwingend erforderlich (Common GND): Ohne gemeinsame Masse schlagen Baudraten und serielle รœbertragungen fehl.
VH / VCC (Strom) Pluspol (+) des externen Netzteils NICHT am Pi anschlieรŸen! Thermokรถpfe ziehen beim Drucken bis zu 1.5Aโ€“2.0A Stromspitzen. Der Pi wรผrde sofort abstรผrzen (Brownout)!
TX (Senden) RX des Raspberry Pi Pin 10 (GPIO 15 / RXD0) Crossover: Sendestift des Druckers geht an Empfangsstift (RX) des Pi.
RX (Empfangen) TX des Raspberry Pi Pin 8 (GPIO 14 / TXD0) Crossover: Empfangsstift des Druckers geht an Sendestift (TX) des Pi.
โš ๏ธ
Wichtige Sicherheitswarnung (Stromversorgung):
SchlieรŸen Sie den VH/VCC-Pin des Thermodruckers niemals an den 5V-Pin des Raspberry Pi an! Das Aufheizen des Thermopapiers benรถtigt beim Zeilendruck kurzzeitig bis zu 2.0 Ampere. Verwenden Sie ein separates 5Vโ€“9V Netzteil (z. B. Steckernetzteil 5V/2A oder 9V/2A) und verbinden Sie die Masse (GND) des Netzteils direkt mit Pin 6 des Raspberry Pi.
๐Ÿ’ก
Raspberry Pi Software-Einrichtung (UART freischalten):
1. In sudo raspi-config โž” Interface Options โž” Serial Port: Serial Console deaktivieren (No), Serial Hardware Port aktivieren (Yes).
2. In Python: from escpos.printer import Serial; p = Serial('/dev/serial0', baudrate=9600).
3. Der Drucker druckt automatisch die generierten Geschichten, Reisedaten und Tarot-Aphorismen bei jedem Druck auf den [PRINT]-Kolben!

๐Ÿ“ฆ Complete Modular System Architecture

Both units operate independently, connecting over USB and CSI to the host Raspberry Pi 4.

MODULAR ARCHITECTURE
๐ŸŒ GLOBE TRACKER CRADLE • 2x PMW3360 SPI Optics • Dedicated Pico 2 WH (Inside) • 1000Hz 3-DoF USB Stream ๐Ÿ›๏ธ 5-TIER ZIGGURAT DIAL • 5x 45ยฐ Optical Bevel Rings • Pi Camera 3 Wide (Inside) • Flush Center [PRINT] Plunger ๐Ÿ“ RASPBERRY PI 4 / 5 • Optical Barcode Decoder • 3-DoF Sphere Kinematics • Web Dashboard Server • ESC/POS Thermal Driver ๐Ÿ“œ THERMAL PRINTER 58mm Mini ESC/POS Dispenses physical reading slips