Ascoding Robotics Workbench
Ascoding Engineering Solutions · Workbench
Applied robotics · reference build

From battery to behaviour, wired properly.

Six circuits that cover a small two-wheel rover end to end: power, switching, motor drive and three kinds of sensing. Each sheet shows the wiring, says why every part is there, and gives the numbers to check on the bench.

Project
Differential-drive rover
Supply
2S LiPo, 7.4 V nominal
Logic
5 V (Uno) · 3.3 V (ESP32)
Sheets
01 to 06
Rev
A · 2026-11

Circuit sheets

Actuator sheets are drawn for a 5 V Arduino Uno. Sensor sheets are drawn for a 3.3 V ESP32, because that is where voltage levels need care.

supplysignalground and returnwires joined (a crossing with no dot is not a connection)

Power tree

+BT12S LiPo7.4 VF15 ASW1mainD11N5822+C1470 µFV_MOT → sheet 03U1 5 V / 3 A buckIN+OUT+GND+C2100 µFC3100 nF+5 V logic0 V: one common ground for motors, logic and sensors
SHEET 01 / 06 · POWER TREEOne battery, two rails, one ground.
Why each part is there
  • F1 limits a short to a blown fuse. A LiPo can deliver tens of amps into a mistake.
  • D1 sits backwards across the rail. Connect the battery reversed and it conducts, blowing F1 before anything else is hurt. It costs no voltage in normal use.
  • C1 supplies the current spike when motors start, so the rail doesn't sag.
  • U1 steps 7.4 V down to 5 V efficiently. A linear regulator would waste a third of the power as heat.
  • C2, C3 smooth the 5 V rail: the big one for slow dips, the small one for fast noise.
Check on the bench
  • Set U1 to 5.00 V with nothing connected to its output, then wire in the logic.
  • Stop driving at 6.6 V (3.3 V per cell). Running a LiPo lower damages it.
  • Servos take a separate tap from +5 V with their own 470 µF capacitor at the connector, not the microcontroller's 5 V pin.

Switching a load with a MOSFET

Arduino Uno (5 V)D9 ~GNDR1220 ΩR210 kΩQ1IRLZ44Nlogic-level N-MOSFET+V_LOAD 5–12 VMM1loadD11N5819flyback
SHEET 02 / 06 · LOW-SIDE SWITCHA 20 mA pin controls amps.
Why each part is there
  • Q1 is the switch. Gate high connects the bottom of the load to ground and current flows. Use it for one-direction loads: pumps, solenoids, fans, LED strips.
  • R1 limits the inrush as the gate charges: 5 V ÷ 220 Ω = 23 mA, inside the pin's 40 mA limit.
  • R2 holds the gate at 0 V while the Uno is resetting and its pins float, so the load stays off.
  • D1 gives the motor's coil current somewhere to go at switch-off. Without it the voltage spike can destroy Q1.
Check on the bench
  • IRLZ44N is about 25 mΩ on at a 5 V gate. At 2 A that is 2² × 0.025 = 0.1 W, so no heatsink.
  • On a 3.3 V board pick a MOSFET rated at a 2.5 V gate, such as the AO3400A.
  • D1's stripe (cathode) faces the positive rail. Fit a 1N5822 for loads over 1 A.

Dual motor drive

Arduino Uno5VD4D5 ~D7D8D6 ~D9D10GNDU1 TB6612FNGVCCSTBYPWMAAIN1AIN2PWMBBIN1BIN2GNDVMAO1AO2BO1BO2+5 V logic supplyenable (high = run)speed Adirection Adirection Aspeed Bdirection Bdirection Bcommon groundV_MOT 7.4 V+C110 µFC2100 nFMleftC3100 nFacross motor tabsMrightC4100 nFacross motor tabs
SHEET 03 / 06 · TB6612FNG H-BRIDGETwo motors, both directions, variable speed.
Why each part is there
  • U1 holds two H-bridges. Each one can connect its motor either way round, which is what reverses it.
  • PWMA / PWMB set speed and must be on PWM pins (marked ~ on the Uno).
  • C1, C2 sit close to the VM pin to absorb switching spikes.
  • C3, C4 are soldered across the motor tabs. They quiet brush noise that otherwise upsets sensors and resets the board.
Control table
IN1IN2PWMMotor
HLdutyForward at that duty
LHdutyReverse at that duty
HHanyBrake (windings shorted)
LLanyCoast

Limits: 1.2 A continuous and 3.2 A peak per channel, VM up to 13.5 V. Pick motors whose stall current stays under the peak.

Ultrasonic range sensor on a 3.3 V board

ESP32 dev board (3.3 V logic)VIN 5VGPIO5GPIO18GNDHC-SR04 ultrasonicVCCTRIGECHOGND+5 V10 µs trigger pulse (3.3 V is enough)R11 kΩR22 kΩ5 V echo3.33 V at the pin
SHEET 04 / 06 · HC-SR04 LEVEL SHIFTTwo resistors protect the input pin.
Why each part is there
  • The HC-SR04 runs on 5 V and answers with a 5 V pulse. ESP32 pins are only rated for 3.3 V.
  • R1, R2 divide the echo: 5 V × 2 k ÷ (1 k + 2 k) = 3.33 V.
  • TRIG needs no shifting. The sensor reads anything above about 2 V as high.
