Chapters

36 Braitenberg Transfer Tuning

sensors
sensor
types
braitenberg

36.1 Start With the Measurement Story

This section: Start With the Measurement Story — A reactive rule only works if the sensor curve and motor response are understood.

A reactive rule only works if the sensor curve and motor response are understood. Begin with the transfer story: how raw light becomes resistance, how that becomes speed, and where saturation or lag breaks the reflex.

Shows: A light-driven robot reveals the limits in its direct sensor-to-motor rule.
  1. Illustrated scene: A light sensor's raw signal changes its electrical resistance.

    A light sensor's raw signal changes its electrical resistance.

  2. Illustrated scene: A direct robot rule can fail when the sensor or motor reaches a limit.

    A direct robot rule can fail when the sensor or motor reaches a limit.

  3. Illustrated scene: Trace the full curve from light through resistance to motor speed.

    Trace the full curve from light through resistance to motor speed.

  4. Illustrated scene: Use the reflex only where delay and limits stay understood.

    Use the reflex only where delay and limits stay understood.

A light-driven robot reveals the limits in its direct sensor-to-motor rule.

36.2 Learning Objectives

This section: Learning Objectives

After this page, you should be able to:

  • Explain why a sensor transfer function can change a Braitenberg vehicle’s apparent behavior.
  • Predict where LDR compression, saturation, and response lag will cause steering errors.
  • Tune divider, dead-band, scaling, and motor mapping choices from bench evidence.
  • Implement and test multi-mode reactive behavior before escalating to AI/ML.

36.3 After Braitenberg Basics

This section: After Braitenberg Basics — Braitenberg Vehicles: Sensing to Action explains how topology and polarity create reactive behavior.

Braitenberg Vehicles: Sensing to Action explains how topology and polarity create reactive behavior. This page tests the physical measurement chain behind those rules: a simple mapping only stays simple if the sensor curve, conditioning circuit, motor scaling, and timing lag are known.

36.4 Transfer Function as Behavior

This section: Transfer Function as Behavior — This is why "more light means more signal" is not enough to predict behaviour.

A Braitenberg vehicle wires a sensor almost directly to a motor, so the vehicle's personality is decided by one thing: the sensor's transfer function — the rule that maps the physical stimulus (say, light level) to the output signal (a voltage that drives the wheel). Change the shape of that curve and you change how the vehicle acts.

This is why "more light means more signal" is not enough to predict behaviour. A light sensor that responds steeply in dim conditions but barely at all in bright ones will make a vehicle lunge toward a distant lamp yet crawl once it is close. The shape of the curve — where it is steep, where it flattens — is the design.

For a light-following robot, the curve is part of the steering loop. If the left light sensor climbs from 10 to 100 lux while the right sensor stays near 10 lux, the left-side signal changes strongly and the vehicle turns. If both sensors are already near saturation at 900 and 1000 lux, the signal difference may be tiny even though the physical light difference is real. The vehicle then appears indecisive near the lamp.

Before tuning motor response, inspect Figure 36.1 to see how the LDR's nonlinear light response becomes a control transfer function.
Shows: Figure 36.1: An LDR gives a compressive transfer function: it changes dramatically across dim-to-normal light, then flattens in bright light, so a Braitenberg vehicle can lose steering sensitivity near a strong lamp.
Logarithmic chart showing light-dependent resistor resistance decreasing as light intensity increases.
Figure 36.1: An LDR gives a compressive transfer function: it changes dramatically across dim-to-normal light, then flattens in bright light, so a Braitenberg vehicle can lose steering sensitivity near a strong lamp.

Read Figure 36.1 from illumination through falling resistance and the divider signal toward the motor command. The steep middle region supplies steering sensitivity, while the flattened bright-light region hides left-right differences, connecting sensor physics directly to behaviour.

A useful bench check is to sweep the sensor with a desk lamp before connecting the motors. Record output at several distances, then ask where the curve is steep enough to steer and where it is flat enough to hide differences. That simple plot predicts most of the vehicle's "personality" before the chassis moves.

