UB90 Help: the Uno Breadboard Simulator
How to use the simulator, from the first example to the multimeter. For the Arduino C commands it runs, see the UB90 Reference. Back to the simulator.
Help - Table of Contents
- Getting Started
- UB90 Simulator
- Quick Start
UB90 Simulator
The Uno Breadboard Simulator (UB90, version 0.9.0) is an Arduino Uno, one long breadboard, a four bus power supply, a multimeter, an oscilloscope, and an Electronics Lab (an L298N motor driver, a thumb joystick, and a robot), with an ATmega328P to place on the breadboard, that run in your browser. Write a sketch in one file or several (.ino, .h, .cpp, with C++ classes and templates), build the circuit, and run it. Nothing is sent to a server. It is made for a desktop or laptop with a mouse or trackpad.
Quick Start
- The page opens with Blink: an LED on pin 13 through 220 Ω, wired under the Uno.
- Press Upload (the right arrow). It builds the sketch, loads it onto the Uno, and starts it. The LED blinks once a second.
- Press Examples and choose another sketch. Leave Wire it for me checked: the example's circuit is placed on the breadboard under the Uno, and its modules in the lab.
- Watch the LEDs on the breadboard and the text in the Serial Monitor.
- To stop the sketch, unplug the USB (click the USB jack) or hold the reset button, as on a real Uno.
Build and Upload
- Build (the check mark) checks the code (syntax). An error shows in red in the Output with its line number, and that line number turns red in the editor.
- Upload (the right arrow) builds the sketch, runs the compiler checks, loads it onto the Uno, and starts it, as in the Arduino IDE. The USB cable must be plugged in.
- Each press starts a new Output; its first line names the button and the sketch, for
example
Upload: Blink.ino. - The green Run LED beside Upload is on while the sketch runs and off when it stops.
- The sketch runs until you press Build, upload another sketch, unplug the USB, or hold the reset button. The editor tab shows "changed since Upload" when the code differs from the sketch on the Uno.
Editor, Output, Serial Monitor, and Plotter
- The editor keeps its size; long code scrolls with the scroll bars or the mouse wheel. Drag the grip in the lower right corner to make it taller.
- Output shows Build and Upload messages and errors. Serial Monitor shows what the sketch prints with Serial.print and Serial.println.
- The Serial Plotter graphs the numbers the sketch prints, one trace per number
on a line. Print
name:valuepairs to name the traces, as in the Arduino IDE 2. - Output, Serial Monitor, and Plotter also have grips. A new example, New, or Reset Page sets the sizes back.
Examples, Files, and Reference
- Examples: 39 sketches in sub menus, as in the Arduino IDE (Basics, Digital, Analog, Carpenter Software with the Numerics lessons, the finite state machines, and Robotics with JoystickDrive, JoystickDriveC, Programmer, and ChipJoystickDrive). JoystickDrive runs the MageMCU Code-JUL files as written: its main sketch and the header ace.h.
- Sketch files: the second row of tabs above the editor lists the sketch's files:
the .ino first, then its .h and .cpp files. Press + to add one (a header gets
include guards); ▾ on a file tab renames or deletes it. In the sketch,
#include "ace.h"reads one of these files. All files of a sketch are in one folder, as in the Arduino IDE, so#include "claude/ace.h"finds ace.h too. An error names its file and line and opens that file. - #include <Arduino.h>: every example starts with this line, so it copies
straight into the Arduino IDE or a PlatformIO main.cpp. The simulator has the Arduino
core built in, so the line loads nothing here;
#include "Arduino.h"works too. A sketch without the line runs, as in the Arduino IDE. A library name the simulator does not have, such as<Arduino>(no .h) or<Servo.h>, is an error that names it. - New starts an empty sketch. Save downloads one .ino file; its header files, circuit, power supply, lab modules, and Chip tab ride along as comment lines. Open loads such a file.
- Export downloads the sketch as a folder in a .zip (Name/Name.ino with its .h and .cpp files) for the Arduino IDE. Open folder reads a sketch folder you choose: its .ino and its .h and .cpp files; other files are left out.
- A file from an older simulator still opens: parts the long breadboard has no hole for are skipped, and the Output says how many.
- Reset Page clears what this browser keeps and starts over.
- Keep your work with Save or Export. The page also remembers your sketch and circuit in this browser, but only in this browser on this computer: clearing the site's data, another computer, or Reset Page loses it. Open and Open folder ask before they replace a sketch you changed.
- Reference opens the UB90 Reference: every Arduino C and C++ command the simulator runs.
The Uno
- The Uno lies beside the instruments, its USB jack and power jack at the right. Its digital pins (0 to 13) run along its bottom edge, over the breadboard; its power and analog pins along its top edge, and their wires run around the Uno to the board.
- Rest the cursor on a pin to see a hint with its name and job, for example "D13 (pin 13): SCK, LED L" or "A4 (analog in, D18): SDA (I2C)".
- Click the USB jack to plug or unplug the Uno. The ON LED shows power.
- The Uno has a 500 mA USB fuse (a polyfuse), as the real board does. A short from 5V or 3.3V to GND opens it: the Uno goes off and its state reads "USB fuse open (short)". Remove the short and the fuse closes again.
- Hold the red reset button, or wire RESET to GND, to hold the Uno in reset.
- The L LED is on pin 13; TX blinks when the sketch prints.
The Bench Layout
- Top: the UB90 title bar across the bench.
- Under it, left: the power supply (Bus A to D), and under that the BENCH: the scope above the multimeter, and beside them the Uno. Right: the Electronics Lab, a square of four slots.
- Bottom: one long breadboard of 68 columns across the whole bench. Its left half (columns 1 to 34) has Bus A on the top rails and Bus B on the bottom rails; its right half (columns 35 to 68) has Bus C on the top and Bus D on the bottom. The bus letters sit at the outer ends.
- The examples follow four wiring rules: the circuit starts under the Uno pins it uses; a module's circuit sits under its dots; the Uno GND (the GND pin beside 5V) joins the − rails of all four buses; and the ATmega328P goes on the breadboard between the Uno and the Electronics Lab.
The Breadboard and Components
- Rows a to e and f to j: the five holes in a column on each half are connected. The gap in the middle separates the halves.
- Each half of the board has a top and a bottom pair of rails, each a + rail and a − rail: Bus A and Bus B on the left half, Bus C and Bus D on the right. The rail holes come in blocks of five, and the rails split in the middle, so Bus A and Bus C (and Bus B and Bus D) are separate until you wire them together.
- Choose a component, then click two holes: a resistor 2 to 8 holes apart; an LED with the long leg (+) first; a wire from a pin or hole to another pin or hole. After each part the tool turns off, so the next click works the circuit; choose the tool again for another part. Escape also turns a tool off.
- Resistors: 220 Ω to 1 MΩ, including 4.7 kΩ (the usual I2C pull up) and 1 MΩ.
- Capacitor (22 pF, 0.1 µF, or 22 µF) and Crystal 16 MHz: placed like a resistor. With steady voltages a capacitor and a crystal pass no current, so they change nothing in the circuit yet; they are saved with it, ready for the ATmega328P on the breadboard, which needs the crystal and two 22 pF capacitors to run. For the 22 µF (electrolytic), place the + leg first.
- Hold a button to press it. Drag a knob or a light sensor to change it.
- Delete removes a part; Starter Circuit places two LEDs and a button; Clear Board removes every part.
Electronics Lab and Modules
- The Electronics Lab at the right has four slots: slot 2 for modules to come, the Robot, the Thumb Joystick, and the L298N Driver, each module with an ON and OFF switch. Turning a slot OFF takes the module and its wires out; Clear Lab takes them all out. The breadboard stays.
- The joystick and the L298N have connection dots in a row along the bottom of the lab, labeled above each dot: the joystick's under it (wired down to columns 51 to 55), and the L298N's in two groups, POWER (12V, GND, 5V, toward columns 60 to 62) and LOGIC (ENA, IN1 to IN4, ENB, toward columns 63 to 68). Wire them like the Uno's pins, to a pin or to a hole.
- The motor connections: Motor A (OUT1, OUT2) above the L298N's upper left corner and Motor B (OUT3, OUT4) above its upper right corner; each robot motor's two leads in a lower corner of the robot's slot, LEFT and RIGHT (red +, black −). Wire each motor to one output pair with the Wire tool.
- Thumb Joystick: two 10 kΩ potentiometers between +5V and GND (VRx and VRy) and a switch (SW) to GND. Drag the yellow knob; it springs back to the center when you let go (the arrow keys move it too). Hold SW to press the stick. The readout under it shows the VRx and VRy voltages.
- L298N Driver, drawn as on the bench (Article 1003): the heat sink at the top, the power terminal at the lower left, the logic header at the lower right. ENA gates OUT1 and OUT2 (IN1 drives OUT1, IN2 drives OUT2); ENB gates OUT3 and OUT4 (IN3, IN4). An IN pin HIGH switches its output to the 12V dot's voltage less about 2 V (lost inside the L298N); LOW switches it to GND. Both outputs at one level brake the motor; the enable LOW lets it coast. PWM (analogWrite) on ENA or ENB sets the speed. Its 5V dot needs 5 V (the 5V jumper is off, as in Joystick-Uno-L298N), and its GND must be joined to the Uno GND; the lab says which is missing.
- Robot: two wheels 12 cm apart, each turned by a 24 Ω motor. Each wheel follows the volts across its own motor's leads (+ above − turns it forward), so the wires decide which output drives which wheel, and which way. It stays in its slot, pointing up, and shows what it would do: an arrow at each wheel (up for forward, down for back, longer with more volts) and a curved arrow for the turn, with a note under it (stopped, straight ahead, turning, or pivot). The left and right motor volts show under it; a motor not wired, with a loose lead, or split over A and B is named instead.
- Try Examples, Carpenter Software, Robotics, JoystickDrive: the drive program of Joystick-Uno-L298N (MageMCU), Code-JUL's main sketch and ace.h unchanged, with the motors on Bus D at 14 V. Press Upload, hold SW once (the LED on D12 lights), then drag the joystick. JoystickDriveC is the same program in plain C, for comparison.
- Never wire 8 V or more to the Uno 5V pin, a 5V dot, or an Uno pin: those voltages are for the L298N's 12V dot only.
Wiring the Robot: Step2_JUL and the MMC
This is one big puzzle, and Article 1009, the Parent, Teacher, and Student Guide, is its guide: the L298N Setup, Circuit-1, and the Motor Movement Checklist, with the printable forms in 1009 Supplemental. Both are on the Robotics page, with the articles 1009 builds on: 1000 Introduction Robotics, 1001 Joystick Algorithm, 1002 Arduino Uno, 1003 L298N Motor Driver, and 1004 Experiments.
- Choose Examples, Carpenter Software, Robotics, Step2_JUL: the L298N Setup of
Article 1009, simplified for the simulator (the same octant algorithm, joystick
correction, dead zone, latching button, and Bits() rules as the program in
Joystick-Uno-L298N). It starts at
bits_0000. - Wire it for me ON: the example wires Circuit-1 for you, the motors included (Motor A to the right motor, Motor B to the left). OFF (the advanced way): the example places the modules and turns on Bus D, and you add every wire: the L298N's POWER and LOGIC, the joystick, and the motors.
- Press Upload, press SW once (the LED on D12 lights: the motors may
run), then run the Motor Movement Checklist (MMC): 16 rows (bits_0000 to
bits_1111) by 8 joystick positions (Right Turn, North-East, Forward, North-West, Left
Turn, South-West, Backward, South-East), 128 cells in all. Push the joystick to each
position in turn and watch the robot's arrows. At the first wrong movement, stop:
change the
Bits()line to the next value, Upload, and start the next row. The first value that passes all 8 positions is the value of your bench. Change the value, never the wires. - The note over the L298N checks your wiring as you build it, with the same model as Motor-Movement-Checklist/BitsProof.py of the repository: MMC: one value fits (green) means one of the 16 values will drive your bench correctly; it never says which. MMC: no value fits (red) names the rule your wiring breaks.
| Rule | Connection |
|---|---|
| 1 | D5 and D10, the two PWM pins, go to ENA and ENB, either way. |
| 2 | D6 and D7 go together to one IN pair (IN1 and IN2, or IN3 and IN4), in either order; D8 and D9 go to the other IN pair. |
| 3 | The two leads of each motor go to one output pair (OUT1 and OUT2, or OUT3 and OUT4); either motor may use either output, with either polarity. |
| 4 | Power, the 5 V logic supply, and the common ground as in Circuit-1 (Article 1009). No value corrects a power or ground fault. |
| 5 | The joystick: VRx and VRy on A0 and A1, either way; SW on D2. |
| Kind | Examples | What you see |
|---|---|---|
| Damaging | 12 V (an L298N output or Bus D) on an Uno pin or a 5V dot; the Uno 5V wired to GND; an LED with no resistor | The part or pin burns and is drawn burned, and the Output names it; a 5V short opens the USB fuse. Reset Breadboard replaces burned parts. |
| Shorts | An L298N output wired straight to its GND; a bus + rail wired to its own − rail | A Short circuit warning under the board names it. |
| Breaking a rule | D6 and D7 split over both IN pairs; D5 and D10 not on ENA and ENB; a motor split over A and B; A0 or A1 not on VRx or VRy | MMC: no value fits over the L298N, with the rule. |
| Missing | The L298N's GND not joined to the Uno GND; no 5 V on its 5V dot; 12V with no return; a loose motor lead | A red note in the L298N's or the robot's slot says what is missing. |
- With the ATmega328P: ChipJoystickDrive runs the drive program on the chip on the breadboard, with the Uno as its programmer (see ATmega328P on the Breadboard). The motor wires and the MMC check work the same way; the chip's pins 11 to 16 are D5 to D10, and its pins 23 and 24 are A0 and A1. The chip runs only with its crystal and capacitors: the 16 MHz crystal across pins 9 and 10, a 22 pF capacitor from each to GND, 0.1 µF across VCC and GND, VCC and AVCC on 5 V, both GND pins on GND, and RESET pulled up (10 kΩ); the Output names whichever is missing.
ATmega328P on the Breadboard
- Choose ATmega328P in the Components column, then tap the column for pin 1 (any row): the chip goes across the middle gap, pins 1 to 14 along row f and pins 15 to 28 back along row e, as a real chip sits on a breadboard. It is drawn as the 0.300 inch package: its body nearly reaches its pins.
- Wiring Rule 4: the examples place it between the Uno and the Electronics Lab, pin 1 at f36 (columns 36 to 49). That half's bottom rail is Bus D, the motor supply, so VCC and GND (pins 7 and 8) reach Bus B by wires around the chip's left end, and AVCC and GND (pins 20 and 22) go to Bus C. No wire runs over the chip.
- It runs only when wired as the real chip needs: 5 V on VCC (pin 7) and AVCC (pin 20), GND (pins 8 and 22) joined to the Uno GND, a 16 MHz crystal across pins 9 and 10 with a 22 pF capacitor from each to GND, and RESET (pin 1) HIGH. Its own pull up holds RESET HIGH; add 10 kΩ as on a real board. A 0.1 µF capacitor across VCC and GND is advised. The Output says what is missing.
- Above 6 V on VCC or AVCC the chip burns; Reset Breadboard replaces burned parts.
- Its Arduino pins are the real chip's: D0 pin 2, D1 pin 3, D2 to D4 pins 4 to 6, D5 to D7 pins 11 to 13, D8 to D13 pins 14 to 19, A0 to A5 pins 23 to 28.
- The Uno as a programmer: click the Uno's chip to pull it from its socket (click the empty socket to put it back). Wire Uno pin 0 (RX) to chip pin 2 (RXD), Uno pin 1 (TX) to chip pin 3 (TXD), and the Uno RESET to chip pin 1. The same names go together, because the Uno's USB chip already crosses its lines.
- Uno and Chip tabs: each tab has its own sketch. Upload sends the open tab to its chip; the Chip tab uploads through the Uno with its chip pulled, and Output lists anything missing. The chip's Serial reaches the Serial Monitor through the Uno. The breadboard chip keeps its sketch when the Uno's chip goes back in.
- On a real Uno an upload can fail while something drives pin 0; the Output gives a note when pin 0 is wired.
- Examples, Carpenter Software, Robotics: Programmer (Blink and Serial on the breadboard chip) and ChipJoystickDrive (the drive program on the breadboard chip).
Power Supply
- The power supply runs across the top of the bench with four buses, A (teal), B (orange), C (purple), and D (green). Each has a display, + and − (0.1 V a click; hold for 1 V steps), SET with presets (OFF, 3.3, 5, 9, 12, 15 V), and an ON and OFF switch that keeps its voltage. The range is 0 to 18 V; 8 V and up are for the L298N motor supply.
- Bus A feeds the top rails of the left half, Bus B the bottom rails of the left half, Bus C the top rails of the right half, and Bus D the bottom rails of the right half.
- Each bus is an isolated output, independent of the other buses: its − rail joins nothing until you wire it. A wire from a bus + rail straight to its own − rail is a short, and the supply warns.
- The supply GND is separate from the Uno GND. Wire the bus − rail to an Uno GND pin so the sketch and the supply share a common ground (the examples do this for all four buses).
- Measure a bus with the multimeter: the red probe on a + rail hole, the black probe on a − rail hole.
Multimeter
- V: click the red probe, then a hole or pin; then the black probe and another hole or pin. It reads the voltage from red to black (a PWM pin reads its average). The meter has a 10 MΩ input, as a real meter. When the two probes are on parts of the board with no circuit between them (a bus whose − rail is not wired, for example), it reads 0.00 V and shows OPEN. The oscilloscope does the same.
- mA: the meter goes in series, as on a real meter. Open the circuit where you want to measure: delete a wire (or move a lead). Put the red probe on one end of the gap and the black probe on the other. The meter closes the gap and reads the current from red to black. Example: in Blink, delete the wire from pin 13 and put the red probe on pin 13 and the black probe on the hole where the wire ended; the LED lights and the meter reads about 12 mA.
- Never put the mA probes across a source (for example 5V and GND, or a pin and GND): that is a short circuit. Over 200 mA the meter's fuse blows and it shows FUSE; press UNPLUG to replace the fuse. A pin can burn before the fuse blows. Press UNPLUG before you change to mA.
- Ω: put the red and black probes on two holes or pins of a circuit with no power. The meter reads the resistance between them through resistors, wires, pressed buttons, the knob, and the light sensor. Two holes in the same strip read 0.0 Ω; with nothing between them it reads OL; an LED reads OL. A part on its own, such as a resistor with nothing else wired to it, reads while the Uno runs. When either probe's circuit is powered (by the running Uno or a bus that is ON) the meter shows PWR ON, as a real meter warns: unplug the USB or turn that bus off first.
- UNPLUG takes both test leads off the board.
Oscilloscope
- The scope sits above the multimeter, under the power supply, and uses the same red and black probes. It shows the voltage from red to black over time; with only the red probe placed it measures to GND. Keep the multimeter on V.
- PWM (analogWrite) and tone() show their square wave: 490 Hz on pins 3, 9, 10, and 11, 980 Hz on pins 5 and 6, or the tone frequency. A rising edge starts each sweep one division from the left, so the wave stands still. Try Fade with the red probe on pin 9 and watch the pulse width change.
- Slower signals, such as Blink, scroll across the screen. Try Blink with the red probe on pin 13 and 500 ms per division.
- ◀ ▶ set the time per division (1 µs to 500 ms); the next button sets 1, 2, or 5 volts per division (5 V for the 8 to 18 V buses); RUN or HOLD freezes the screen. The readout shows the frequency, duty cycle, and peak voltage. Ground (0 V) is one division above the bottom.
- When a wave is too fast for the time per division, it shows as a band between its low and high levels; choose a shorter time per division to see each pulse.
Mistakes and Burned Parts
- Mistakes burn parts, marked with a red X: an LED over 50 mA, a resistor over 0.3 W, an Uno pin over 80 mA or above 5.5 V, and the Uno itself above 5.6 V on its 5V pin.
- The page warns above 20 mA per LED or pin. Try 24.MistakeLab in the Examples.
- Reset Breadboard replaces burned parts and keeps the wiring.
Computer Requirements
- A desktop or laptop computer with a mouse or trackpad. Phones and tablets are not supported.
- A window at least 1100 pixels wide; 1366 or wider shows the bench and the IDE side by side.
- A current version of Chrome, Edge, Firefox, or Safari, with JavaScript on.
- The page loads about 300 KB once. While a sketch runs it uses about 5 MB of memory and a small part of one processor core, so any computer from the last ten years runs it smoothly.
- Nothing is installed, and no account is needed. Sound (tone) needs speakers or headphones.
Speed and Timing Limits
The simulator runs your sketch in your browser, not on a 16 MHz chip. Measured on a desktop computer with Chrome (your computer may be somewhat faster or slower):
- Math: about 0.9 million additions a second, close to a real Uno.
- Pin changes: about 11,000 digitalWrite calls a second, about 20 times slower than a real Uno, because each change updates the circuit.
- Clock: millis() and micros() follow the real clock in steps of 0.1 ms (the browser's step), so delay() of 1 ms or more is accurate and delayMicroseconds() under 100 µs is only approximate.
- Screen: LEDs, meters, the joystick, and the robot update about 60 times a second (every 16.7 ms). A pulse shorter than that shows on the scope, not as an LED blink.
- Polling: a loop() that only waits (reads a button or millis() over and over) runs at most 50 times in each millisecond, so the page stays light; for loops run at full speed.
- PWM and tone(): drawn from their frequency and duty cycle, so the scope shows them at their true speed (490 Hz, 980 Hz, or the tone).
- Two chips (the Uno and the ATmega328P on the breadboard): both keep the real clock, so delay() and millis() stay accurate; each chip's math runs about 25 percent slower while both run.
Privacy and Limits
- Your sketches (Uno and Chip tabs) and their header files, the circuit on the breadboard, power supply settings, the modules in the Electronics Lab, and whether the Uno's chip is pulled are kept in this browser only. Nothing is sent to a server.
- Export makes its .zip in this browser. Open folder reads only the folder you choose, only in this browser, and only its .ino, .h, and .cpp files at the top level; nothing is uploaded.
- Security: an opened file is read as plain text and is never run as page code. Each part in a file's circuit is checked (known part, real holes, known values), and so is the list of lab modules (known modules only), each header file (a plain name ending in .h or .cpp, at most 100 KB, at most 15 files), and the Chip tab is checked (a plain name, text code, and yes or no for the pulled chip) and kept as text until you press Upload; anything else is skipped. Your sketch runs only in the simulator's own interpreter, with limits on array sizes, nested calls, files (16), include levels (8), class instances (64), and objects (256). #include reads only the sketch's own files, never a path or a web address. The page loads code only from this site and Google Analytics.
- The simulator is experimental and under development. A bug is an error in a program; if a result looks wrong, check it against a real circuit. The Enigmatic Bug stamp marks the site's experimental pages.
- Not covered: libraries, String, interrupts, timers, and exact timing. See the Not supported list.
- Designed: Jesse Carpenter and Claude (Anthropic). Simulator code: MIT License.