Instructions

Deliverable A

Create your own code to generate a PWM signal at a configurable frequency. Do not use the built-in PWM generator, write software to do it instead. Use a 4-bit input, so the full range should be represented by 0-15. For example, an input of 4 should produce a 25% duty cycle. Write code that uses your PWM to change the brightness of an LED from 0 to full in 4 seconds (so increase 25% each second). Test that code at the following PWM frequencies: 20Hz, 50Hz, 100Hz, 200Hz. Demonstrate this at all four frequencies.

Deliverable B

For this deliverable, we want to connect a servo to the RP Pico. Your kit should contain instructions for this (Project 21 in the kit recommended to buy). Once you are done with that, try to control your servo with the PWM code you wrote in Deliverable A. Does it work at any frequency?

When you are done experimenting with your PWM code, use the hardware PWM to control the servo, sweeping across all positions in about 5 seconds. Demonstrate this.

Deliverable C

For this deliverable, you will build a “Useless Machine”. For example, see: https://www.youtube.com/watch?v=kproPsch7i0. You are encouraged to be creative when accomplishing this! To receive full credit, you need to:

  • Read when a physical switch of some kind is turned on.
  • Use an actuator of some kind to physically turn the switch off in a reasonable amount of time to demonstrate in class.

You are encouraged to use anything in your kit to accomplish this. Be creative with your interpretation of what a “switch” and “actuator” mean. When in doubt, ask the instructor if your solution meets the objective. You do not need to build a rugged, permanent setup for this. You only need to make sure it can survive a demo. Switches and other hardware will be available to borrow if needed.

Turn in to Blackboard

  • A zip file with the following code named after the deliverable it corresponds to:
    • Deliverable A (2 points)
    • Deliverable B (2 points)
    • Deliverable C (2 points)
  • A PDF with answers to the following questions. If needed, use the datasheet for the RP2-40 processor to answer these questions.
    1. At what frequency did you find that your PWM controlled an LED without visible blinking? (1 points)
    2. At what frequency, if any, did you find that your PWM (not the hardware PWM) controlled a motor without chattering (stopping and starting frequently)? (1 points)
    3. How many PWM generators and channels are on the RO2040? (2 points)

Rubric

Demo

  • Deliverable A
    • 5 points
  • Deliverable B
    • 5 points
  • Deliverable C
    • 10 points