ENGR 2210 - Principles of Engineering
Profs. Hoover, Faas, Minch, & Reifel
Lab 3 - Due before class Fri., 10/13
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 (there is also an alternative model for folks who might have one of the newer 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. Though it may enhance the performance of your robot, you are not required to use PID feedback control. Any simple, closed-loop control scheme that accomplishes the task of completing the track is acceptable.
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.
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 firstname.lastname@example.org and read the Lab Report Style Guide carefully before writing your lab report.