Intuition: the transfer function is the vehicle's reflexes. A gentle, gradual curve gives calm, proportional reactions; a steep or saturating curve gives twitchy, all-or-nothing ones. The same wiring feels completely different behind a different sensor curve.

Overview Knowledge Check

Check your understanding: Use the questions below to check the key idea

36.5 Photoresistor Compression Loop

This section: Photoresistor Compression Loop — Sensitivity is the local slope of the transfer function, and for many real sensors that slope changes along the curve.

Sensitivity is the local slope of the transfer function, and for many real sensors that slope changes along the curve. A photoresistor (LDR/CdS cell) is a classic example: its resistance follows a power law in illuminance, so it is compressive.

Sensitivity = d(output) / d(stimulus)   (the local slope, not a constant)
Photoresistor: R = R_ref × (E / E_ref)^(-γ)
  E = illuminance,  γ ≈ 0.6 to 0.9 for a CdS cell (a compressive, log-like law)

Worked example: equal light ratios, shrinking resistance steps

This is a chosen power-law model. A data-sheet gamma may be specified only over a narrower illuminance interval (for example, 10-100 lux); the 1,000 lux point is an extrapolation that must be checked against the selected LDR.

LDR: R = 10 kΩ at 10 lux, γ = 0.7

At 100 lux (10x brighter): R = 10k × (100/10)^-0.7 = 10k × 10^-0.7 = 10k × 0.20 = 2.0 kΩ At 1000 lux (another 10x): R = 10k × (1000/10)^-0.7 = 10k × 100^-0.7 = 10k × 0.04 = 0.4 kΩ

Each 10x jump in light multiplies R by the same 0.20, so the resistance CHANGE shrinks: 8 kΩ then 1.6 kΩ. The sensor is far more responsive in dim light than bright.

For the vehicle, that compressive curve means strong reactions to a faint, distant light and muted reactions once the light is close and bright — behaviour that comes entirely from the sensor's curve, not from any code.

Now put that LDR into a voltage divider with a 10 kΩ fixed resistor to ground and a 3.3 V supply. With the LDR as the top resistor, Vout = 3.3 × 10k / (Rldr + 10k). At 10 lux, Rldr = 10 kΩ, so Vout = 1.65 V. At 100 lux, Rldr = 2 kΩ, so Vout = 2.75 V. At 1000 lux, Rldr = 0.4 kΩ, so Vout = 3.17 V.

The first 10x light increase moves the signal by about 1.10 V; the next 10x increase moves it by only 0.42 V. A microcontroller or motor driver sees those voltages, not the lux directly. So the effective vehicle rule is not "turn proportional to light"; it is "turn proportional to the conditioned voltage curve."

Practitioner Knowledge Check

Check your understanding: Use the questions below to check the key idea

The mathematical gist. Under the chapter’s assumed R=Rref(E/Eref)−γR=R_{ref}(E/E_{ref})^{-\gamma} model, Rref=10R_{ref}=10 kΩ at 10 lux and γ=0.7\gamma=0.7 give 1.995 kΩ at 100 lux and 0.398 kΩ at 1,000 lux. In the 3.3 V, 10 kΩ divider, those points give 1.650 V, 2.751 V, and 3.174 V: equal 10× light jumps produce shrinking voltage steps of 1.101 V and 0.423 V. The 1,000 lux prediction extrapolates beyond many data sheets’ gamma test interval and needs device-specific verification.

Math Bridge · guided foundationsWhy do equal light ratios make shrinking voltage steps?Let Phoebe derive the LDR power law and the chapter's three divider voltages.

36.6 Curve Shaping and Photoresistor Memory

This section: Curve Shaping and Photoresistor Memory — Once you see behaviour as a consequence of the transfer function, you can engineer it — and you can also spot where a real sensor will betray you.

