DROID ACADEMY (E-32) Robotics Course
(Junior Track)
What is Electricity?
Big idea: Everything is made of tiny bits called atoms. Inside atoms are even tinier bits called electrons. When electrons move, we call it electricity. Your robot E-32 uses electricity to think, see, and move!
1. Atoms and Electrons
Everything around you โ you, your chair, the air, the stars โ is made of super-tiny building blocks called atoms.
Think of an atom like a tiny solar system:
In the middle is the nucleus (like the Sun).
Zooming around it are tiny particles called electrons (like little bees buzzing around).
Electrons have a negative charge. In some metals, like copper, the electrons are loose and can be pushed from one atom to the next โ like a giant game of tag!
When lots of electrons move together, that’s electricity!
๐ก Fun fact: Electrons are so tiny and weird that they can act like little waves AND little balls at the same time. Scientists call this “quantum weirdness” โ and it’s what makes computers possible!
2. Voltage, Current and Resistance
Electricity isn’t really like water โ it’s moving electrons. But we can pretend it’s water in a garden hose to help us understand. ๐ฟ
| Word | Water picture | What it means |
|---|---|---|
| Voltage | How hard the water pushes from the tap | The push that makes electrons move |
| Current | How much water flows each second | How many electrons are flowing |
| Resistance | How narrow or clogged the hose is | How much the wire blocks the electrons |
Easy rule:
More push โ more flow (more voltage = more current)
More blockage โ less flow (more resistance = less current)
๐ง Remember this: A battery gives the push. A thin wire gives more blockage. That’s why we use special parts called resistors to slow electricity down when we don’t want too much!
3. How Computers Use Electricity: ON and OFF
Inside E-32’s brain (the ESP32) electricity does two big jobs.
ย
Job 1 โ The ON/OFF switches (binary)
Computers only understand two things:
ON = electricity flowing = 1
OFF = no electricity = 0
By flicking billions of tiny switches ON and OFF super fast, the ESP32 can store words, numbers, and instructions. This is called binary โ it’s like a secret code made of just 1s and 0s!
๐ฎ Think of it like this: Imagine a row of flashlights. Some are ON (1), some are OFF (0). If you know the pattern, you can read a secret message. That’s how computers “talk”!
Job 2 โ The pins (the robot’s arms)
The little metal legs on the ESP32 are called pins. They are like the robot’s arms. Each pin can do one of two things:
Output โ send electricity OUT. Example: turn on a light, spin a wheel.
Input โ listen for electricity coming IN. Example: is a button pressed? What does the sensor see?
When we tell E-32 “turn pin 13 ON”, we really mean: “Let electricity flow out of pin 13 right now!”
โ ๏ธ Safety first! E-32 runs on 3.3 volts. Never touch 5 volts to its pins โ it could break! We always use the right parts to keep E-32 safe.
4. Digital vs Analog
E-32 can talk to the world in two ways โ like two different kinds of switches.
ย
ย
Digital = Light Switch ๐ก
ย
A light switch is either ON or OFF. That’s it!
ON = full power (3.3 volts) = 1
OFF = no power (0 volts) = 0
E-32 uses digital pins for things that are just YES or NO:
Is the button pressed? (Yes/No)
Turn the LED on or off.
ย
Analog = Dimmer Switch ๐๏ธ
A dimmer switch can be a little bit on, medium on, or almost all the way on. Any level in between!
E-32 uses analog pins to ask “how much?”:
How bright is the light?
How far away is something?
How loud is the sound?
๐ The numbers: E-32 reads analog values from 0 to 4095. 0 means “none” (0 volts), and 4095 means “full” (3.3 volts). Everything in between is somewhere in the middle!
Easy summary:
Digital pin = light switch โ ON or OFF (1 or 0)
Analog pin = dimmer switch โ any amount (0 to 4095)
5. Quick Check โ
Try answering these:
What are the three things in the water hose picture? (Hint: push, flow, blockage)
What does binary mean for a computer?
What’s the difference between a digital pin and an analog pin?
If a pin is ON, is it a 1 or a 0?
Key Words
| Word | What it means |
|---|---|
| Atom | Tiny building block of everything |
| Electron | Tiny particle inside atoms that can move and make electricity |
| Voltage | The push that makes electrons move |
| Current | How many electrons are flowing |
| Resistance | How much something blocks the electrons |
| Binary | A code made of only 1s (ON) and 0s (OFF) |
| Pin | A metal leg on E-32’s brain that sends or listens for electricity |
| Digital | Only ON or OFF (1 or 0) |
| Analog | Any amount in between (0 to 4095) |
How Computers Work
Big idea:
A computer is a giant pile of tiny ON/OFF switches.
Keeping a pattern of switches = remembering.
Wiring switches so one controls another = making a decision.
That’s it โ that’s a computer!
1. Two Big Questions
To understand any computer โ a laptop, a phone, or the ESP32 brain inside E-32 โ you only need to ask:
How does a machine remember?
How does a machine decide?
That’s all! Let’s answer both.
2. How a Machine Remembers ๐พ
Inside a computer are billions of tiny switches called transistors. Each one can only be ON or OFF.
ON = 1
OFF = 0
This two-switch language is called binary โ a secret code made of only 1s and 0s!
Bits and bytes:
1 switch = a bit (just one 1 or 0)
8 switches in a team = a byte
A byte can make 256 different patterns โ enough to spell letters, numbers, and more!
| Byte | Means |
|---|---|
01000001 | the letter A |
00000001 | the number 1 |
Put lots of bytes together and you can store words, pictures, songs, games โ anything! The computer turns everything into numbers, and turns them back when it needs to show them.
๐ Cool thought: The computer has no idea what a byte means. The same byte could be the letter A, a colour, or a robot command. The program decides what it means!
3. How a Machine Decidesย
A switch you can’t touch
A light switch is flipped by your finger. A transistor is flipped by electricity. That’s the big trick โ one electric signal can control another!
Decisions made of wires
Take two switches and a lamp. There are two clever ways to wire them:
AND โ both must say yes ๐
Switches sit one after the other on the same wire. Electricity has to pass through both to reach the lamp.
A: ON, B: ON โ ๐ก lamp ON
Anything else โ lamp OFF
OR โ just one has to say yes ๐
Switches sit side by side. Electricity can go through either one.
A: ON, B: OFF โ ๐ก lamp ON
Only OFF + OFF โ lamp OFF
NOT โ the opposite ๐
A switch wired so the lamp is on when the switch is off. Press it โ lamp goes out. It flips the answer!
These three are called logic gates โ tiny decision machines. They’re the Lego bricks of a computer!
๐ก You use gates! When your code says:
“IF the sensor sees something AND we’re moving, THEN stop!”
โฆthat’s an AND gate at work inside the chip!
4. Two Kinds of Memory ๐ง
Think of the CPU as a chef ๐ณ following recipes (your code).
| ย | RAM | Flash / Storage |
|---|---|---|
| Chef picture | The counter โ food out, ready to cook | The pantry โ food stored away |
| Speed | Super fast | Slower |
| Power off? | Forgets everything! ๐ฑ | Remembers everything โ |
That’s why you save your work โ RAM gets wiped when the power goes off!
5: Why a Microcontroller (and Not a Laptop)?
Both are computers โ but they’re built for very different jobs.
Your laptop or phone is a do-everything computer. It can play games, show videos, browse the internet, and do homework โ all at once.
The ESP32 inside E-32 is a microcontroller. It’s a tiny computer built to do one job really well, over and over โ and it’s great at it!
| ย | Laptop / Phone | ESP32 Microcontroller |
|---|---|---|
| Brain | Super fast and powerful | Small and simple |
| Jobs at once | Lots โ games, music, browser, everything | Just one job, done really well |
| Memory (RAM) | Huge | Tiny โ about a million times smaller! |
| Storage | Huge โ thousands of photos and games | Tiny โ just enough for one program |
| Operating system | Windows, Android, iOSโฆ | None! Your code is the program |
| Power | Needs charging all the time | Runs for weeks on small batteries |
| Cost | Lots of money | Just a few dollars |
| Heat | Gets hot โ needs a fan | Barely warms up |
ย
The shopping mall and the vending machineย
A laptop is like a shopping mall โ hundreds of shops, and you choose where to go.
The ESP32 is like a vending machine โ it does exactly one thing, perfectly, every single time you press the button.
That’s not a weakness โ it’s a superpower! If you want a robot to check a sensor and spin a motor thousands of times without ever making a mistake, you want the specialist.ย
ย
How does your code get inside? ๐ปโก๏ธ๐ค
You write your program on the laptop โ using blocks or MicroPython.
You plug in the USB cable and send it to the ESP32.
The ESP32 saves it in flash and starts running it.
It runs that program forever โ starting again automatically every time it gets power โ until you send a new one.
There’s no Windows or Android inside! No desktop, no apps to open, no loading screen. When E-32 wakes up, your code is the only thing running.
๐ Remember this before you write your first line of code: On a laptop, your program is just one app among many. On the ESP32, your program IS the machine!
6. Quick Check โ
What are the two states of a transistor? (Hint: ON = ?)
How many bits are in a byte?
If I need both switches on for the lamp to light โ which gate is that?
Which memory forgets when the power goes off โ RAM or flash?
Why does E-32 need us to be careful with memory?
Key Words
| Word | What it means |
|---|---|
| Transistor | A tiny electric switch โ ON or OFF |
| Binary | A code made of only 1s and 0s |
| Bit | One single 1 or 0 |
| Byte | A team of 8 bits |
| CPU | The “brain” that follows your program |
| Logic gate | A tiny decision circuit (AND / OR / NOT) |
| RAM | Fast memory that forgets when power is off |
| Flash | Memory that remembers even with no power |
The LED
Big idea: An LED makes light when electricity flows through it the right way round. It has two legs, and it only works if you connect it correctly!
1. What is an LED?
LED stands for Light-Emitting Diode. It’s a tiny part that lights up when electricity flows through it.
It has two legs:
Long leg = the + side (electricity goes IN here)
Short leg = the โ side (electricity comes OUT here)
๐ The “D” is important! Diode means a one-way door for electricity. Connect it the right way โ it lights up. Connect it backwards โ nothing happens. It’s not broken, it’s just blocking the door!
2. How Does an LED Make Light?
Shrink down to the size of an electron and look inside. The LED has two layers squished together:
One layer is packed with electrons (little energy balls).
The other layer has holes (empty spots that want electrons).
Here’s the waterslide picture: ๐ข
Imagine the electrons are excited kids at the top of a waterslide, all crowded together. Down below is a pool with empty spots waiting for them. A gate is closed, so nobody can slide down.
When we connect the battery the right way, the gate opens โ the kids rush down the slide! ๐
When a kid splashes into an empty spot in the pool, all that extra energy turns into a big flash of light! โจ That flash is the glow we see from the LED.
Connect the battery backwards? The gate stays closed. No sliding, no splash, no light!
3. Why Are There Different Colours?
The colour depends on what the LED is made of โ and that changes how big the drop is.
Taller slide โ bigger splash โ blue light ๐ต
Shorter slide โ smaller splash โ red light ๐ด
So a red LED and a blue LED aren’t just different paint โ they’re made from different stuff inside! The material decides the colour.
4. Keeping the LED Safe โ ๏ธ
Two important rules:
Rule 1 โ Get the legs the right way round.
Long leg to +, short leg to โ. (If it doesn’t light up, don’t panic โ just flip it around!)
Rule 2 โ Always use a resistor.
An LED lets way too much electricity through all at once. It’s like a slide with no gate โ all the kids pile on at once and CRASH! ๐ฅ The LED burns out.
A resistor is like a narrow doorway at the top of the slide. It only lets a few kids down at a time โ a nice, safe, steady flow. Then the LED glows happily instead of breaking!
๐ก Remember: LED + resistor = happy LED. LED without resistor = ๐ฅ
5. Quick Check โ
What do the letters LED stand for?
Which leg is the + side โ the long one or the short one?
In the waterslide, what makes the splash of light?
Which colour has the taller slide โ red or blue?
Why does an LED need a resistor?
Key Words
| Word | What it means |
|---|---|
| LED | A part that makes light when electricity flows through it |
| Diode | A one-way door for electricity |
| Anode | The long leg (+) where electricity goes in |
| Cathode | The short leg (โ) where electricity comes out |
| Hole | An empty spot in the LED that wants an electron |
| Photon | A tiny particle of light |
| Resistor | A part that slows electricity down to keep the LED safe |
The Ultrasonic Sensor
Big idea: E-32 “sees” with sound! The HC-SR04 sensor shouts a tiny sound and listens for the echo โ just like a bat. The faster the echo comes back, the closer the thing in front is.
ย
1. How Does E-32 See? ๐ฆ
Bats can’t see very well in the dark, so they shout and listen. The sound bounces off things and comes back as an echo. Bats use the echo to know what’s around them.
E-32 does exactly the same thing with a sensor called the HC-SR04!
Here’s how it works:
Shout! โ the sensor sends out a tiny sound. ๐ You can’t hear it โ it’s way too high-pitched for humans or dogs!
Bounce! โ the sound hits something in front (a wall, your hand, a box) and bounces back. ๐
Listen! โ the sensor hears the echo coming back.
Time it! โ it measures how long the sound was away.
Work it out! โ sound travels at a known speed, so the sensor can work out the distance!
The easy rule:
Echo comes back fast โ the object is close! ๐
Echo comes back slow โ the object is far away! ๐ข
๐ฏ E-32 can sense things from about 2 cm (almost touching) all the way up to 400 cm (4 metres โ about the length of a car)!
ย
2. The Four Legs ๐ฆต
The sensor has four pins (little legs):
| Pin | Name | What it does |
|---|---|---|
| VCC | Power | Gives the sensor electricity to work โก |
| GND | Ground | The way electricity goes back home โ like the other half of a plug ๐ |
| Trig | Trigger | The “GO!” button. E-32 pokes this pin and the sensor shouts! ๐ข |
| Echo | Echo | The “I’m back!” pin. It stays on for exactly as long as the sound is travelling ๐ |
So Trig sends the sound out, and Echo tells E-32 how long the trip took. Simple!
ย
3. Being Careful with E-32 โ ๏ธ
The sensor needs 5 volts to work properly. But E-32’s brain only likes 3.3 volts!
It’s like giving a small child a big heavy backpack โ too much and they fall over! ๐ต
So we use a special pair of parts called a voltage divider to make the signal smaller and safe before it reaches E-32’s brain.
๐ Remember: The sensor is strong (5 V). E-32 is delicate (3.3 V). We always keep E-32 safe!
4. When the Sensor Gets Confused ๐ค
The sensor is really good โ but sometimes it gets tricked!
| What’s in front | What happens |
|---|---|
| A soft curtain or fluffy blanket ๐งฃ | The sound gets soaked up โ no echo comes back! |
| A slanted wall ๐ | The sound bounces off sideways instead of back |
| Something very, very close ๐ | It’s too close for the sensor to measure |
| A thin pole or chair leg ๐ช | The sound goes right past it โ it gets missed! |
๐ก That’s why E-32 checks more than once! One strange reading doesn’t mean there’s really something there. E-32 looks again and again before deciding.
ย
5. Quick Check โ
What animal does the ultrasonic sensor copy? ๐ฆ
If the echo comes back really fast, is the object close or far away?
Which pin is the “GO!” button? (Hint: it starts with T)
Which pin tells E-32 how long the sound was away?
Why do we need to keep E-32’s brain safe with a voltage divider?
Why might a fluffy curtain trick the sensor?
ย
Key Words
| Word | What it means |
|---|---|
| Ultrasonic | Sound so high-pitched that humans can’t hear it |
| Echo | Sound that bounces off something and comes back |
| HC-SR04 | The name of E-32’s distance sensor |
| Trig | The “GO!” pin โ sends the sound out |
| Echo pin | The “I’m back!” pin โ tells E-32 how long the sound was away |
| Voltage divider | A special pair of parts that makes a big signal safe and small |
| Distance | How far away something is |
Actuators โ Muscles for E-32
Big idea: Actuators are the muscles of a robot โ they turn electricity into movement. E-32 has two kinds: DC motors that spin round and round (for the wheels) and a servo that turns to an exact spot and stays there (for the head). ๐ช
1. Two Kinds of Muscle ๐ฆพ
| ย | DC Motor | Servo Motor |
|---|---|---|
| What it does | Spins round and round, super fast | Turns to an exact spot, then holds still |
| How far can it turn? | All the way round, forever | Usually only half a circle (180ยฐ) |
| Does it know where it is? | No! ๐ | Yes! ๐ฏ |
| E-32 uses it for | The wheels ๐ | The head ๐ฃ๏ธ |
In one line: a DC motor doesn’t know where it is โ a servo always does!
ย
2. DC Motors โ The Spinners ๐
A DC motor just spins when you give it power. That’s all it does!
Give it power โ it spins ๐
Swap the two wires โ it spins the other way ๐
Take the power away โ it stops ๐
It has no idea how far it has turned. It just keeps going until you stop it โ like a spinning top! ๐
ย
ย
E-32’s motor: the TT geared motor ๐จ
It’s the little yellow box with a spinning bit on each side. You’ll see them on almost every small robot!
ย
Two important numbers:
6 volts โ that’s the power it likes. Too little and it won’t move. Too much and it gets hot and wears out! ๐ฅ
100 RPM โ with nothing attached, it spins 100 times every minute. That’s about 1.5 times a second!
โ๏ธ Why is there a gearbox? Inside the yellow box are lots of little gears. A bare motor spins way too fast and has no strength โ like a bicycle wheel spinning in the air. The gears slow it down and make it strong. Slow and strong beats fast and weak! ๐ช
3. Why Can’t We Plug a Motor Straight Into E-32? โ ๏ธ
Great question! Two big reasons:
Reason 1 โ It’s too hungry! ๐
E-32’s brain sends out tiny sips of electricity. A motor wants big gulps. If you plug a motor straight into E-32, the motor gulps so hard it breaks the brain!ย
Reason 2 โ Motors are bouncy! ๐
When you stop power to a motor, it doesn’t stop quietly โ it kicks back a little burst of electricity, like a ball bouncing back at you. That kick can damage E-32’s brain too.
ย
The solution: a motor driver ๐ง ๐ช
A motor driver is like a strong helper that stands between E-32 and the motors.
E-32 says quietly: “go forward!”
The helper does the heavy lifting ๐ช
The helper takes the big gulps of electricity
The helper absorbs the bouncy kicks ๐
๐ฆธ Think of it like this: E-32 is the coach shouting instructions from the side. The motor driver is the strong player doing all the pushing. The coach doesn’t need to be strong โ they just need to give good instructions!
4. How Do We Control the Speed? ๐๏ธ
You might think: “just give it less electricity!”
But that doesn’t really work โ the motor gets weak and might not turn at all.
Instead, we use a clever trick called PWM. It’s simple:
Switch the power ON and OFF super fast! โก
If it’s ON half the time and OFF half the time โ the motor goes half speed!
| How much ON | What happens |
|---|---|
| Always OFF | Motor stopped ๐ |
| ON a little bit | Motor goes slowly ๐ข |
| ON half the time | Motor goes half speed ๐ถ |
| Always ON | Motor goes full speed ๐ |
The switching is so fast (thousands of times a second!) that the motor can’t even tell. It just feels like a smooth, steady speed. ๐
๐ก Fun fact: We use the same trick to make the RGB LED glow at different brightnesses. Same idea โ just switching on and off super fast!
ย
5. Servo Motors โ The Precise Turnersย
A servo is not just a motor. It’s a motor plus three clever extras:
ย
Gears โ to make it strong โ๏ธ
A position sensor โ it knows exactly what angle it’s at ๐งญ
A tiny brain โ it checks “am I at the right spot?” and keeps correcting ๐ง
That’s why a servo holds still even if you push it! It’s always checking and correcting. ๐ช
It has three wires:
| Wire colour | What it does |
|---|---|
| Red ๐ด | Power โ gives it energy |
| Brown / Black ๐คโซ | Ground โ the way back home |
| Orange / Yellow / White ๐ ๐กโช | Signal โ the instruction wire! |
How does it know where to go? The signal wire sends tiny blinks โ like Morse code! ๐ก
A short blink โ go to 0ยฐ
A medium blink โ go to 90ยฐ (straight ahead)
A long blink โ go to 180ยฐ
The servo reads the blink length and turns to that exact spot. Then it stays there until you send a new one! ๐ฏ
ย
6. E-32’s Servo โ the SG90S ๐ค
This is a tiny, light servo โ about the size of your thumb! It moves E-32’s head so the sensor can look around.
How strong is it? It’s rated about 1.8 kgยทcm. That means it can hold 1.8 kg if the weight is 1 cm from the middle. But if the weight is 10 cm away, it can only hold 0.18 kg โ ten times less!
๐ฃ Think of it like a fishing rod: holding a fish close to your hand is easy. Holding it far away on a long rod is much harder โ because the weight is pulling further from you! That’s why the arm length matters.
A little honesty: these little servos are cheap and they do break sometimes. But E-32’s head is very light, so we’re totally fine. ๐
ย
7. Important Rules โ ๏ธ
Rule 1 โ Motors never plug into E-32’s brain. They go through the motor driver! ๐ง
Rule 2 โ Motors and servos get their own power. They’re too hungry for E-32’s little battery. ๐
Rule 3 โ Everything shares the same ground. It’s like everyone needs to be standing on the same floor to hear each other! ๐
๐ฏ Simple version: E-32 gives the instructions. The battery and motor driver do the hard work. Everybody stays safe and happy!
ย
8. Quick Check โ
What’s the big difference between a DC motor and a servo?
Can a DC motor tell you where it is? Can a servo?
Why can’t we plug a motor straight into E-32’s brain? (Two reasons!)
What does the motor driver do?
How does the “super fast on and off” trick change a motor’s speed?
How many wires does a servo have? Which one sends the instructions?
If a servo can hold 1.8 kg at 1 cm, roughly how much can it hold at 10 cm?
ย
Key Words
| Word | What it means |
|---|---|
| Actuator | A robot part that makes movement โ a muscle |
| DC motor | Spins round and round; used for wheels |
| TT geared motor | The yellow gearbox motor that drives E-32’s wheels |
| Gearbox | Gears inside the motor that make it slower but stronger |
| Torque | How strong a motor’s twist is |
| Motor driver | The strong helper between E-32 and the motors |
| PWM | Switching power on and off super fast to control speed |
| Servo | A motor that turns to an exact spot and holds it |
| Signal wire | The wire that sends “go to this angle” blinks |
๐ Extra for the curious: E-32 has two motors, one on each wheel. You’d think two identical motors would spin at exactly the same speed โ but they never do! Tiny differences make one slightly faster, so E-32 slowly drifts to one side instead of driving straight. The fix isn’t in the motors โ it’s in the instructions. We tell the faster one to go slightly slower so they match. Clever, right? ๐
The Secret Blink
Before you write your first program for E-32, here’s one idea that will make everything afterwards make sense.
It’s about blinks.
A blink is just electricity going ON and then OFF really quickly โ like a tiny flash. โก
Almost everything E-32 does involves blinks. And here’s the secret: E-32 uses blinks in two totally different ways.
ย
Way 1 โ The blink’s length is the message ๐
Some parts of E-32 read how long each blink lasts.
The servo (E-32’s head):
Short blink โ turn to 0ยฐ
Medium blink โ turn to 90ยฐ (straight ahead)
Long blink โ turn to 180ยฐ
The ultrasonic sensor (E-32’s “eye”):
A short ON = the sound came back quickly = something is close
A long ON = the sound took ages = something is far away
The length of the blink is the information.
ย
ย
Way 2 โ The blink’s speed sets the power ๐๏ธ
Other parts of E-32 only care about how much of the time the electricity is ON โ not how long each blink is.
The motors (E-32’s wheels):
ON half the time โ half speed ๐ถ
ON all the time โ full speed ๐
The RGB LED (E-32’s light):
ON a little โ dim glow ๐
ON a lot โ bright shine โ๏ธ
This works because the blinking is so fast that the motor and your eye can’t even tell โ they just feel the average. Clever, right? ๐
How much it blinks is the power.
ย
The big idea ๐ฏ
Blink length can carry a message. Blink amount can control power.
Same blink, two different jobs โ and E-32 uses both, all the time.
ย
Why tell you this now? ๐ค
Because when you start coding, this is what you’ll actually be doing.
You won’t be typing “turn left” or “go faster.” You’ll be telling E-32 when to blink and how much โ and E-32 will turn that into a message or a power level.
So the blinks aren’t a side detail. The blinks are the whole language. And now you know it before you’ve written a single block. ๐