Electronics From Zero Search/

Embedded · Hardware lab · Intermediate · about 60 minutes

Hardware lab: connect a real Arduino

Plug an Arduino into your computer and this page reads its inputs and drives its outputs, live. Then measure real circuits and compare them with the models you have been using: a light sensor, a thermistor, a charging capacitor, a night light and a 555 timer.

Before you start

What you need

  • An Arduino Uno R3 or Nano (5 V boards) and its USB cable. Other boards may work but have not been tested.
  • The free Arduino IDE, to upload a small sketch once.
  • Chrome or Edge on a computer. The page talks to the board with the browser’s Web Serial feature, which Firefox, Safari and phones do not offer.
  • For the experiments: a breadboard, jumper wires, an LDR, a 10 kΩ NTC thermistor, three 10 kΩ resistors, a 100 µF capacitor, an LED with a 220 Ω resistor, a push button, and for the last one a 555 with 1 kΩ, 10 kΩ and 47 µF.

Safety checklist

  • An Arduino pin can supply about 20 mA. Always put a resistor in series with an LED.
  • Never connect a motor, relay, speaker or long LED strip straight to a pin. Use a transistor or a driver board.
  • Nothing above 5 V on any pin. Do not connect a 9 V battery to the board’s pins. (A 3.3 V board such as an ESP32 can be damaged by 5 V.)
  • Wire up with the USB cable unplugged, check twice, then plug in. If anything gets warm, unplug at once.
  • Connecting 5 V straight to GND (a short) can damage the board or the computer’s USB port.

Step 1: upload the bridge sketch

  1. Download efz-bridge.ino (or copy it from below) and open it in the Arduino IDE. The IDE asks to put it in a folder called efz-bridge: say yes.
  2. Choose your board and port (Tools → Board and Tools → Port), then press Upload.
  3. Close the IDE’s Serial Monitor if it is open: only one program can use the port at a time.
Show the sketch
Loading…

The sketch is plain text at 115 200 baud, so you can also type its commands (such as PING or READ) into the IDE’s Serial Monitor. Pins 0 and 1 are never used, because they carry the USB link.

Step 2: connect

Not connected.

Live readings

Voltages assume the board’s 5 V reference and 10-bit converter (0–1023). The USB 5 V is often a little low (4.8–5.1 V), which shifts every reading by the same proportion. A pin with nothing connected “floats” and reads random values: that is normal.

Experiments: real readings next to the models

Each experiment says how to wire it, then compares what your board measures with what the site’s model predicts. Differences of a few per cent are normal: real parts have tolerances.

1 · Light sensor divider (A0)

Wire: LDR from 5V to A0; 10 kΩ from A0 to GND. This is the divider from Circuit lab 02.

kΩ

Connect a board to see readings.

2 · Thermometer (A1)

Wire: 10 kΩ NTC thermistor from 5V to A1; 10 kΩ from A1 to GND. Hold the thermistor between your fingers and watch it warm up.

kΩ
K

Connect a board to see readings.

3 · Capacitor charging curve (D7 → A2)

Wire: 10 kΩ from D7 to A2; 100 µF capacitor from A2 to GND (its − leg, the striped side, to GND). The board empties the capacitor, switches D7 high and records the voltage at A2.

kΩ
µF

The recording takes about five time constants.

4 · Night light (A0 → PWM on D9)

Wire: keep the light-sensor divider on A0. Add an LED and 220 Ω resistor from D9 to GND (long leg towards D9). The page reads the light level and sets the LED’s brightness, like the night light project, with map() between two readings you take.

Take the two readings first.

5 · Measure a 555’s frequency (D4)

Wire: build the Blinky circuit, but power it from the Arduino’s 5V and GND, not from a 9 V battery: a 9 V signal would damage the input. Connect the 555’s pin 3 to D4.

kΩ
kΩ
µF

The board times one high and one low pulse (it waits up to 3 s for each).

What the page and the board say to each other

Every command the page sends and every reply, so you can see there is nothing hidden. Readings are left out to keep it short.


  

Want to see any sketch’s output, or plot your own values? Use the serial monitor and plotter.

Check your understanding