Everything You Need to Know Before ESP32
Vanusele 9–14 | Varasemat kogemust pole vajaEverything in the universe — your desk, your body, the air you breathe — is made of tiny particles called atoms. Aatomid on nii väikesed, et neid mahub nõelaotsale miljoneid!
When you get a static shock from touching a doorknob, that's billions of electrons jumping from your body to the metal all at once! It's the same electricity — just uncontrolled.
Voltage is the force that pushes electrons through a wire. It's measured in Volts (V), mis on nimetatud teadlase Alessandro Volta järgi.
Voltage is like water pressure. Kõrge veetorn surub vett torudest läbi tugevamini kui madal torn.
A 9V battery pushes electrons harder than a 1.5V patarei. Suurem pinge = tugevam tõuge!
| Source | Voltage | Safe? | Used For |
|---|---|---|---|
| AA-patarei | 1.5V | ✅ Very safe | Toys, remotes |
| USB Port | 5V | ✅ Safe | Charging phones, Arduino |
| 9V Battery | 9V | ✅ Safe | Smoke detectors, guitars |
| Car Battery | 12V | ⚠️ Careful | Cars, some electronics |
| Wall Outlet (US) | 120V | ❌ Dangerous! | Home appliances |
| Wall Outlet (EU/ME) | 220–240V | ❌ Very dangerous! | Home appliances |
| Toiteliinid | 10,000V+ | ☠️ Deadly! | Electricity distribution |
In our ESP32 projects, we only use 3.3V ja 5V — completely safe voltages powered by USB. We MITTE KUNAGI work with wall outlets or high voltage. Always ask an adult before working with anything above 12V!
Voltage is always measured between two points. Seepärast on patareidel + (positiivne) and a – (negative) side. The difference between them is the voltage.
Current is the amount of electrons actually flowing through a wire. It's measured in Amprid (A), või lihtsalt Amprid.
Current is like the amount of water flowing through a pipe. A fire hose has more current than a drinking straw.
LED tarbib umbes 20mA (väike nire). Mikrolaineahi kasutab umbes 10A (hiiglaslik voog!).
The ESP32 typically uses about 80mA when running normally, and can drop to 10μA in deep sleep mode. That's like going from drinking a glass of water to barely a single drop!
If voltage is the "push" and current is the "flow" — what determines how much actually flows?
Resistance is anything that slows down the flow of electrons. It's measured in Oomid (Ω), mis on nimetatud Georg Ohmi järgi.
Resistance is like the width of a pipe. Peenike toru laseb vähem vett läbi. Ummistunud torul on väga suur takistus.
A resistor limits how much current flows. A 1kΩ resistor limits more than a 100Ω resistor.
Without resistance, too much current would flow and burn out your components! Resistors are like bodyguards that protect your LEDs and chips.
Resistors have colored stripes that tell you their value. You'll learn to read these as you work with circuits!
| Color | Digit | Meeldejätmise nipp |
|---|---|---|
| ⬛ Black | 0 | Blackout = zero |
| 🟫 Pruun | 1 | 1 pruunkaru |
| 🔴 Punane | 2 | 2 punast silma |
| 🟠 Oranž | 3 | 3 apelsini |
| 🟡 Kollane | 4 | 4-leheline kollane ristik |
| 🟢 Roheline | 5 | 5 green fingers |
| 🔵 Sinine | 6 | 6-sided blue dice |
| 🟣 Violetne | 7 | 7 violet flowers |
| ⬜ Gray | 8 | 8 gray rocks |
| ⬜ White | 9 | 9 white clouds |
This one formula connects voltage, current, ja resistance together. It's the most important formula in electronics!
9V patarei on ühendatud 1000Ω (1kΩ) takistiga. Kui suur vool läbib ahelat?
A circuit is a complete loop that electricity flows through. The word "circuit" comes from "circle" — because electricity must travel in a complete loop to work!
1. Toiteallikas (aku, USB) — annab edasiviiva jõu.
2. Juht (juhe) — elektronide liikumistee.
3. Koormus (LED, mootor, sumisti) — kasutab elektrit.
4. Täielik ahel — back to the power source. If any part breaks, the circuit is "open" and nothing works!
A switch (nagu seinal olev valguslüliti) lihtsalt katkestab või sulgeb vooluringi. Kui see on SEES, on vooluring suletud (terviklik). Kui see on VÄLJAS, on vooluring avatud (katkestatud). See ongi kõik, mida lüliti teeb!
There are two main ways to connect components in a circuit. This is super important to understand!
| Feature | Series | Rööbiti |
|---|---|---|
| Tee | Üksainus voolutee | Mitu teed (harud) |
| Current | Same everywhere | Splits between branches |
| Voltage | Splits between components | Same across all branches |
| If one breaks? | KÕIK lakkavad töötamast | Teised töötavad edasi |
| Real example | Vanad jõulutuled | Your house wiring! |
Vanad jõulutuled olid ühendatud series — if one bulb burned out, the entire string went dark and you had to find the bad one! Modern Christmas lights use parallel so one dead bulb doesn't ruin the whole string.
These are the basic building blocks you'll use in your circuits. Get to know them — they'll be your best friends!
What it does: Piirab voolu. Kaitseb teisi komponente liigse võimsuse eest.
Unit: Oomid (Ω). Levinud väärtused: 220Ω, 1kΩ, 10kΩ
Tip: Has no direction — you can connect it either way!
What it does: Süttib, kui vool sellest läbi liigub.
Important: Has a direction! Long leg = positive (+), Short leg = negative (–)
Vajab: Kasuta alati koos takistiga (tavaliselt 220Ω), muidu põleb see läbi!
Colors: Red, green, blue, yellow, white — depends on materials inside.
What it does: Avab või sulgeb vajutamisel vooluringi.
Types: Hetkeline (SEES ainult vajutades) või lülituv (jääb SISSE/VÄLJA)
In ESP32: Used as digital input — the microcontroller reads if it's pressed!
What it does: Stores and releases small amounts of electrical energy — like a tiny rechargeable battery.
Unit: Farads (F). Usually microfarads (μF) or picofarads (pF)
Uses: Smoothing power, filtering noise, timing circuits.
Types: Ceramic (small, no direction) and Electrolytic (bigger, has + and – sides!)
What it does: Toimib elektroonilise lüliti või võimendina. Väike signaal juhib suuremat.
Think of it as: Veekraan — väike käepideme pööre juhib suurt veevoolu.
Why it matters: Transistors are the building blocks of ALL computer chips! A modern CPU has billions of transistors!
What it does: Laseb voolul liikuda ainult one direction — like a one-way street for electricity.
LED is a type of diode! (Valgusdiood)
Used for: Protecting circuits from reverse current, converting AC to DC power.
What it does: Takisti nupuga, mida keerates saad takistust muuta.
Used for: Volume knobs, brightness dimmers, reading analog input on ESP32.
Has 3 pins: Üks ots, liugur (keskel) ja teine ots.
Suunata (ühenda kumba pidi tahes): Resistors, push buttons, potentiometers
Has direction (connect correctly!): LEDs (long leg = +), electrolytic capacitors (marked + side), diodes (stripe = negative side), transistors (check datasheet)
Üks Integrated Circuit (IC) — often just called a chip — is a tiny piece of silicon with millions or billions of transistors packed inside. It's like a whole city of electronic components shrunk to the size of a fingernail!
Building a computer required a room full of separate wires, resistors, and transistors. Slow, expensive, unreliable.
Üks kiip, mille suurus on nagu sinu thumbnail holds billions of transistors. Your phone is more powerful than early supercomputers!
The first integrated circuit was invented in 1958 by Jack Kilby. It had just 1 transistor. Tänapäeval on Apple'i M4 kiibis üle 28 miljardit transistorit! See on nagu koliksid ühest majast linna, mis on suurem kui ükski linn Maal.
These sound similar but are quite different! Understanding the difference helps you know why we use the ESP32.
| Feature | Mikroprotsessor | Mikrokontroller |
|---|---|---|
| What is it? | Just a CPU (brain) | CPU + Memory + I/O all in one! |
| Vajab lisasid? | Yes — needs external RAM, storage, etc. | Ei — kõik on sisseehitatud! |
| Toide | High power (watts) | Väike energiatarve (millivatid) |
| Speed | Very fast (GHz) | Keskmine (MHz) |
| Cost | $50 – $1000+ | $1 – $20 |
| Good at | Complex tasks (running OS, games, browsers) | Specific tasks (read sensor, blink LED, control motor) |
| Examples | Intel Core, AMD Ryzen, Apple M4 | ESP32, Arduino, STM32, Raspberry Pi Pico |
| Found in | Laptops, desktops, servers | Washing machines, cars, toys, IoT devices |
It has everything on one chip: a dual-core CPU, RAM, Flash memory, Wi-Fi, Bluetooth, GPIO pins, ja built-in sensors. Sellepärast ongi see nii populaarne — terviklik süsteem vaid mõne dollari eest!
In electronics, signals come in two types. Understanding this is essential for working with sensors!
| Feature | Digital | Analoog |
|---|---|---|
| Values | Ainult 0 või 1 (VÄLJAS või SEES) | Any value in a range (smooth) |
| Nagu... | Valguslüliti (sees/väljas) | Dimmer knob (any brightness) |
| ESP32 reading | digitalRead() → 0 or 1 | analogRead() → 0 to 4095 |
| Examples | Button, switch, LED on/off | Temperature, light level, sound |
The real world is analog (temperature changes smoothly), but computers think in digital (0s and 1s). The ADC (analoog-digitaalmuundur) built into the ESP32 converts analog signals to digital numbers so the chip can understand them!
Computers don't understand letters or decimal numbers. They only understand two things: 0 and 1. Seda nimetatakse binary!
Inside a computer, electricity is either flowing (1) või not flowing (0). „Natuke voolamist“ pole olemas. Seetõttu sobib kahendsüsteem elektroonikale ideaalselt — iga juhe on kas SEES või VÄLJAS!
Each position in binary is worth double the previous one (just like decimal positions are worth 10× more):
128 + 0 + 32 + 0 + 8 + 4 + 0 + 1 = 173
What is the binary number 1010 in decimal?
A breadboard lets you build circuits without soldering! Pista lihtsalt juhtmed ja komponendid aukudesse. Osi saab hõlpsasti lisada, eemaldada ja ümber paigutada.
1. Putting both legs of a component in the same column (that shorts it!).
2. Forgetting that the center gap separates the two halves.
3. Toiterööpad pole ühendatud — need ei saa automaatselt voolu. Ühenda need juhtmetega toiteallikaga!
A multimeter is your detective tool — it measures voltage, current, and resistance. Every electronics maker needs one!
Enamikul multimeetritel on continuity mode (näeb välja nagu helilaine sümbol). See piiksub, kui kahe punkti vahel on ühendus. Väga kasulik kontrollimaks, kas juhtmed on ühendatud või miski on katki!
Mitte kunagi measure current (amps) on a wall outlet or high-voltage source. For our ESP32 projects, we only measure low voltages (3.3V–5V) which are completely safe.
Electronics is fun and safe when you follow the rules! These aren't just suggestions — they're essential.
To tell the ESP32 what to do, you write code (juhised) programmeerimiskeeles nimega C++ using the Arduino framework. Here are the key concepts:
Programm on list of instructions that the computer follows, one by one, from top to bottom. It's like a recipe — do step 1, then step 2, then step 3...
Muutuja on nagu labeled box that holds a value. You give it a name and put something inside.
Funktsioon on named block of code that does a specific job. You can call it whenever you need it.
Use if/else to make the program choose what to do based on conditions.
Tsüklid võimaldavad sul repeat code without writing it over and over.
Every Arduino/ESP32 program has exactly two required functions:
Congratulations! You now understand the fundamentals of electronics that form the foundation for everything you'll do with the ESP32. Let's review what you've learned:
Järgmine samm: Alin Li ESP32 avastaja!
Nüüd, kui alused on olemas, oled valmis esimeseks ESP32 programmiks, LEDide vilgutamiseks, andurite lugemiseks ja ägedateks projektideks!
⚡🎉🚀