WEEK OF SEPT 20
Implement a circuit and create the appropriate software code to program an Arduino that is able to make a motor move. Use both a servo and a regular DC motor. Make a motor react to input.
- Skim over the COGS 300 Lab Manual section on motors and building robots.
Part 1: Servo Sweep
Servos are powerful little motors with embedded gears and electronics designed for controlling wings on remote control airplanes. They are easy to use and program, but usually have a limited range of motion. Be careful not to put too much pressure on them, because they often have small nylon gears with soft gear teeth. However, it’s good to get a bit of a sense of how strong they are, so it’s OK to press on them with your thumb a little bit.
- Follow the Arduino Servo Sweep tutorial to build your circuit. Remember, you can damage your board if things are not plugged in correctly, so show your TA if you are unsure.
- Upload and run the Sweep program from the tutorial.
- Try changing all of the numerical parameters from the Sweep program. Which parameters make the servo go faster or slower? Which limit the servo motion?
Part 2: Knob
- Follow the Arduino Servo Knob tutorial to build your circuit. Note that you may need to use a breadboard to get two connections to +5V.
- Upload and run the knob program from the tutorial. Play around with it.
- Keep at least one person’s circuit assembled to show a TA later. Go ahead and move on before showing a TA.
Part 3: Motor Driver
For DC motors, it’s important to use some kind of motor driver when connecting to an Arduino. This is because DC motors can easily draw more current than your Arduino can provide and cause overheating, or sometimes back-drive and reverse the current. However, it is also difficult to control DC motors without extra circuitry. Here we will learn about one of the simplest motor drivers on the market. If you’d like some extra info, check out this great YouTube video.
- Read the COGS 300 Lab Manual section on motors and wire your motors as described. Be especially careful here!
- Copy and paste the code from this tutorial and upload it into your Arduino. Notice that you can direct the motor motion through the Serial monitor. Try inputting different motor commands.
- Again, keep at least one person’s circuit unmodified and assembled to show a TA before moving on to the optional next part.
- Upload a video of the motors moving into the Discord. Attach a wheel if you’d like!
Optional Challenge: Physical User Interface
By combining the code from Parts 2 and 3, create a physical interface for your motor driver. You could use the knob for speed control, buttons to trigger actions, or even use a light sensor. Take a video of whatever you finish and post it on Discord.
Although there are no extra marks for this, PLEASE SHOW THE TA. We can help use this portion of the lab to calibrate the difficulty of future lab work for this section.