60 circuits
From an LED and its resistor to a microcontroller. Each one has a breadboard you can touch.
LED with a series resistorThe resistor sets the LED current: I = (V − Vf) / R
Voltage dividerVout = Vin · R2 / (R1 + R2), measured where the two resistors meet
NPN transistor switchA small base current switches a larger collector current (press S1)
Potentiometer dimming an LEDThe wiper is an adjustable divider: its voltage goes from 0 to the supply
MOSFET switchThe gate takes voltage, not current; the pull-down R2 discharges it when S1 is released
Button with a pull-up resistorReleased, R1 pulls the output up (LED on); pressed, S1 takes it to ground (LED off)
Button with a pull-down resistorReleased, R1 holds the output at ground (LED off); pressed, S1 takes it to the supply (LED on)
RC circuit with a square waveC1 charges and discharges with τ = R·C; compare it with the period of G1
555 astable blinking an LEDC1 charges through R1 + R2 and discharges through R2: f ≈ 1.44 / ((R1 + 2·R2) · C1)
7805 regulator with a pilot LEDA fixed output from a higher input; the difference is lost as heat in U1
AMS1117 module with an LEDA low-dropout regulator: 3.3 V out from 5 V in
Bridge rectifier with a filter capacitorBoth half-waves come out positive; C1 fills the gaps between peaks (ripple)
Zener regulatorReversed, the Zener holds its voltage; R1 takes the rest of the supply
ESP32 blinking an LEDA GPIO pin as an output: digitalWrite(13, HIGH) lights D1, delay() sets the rhythm
ESP32 reading a buttonA GPIO pin as an input with the internal pull-up: digitalRead(27) reads LOW while S1 is pressed
Op-amp comparatorWithout feedback the output saturates: high when V+ > V−, low when V+ < V−
LM393 comparator (open collector)The output only pulls down: the LED, fed from the supply, lights while V− > V+
Op-amp voltage follower (buffer)With the output on V−, the output copies V+: the potentiometer gives a voltage, the op-amp gives the current
Non-inverting amplifierGain = 1 + R2/R1: the output is the input times 3, in phase
Inverting amplifierGain = −R2/R1 around the reference on V+: the output is twice the input, upside down
Arduino UNO blinking an LEDA pin as an output at 5 V: digitalWrite(13, HIGH) lights D1, delay() sets the rhythm
Arduino UNO: a button lights an LEDA pin as an input with the internal pull-up: it reads LOW while S1 is pressed, and the program decides the LED
Arduino UNO: a potentiometer dims an LED (ADC and PWM)analogRead turns a voltage into 0…1023; analogWrite turns 0…255 into the share of time the pin is high
ESP32-C3 SuperMini blinking an LEDA GPIO as an output at 3.3 V: digitalWrite(3, HIGH) lights D1
ESP32-C3: a potentiometer dims an LED (ADC and PWM)analogRead turns a voltage into 0…4095 (12 bits, up to about 2.5 V); analogWrite sets the share of time the pin is high
Arduino UNO: an RGB LED mixes colours (PWM)Three LEDs in one dome, each with its own resistor: their brightness, set by PWM, adds up to the colour the eye sees
Arduino UNO: a 7-segment display counts 0 to 9Seven LEDs to one common pin, each with its own resistor: a digit is the set of segments the program lights
Slide switch picks an LEDA changeover (SPDT): its middle pin is joined to one end or the other, so one switch sends the current down one of two paths
Tilt switch alarmUpright, the closed switch takes the resistor's current past the LED; tilted, it opens and the LED gets it
Arduino UNO: LM35 thermometerThe LM35 turns temperature into 10 mV per °C; the ADC turns that voltage into a number, and the program back into degrees
Relay with an NPN and a flyback diodeA small base current lets the coil's 71 mA flow; the coil pulls the contact over and the LED lights. Released, the diode takes the coil's current (without it, its voltage would jump far past the supply)
DC motor speed with a transistorStarted, the motor draws nearly its stall current and speeds up with a time constant of its inertia; turning, its back-EMF rises with the speed until it nearly balances the supply, and the current falls
Night light with a photoresistorIn the dark the photoresistor's resistance is high, the divider's voltage rises and the transistor switches the LED on; with light it falls and the LED goes out. It switches at about 95 lx on 3 V, 190 lx on 5 V and 375 lx on 9 V in the model.
Light comparator with a photoresistorThe photoresistor's divider is compared with a reference you set: below it (dark) the output pulls down and the LED lights; above it (light) the output is released. With the reference at half the supply it switches at about 18 lx for the model's photoresistor (a real one varies)
Temperature alarm with an LM35 and a comparatorThe LM35 gives 10 mV per °C; the comparator releases its output when that voltage passes the reference from the divider (about 42 °C, give or take 4 °C with 5 % resistors) and the LED lights
NTC thermistor divider with a followerA thermistor divider turns temperature into a voltage; the follower copies it to a load without loading the divider, as long as the output can follow: an LM358 stops about 1.5 V under its supply, about 65 °C at 9 V.
Arduino UNO: NTC thermistor thermometerThe thermistor and a resistor make a divider; the ADC turns its voltage into a number, and the B equation turns the resistance into degrees
PIR motion sensor lights a lampA PIR module holds OUT high for its delay after motion and then rests; OUT is too weak for a lamp, so it drives a transistor that carries the LED's current
Arduino UNO: PIR motion detectorA PIR's OUT is a plain digital level: the program watches for its rising edge and prints the time of each new motion with millis(). A real module needs about a minute to warm up and may fire falsely meanwhile (the recipe starts already warm); its shortest delay is about 2.5 s
Touch module toggles an LEDIn toggle mode each touch flips the TTP223's output; its pin can drive a small LED directly, if the resistor keeps the current under the 4 mA its high level is guaranteed at
Arduino UNO: touch sensorThe TTP223 gives a clean digital level that follows the finger, 60 to 220 ms late; the program prints each change; powered from the UNO's 5 V its output is 5 V, well above the 3 V the UNO needs for a HIGH
Rain alarm with an MH-RD moduleWater bridges the comb, AO falls under Vref and DO goes low: the LED on the board lights and DO pulls the PNP's base down, which switches the buzzer on
Soil moisture LED with a YL-69 moduleThe damper the soil, the lower the fork's resistance and AO; past the trimmer's Vref DO goes low and sinks the LED's current
Light switch with an LDR-LM393 moduleThe module turns light into yes or no: DO goes low past about 18 lx with the trimmer in the middle (the figure is the model's photoresistor; a real one varies), and the LED lights; the trimmer moves that point
Arduino UNO: TCRT5000 line followerWhite paper sends the infrared back and the phototransistor pulls AO low, so DO reads LOW; black ink absorbs it, AO rises and DO reads HIGH: the program prints LINE
Obstacle alarm with an FC-51 moduleThe nearer the object, the more infrared comes back and the lower AO; past Vref OUT goes low and the PNP lets the active buzzer's current through. The trimmer sets the distance: about 4 cm at 25 %, 9 cm at 50 % and 28 cm at 90 % (white paper, in the model; a real module varies).
Arduino UNO: KY-024 magnet counterThe Hall switch turns on at about 160 G and off under about 105 G in the model (hysteresis; real parts differ, and only a south pole counts: turn the magnet over if nothing counts), so a magnet that wobbles near the threshold counts once; the program counts each fall of DO
Arduino UNO: KY-040 rotary encoder counterA rotary encoder gives two square waves a quarter of a cycle apart: at each fall of CLK, DT high means clockwise and DT low counter-clockwise. The sketch ignores a CLK change under 8 ms after the last one, so contact bounce of up to 5 ms does not miscount.
Arduino UNO: dimmer with a KY-040 rotary encoderThe encoder counts clicks in either direction and the sketch turns the count into a PWM duty: 12 per click, held between 0 and 20 clicks, so 240 at most. Clockwise brightens the LED, counter-clockwise dims it, the button turns it off.
Laser tripwire with a KY-008 and an LDR-LM393 moduleThe laser's light adds to the room's for the light sensor; cut the beam and only the room is left: DO goes high, the transistor conducts and the LED lights (with the trimmer at 0.1 it only works in a room under about 410 lx; the figure depends on the photoresistor)
Arduino UNO: a laser and a light sensorA pin switches the laser through a transistor (the module takes about 28 mA and a UNO pin is recommended up to 20 mA, 40 mA at most); its light adds to the room's at the photoresistor, so the reading on A0 rises while it is on and falls back when it is off
Arduino UNO: HC-SR04 distance meterTRIG starts a ping; ECHO stays high for the round trip of the sound, and pulseIn measures it: microseconds ÷ 58 is centimetres
ESP32 with an HC-SR04 (ECHO through a divider)The HC-SR04 needs 5 V and its ECHO is 5 V; a 3.3 V board's pin takes it through 1 kΩ / 2 kΩ, which leaves 3.33 V, while TRIG at 3.3 V is enough for the module
Arduino UNO: LED alarm under 15 cm (HC-SR04)The program compares the distance it measured with a limit and lights an LED; pulseIn returns 0 when no echo comes, which is not "close"
Arduino UNO: KY-035 gaussmeterThe linear Hall sensor is ratiometric: its output is about half the supply plus about 1.4 mV per gauss. Its zero varies from part to part (2.25 to 2.75 V), so the program measures it at start-up (the average of 32 readings) with no magnet near and turns the difference back into gauss
Arduino UNO: voltmeter with a voltage sensor moduleThe module is a 30 kΩ and 7.5 kΩ divider: S carries a fifth of the voltage at its terminal, so a 25 V input still fits the 5 V ADC, and the program multiplies the reading by five
Arduino UNO: clap switch with a KY-037 sound moduleA clap is any change of DO from its resting level, whichever way the board moves it and however short the pulse. The sketch takes the rest level from 100 readings, polls without waiting and accepts the next clap only when DO is back at rest and 200 ms have passed.
Arduino UNO: temperature and humidity with a DHT11A sensor read through its library: the DHT11 answers on one data pin, in whole degrees and whole %RH, read through a library that asks at most every 2 s (the chip itself admits one a second); isnan() tells a failed read
ESP32 with a BME280: temperature, pressure, humidityAn I2C sensor answers at its address on the board's SDA and SCL: begin(0x76) finds the usual board; readPressure() is in Pa, ÷ 100 is hPa; the altitude comes from the pressure
Arduino UNO: altitude with a BMP280 (on 3.3 V)The usual BMP280 board has no regulator: it goes on the UNO's 3.3 V pin, not 5 V. Wire turns on the UNO's own 5 V pull-ups, so after begin() the sketch turns them off and the bus idles at 3.3 V. Lower pressure, higher altitude.
No circuits on this topic yet. Try «All».
