ENGR 2110 - Principles of Engineering
Profs. Millner, Faas, Minch, & Reifel
Lab 3 - Due before class Fri., 10/12
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. You may not permanently physically modify any of the chassis in any way (this includes drilling, cutting, and gluing - as they will be reused).
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. 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.
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.
You will receive 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. You may also find it helpful to watch this video to see how NINJAs made the cables you received.
Figure 5 - Barrel jack to screw terminal power adapter.
Figure 6 - Molex Ditto genderless connector
Suggested Steps if you need to replace the cable (with NINJA guidance)
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.