Skip to content

Configuration

Ahmed Dabak edited this page Jul 24, 2026 · 2 revisions

Configuration

Introduction

OttoFlow configuration has three levels, and you only climb as high as your robot forces you to:

OttoFlow::start();                     // level 0: the standard kit, nothing to learn
OttoFlow::start(Preset::Humanoid);     // level 1: a known build, standard wiring

OttoConfig cfg = Preset::Humanoid;     // level 2: change any pin or setting
cfg.arms.leftPin = 10;
OttoFlow::start(cfg);

The defaults always match the official Otto DIY kit wiring, so the zero-configuration path works unmodified for the largest group of builders.

Zero configuration

void setup() {
  OttoFlow::start();
}

This is the classic Otto biped: four servos, buzzer, matrix, and distance sensor on the documented kit pins. Arms, Bluetooth, and the MPU-6050 stay off, because a robot that does not have them should not spend time initialising them.

Presets

A preset is a named build. Passing one only changes which optional hardware is enabled; the wiring stays standard.

Preset Description
Preset::Biped The classic Otto: four leg and foot servos, no arms. This is the default.
Preset::Humanoid The biped plus two arm servos on pins 6 (left) and 7 (right).
OttoFlow::start(Preset::Humanoid);

Overriding settings

OttoConfig is a plain struct, and a preset converts into one. Assign a preset, adjust what differs on your robot, and start:

OttoConfig cfg = Preset::Humanoid;

cfg.arms.leftPin       = 10;    // your left arm servo is not on pin 6
cfg.matrix.brightness  = 8;     // brighter mouth
cfg.ultrasonic.samples = 5;     // stronger median filter
cfg.mpu6050.enabled    = true;  // GY-521 wired to A4/A5

OttoFlow::start(cfg);

Starting from a bare OttoConfig works the same way and gives you the biped defaults:

OttoConfig cfg;                 // same as Preset::Biped
cfg.buzzer.helloOnStart = false;
OttoFlow::start(cfg);

Note The configuration is copied into the framework by start(). Changing your local cfg afterwards has no effect -- start again if you need different settings.

Default wiring

Part Pins
Leg servos left 2, right 3
Foot servos left 4, right 5
Arm servos (optional) left 6, right 7
Buzzer 13
Ultrasonic HC-SR04 trigger 8, echo 9
LED matrix MAX7219 DIN A3, CS A2, CLK A1
Touch sensor A0
Microphone A6
Photoresistor A7
Bluetooth RX 11, TX 12
MPU-6050 I2C: SDA A4, SCL A5

Pin 11 is where the board receives, so it goes to the module's TXD; pin 12 is where the board sends, so it goes to the module's RXD.

Configuration options

legs -- LegServoPins

Field Default Meaning
legLeft 2 Left hip servo pin
legRight 3 Right hip servo pin
footLeft 4 Left foot servo pin
footRight 5 Right foot servo pin

arms -- ArmsConfig

Field Default Meaning
enabled false Preset::Humanoid turns this on
leftPin 6 Left arm servo pin
rightPin 7 Right arm servo pin

matrix -- MatrixConfig

Field Default Meaning
din A3 Data in
cs A2 Chip select
clk A1 Clock
orientation 1 1 top, 2 bottom, 3 left, 4 right
brightness 4 0 dim to 15 bright

Rotate orientation if your icons appear upside down or on their side -- it is a mounting question, not a wiring fault.

ultrasonic -- UltrasonicConfig

Field Default Meaning
triggerPin 8 Trigger
echoPin 9 Echo
medianFilter true Take the median of several readings
samples 3 1 to 5 readings per distanceCm() call
timeoutMicros 25000 Per reading, roughly a 4 m round trip

More samples means steadier numbers and slower reads. See Eyes for the trade-off.

buzzer -- BuzzerConfig

Field Default Meaning
pin 13 Buzzer pin
muted false Start muted; Voice::mute() does the same at runtime
helloOnStart true Chirp once when start() finishes

touch -- TouchConfig

Field Default Meaning
pin A0 TTP223 signal pin, or a push button
toggleMode false false: output is HIGH only while touched. true: output flips on every touch

Some kits ship the sensor soldered in toggle mode. Touch::wasTapped() works in both -- see Sensors.

soundSensor / lightSensor

Field Default Meaning
soundSensor.pin A6 Analog microphone output
lightSensor.pin A7 Photoresistor output. Official single-sensor examples use A0

bluetooth -- BluetoothConfig

Field Default Meaning
enabled false Wire the module before enabling
rxPin 11 Board receives, module TXD
txPin 12 Board sends, module RXD
baud 9600 Standard for HC-05, HC-06, and BLE serial modules

mpu6050 -- Mpu6050Config

Field Default Meaning
enabled false 6-axis accelerometer and gyroscope on I2C
i2cAddress 0x68 0x69 when the AD0 pin is pulled high

Top-level

Field Default Meaning
loadTrimsFromEeprom true Load the servo calibration saved by Legs::saveTrimsToEeprom()

Enabling optional hardware

Optional parts stay off until you say otherwise, and a disabled part never fails loudly -- its calls are silent no-ops. This lets you write one sketch that runs on several builds.

OttoConfig cfg;
cfg.arms.enabled      = true;
cfg.bluetooth.enabled = true;
cfg.mpu6050.enabled   = true;
OttoFlow::start(cfg);

Sensors on analog pins -- microphone and photoresistor -- need no enabling. They are passively available; reading an unconnected pin simply returns noise.

Clone this wiki locally