Summary of "Micropython - controlling a servo"

Micropython servo control tutorial

What the video covers

Hardware / wiring

Warning: be careful with VBUS connections to avoid damaging other parts. When using multiple servos, test wiring incrementally and consider a dedicated power supply or proper decoupling to avoid brownouts and noise on the Pico.

Software / workflow (MicroPython on a Raspberry Pi Pico)

  1. Copy the provided MicroPython servo module (from the raw link shown in the video) onto the Pico and save it as servo.py (lowercase).
  2. Create a test script, e.g. servo_test.py, and import the module:
    • from servo import Servo
  3. Instantiate a servo object:
    • s = Servo(pin=16)
    • Optional constructor parameters: frequency, min_us, max_us, and degrees to match specific servo ranges.
  4. Basic commands
    • Move to endpoints: s.write(0) and s.write(180) (include time.sleep() between commands to allow motion).
    • Sweep example:
import time
from servo import Servo

s = Servo(pin=16)

# sweep from 0 to 179
for i in range(180):
    s.write(i)
    time.sleep(0.02)   # adjust delay as needed

# sweep back
for i in reversed(range(180)):
    s.write(i)
    time.sleep(0.02)

Implementation notes / tips

Resources / files used

Main speaker / source

Category ?

Technology


Share this summary


Is the summary off?

If you think the summary is inaccurate, you can reprocess it with the latest model.

Video