MG90S Servo Motor (360° Continuous Rotation)

🎮 The Endless Spinner
Module Goal: the same blue box, the same three wires but with its brain reprogrammed: the position sensor now measures SPEED instead of angle. You command -100 to 100 and it spins forever. One hardware, two souls.
📦 CONCEPT BOX The reprogrammed servo
Open a 180° servo and a continuous servo: the insides are nearly twins motor, gearbox, sensor, brain. The difference is one decision made in firmware: what the sensor reports.
- SG90 (Module 28): sensor reports position → commands mean angles → the arm goes somewhere and holds.
- MG90S (today): sensor reports speed → commands mean velocity → the wheel spins forever.
The command scale: -100 to +100.
| Command | What it does |
|---|---|
100 | Full speed, one direction |
50 | Half speed, same direction |
0 | Stop (in theory see the dead zone!) |
-50 | Half speed, the OTHER direction |
-100 | Full speed, reversed |
Which sign spins which way? Nobody can tell you it depends on wiring and firmware. That is your first detective job. And the second: around 0 lives a dead zone where the motor hums but doesn't move. You will map both by experiment.
One safety habit from the fan returns stronger: always end motor programs with the stop command (speed 0). A commanded stop is the only reliable stop.
Goal:
the first endless spin launch, run, commanded stop.
Concepts:
Speed Command · Commanded Stop · Motor Safety Habit
import servo # Controls the servo motor
import time # Controls pauses and timing
# Commands the continuous servo connected to pin 26
# pin26 corresponds to D2 on the Sensor Shield V5.0
print("Launch!") # The announcement
servo.servo360_speed(26, 100) # Full speed, one direction
print("Speed: 100 spinning!") # Narrate the state
time.sleep(2) # Two seconds of spinning
servo.servo360_speed(26, 0) # The COMMANDED stop
print("Speed: 0 stopped.") # Narrate the calm💡 Note: look at the difference from every motor so far this one keeps spinning between your commands. You didn't hold a pin HIGH; you gave one order and the servo obeyed continuously. That is why the stop command matters so much: without speed 0, it would run until the program ends. From this module on, every motor program you write should end with a stop make it a reflex.
🎮 The Detective Table
Goal:
discover which sign spins which way and write YOUR servo's table.
Concepts:
Sign Convention · Experiment First · Direction Control
import servo # Controls the servo motor
import time # Controls pauses and timing
# Commands the continuous servo connected to pin 26
# pin26 corresponds to D2 on the Sensor Shield V5.0
print("Positive test: speed 100") # Test one
servo.servo360_speed(26, 100) # Positive full speed
time.sleep(2) # Watch which way it turns!
servo.servo360_speed(26, 0) # Stop
time.sleep(1) # A pause to write down the result
print("Negative test: speed -100") # Test two
servo.servo360_speed(26, -100) # NEGATIVE full speed
time.sleep(2) # Watch the other way!
servo.servo360_speed(26, 0) # Stop
print("Write your table: +100 = ?, -100 = ?") # The detective's homeworkSerial Monitor:
Positive test: speed 100
Negative test: speed -100
Write your table: +100 = ?, -100 = ?
💡 Note: fill in the table for YOUR servo for example: +100 spins clockwise, -100 counter-clockwise. Another team's servo might be exactly mirrored! There is no "correct" answer, only documented answers. Professional engineers keep these tables in their notebooks for every motor they ever wire today that habit becomes yours.
🎮 Mapping the Dead Zone
Goal:
descend the speed ladder 100, 75, 50, 25, 10, 5 and find where your servo stops turning.
Concepts:
Dead Zone Mapping · Experiment Ladder · Motor Personality python
import servo # Controls the servo motor
import time # Controls pauses and timing
# Commands the continuous servo connected to pin 26
# pin26 corresponds to D2 on the Sensor Shield V5.0
print("=== DEAD ZONE MAP ===") # The experiment begins
servo.servo360_speed(26, 100) # Step 1: full speed
print("Speed 100 spinning fast") # Narrate
time.sleep(2) # Observe
servo.servo360_speed(26, 50) # Step 2: half speed
print("Speed 50 still turning?") # Ask the audience
time.sleep(2) # Observe
servo.servo360_speed(26, 25) # Step 3: quarter speed
print("Speed 25 slower now...") # Narrate
time.sleep(2) # Observe
servo.servo360_speed(26, 10) # Step 4: crawling
print("Speed 10 crawling or stopped?") # The critical question
time.sleep(2) # Observe carefully
servo.servo360_speed(26, 5) # Step 5: the whisper
print("Speed 5 probably just humming!") # The dead zone
time.sleep(2) # Observe
servo.servo360_speed(26, 0) # Full stop
print("Write down YOUR lowest turning speed.") # The homework💡 Note: your servo's personality card comes from this exercise: the lowest speed that still turns (maybe 20? maybe 8?). Below it: humming, warming, nothing. This is the same dead-zone lesson from the fan (26.3), now measured precisely because a continuous servo is designed for speed, its floor matters in every project: a line-following robot that can't command its slowest reliable speed can't make fine adjustments. Know your floors.
🎮 The Mixing Machine
Goal:
a kitchen-robot routine three bursts one way, pause, three bursts the other way. Like a blender that knows what it's doing.
Concepts:
Direction Bursts · Nested Loops · Practical Sequencing
import servo # Controls the servo motor
import time # Controls pauses and timing
# Commands the continuous servo connected to pin 26
# pin26 corresponds to D2 on the Sensor Shield V5.0
print("=== THE MIXING MACHINE ===") # The routine begins
for burst in range(1, 4, 1): # Three bursts in the positive direction
print("Mixing burst", burst, "forward") # Count it
servo.servo360_speed(26, 80) # Strong burst
time.sleep_ms(600) # Half a second of mixing
servo.servo360_speed(26, 0) # Rest between bursts
time.sleep_ms(400) # The pause
print("Changing direction...") # The dramatic turn
for burst in range(1, 4, 1): # Three bursts in the NEGATIVE direction
print("Mixing burst", burst, "reverse") # Count it
servo.servo360_speed(26, -80) # The other way!
time.sleep_ms(600) # Half a second
servo.servo360_speed(26, 0) # Rest
time.sleep_ms(400) # Pause
print("Perfectly mixed. Chef's kiss.") # The ending💡 Note: the pattern is burst-rest-burst and notice how the pauses between bursts are what make it look intentional, almost professional. The same trick as the heartbeat's darkness (2.4) and the breeze choreography's calm (26.4): silence between actions is part of the action. Real kitchen machines, washing machines and concrete mixers run sequences exactly like this and with a cup of rice and tape, yours really can mix.
🎮 The Prize Wheel
Goal:
the classroom game press Enter, the wheel launches at a random speed, spins a random time, slows down in steps, stops... and the program awards a random prize. Suspense by motor.
Concepts:
Random Launch · Ramp-Down · Honest Design · Game Assembly
import servo # Controls the servo motor
import time # Controls pauses and timing
import random # Controls random numbers
# Commands the continuous servo connected to pin 26
# pin26 corresponds to D2 on the Sensor Shield V5.0
print("=== PRIZE WHEEL ===") # The game title
print("Press Enter to spin. Type EXIT to quit.") # The rules
while True: # Play forever
cmd = input("Ready? ") # Wait for the player
if cmd == "EXIT": # The quit command
servo.servo360_speed(26, 0) # SAFETY: the wheel always stops first
print("Wheel parked. Casino closed!") # Farewell
break # Leave the loop
speed = random.randint(60, 100) # A random launch strength
servo.servo360_speed(26, speed) # LAUNCH!
print("Launched at", speed, "!") # Narrate the spin
time.sleep(random.randint(2, 4)) # A random full-speed time
print("Slowing down...") # The suspense begins
for s in range(speed, 0, -10): # Descend: speed, speed-10 ... toward 0
servo.servo360_speed(26, s) # Each step a little slower
time.sleep_ms(150) # Savor the deceleration
servo.servo360_speed(26, 0) # The final commanded stop
print("Stopped!") # The wheel rests
time.sleep_ms(800) # Drumroll...
prize = random.randint(1, 5) # The prize is chosen by pure random
if prize == 1: # Prize one
print(">>> YOU WIN: +5 POINTS!") # The reveal
elif prize == 2: # Prize two
print(">>> YOU WIN: A STICKER!") # The reveal
elif prize == 3: # Prize three
print(">>> YOU WIN: CHOOSE THE NEXT SONG!") # The reveal
elif prize == 4: # Prize four
print(">>> YOU WIN: 10 JUMPING JACKS!") # The reveal (for someone else!)
else: # Prize five
print(">>> YOU WIN: THE TEACHER'S RESPECT. Priceless.") # The revealSerial Monitor:
=== PRIZE WHEEL ===
Press Enter to spin. Type EXIT to quit.
Ready?
Launched at 87 !
Slowing down...
Stopped!
>>> YOU WIN: A STICKER!
Ready?
Launched at 64 !
Slowing down...
Stopped!
>>> YOU WIN: +5 POINTS!
💡 Note the honest-design secret: attach a cardboard wheel with numbers to the servo horn if you like the spinning looks fantastic. But notice what the program never claims: that it knows where the wheel stopped. It can't! A continuous servo has no position memory (that was Module 28's superpower you traded it away for endless spin). So the prize is declared by random, honestly. Compare your two servos one last time: the SG90 knows where it is; the MG90S knows how fast it goes and each mission was designed around what its motor truly knows. That is engineering maturity: build on what the hardware really knows, never on what you wish it knew. The motor family is complete: power (TT), position (SG90), speed (MG90S). Next stop the air itself carries your commands: infrared, Bluetooth, Wi-Fi, and robots talking to robots.
