EGR 1301 Lab 4 EGR 1301: Introduction to Engineering Lab 4: Whiskers and Roach-Bot 1.0 Objective This laboratory exercise will introduce students to how a robot interacts with its environment. This will be accomplished by the use of two types of sensors: tactile whiskers and light sensitive photoresistors. Introduction Tactile Navigation with Whiskers Many types of robotic machinery rely on a variety of tactile switches. For example, a tactile switch may detect when a robotic arm has encountered an object. The robot can be programmed to pick up the object and place it elsewhere. Factories use tactile switches to count objects on a production line, and also for aligning objects during industrial processes. In all these instances, the switches provide inputs that dictate some other form of programmed output. The inputs are electronically monitored by the product, be it a robot, or a calculator, or a production line. Based on the state of the switches, the robot arm grabs an object, or the calculator display updates, or the factory production line reacts with motors or servos to guide products. In this chapter, you will build tactile switches, called whiskers, onto your Boe-Bot and test them. You will then program the Boe-Bot to monitor the state of these switches, and to decide what to do when it encounters an obstacle. The end result will be autonomous navigation by touch. Light Sensitive Navigation with Photoresistors Another type of sensor is a light detector. There are many different kinds, two of which are included in your Boe-Bot kit – one for detecting visible light (photoresistor) and one for detecting infrared light (IR detector). In this lab, you will program your Boe-Bot to detect light using the photoresistor and a capacitor. You can think of a capacitor like a small rechargeable battery. In other words, it can store a small amount of energy. A resistor and capacitor can be connected in parallel to form what called an RC (resistor-capacitor) circuit. Because a capacitor can store energy, an RC circuit has a charge/discharge time associated with it. We can talk about this time via a quantity called the time constant. We denote the time constant with the greek letter tau (τ) and calculate it as τ = RC, where R is the resistance (in ohms) and C is the capacitance (in farads). You can see in the figure below that the value of your capacitor is 0.01 µF or 1x10-8 F. The value of R in the circuit below is variable, that is, it depends on the amount of light shining on the photoresistor. More light = less resistance = shorter (smaller) time constant. Less light = more resistance = longer (larger) time constant. 2/8/2016 11:09 PM Page 1 of 4 EGR 1301 Lab 4 Building the Circuits Pay careful attention to how you place and wire the components on your breadboard. Incorrect connections will cause issues when programming the Boe-Bot. 2/8/2016 11:09 PM Page 2 of 4 EGR 1301 Lab 4 Procedure Whiskers 1. Grab your Robotics with the Boe-Bot user manual and open it to page 165 and read the introduction, then build the whiskers circuit on your Boe-Bot’s breadboard and follow the manual’s instructions for testing the whisker connections. 2. Add the LED’s to your whisker circuit and test. These LED’s will allow visual debugging when the Boe-Bot is not connected to the terminal to aid in checking the programming in later steps. 3. Read pages 177-187 of the Boe-Bot manual and program the Bot to navigate using the tactile whiskers. Include the “artificial intelligence” coding that will aid in escaping tight corners. Adjust subroutines and create your own movement subroutines to fine tune your Boe-Bot’s navigation abilities. Note: Subroutines are blocks of code which you can jump to, execute, and then return from (returning back to the code (the Main Routine) that “called” the subroutine). Note: Save all of your programs as you work through each exercise. You will need to be able to reference and use pieces of them later to complete this lab. RC Circuit for Photosensitive Navigation 1. Open the manual to page 193 and read about the photoresistor. Read through page 204 to gain further understanding on how the photoresistor will aid the Boe-Bot with navigation based on luminescent conditions. 2. Read and perform Activity #4: Getting more information from your photoresistors. Note: Building the circuit required for this lab means that you will have to move the circuit components around from their displayed positions on page 207 to the circuit layout seen above in order to get all the components on the Breadboard. 3. Next, read and perform Activity #5: Flashlight Beam following Boe-Bot. Use this table to record your RC time measurements. Averaging multiple measurements is helpful to achieve the best average RC time measurements. 4. Adjust your coding to understand how it will affect your Boe-Bots performance. Creating the Roach-Bot 2/8/2016 11:09 PM Page 3 of 4 EGR 1301 Lab 4 1. Both the Whisker tactile switches and the RC photosensitive circuits should be connected to the Boe-Bot’s breadboard. 2. Write the program for the whisker navigation and test the code to refine your Boe-Bots movements. Save this program. 3. Write a SEPARATE program that has your Boe-Bot moving around until light is placed over the photo-resistors. When light is on the photo-resistors your Boe-Bot should back away from the light source. Modifiy the Flashlight beam following Boe-Bot code from the manual to accomplish this task. 4. Utilize subroutines when you write your code. 5. Also include a “Start-Up Sequence” using the piezospeaker. (The optimal range is 2kHz – 3kHz) 6. It should be noted that in order to complete this lab’s evaluation portion the Boe-Bot must be able to move normally even when light is not aimed at the photoresistors. In other words, your Boe-Bot should always be moving. 7. It should be noted that these two separate programs could be integrated into a single program. Should you combine the programs successfully, EXTRA CREDIT will be given. Evaluation Show your final program coding to the TA. It should be concise and structured as seen on page 215 of the Boe-Bot manual. Comments should be including that explain the code. Your “Start-Up Sequence” must play whenever the Boe-Bot is turned on or reset. Your Boe-Bot will need to be able to escape a simulated corner situation. o The corner will be a 15” x 30” rectangle with one open end. o The Boe-Bot will be started at the open end and must then be able to escape. o The LED’s must correctly show which whisker was bumped, including both at the same time. Your Boe-Bot must move away from a flashlight beam aimed at your Boe-Bot repeatedly. Questions 1. What is a photoresistor? 2. What is a capacitor? 3. How does the resistance of the photoresistor change according to the light that shines on it? Why? 2/8/2016 11:09 PM Page 4 of 4