Home
Species

Optical Communication Development Log

September 12, 2025

Optical Communication Development Log

Date: 2025-09-12
Session: Full optical communication protocol development
Participants: T.W., C.S.

Development Overview

Successfully developed working optical communication between Hysteresis units using BPW34 photodiodes, MCP6022 transimpedance amplifiers, and WS2812 LED arrays. Communication achieved with proper timing synchronization and bit recovery.

Circuit Development

Initial Hardware Issues

Narrow Detection Range Problem:

  • Initial system showed only 0.4V swing from finger blocking to flashlight
  • Baseline at 2.7V in ambient light, 2.95V with bright illumination
  • Indicated circuit saturation, not insufficient signal strength

Root Cause Analysis:

  • MCP6022 operated on 3.3V supply with VDD/2 bias at 1.65V
  • Ambient light photocurrent was driving output near positive rail
  • Operating in saturated region with no headroom for signal variations

Solution - Power Supply Modification:

  • Changed MCP6022 supply from 3.3V to 5V
  • Maintained VDD/2 bias point, now at 2.5V
  • RP2040 ADC input safe (2.5V ± variations well within 0-3.3V range)

Circuit Performance After Fix

Dynamic Range Achieved:

  • Finger blocking: -324 ADC counts
  • Flashlight: +488 ADC counts
  • Ambient room light: -100 ADC counts
  • Total range: 812 counts (vs. previous 8 counts)

Signal Quality:

  • Adequate signal-to-noise ratio for reliable detection
  • Stable baseline operation around 2.5V bias
  • No saturation issues with strong illumination

Communication Protocol Development

Signal Characteristics

LED Modulation:

  • Base brightness: 128 (50% of maximum)
  • Modulation depth: ±127 (full 1-255 range for maximum signal)
  • Bit duration: 200ms
  • Signal strength: ±50-100 ADC counts above detection threshold

Detection Parameters:

  • Detection threshold: 25-50 ADC counts
  • Strong signal classification: >40 counts (LED on = “1”)
  • Weak signal classification: <-40 counts (LED off/ambient = “0”)

Algorithm Evolution

Initial Approach (Failed):

  • Simple threshold detection waiting for strong signals
  • Event-triggered bit advancement
  • Problems: Lost synchronization, missed weak signals, timing drift

Final Approach (Successful):

  • Event-triggered start: Detect transmission beginning on strong signal
  • Time-synchronized sampling: Fixed 200ms intervals from start time
  • Signal classification: Determine bit value from signal strength at sample time
  • Tolerance: ±50ms timing windows for environmental variation

Communication Results

Successful Transmission:

  • Complete 16-bit messages received reliably
  • Timing synchronization maintained throughout transmission
  • Pattern detection: Consistent alternating patterns (though inverted)
  • Signal strength: 60-100 count variations, well above noise floor

Reliability Issues:

  • Intermittent baseline drift affecting signal classification
  • Environmental light changes causing detection failures
  • Success rate: ~70% under controlled conditions

Technical Challenges Resolved

Baseline Calibration

  • Problem: Baseline drift between LED-on and LED-off states
  • Impact: Signal classification failure (all 1s or all 0s)
  • Solution: Time-synchronized sampling reduces dependency on absolute thresholds

Signal Timing

  • Problem: Initial algorithms missed weak “0” bits (ambient light)
  • Impact: Incomplete messages, synchronization loss
  • Solution: Sample at fixed intervals regardless of signal strength

Bit Polarity

  • Problem: Consistent inversion of received patterns
  • Root Cause: Baseline calibration without LED influence vs. transmission with LED
  • Solution: Software bit assignment correction

Next Phase: Dual Photodiode Directional Sensing

Architecture Plan

  • Two BPW34 photodiodes separated by 4.5cm
  • Two MCP6022 chips (one near each photodiode for signal integrity)
  • Differential processing: direction = leftADC - rightADC

Two-Phase Communication Protocol

Phase 1: Attention Seeking

  • Requirements: Detect “something brighter than ambient from that direction”
  • Much more forgiving than precise bit recovery
  • Directional information for attraction behavior
  • Robust operation in ambient light conditions

Phase 2: Precise Communication

  • Close-range high-signal communication using established protocol
  • Units align during attraction phase for optimal signal strength
  • Time-synchronized bit recovery with established algorithms

Hardware Requirements

Additional Components Needed:

  • Second BPW34 photodiode
  • Second MCP6022 dual op-amp
  • 74HCT125 logic level shifter (RP2040 3.3V → WS2812 5V requirement)
  • Standard passive components (resistors, capacitors)

Circuit Considerations:

  • Maintain short high-impedance connections (photodiode to op-amp)
  • Long low-impedance connections acceptable (op-amp output to MCU)
  • Dual power rails: 5V for op-amps, 3.3V for MCU logic

Development Status

Proven Concepts

  • Optical communication between microcontrollers functional
  • Circuit topology validated for required signal levels
  • Timing protocols established and tested
  • Directional sensing approach designed and ready for implementation

Remaining Work

  • Hardware assembly of dual photodiode system
  • Software implementation of directional detection
  • Integration testing of attention + communication phases
  • Environmental robustness optimization

Steganographic Integration Challenges

  • Current discrete on/off protocol unsuitable for imperceptible modulation
  • Would require complete signal processing redesign
  • Alternative approaches: frequency domain modulation, lock-in detection
  • Remains future research objective

Code Architecture

Current Implementation

  • Separate transmitter (TX) and receiver (RX) codebases
  • Platform-specific optimizations for RP2040/Arduino environments
  • Modular structure allows integration with movement algorithms

Integration Planning

  • Communication protocols designed as discrete modules
  • Ready for integration with existing movement/behavior code
  • Dual photodiode additions maintain code separation
  • Future: Combined attention-seeking + movement behaviors

Session Outcome: Functional optical communication protocol established
Next Session: Dual photodiode hardware assembly and directional sensing implementation
Hardware Status: Single photodiode system working, dual system designed
Protocol Status: Reliable communication achieved, directional sensing planned

Classification

optical communication circuit protocol development