PATH A  /  TWO-HEAD READOUT AND ILLUMINATION
Prototype build definition A-E1  •  31 October 2026  •  Mostafa and Omar

FIRST AFTERNOON
Build the two heads, ADC and USB controller in sections 1–3. A bench LED, a
piece of opaque card and a multimeter suffice for the first recorded burst.
For the full source and scanner, use OPTICS_AND_COLLECTION.txt and MOTOR_OPTION.txt. Preserve the first as-wired photo,
board marking, voltages, wiring revision, raw files and any failed tests.
Read the replication sequence in ../README.md before a comparison.

1   Parts on the table
U1 Raspberry Pi Pico H (RP2040, standard 40-pin layout, 3.3 V logic), USB
data cable to the computer. U2 Adafruit ADS1115 #1085 16-bit board, 3.3 V,
7-bit I²C address 0x48. U3 and U4 TI OPT101P clear PDIP-8 photodiode and
amplifier. U3 is the moving measuring head and U4 is the source monitor.
Label the heads, their keyed 3-way connectors, and the two ADC inputs. U3 and
U4 keep their assignments for all comparisons. Fit one 100 nF ceramic X7R
near each head. A short metal-backed or opaque housing has a clear opening
over the actual die, not the plastic package centre assumed by eye. Keep
converter, USB indicator LEDs and scattered light outside the dark enclosure.
Use soldered perforated board with strain relief after breadboard checkout.

2   As-wire schedule. All pin numbers on U3/U4 are TOP views from TI.
Record face orientation/photodiode centre and the keyed mating connector before
assembly. Identify pin 1 using TI's package drawing and package index mark.

NET               SOURCE                     DESTINATION
Analog 3V3        U1 physical 36, 3V3 OUT     U2 VIN/VDD, head J1.1 and J2.1
Analog return     U1 physical 38, GND         U2 GND, J1.2, J2.2 at acquisition box
I²C SDA           U1 physical 1, GP0         U2 SDA
I²C SCL           U1 physical 2, GP1         U2 SCL
Moving output     J1.3                       U2 A0
Monitor output    J2.3                       U2 A1
Head positive     Each J.1                   Its OPT101 pin 1
Head return       Each J.2                   Its OPT101 pins 3 and 8
Head signal       Each J.3                   Its OPT101 pin 5
Head feedback     Each OPT101 pin 4          SAME head pin 5, shortest local link
Head bypass       100 nF each                Across pins 1 and 3 at package
Unused            Each OPT101 pins 2,6,7     Open, no long traces or test leads
Address/alert     U2 factory 0x48            Default jumper or ADDR to GND per
                                            actual board revision. ALRT unused.
Unused ADC        U2 A2,A3                   No connection, never selected

Cable design: use flexible shielded two-pair cable to each head. Carry signal
and ground in one twisted pair; 3V3 and return in the other. Bond drains at
the acquisition box only. Check the shield has no accidental second bond to
the moving frame. Keep analog returns away from motor/LED return currents.
Do not join the two USB-board positive rails. The ADS board's A+/A− pins, when
fitted, are supply/return outputs. Its factory I²C pull-ups terminate at VIN.
Apply 3.3 V to VIN; leave Pico VBUS/VSYS and all 5 V outside the analog circuit.

3   Bring-up card. Fill measured values and repeat after final assembly.
[ ] Unpowered: verify each listed net end-to-end, pin 4–5 continuity inside
    both heads, correct rail polarity, no solder bridge, no short from 3V3
    to GND. Photograph and mark connector orientation at both ends.
[ ] Power U1/U2 without heads, via USB only. Measure 3V3 at each keyed head
    socket to return; target 3.30 V, provisional checkout band 3.15–3.45 V.
    Check idle SCL/SDA high near supply. Do not fit heads on an invalid rail.
[ ] Power off and fit heads. Power up with both windows covered. Compare U3/U4
    pin 5 with the DMM. Characterize each dark pedestal independently. Repeat
    with one head illuminated at a time and confirm U3=A0, U4=A1. Incorrect
    channel order invalidates normalization.
[ ] Optional electrical checkout with both sensor outputs disconnected: put
    a 10 kΩ multiturn pot across 3V3/GND, measure the wiper with the DMM,
    feed it to one ADC input at a time. Approach ~0.10, 0.50, 1.0 and 1.5 V.
    Save indicated voltage, DMM ID/range/resolution and ADC codes at each
    point and when returning. Expectations from 62.5 µV/count give 1600,
    8000, 16000 and 24000 nominal respectively. Compare to actual meter
    values and their uncertainty; meter and board tolerances matter.
    De-energize, restore correct heads and record a new both-dark burst.
[ ] Illuminate one head using a weak, shielded red source. Check both DMM and
    logger. At 3.3 V the OPT101 can run out of high-side swing well before
    supply. Aim for a bright reference near 0.2–1.5 V. Flag any raw output
    ≥1.8 V, flat-topped response or ADC clipping. Test at multiple attenuations
    before accepting linearity. Adjust illumination/monitor view as needed.
    Changing PGA cannot fix an overloaded photodiode amplifier.
[ ] Power and route motors separately if fitted. At a fixed illumination and
    stationary head, compare off/energized/during motion/settled traces. Try
    both approach directions. Choose settling by measured recovery and
    record sensitivity to elapsed time. A single DMM reading misses ripple.
    Borrow a scope for LED current and both head outputs when aliasing or
    instability remains. Record actual optical-head temperature if available.

