Built-in project · Arduino Uno R3

Power module on an Arduino Uno

An MB102 breadboard power supply runs a servo off a 9 V battery, 5 V on the top rails and 3.3 V on the bottom, sharing ground and the servo signal with the Uno while A0 watches the 3.3 V rail. The whole build, an Arduino Uno and 3 more parts, runs here in your browser on the firmware below; open it in the editor to change the wiring or the code and run it again.

Teaching? Assign it to your class in one click.

Beginner Runs in your browser. Free, and no account needed.

The parts retail for about $39. On Mokxi they're free.

Power module · Arduino Uno R3live0.000 s 0.00x
Press Run, then click the power module to switch it off
The circuit itself, running here on the simulator. Press what can be pressed; click anything else to open it in the editor.

The code

The firmware exactly as the editor opens it. Change a line there and press Run: it compiles in the browser.

sketch.ino · Arduino Uno R3
// Power module: an MB102 breadboard power supply runs a servo off a 9 V
// battery, so the servo's current never comes through the Uno, and the Uno
// keeps an eye on the module's 3.3 V rail.
//
//   MB102     on the left end of the breadboard; a 9 V battery on its jack
//             top rails 5 V (jumper), bottom rails 3.3 V (jumper)
//   servo     red -> top + rail   brown -> top - rail   signal -> pin 9
//   Uno       GND -> top - rail (one ground for everything)   A0 -> bottom + rail
//
// A servo moving draws hundreds of milliamps in bursts, enough to pull a USB
// port's 5 V down and reset the board. The kit's answer is the power module:
// its own regulator, its own battery, and only the ground and the signal
// shared with the Uno.
//
// The sketch sweeps the servo and prints the 3.3 V rail as the Uno reads it.
// Click the module to switch it off and watch the rail fall to nothing and
// the servo stop where it is.

#include <Servo.h>

const int SERVO_PIN = 9;
const int RAIL_PIN = A0;

Servo arm;

void setup() {
  Serial.begin(9600);
  arm.attach(SERVO_PIN);
  Serial.println("Power module: servo on the 5 V rail, watching the 3.3 V rail");
}

void loop() {
  for (int angle = 0; angle <= 180; angle += 45) {
    arm.write(angle);
    delay(400);
    long millivolts = (long)analogRead(RAIL_PIN) * 5000 / 1023;
    Serial.print("servo ");
    Serial.print(angle);
    Serial.print(", 3.3 V rail ");
    Serial.print(millivolts);
    Serial.println(" mV");
  }
}

Parts list

5 parts, plus the jumper wires. They retail for about $39; on Mokxi they're free.

How it is wired

6 connections, pin by pin, read from the circuit itself. Each line is one set of pins joined together, by a jumper wire or a breadboard strip.

  • Ground: Arduino Uno R3 pin GND; Breadboard power supply, MB102 pin TOP-; Hobby servo pin GND
  • Arduino Uno R3 pin 9; Hobby servo pin PWM
  • Arduino Uno R3 pin A0; Breadboard power supply, MB102 pin BOT+
  • Breadboard power supply, MB102 pin VIN; Battery: AA, coin cell, LiPo pin V+
  • Ground: Breadboard power supply, MB102 pin GND; Battery: AA, coin cell, LiPo pin V-
  • Breadboard power supply, MB102 pin TOP+; Hobby servo pin VCC

Change it and keep it

Open it in the editor, change the circuit or the code, and keep your version in a free account.