Project 04 · Voltage divider
Ohm’s law as an instrument.
A known 1kΩ, an unknown resistor, and A0. Students stop treating resistance as a textbook number and start measuring it.

Vout = Vin × R2 / (R1 + R2), rearranged to R2 = R1 × (Vin / Vout − 1). Arduino reads Vout as a 0–1023 count.
const int analogPin = A0;
const float Vin = 5.0;
const float R1 = 1000.0; // known resistor, ohms
void setup() {
Serial.begin(9600);
}
void loop() {
int raw = analogRead(analogPin);
float Vout = (raw * Vin) / 1023.0;
if (Vout < 0.01) {
Serial.println(0);
delay(500);
return;
}
float R2 = R1 * (Vin / Vout - 1.0);
Serial.println(R2);
delay(500);
}import processing.serial.*;
Serial myPort;
float resistance = 0;
void setup() {
size(420, 220);
myPort = new Serial(this, Serial.list()[0], 9600);
}
void draw() {
background(255);
fill(20);
textSize(20);
text("Measured resistance", 40, 70);
text(nf(resistance, 1, 1) + " ohm", 40, 110);
}
void serialEvent(Serial p) {
String val = p.readStringUntil('\n');
if (val != null) {
resistance = float(trim(val));
}
}Basic Display ohms as text.
Intermediate Color by range (low / mid / high).
Advanced Analog gauge with arc().
Challenge Compare with color-code tolerance; log a batch.