Once you see behaviour as a consequence of the transfer function, you can engineer it — and you can also spot where a real sensor will betray you.

The full controller is the product of three curves: physical stimulus to sensor output, sensor output to conditioned voltage, and conditioned voltage to actuator command. A different divider resistor, ADC reference, dead band, PWM mapping, or motor driver gain changes the behaviour even when the wiring diagram stays the same. That is why a bench plot of voltage versus lux is more useful than a single "LDR sensitivity" number.

Photoresistors add one more complication: memory. CdS cells can take tens or hundreds of milliseconds to brighten and longer to recover after bright exposure. A fast robot may therefore steer using yesterday's light reading for part of a turn. In a Braitenberg loop, that lag is feedback delay; too much delay causes oscillation, hunting, or overshoot around the stimulus.

Linear, compressive, saturating

A linear curve gives proportional reactions; a compressive (log-like) curve stays responsive across a huge range but dulls when strong; a saturating curve flattens above a level, so the vehicle cannot tell a bright light from a brighter one.

Sensitivity dies at saturation

Where the curve flattens, the local slope approaches zero, so 900 and 1000 lux produce nearly the same signal. Near a lamp a saturating sensor makes the vehicle blind to further increases.

You can reshape it with conditioning

The divider resistor, and any log or linearising amplifier, changes the overall stimulus-to-voltage curve. Sensor plus conditioning equals the effective transfer function, which is the real behaviour lever.

The CdS memory effect

Photoresistors respond slowly (tens of milliseconds to seconds) and show light-history hysteresis: the same illuminance can read differently depending on prior exposure. A fast-moving vehicle can lag and behave inconsistently because of it.

The lesson generalises well beyond toy robots: whenever a sensor drives an action with little processing in between, the transfer function is the controller. Choosing or shaping that curve — and knowing where it saturates or lags — is how you get the behaviour you intend rather than the one the raw sensor happens to give. A practical validation run should therefore log raw lux or resistance, conditioned voltage, PWM command, and observed turn direction at several distances from the lamp.

Under-the-Hood Knowledge Check

Check your understanding: Use the questions below to check the key idea

36.7 Beginner Build: Light-Following Robot

This section: Beginner Build: Light-Following Robot — Goal: Build Vehicle 2b that chases a flashlight.

Goal: Build Vehicle 2b that chases a flashlight.

Components:

  • ESP32 + L298N motor driver
  • 2× LDR photoresistors (left/right sensors)
  • 2× DC motors + wheels
  • 9V battery

Wiring:

Left LDR  → ADC pin 34 → Right motor (cross-wired)
Right LDR → ADC pin 35 → Left motor (cross-wired)
More light = faster motor (excitatory)

Expected behavior: Robot turns toward flashlight and drives into it

36.8 Temperature-Seeking Heater

This section: Temperature-Seeking Heater — Goal: Build a mobile heater that moves toward warm areas and stays there (for temperature monitoring or co-locating with existing heat sources).

Goal: Build a mobile heater that moves toward warm areas and stays there (for temperature monitoring or co-locating with existing heat sources).

Components:

  • 2x thermistors (left/right temperature sensors)
  • 2x DC motors
  • Temperature logger / display

Wiring topology:

  • Same-side inhibitory (love behavior)
  • Warm side (high temp reading) inhibits same-side motor more, slowing it -> turns toward warmth
  • As it reaches the warm zone, both sensors read high, both motors slow -> stops near the heat source

Why this works: Same-side inhibitory means motor = base_speed - sensor * gain. High stimulus (warmth) produces high inhibition, slowing the motor on that side. The opposite motor runs faster, turning the vehicle toward the warm area. Near the source, both sensors read high, both motors slow, and the vehicle stops — classic “love” behavior.

Real application: A mobile sensor platform that autonomously navigates to warm zones for thermal monitoring, or a robot that finds and stays near a charging station emitting heat.

36.9 Multi-Behavior State Machine