Check on the bench
  • Distance in cm = echo time in µs ÷ 58 (sound covers 0.0343 cm per µs, there and back).
  • Useful range is about 2 cm to 4 m. Wait 60 ms between pings so old echoes die away.
  • Soft or angled surfaces return weak echoes. Treat a timeout as "nothing seen", not zero.

Line sensor

ESP32 (ADC1)3V3GPIO34GNDTCRT5000 packageR1100 ΩIR LEDR210 kΩOUTphoto-transistorIR via floor
SHEET 05 / 06 · TCRT5000 REFLECTANCELight out, voltage back.
Why each part is there
  • R1 sets the LED current: (3.3 V − 1.25 V) ÷ 100 Ω = 20 mA.
  • The phototransistor conducts more the more infrared it receives. With R2 above it, that becomes a voltage at OUT.
  • A white floor reflects strongly, so OUT is pulled low. A black line absorbs the light and OUT rises towards 3.3 V.
Check on the bench
  • Mount the sensor 2 to 5 mm above the floor. Higher than 10 mm and the contrast collapses.
  • Record the reading on white and on black, then set the threshold halfway between.
  • GPIO34 is input-only and on ADC1, which keeps working when Wi-Fi is on.

Sharing one I²C bus

ESP323V3GPIO21GPIO22GNDR14.7 kΩR24.7 kΩSDA (data)SCL (clock)SDASCLMPU-6050IMU · 0x68+3V3SDASCLVL53L0XToF · 0x29+3V3
SHEET 06 / 06 · I²C SENSOR BUSTwo wires, many devices.
Why each part is there
  • I²C devices only ever pull a line low. R1, R2 pull it back high, so the bus needs exactly one pair.
  • Each device answers to its own address, so the IMU (0x68) and the distance sensor (0x29) share the same two wires.
  • On the MPU-6050, tie AD0 to ground for 0x68 or to 3.3 V for 0x69.
Check on the bench
  • Many breakout boards already carry pull-ups. If yours do, leave R1 and R2 out.
  • Run an I²C scanner sketch first. Both addresses should appear before you write any driver code.
  • Keep the bus under about 30 cm and away from motor wires.

Bench calculators

The three sums behind the sheets above. Change any value.

Voltage divider

LED resistor

Battery runtime

Uses 80% of rated capacity, which keeps a LiPo above its safe cutoff.

Firmware for sheet 03

An Arduino sketch that drives both motors with the pins exactly as drawn. Put the wheels off the ground for the first run.

// TB6612FNG dual motor drive, pins as drawn on sheet 03
const uint8_t STBY = 4;
const uint8_t PWMA = 5, AIN1 = 7, AIN2 = 8;    // left motor
const uint8_t PWMB = 6, BIN1 = 9, BIN2 = 10;   // right motor
const uint8_t PINS[] = {STBY, PWMA, AIN1, AIN2, PWMB, BIN1, BIN2};

// speed: -255 (full reverse) to 255 (full forward), 0 = coast
void drive(uint8_t in1, uint8_t in2, uint8_t pwm, int speed) {
  digitalWrite(in1, speed > 0);
  digitalWrite(in2, speed < 0);
  analogWrite(pwm, constrain(abs(speed), 0, 255));
}

void rover(int left, int right) {
  drive(AIN1, AIN2, PWMA, left);
  drive(BIN1, BIN2, PWMB, right);
}

void setup() {
  for (uint8_t p : PINS) pinMode(p, OUTPUT);
  digitalWrite(STBY, HIGH);        // leave standby
}

void loop() {
  rover( 180,  180);  delay(1500); // forward
  rover(   0,    0);  delay(400);  // coast before reversing: kinder to the gears
  rover(-150,  150);  delay(600);  // spin left on the spot
  rover(   0,    0);  delay(400);
}

Parts list

SheetRefPartNotes
01BT12S LiPo, 7.4 V, 2200 mAhKeyed XT30 connector; charge only with a balance charger
01F1, SW15 A blade fuse, 5 A toggle switchFuse goes closest to the battery
01, 02D11N5822 / 1N5819 Schottky3 A / 1 A, 40 V
01U15 V 3 A buck module (LM2596 or MP1584)Adjust before connecting logic
01, 03C1, C2470 µF, 100 µF, 10 µF electrolytic, 16 V or moreStripe marks the negative lead
allC3, C4100 nF ceramicBuy a strip; they go everywhere
02Q1IRLZ44N N-MOSFETThe L matters: plain IRFZ44N needs a 10 V gate
03U1TB6612FNG breakoutPlus two 6 V geared DC motors
04—HC-SR041 kΩ and 2 kΩ resistors
05—TCRT5000100 Ω and 10 kΩ; one sensor per line edge
06—MPU-6050 and VL53L0X breakoutsTwo 4.7 kΩ if the boards have no pull-ups

Bring-up order

Power things up in this order and a fault shows itself while it is still cheap.

  1. With the battery unplugged, measure resistance from each rail to ground. A reading near 0 Ω is a short; find it now.
  2. Connect the battery with only sheet 01 built. Confirm V_MOT, then set the buck to 5.00 V.
  3. Add the microcontroller alone. Check 5 V is still 5 V and upload a blink sketch.
  4. Add sensors one at a time and print raw readings before using them for anything.
  5. Add the motor driver with the wheels off the ground. Start at a low duty such as 80 of 255.
  6. Hold a wheel still for a second while watching the 5 V rail. If it dips below 4.5 V the board will reset on the floor; add capacitance or separate the supplies.
  7. Put it on the floor.