Before any long scan, verify the whole optical readout's linearity as distinct
from the pot/ADC test. At constant thermal conditions combine two independent
stable beams at one head (or borrow a calibrated attenuator). Capture blocked,
beam A alone, B alone, and both A+B in randomized repeats with both heads'
raw values saved. Compare S(A+B)−S(dark) with [S(A)−S(dark)] + [S(B)−S(dark)]
over the actual working range, with drift/reference and repeat uncertainty.
Simply increasing LED drive also changes optical output, so it cannot establish
detector linearity by itself. Freeze the accepted input range and use only
qualified readings in the final maps, retaining all raw values.

4   First data. No persistent firmware changes beyond installing MicroPython.
On a blank, dedicated Pico H install the official RP2040 Pico MicroPython UF2
via BOOTSEL. This first-use step replaces board firmware; use a spare if it
already runs anything. Use the computer's normal Python 3 with mpremote
installed in an isolated environment. See the Raspberry Pi getting-started
guide and mpremote guide below. Check the actual board and select its exact
USB serial port. A firmware for Pico 2 is different.

    python3 -m venv .venv
    .venv/bin/python -m pip install mpremote
    .venv/bin/python -m mpremote connect list
    cp setup_template.json bench01.json
    # Fill identifiers and observed conditions in bench01.json.
    .venv/bin/python capture.py --port /dev/cu.usbmodemACTUAL --metadata bench01.json --output run001

Use a new output directory for every attempt; Windows uses its COM port and
the environment's Scripts/python. Use stable IDs for temperature instruments,
head/cable/ADC/source/fixture, session and calibration. Put actual temperature,
LED current setting and coordinate observations in the input record when known.
Do not fill measured coordinates from a motion command. Unavailable numerical
observations remain null. For a failed link check raw.txt/diagnostics.txt and
session.json before trying again in a new directory. Never overwrite raw data.

capture.py issues a bounded burst at a stationary point. A1 -> A0 -> A1 is one
bracket. Each single-shot conversion has a saved command-start and ready-poll
time in microseconds on the Pico clock, relative to burst start. The saved
counts are signed. Configuration read-back is checked on each conversion.
The terminal END marker, ordering and timings are checked on the host; all
counts, even flagged ones, are retained. The ADS1015 also left-justifies its 12-bit output in a 16-bit register,
so it can have the same apparent voltage slope. Inspect the actual chip/
supplier identity and sweep a small analog ramp across many codes; an ADS1015
leaves the bottom four raw bits zero for every valid code. Seeing nonzero
low bits distinguishes this case. An all-zero low nibble in just a few
constant samples is inconclusive. A structure-checked file can still be saturated,
miswired or scientifically unusable. A burst does not home or move a stage.
Each point CLI call can reset the acquisition Pico. A separate motion
controller owns its homing state. For the Grbl branch use RUN_A_RASTER.txt:
the raster runner maintains persistent sessions and journals each completed
point. Physically qualify the handshake before full-field use; the synthetic
Bench Studio schema remains separate. reader_selfcheck.py exercises the electronic protocol with fakes only.

5   Safe low-voltage LED branch
Source for first assembly: LEDdynamics/LEDSupply CREEXPE2-RED-1, one 20 mm
metal-core star, red 620–630 nm dominant-wavelength bin. Attach to a heatsink
with thermal interface before power-up. Record bin/part on receipt. Do not
convert counts to watts using TI's 650 nm responsivity at this different
spectrum. The target observable is a matched normalized power ratio.

    Existing DC bench source (+) -> series 22 Ω / 2 W resistor -> LED (+)
    LED (−) -> source (−). Keep this circuit separate from the acquisition rail.

Use an actual constant-current-capable regulated supply, output OFF during
connection. Verify its settings into a dummy load before plugging in the LED.
Set voltage ceiling 5.0 V and current limit 20 mA for initial aiming. Increase
within 20–100 mA only after checking heatsink temperature, actual Vf, head
range, source stability and sufficient compliance for Vf + 22 Ω·I. Verify CC
indicator and actual current throughout the selected run. The ballast also
bounds a 5.0 V short to 0.23 A, about 1.14 W in the 2 W resistor. Mount resistor
in free air away from the optics. If the supply leaves CC at the selected
current, reduce current or qualify a separate driver. No PWM on this branch.
A single-output supply dedicated to the LED requires a separate 12 V motor
supply when motorization starts. Borrow if available. Close the source hood
and use diffuse cards when aligning the condenser; avoid direct viewing.

6   Circuit references
TI OPT101 datasheet, §§5, 6.7, 8.3 and 10:
https://www.ti.com/lit/ds/symlink/opt101.pdf
TI ADS1115 datasheet, ADC input range, registers 0x00/0x01 and full scale:
https://www.ti.com/lit/ds/symlink/ads1115.pdf
Adafruit #1085 board and board-specific pin naming:
https://learn.adafruit.com/adafruit-4-channel-adc-breakouts/pinouts
RP2040 Pico pin layout and MicroPython setup:
https://datasheets.raspberrypi.com/pico/Pico-R3-A4-Pinout.pdf
https://www.raspberrypi.com/documentation/microcontrollers/micropython.html
MicroPython mpremote CLI:
https://docs.micropython.org/en/latest/reference/mpremote.html
Red star part/bin and emitter family:
https://www.ledsupply.com/index.php?id=2410&p=product
https://downloads.cree-led.com/files/ds/x/XLamp-XPE2.pdf
