Learning Objective
Read variable voltage, understand analog signals, and use direct mapping to control outputs.
Analog Inputs & Direct Mapping


Hardware: MakerBuddy On-board Potentiometer


Dashboard: Potentiometer Mapping Card
See How the Potentiometer Works
Read the picture from left to right: the change in the world → the sensor signal → a useful action.

1 · What it notices
How far its knob has been turned.
2 · How it works
A sliding contact (the wiper) moves along a track and smoothly changes the output voltage.
3 · Why it matters
Some things need a range, like brightness or volume, not just on or off.
Where might we use it?
- Lamp dimmers
- Volume controls
- Position and speed controls
Student sentence: A potentiometer turns knob position into a smoothly changing analog value.
Teacher/parent prompt: Ask, “What changes on the left, what does the sensor turn it into, and what could happen next?”
Theory: Analog Signals and Variable Resistors
From Digital to Analog
In Week 6 we learned about digital inputs: only ON or OFF (1 or 0). Analog inputs can be any value in a range. A light switch is digital; a dimmer is analog.
How Potentiometers Work
A potentiometer ("pot") is a variable resistor with three connections. Turning the knob moves a wiper inside, which changes the voltage it gives out. The ESP32's Analog-to-Digital Converter (ADC) turns 0 V to about 3.3 V into a number from 0 to 4095. On the V1.0 board the knob runs from 5 V. Near the end of its turn that is too high for the ADC, so the reading stays at its top value.
Resolution: 12-bit Precision
The ADC is 12-bit: it splits the voltage into 4096 steps (212 = 4096), so it notices tiny turns. MakerBuddy turns these into a simpler 0 to 100 scale for the dashboard and the Rule Engine. Each step on the card covers about 41 ADC steps.
Real-World Applications
Volume knobs, monitor brightness controls and game joysticks.
For Teachers
Compare a staircase (digital steps) with a ramp (analog). Show that raw ADC values (0-4095) can be scaled to any range, like 0-100%.
For Parents
Your child learns about analog signals, which measure in a range, not just on or off. Devices measure temperature, light and position this way.
Theory: Direct Mapping - One Input, Many Outputs
What is Mapping?
Mapping turns a value from one range into another. The pot reads 0-4095, an LED uses 0-255 and a servo 0-180°. With proportional mapping, a pot at 50% gives the LED 50% brightness and the servo 90°.
The Mapping Formula
output = (input - inputMin) / (inputMax - inputMin) × (outputMax - outputMin) + outputMin
Example: The pot reads 2048 (out of 4095).
LED (0-255): 2048/4095 × 255 ≈ 127.5, half brightness. The board drops the decimals and shows 127.
Servo (0-180°): 2048/4095 × 180 ≈ 90°, the middle.
Direct vs Indirect Mapping
Direct mapping ties the output straight to the input, with no rule in between. The board updates the LED (or servo) once every second. The servo glides to each new angle in half a second and ignores changes under 3°. Later you will learn threshold control: the output changes only when a value crosses a line.
Real-World Applications
Volume knobs, steering wheels and gas pedals.
For Teachers
This links proportions and straight-line graphs to hardware. Have students work out the expected output before testing.
For Parents
Volume knobs and steering wheels work this way. It shows the math inside everyday technology.
Try It: Map the Knob
Interactive demo · no kit needed
Play with a pretend MakerBuddy board and its web page, right here.
Follow the steps one at a time. Got the kit? You can switch to the real board inside.
Hands-On Activity: Potentiometer Reading
Activity Duration: 20-25 minutes
Turn the knob and watch the value change smoothly.
Step-by-Step Instructions:
- Locate the Potentiometer: Find the small knob (a trimmer) next to the label 34-Potentio. It is built in, so no wiring. Turn it gently with a fingertip or the kit's small screwdriver.
- Open the Dashboard: Find the Potentiometer card.
- Turn to One End: Turn the knob fully one way, wait 3 seconds and note the number (it should be close to 0).
- Turn to the Other End: Turn it fully the other way and wait (close to 100). On the V1.0 board it may reach 100 before the knob reaches the end of its turn. That is normal.
- Smooth Rotation: Turn slowly. The value moves in many small steps, not just two values like the button. The card updates about every 2 seconds.
- Precision Test: Try to set the knob to exactly 25, then 50, then 75.
- Record Data: Note the value at each end and at 1/4, 1/2 and 3/4 turn. A reading of 100 at 3/4 turn comes from the 5 V supply, not a broken knob.
- Choose LED Mapping: On the Potentiometer Mapping card, choose LED PWM. (After a restart, the mapping is always back to None.)
- Test LED Control: Turn the knob slowly. The LED follows in small steps, from off at 0% to full brightness at 100%.
- Choose Servo Mapping: Select Servo instead.
- Test Servo Control: Unplug the USB cable first, then plug the SG90 into connector 19. It only fits one way, so never force it. Plug the USB cable back in. When the board starts again, the servo turns to 0°. Press 🔌 Connect again, choose Servo and turn the knob: one end gives 0°, the other 180°. While Servo is selected, the board ignores the Servo Motor card, and the WebApp locks it with "Potentiometer mapping owns the servo." Keep your fingers clear of the servo arm.
- One Mapping at a Time: Pick one output (LED, RGB or Servo) and turn the knob.
What Students Should Observe:
- Values from 0 to 100 in many small steps
- The chosen output follows the knob in proportion
- Smooth control of one chosen output at a time (LED PWM, RGB LED or Servo)
Challenge
Your Mission: Precision Challenge
How precise can you be with an analog knob?
Challenge 1: Precision Mapping
Dial in each value fast (within ±1):
- Exactly 25
- Exactly 50
- Exactly 75
At each one, predict the number the Potentiometer Mapping card will show after the arrow: the LED PWM value (0-255) with LED PWM selected, and the servo angle with Servo selected. Were you right?
Challenge 2: The Mood Controller
Give each zone of the knob a 'mood'. Keep these names or make up your own:
- Zone 1 (0-25%): "Calm"
- Zone 2 (25-50%): "Alert"
- Zone 3 (50-75%): "Excited"
- Zone 4 (75-100%): "Maximum"
Direct mapping can't hold one output across a whole zone. So predict each zone's end point (knob 25, 50, 75 and 100), then test with LED PWM and then Servo. (In Week 27, range rules will hold one fixed output per zone.)
Check your predictions: knob 25 → LED about 64, servo about 45°; knob 50 → about 128 and 90°; knob 75 → about 191 and 135°; knob 100 → 255 and 180°.
Bonus: Reverse Mapping: If the servo is at 45°, where is the knob? (Answer: 45/180 × 100 = 25%)
Key Takeaways
✓ Analog vs Digital
Digital has two states (HIGH/LOW). Analog can be any value in a range.
✓ Variable Resistors
Turning a potentiometer changes its resistance, and so its output voltage.
✓ ADC (Analog-Digital Converter)
The ESP32's 12-bit ADC turns a voltage (0-3.3V) into a number from 0 to 4095.
✓ Resolution
12 bits give 4096 values. More bits mean finer readings.
✓ Direct Mapping
Mapping scales one range to another. In general one input can drive several outputs, each with its own range. The Potentiometer Mapping card drives one output at a time: LED PWM (0-255), RGB LED colors or Servo (0-180°).
✓ Proportional Control
The output changes smoothly as the input changes, like cruise control.
Coming Up Next Week:
Week 10: Atmospheric Sensing (DHT11)
Learning Support
Use this quick guide to help every learner understand, practice and explain Analog Inputs & Direct Mapping Masterclass.
For students
Try it in three steps
- Say it: explain the main idea in one simple sentence.
- Show it: Rotational knob tracking. Direct linear map control of LED brightness and Servo angle.
- Stretch it: Build a 'Mood Controller': predict the LED brightness and servo angle for four knob zones, then test them with LED PWM mapping and Servo mapping, one at a time.
Checkpoint: What was your input, what decision or process happened, and what was the output?
For teachers & parents
Coach without taking over
- Before: ask the learner to predict what will happen and why.
- During: use prompts such as “What changed?” and “What could you test next?” instead of giving the answer.
- After: ask for a 30-second explanation, one piece of evidence and one improvement.
Look for: safe handling, correct vocabulary, a result the learner can demonstrate, and an explanation in their own words.
Did you get it?
Three quick questions. Pick an answer to see whether it is right, and why.
1How is an analog input different from a digital input?
2What does the board's ADC (Analog-to-Digital Converter) do?
3If the knob is halfway, what does direct mapping give for the servo arm?