This section: Multi-Behavior State Machine — Goal: Robot switches between fear/aggression/love modes using a button.

Goal: Robot switches between fear/aggression/love modes using a button.

Modes:

  1. Fear mode (same-side excitatory): Runs from light
  2. Aggression mode (cross-wired excitatory): Attacks light
  3. Love mode (same-side inhibitory): Approaches and stops near light

Challenge: Implement smooth transitions between modes, add LED indicators for current mode

Bonus: Add a fourth mode: “Explorer” (cross-wired inhibitory) for obstacle avoidance (Roomba-like)

36.10 Reactive Design Rule Practice

This section: Reactive Design Rule Practice

36.11 Concept Relationships

This section: Concept Relationships

Core ConceptRelated ConceptsWhy It Matters
Cross-Wired vs Same-SideApproach vs AvoidanceDetermines direction of response
Excitatory vs InhibitorySpeed Up vs Slow DownDetermines intensity of response
Emergent BehaviorSimple Rules, Complex OutcomesIntelligence appears without programming it
Reactive ControlNo Memory, Fast ResponseSimpler than AI, often sufficient

Common Pitfalls

This section: Common Pitfalls

Inhibitory vs Excitatory Links

An excitatory connection increases motor speed when the sensor signal increases; an inhibitory connection decreases motor speed. Swapping these causes vehicles to move opposite to intended — approach instead of avoid. Always simulate the behavior on paper before wiring physical motors.

Sensor-Motor Scale Mismatch

If the sensor output range drives motor speed directly without scaling, the motor may always run at maximum or minimum speed with little intermediate behavior. Add a scaling function between the sensor output and the motor driver to use the full behavioral range.

Ignoring Motor Mechanical Delays

Physical motors have inertia and time constants (50-500 ms) that lag behind rapidly changing sensor inputs, causing jittery oscillatory motion. Add a low-pass filter to the sensor input or a ramp-rate limit on the motor command to achieve smooth behavior.

Single-Sensor Design Limits

A vehicle controlled by a single light sensor fails unpredictably when walls, reflections, or shadows create contradictory stimuli. Add a second sensor type (proximity, IR distance) to provide context and enable more situation-aware behaviors.

36.12 Release Checklist

This section: Release Checklist — Start by sensor output measured across the expected stimulus range, including saturation points.

Before accepting a Braitenberg-style reactive controller, capture this evidence:

Start by sensor output measured across the expected stimulus range, including saturation points. Then conditioned voltage or ADC count plotted against physical stimulus, not just raw sensor resistance. Next motor command scaling, dead band, and ramp limits chosen from bench tests. After that delay or hysteresis measured for sensors such as LDRs before fast-motion tests. Continue by mode-switching behavior verified for every wiring/polarity combination. Finally a documented decision that reactive control is sufficient, or a trigger for escalating to AI/ML.

36.13 See Also

This section: See Also — Start by Braitenberg Vehicles: Sensing to Action - core wiring and behavior model.

Start by Braitenberg Vehicles: Sensing to Action - core wiring and behavior model. Then Sensor Signal Conditioning - shaping analog signals before control. Finally Common Sensor Mistakes - broader sensing failure patterns.

36.14 What’s Next

This section: What’s Next — Return to Braitenberg Vehicles for the main module path, or continue to Infrastructure Sensing for reactive systems built from existing signals.

Return to Braitenberg Vehicles for the main module path, or continue to Infrastructure Sensing for reactive systems built from existing signals.

Find help

3 reviewed answers.

Where should I start in a module?

Open the module page from the sidebar to see its chapters in order. Use the module map to return to a topic you need.

Modules and paths

Reviewed

What can I try when a project does not work?

Check the symptom, then work through the diagnostic steps. Keep the error message and the smallest example that reproduces it.

When you are stuck

Reviewed

How do interactive examples work?

Use the interactive guide to check how examples and simulations work before changing your project.

Interactive examples guide

Reviewed