ucsd-creative-robotics

Week 2 - Making Things Move

Agenda

Artist(s) of the Day

image

Daniel Rozin

Analog Input and Output

Analog Output

Commonly called PWM (Pulse Width Modulation).

Image

https://www.arduino.cc/en/Tutorial/BuiltInExamples/Fade

Making Things Move

Another use of Pulse Width Modulation is driving the position of a servo motor.

Servo Sweep

  1. Install the ESP32Servo library:
    • Tools -> Manage Libraries:
      • image
    • Search for ESP32Servo. Click Install:
    • image
  2. Under Examples -> ESP32Servo, select the Sweep example:
    • image
    • Make sure that your servo is connected to the pins used in the example code. Or change the pins in the code to match your setup.
    • alt text
  3. Wire up the servo:
    • BLACK/BROWN -> Ground
    • RED/YELLOW -> +5V
    • ORANGE -> your servoPin.
  4. Compile and run the example.

What is PWM?

Timing Diagram image

Simplified Wiring Diagram Image

https://www.arduino.cc/en/Tutorial/LibraryExamples/Sweep

Talk Through

Servo Knob

We are going to use the potentiometer knob as an input device. You can think of a knob as a kind of simple “sensor” to drive the servo motion.

Image

Image

Homework

References