Complete Code Changelog
Hysteresis Project - Complete Code Changelog
Movement Algorithm Stream (Searching Series)
SearchingV31.ino - August 4, 2025
Pull-pullback gravity dynamics with territorial exploration
- v31: Prolonged dramatic struggle against darkness - slower energy drain, stronger resistance, tighter centre threshold
- v30: Gravity-influenced territorial exploration, multi-vector movement system
- v29: Spatial weighting for systematic coverage, organic perimeter search
- v28: Grid memory for systematic exploration, balanced search speeds, no randomness
SearchingV27.ino - August 3, 2025
Fixed SEARCH to explore at perimeter with irregular patterns
- v27: SEARCH now stays at perimeter with irregular, elongated circles
- v26: Four-state system (Rest/Seek/Search/Return) with clear transitions
- v25: Energy/gravity model - rest position has gravitational pull
- v24: Two-tier search with major/minor circles, dual memory systems
- v23: Implemented hysteresis-based dwelling for lonely search behavior
- v22: Added epicycloid pattern generation for circles within circles
- v21: Multi-frequency sine wave exploration with organic movement
- v20: Added Perlin-like noise generation for natural variations
- v19: Improved smoothing algorithms for servo response
- v18: Enhanced boundary constraints and limit handling
- v17: Optimized timing intervals for consistent updates
- v16: Refactored movement calculation pipeline
- v15: Added debug output for position tracking
- v14: Fixed servo pin assignments (X=3, Y=5)
- v13: Renamed base/axial to X/Y for clarity
SearchingV12.ino - July 27, 2025
Basic smooth searching with manual override
- v12: Implemented smooth searching motion from startup
- v11: Added manual override via serial terminal
- v10: Basic random walk implementation
LED Communication Stream (Hysteresis_I_MMLC Series)
Hysteresis_I_MMLC_0.16.ino - July 30, 2025
LED Hysteresis Lighting System
- v0.16: Adjusted fade ranges to reduce pastel tones
- v0.14 and earlier: Developed hysteresis-controlled RGB transitions
Note: Significant version gap suggests concentrated development period between v0.10-v0.14 not captured in available files
Development Timeline Summary
| Date | Movement Stream | LED Stream | Key Innovation |
|---|---|---|---|
| July 27, 2025 | SearchingV12.ino | - | Manual override, smooth motion |
| July 30, 2025 | - | Hysteresis_I_MMLC_0.16.ino | Color fade refinement |
| August 3, 2025 | SearchingV27.ino | - | Four-state behavioral system |
| August 4, 2025 | SearchingV31.ino | - | Prolonged struggle dynamics |
| August 31, 2025 | SimpleFOC_TestUtility.ino | - | BLDC motor compatibility testing |
| August 31, 2025 | Open-Loop BLDC Analysis | - | Critical design discovery: encoder required |
| August 31, 2025 | BLDC Testing Session | - | Motor compatibility validation |
| September 5, 2025 | AS5600 Testbench | - | Completed encoder testbench for 2204 motor |
| September 6, 2025 | SimpleFOC Integration Issues | - | Hardware validated, library integration problems identified |
BLDC Hardware Stream (Motor Control System)
SimpleFOC_TestUtility.ino - August 31, 2025
Live-tunable BLDC motor testing framework
Purpose: Universal testing utility for BLDC motor compatibility with SimpleFOCMini
Location: /code/Arduino/utilities/SimpleFOC_TestUtility.ino
Features:
- Live voltage adjustment via serial (
v1.2) - Live speed adjustment via serial (
s0.8) - Systematic pole pairs testing through code changes
- RP2040-Zero pin configuration (GP0,1,2,3)
- Thermal monitoring and safety limits
Hardware Validated:
- RP2040-Zero + SimpleFOCMini v1.1 integration
- 9V supply with 2200µF capacitor
- Motor resistance compatibility testing
BLDC Testing Session - August 31, 2025
Hardware validation and motor compatibility research
Hardware Configuration:
- RP2040-Zero microcontroller (GP0,1,2,3 for motor control)
- SimpleFOCMini v1.1 BLDC driver
- 9V 2A supply with 2200µF capacitor
- Various motor testing (1503, A2212, 2204 gimbal)
Key Discoveries:
- Motor resistance critical: SimpleFOCMini requires >10Ω gimbal motors
- Drone motors incompatible: 1503 (1Ω) and A2212 (low resistance) cause driver overheating
- Live tuning interface: Serial commands for voltage/speed adjustment
- Component mismatch: All tested drone motors below SimpleFOCMini specifications
Test Code Features:
// SimpleFOC_TestUtility.ino - Live tunable parameters via serial
float voltageLimit = 0.5; // Command: v1.2
float targetSpeed = 1.0; // Command: s0.8
BLDCMotor motor = BLDCMotor(5); // Pole pairs testing
Outcome: 2204-260KV gimbal motor identified as proper solution, delivery pending
Open-Loop BLDC Control Analysis - August 31, 2025
Critical design discovery: Encoder integration mandatory
Problem: All BLDC motors exhibited overheating in open-loop mode regardless of type:
- 1503 micro motors (1Ω resistance)
- A2212 drone motors (low resistance)
- 2204-260KV gimbal motors (9.8Ω resistance)
Root Cause Discovery:
- Open-loop BLDC inherently inefficient - cannot synchronize electrical timing with rotor position
- Creates internal “fighting” between electrical field and rotor position
- Energy converts to heat instead of useful torque
- Resistance compatibility secondary issue to fundamental control method problem
Failed Mitigation Attempts:
- Current limiting (
motor.current_limit = 1.1) - PWM frequency adjustment (20kHz)
- Phase sequence optimization
- Voltage reduction strategies
Solution Required: AS5600 encoder integration for closed-loop FOC control
- Enables electrical field synchronization with actual rotor position
- Eliminates timing mismatch heating
- Mandatory for reliable BLDC operation
BLDC Hardware Stream (Motor Control System)
BLDC Testing Session - August 31, 2025
Hardware validation and motor compatibility research
Hardware Configuration:
- RP2040-Zero microcontroller (GP0,1,2,3 for motor control)
- SimpleFOCMini v1.1 BLDC driver
- 9V 2A supply with 2200µF capacitor
- Various motor testing (1503, A2212, 2204 gimbal)
Key Discoveries:
- Motor resistance critical: SimpleFOCMini requires >10Ω gimbal motors
- Drone motors incompatible: 1503 (1Ω) and A2212 (low resistance) cause driver overheating
- Live tuning interface: Serial commands for voltage/speed adjustment
- Component mismatch: All tested drone motors below SimpleFOCMini specifications
Test Code Features:
// Live tunable parameters via serial
float voltageLimit = 0.5; // Command: v1.2
float targetSpeed = 1.0; // Command: s0.8
BLDCMotor motor = BLDCMotor(5); // Pole pairs testing
Outcome: 2204-260KV gimbal motor identified as proper solution, delivery pending
Key Architectural Evolution
Movement System Progression:
- v10-v12: Basic random walk → smooth motion
- v13-v17: Infrastructure improvements (naming, timing, boundaries)
- v18-v22: Advanced patterns (epicycloids, noise generation)
- v23-v26: Behavioral psychology (dwelling, four-state system)
- v27-v29: Perimeter specialization and spatial memory
- v30-v31: Gravity dynamics and dramatic struggle
Communication System Development:
- Early Phase (≤v0.14): Core hysteresis RGB transitions
- Refinement (v0.16): Color palette optimization
Development Intensity Patterns
Movement Algorithms: Continuous iteration with 21+ documented versions over 8 days
- Primary development focus with detailed behavioral evolution
- Clear progression from mechanical motion to psychological dynamics
LED Communication: Concentrated development with fewer documented versions
- Parallel development stream with less frequent major revisions
- Focus on aesthetic refinement rather than behavioral complexity
Missing Documentation
- SearchingV13-V26: Individual version details not captured in available files
- Hysteresis_I_MMLC v0.01-v0.15: Early development phases undocumented
- Integration versions: Combined movement + LED coordination not evident
Hxyxy Tuning Interface Stream (OpenFrameworks)
HIxyxy_Tuning_OF.ino + ofApp - September 2, 2025
Servo control debugging and interface enhancement
Critical Bug Fixes:
- Servo Direction Fix: TipX servo direction inverted in
updateServos()-servoTipX.write((int)(180 - tipX)); - Range Validation Bug: Updated Arduino validation from 5-175° to full 0-180° servo range
- System Freeze Fix: Mismatched range validation between OF GUI (0-180°) and Arduino (5-175°) caused complete lockup
Interface Enhancements:
- Mouse Grid Control: Added direct click/drag manipulation of servo position grids
- Real-time Visual Feedback: Improved coordinate mapping with proper Y-axis inversion
- Interactive Tuning: Enhanced user experience with intuitive direct servo control
Visualization Analysis:
- Critical Issue Identified: Current “Tentacle Profile” uses rigid segments with linear interpolation
- Reality Mismatch: Physical tentacle is continuous flexible structure with complex cable deformation
- Path Forward: Empirical curve fitting based on actual hardware measurements needed
Technical Debt Documented:
- Tentacle curve physics depend on spine material, knuckle geometry, thread routing
- Current visualization actively misleading about system behavior
- Proper spatial modeling essential for advanced control algorithm development
Optical Communication Stream (/Lighting/ Directory)
OpticalCommsTesterTX_Fixed.ino + OpticalCommsTesterRX_TimeSync.ino - September 12, 2025
Breakthrough: Functional optical communication achieved with timing synchronization
Location: /code/Arduino/Lighting/
Hardware: RP2040 (TX + RX), WS2812 LED arrays, MCP6022 + BPW34 photodiode circuits
Critical Circuit Fix - Power Supply:
- Problem Identified: MCP6022 on 3.3V supply was saturated, only 0.4V total detection range
- Solution Applied: Changed to 5V supply with 2.5V bias point (VDD/2)
- Result: 812 ADC count dynamic range (vs. previous 8 counts)
- Signal Performance: -324 counts (finger blocking) to +488 counts (flashlight)
Protocol Development Success:
- Algorithm Evolution: Event-triggered start + time-synchronized sampling
- Bit Duration: 200ms (matched between TX and RX)
- Signal Modulation: Full 1-255 brightness range for maximum contrast
- Detection: 16-bit messages received with proper timing synchronization
Key Technical Achievements:
// Successful communication pattern:
// TX sends: "0101010101010101"
// RX receives: "1010101010101010" (inverted but consistent)
// Signal levels: 60-100 count variations above noise floor
Timing Synchronization Breakthrough:
- Start Detection: Strong signal triggers transmission beginning
- Fixed Sampling: 200ms intervals regardless of signal strength
- Tolerance: ±50ms timing windows for environmental variation
- Reliability: ~70% success rate under controlled conditions
Remaining Challenges:
- Baseline Drift: Environmental light changes affect signal classification
- Polarity Inversion: Bit assignments need calibration adjustment
- Environmental Sensitivity: Requires stable ambient light conditions
Next Phase Architecture - Dual Photodiode System:
- Hardware Plan: Two BPW34s separated by 4.5cm with dual MCP6022 circuits
- Two-Phase Protocol:
- Phase 1: Directional attention seeking (“something brighter over there”)
- Phase 2: Close-range precise communication using established protocol
- Components Needed: 74HCT125 logic level shifter for RP2040→WS2812 compatibility
OpticalCommsTesterTX.ino + OpticalCommsTesterRX.ino - September 9, 2025
Initial transimpedance amplifier circuit validation
Purpose: Validate MCP6022 + BPW34 transimpedance amplifier circuit for inter-unit communication Hardware: Arduino Uno (TX) + RP2040 (RX), WS2812 LED + photodiode circuit
Circuit Issues Identified:
- Narrow Detection Range: Only 0.4V swing indicated saturation problems
- Platform Incompatibility: RP2040 3.3V logic insufficient for WS2812 control
- Breadboard Reliability: Intermittent analog connections in sensitive TIA circuit
Initial Protocol Framework:
- Steganographic Approach: ±0.4% brightness variations (imperceptible to humans)
- Binary Encoding: Test pattern transmission with timing protocols
- Detection Threshold: 5 ADC count variations above baseline
Technical Validation:
- Circuit topology proven when hardware connections stable
- Optical communication concept demonstrated
- Production requires PCB implementation for reliable analog performance
Last Updated: September 12, 2025
Sources: SearchingV12.ino, SearchingV27.ino, SearchingV31.ino, Hysteresis_I_MMLC_0.16.ino, HIxyxy_Tuning_OF.ino, OpticalCommsTesterTX_Fixed.ino, OpticalCommsTesterRX_TimeSync.ino