ENGR 2210 - Principles of Engineering
Profs. Hoover, Bennett, Faas, & Minch
Lab 3 - Due before class Fri., 10/14
Lab 3 - DC Motor Control
In completing the first and second labs, you have developed an understanding of how to output digital signals, read analog inputs, and use the combination to act on and measure the physical world.
The purpose of this lab is to integrate your ability to sense the physical world through sensors connected to the microcontroller with your ability to act on the physical world through actuators (direct current, or DC, motors in this case).
Fig. 1 - A standard robot chassis that you must integrate with.
In this lab you will use a standard robot chassis platform to create a line-following robot with your Arduino, a motor shield (and accompanying Arduino Library with documentation), and two infrared reflectance sensors. A single chassis will be shared by two lab teams across the two morning time blocks (eg. a team from the 9am block will share a chassis with a team from the 10:50 block). You may not permanently physically modify any of the chassis in any way (this includes drilling, cutting, and gluing).
You must design the physical integration of your electronics to accommodate the existing features of the chassis, and you must be able to remove your electronics reasonably quickly to enable the other team to test their designs. You may find this Solidworks model of the acrylic plate portion of the chassis helpful for designing your mechanical attachment. The chassis platform will not be released to the teams sharing it until the second week of the lab. This is done to encourage you to design based on a specification before physically integrating your system.
Fig. 2 - The Adafruit Motor Shield v2
You will use the IR sensors to detect the presence or absence of the tape line on the ground, and your controller logic will use that information to compute the signals that must be sent to the motors to enable the robot to follow that line. The IR sensor consists of an infrared light emitting diode and a phototransistor. The more IR light that is reflected back to the phototransistor, the closer Vout will be to zero. A sample schematic showing how to connect a sensor to your arduino is shown in Figure 4. You will use the reflectance reported by your sensors as signals around which to design a feedback loop that ensures your motors will keep your robot following the tape line.
Fig. 3 - Your IR reflectance sensor
Figure 4: A circuit for connecting your IR reflectance sensors
A really helpful resource for understanding how to design and implement feedback control is the excellent article from Embedded Systems Programming magazine entitled PID Without a PhD. You may also find the “Implementation” section of the PID chapter in Astrom and Murray’s excellent book, Feedback Systems: An Introduction for Scientists and Engineers useful.
Lastly, you must be able to update the behavior of your control code via the serial connection without restarting the Arduino or recompiling/reloading code.
Design and build a removable attachment method for integrating your electronics with the wheeled robotic platform. You may not modify the platform in any way that persists after you remove your electronics. Write a controller that uses the optical reflectivity sensors provided to guide your robotic platform along the “track.”
Integrate the Adafruit motor shield with the wheeled platform to drive two DC motors independently. Using two IR reflectivity sensors, implement a controller that enables your robot to follow a black tape line around a loop as fast as possible.
Create an interface to your Arduino code that allows you to change the behavior of your controller from your laptop (via the serial connection) without recompiling or reloading your Arduino code.
To avoid electrical disasters and mishaps, you should also assemble a wiring harness that attaches to a barrel jack to screw terminal adapter (Figure 5) on your Arduino and the screw terminals on your motor shield. At the other end will be a four pin, wire-to-wire Molex connector shown below in Figure 6. For the Molex connector, you should use the 1.8mm setting on the crimper. You may also find it helpful to watch this video.
Figure 5 - Barrel jack to screw terminal power adapter.
Figure 6 - Molex Ditto genderless connector
Bill of Materials (BOM):
Please complete the Lab 3 Hardware Inventory spreadsheet so that we may track and recover the hardware used in the lab for future offerings of the class.
Your lab report should include the following elements:
Please submit your reports as pdf attachments to email@example.com and read the Lab Report Style Guide carefully before writing your lab report.