Department of Electrical Engineering

University of Florida

INTELLIGENT MACHINES DESIGN LABORATORY

Prepared for: Professor Keith L. Doty

By Brian Skeldon

skeldon@eel.ufl.edu

Table of Contents

1. Abstract	3

2. Executive Summary	4

3. Introduction	5

4. Mobile Platform Design	7

4.1. Characteristics of Shaft encoders	8

4.2. Characteristics of Motors	9

5. Sensors

5.1. IR	10

5.2. Photocells	12

5.3 7-Segment Display	13

6. Behaviors	13

6.1. Dark Light	14

6.2. Bright Light	15

6.3. Docking to a recharger	15

7. Conclusion	16

8. References	17

9. Acknowledgements	18

Appendices

A. Circuits

Figure 3. Motor Driver	19

Figure 4. LED	20

Figure 5. CdS Cells	21

Figure 6. 7-Segment Display	22

B. Software Program

PAL Chip	23

IC Program	24

C. Glossary	30

D. Suppliers	30

E. Course Recommendations	31

1. Abstract.

Designing an Energy Managed Autonomous Agent

Energy management of an autonomous agent is effectively dealt with by monitoring its battery level and changing its behavior accordingly. This is accomplished through the use of a voltage divider circuit, infrared LEDs, CdS cells, and software. First, the voltage divider circuit must be installed on the agent because the M68HC11 A/D port can handle only up to five volts. Second, infrared LEDs should be used for obstacle avoidance so the agent will not bump into anything as its wanders around in its terrain. Third, CdS cells can be used so the agent can detect the beacon emitted from the recharging station. When the agent finds the recharging station, it will be rewarded by getting its batteries recharged. Finally, software will constantly check the battery voltage and change the behavior of the agent as needed. For example, fully charged batteries will tell the agent to hide in the dark, while dead batteries will tell the agent to look for a light source.

2. Executive Summary.

Energy management is achieved with the use of a simple voltage divider circuit and software that detects the change in battery voltage. It is extremely important to note that the A/D port of the M68HC11 board can read only up to five volts without burning up.

Installed on the wheel base platform will be infrared (IR) LEDs for obstacle avoidance and CdS cells to detect visible light. A 40 KHz square wave will supply IR light while a sharp sensor detects the signal reflected back to the agent. The two light sources, IR and sunlight, are different wavelengths, so the normal operation of the agent will not be affected when both are present. IR light will spray out in front of the agent, like the lights on an automobile, and the sharp sensor will detect the reflected signal. After the sharp sensor detects this reflection, software is used so that the agent will respond accordingly.

The CdS cells mounted on the platform will detect visible light. With the use of the CdS cells and a set of fully charged batteries, the agent will stay in the dark areas. As the battery level decreases, the agent will start to wander into the lighted areas. Eventually, dead batteries will cause the agent to come out from hiding and look for the bright spots in the room to get rewarded by a recharge of its batteries.

3. Introduction.

Energy management in an autonomous agent that responds to different situations according to its battery level needs some attention. When the battery voltage changes in the agent, so does the behavior of the agent. For example, fully charged batteries will cause the agent to act like a cockroach and hide in the dark. Both the agent and the cockroach are full and do not require looking for food in their present state of energy. While the other extreme of energy management is when the agent or cockroach is hungry. They both need to search not only dark places but also lighted areas. The cockroach is an intelligent insect and survived for thousands of years by using its sensors. I will try to imitate a cockroach using a combination of IR sensors for obstacle avoidance and CdS cells for the agent to act out the different stages of hunger.

A subroutine in the main program will always be checking the battery level of the agent. A fully charged battery on the agent means that it is full of energy and does not require recharging, just like the cockroach which is full of food and does not need to eating. As time passes, both the agent and cockroach get hungry. They cannot find food in the dark places, so they must wander out in the lighted areas searching for food. The agent and cockroach will both restore their energy by eating food. The agent's food, on the other hand, is found at the recharging station.

The robot, named 2XL, will try to achieve some of the cockroach's behavior, although the cockroach has several thousand years' experience over 2XL. With the use of IR sensors and CdS cells, 2XL will imitate some basic habits of the cockroach.

1Light sensors can enable robot behaviors such as hiding in the dark, playing tag with a flashlight, and moving toward a beacon.

4. Mobile Platform Design.

The backbone of any agent is the platform. The designer must first observe and decide in what terrain the agent will wander. For example, a rocky terrain might have a track driven platform, while a smooth terrain might have a wheel base platform.

The platform design will also dictates some of the functions of the sensors. The robot, 2XL is flat and has a round shaped platform. This seems to be the standard platform criterion since everything bolts up easy to this type of design. For example, the battery pack is mounted on the bottom of the robot while the M68HC11 board is bolted to the top. The mounting plate for the drive motors is also easily mounted to a flat surface.

By designing a round robot with both drive motors centered symmetrically under the body, the robot can easily turn completely around without bumping into anything. A square robot, on the other hand, has to worry about the back two corners as it is turning.

4.1. Characteristics of Shaft encoders.

One problem encountered designing the platform is the air gap between the shaft encoders and the 32 segment-display glued on the wheels.

1A shaft encoder is a sensor that measures the position or rotation rate of a shaft. Typically, a shaft encoder is mounted on the output shaft of a drive motor or on the axle.

The 32-segment display has

2alternating white and black stripes make reflecting and non-reflecting surfaces, respectively, for light emitted from a photoreflector's LED.

An example of a segment display is shown in Figure 2. By using a hose clamp the designer can properly set the gap between the shaft encoder and the 32-segment display which is shown in Figure 1. Figure 3, shows the schematic diagram for the motor driver circuit, which is also found on page 97 in Mobile Robots written by Jones and Flynn.

4.2. Characteristics of Motors.

Referring to Figure 1, the motors installed on the robot are geared down Swiss motors. The motors are driven by pulse width modulation and range in operation from a 100 percent duty cycle to as low as a 7 percent duty cycle. Each motor is driven individually. This means that one motor can go forward while the other is going backwards.

FIGURE 1. Bracket that connects the motor to the platform.

FIGURE 2. Example of an 8-segment display.

5. Sensors.

5.1. IR.

Three LEDs and their sharp sensors are installed on the platform. One is set aiming straight ahead while the other two sets are angled out to the sides. Radio Shack or any electronic store supplies these LEDs and sharp sensors. The output of each sharp sensor is connected to the A/D port on the M68HC11 board. The data reading from the sharp sensors will tell the EVBU (Universal Evaluation Board) if an object is in front of it or not. A five- volt source for the sharp sensors and a 40KHz square wave for the LEDs are required for the two to operate. Graph 1 helps to explain their operation. By observing this graph, one can see the light generated by the LED will not reflect off black objects or hands very well. The other colors, on the other hand, will reflect the IR light, allowing the robot to detect an object in front of it. The size of an object in front of the robot is also a critical point of interest. For example, the legs of a chair can cause problems. The robot cannot see these small objects and will bump right into them. Figure 4, shows the schematic diagram for the LED circuit. The PAL chip will turn the D flip-flop on or off as needed by the designer.

GRAPH 1. Graph of sharp sensors detecting different colors.

5.2 Photocells.

1A photoresistor (or photocell) is easy to interface to a microprocessor. Photoresistors are simply variable resistors in many ways similar to potentiometers, except that the resistance change is caused by a change in light level rather than by turning a knob.

Figure 5 shows the schematic diagram for the CdS cells installed on 2XL. As can be seen from this figure the 74HC374 chip is a D flip-flop that will latch in the data from the data bus. The PALCE22V10 is a programmable CMOS erasable chip. This PAL

2device implements the familiar Boolean logic transfer function, the sum of products. The PAL device is a programmable AND array driving a fixed OR array.

A PAL chip must have a program down-loaded into it to operate. The program for the PAL chip is located in Appendix B. One main advantage of using a PAL chip is that it allows the designer to turn on each D flip-flop separately when needed. Software will then control which output port on the D flip-flop to turn on or off. By turning on only one CdS cell at a time and storing the data in memory, the D flip-flop also allows the use of only one A/D port.

5.3. 7-Segment Display.

The seven-segment display is one form of a sensor. It senses the battery voltage level of the robot. The circuit diagram of this seven-segment display is in Figure 6, which is located in the Appendix A. A major decision was whether or not to have this device on the robot. The seven-segment display draws lots of current to light up each individual segment. By installing a switch, the display will be off all the time and thus will not run down the batteries. Pressing the switch it makes a connection between the regulated voltage and the VCC pin on the 74HC374 chip. By doing the design this way, the display is only visible a short period of time.

6. Behaviors.

First, a word of warning. The A/D port on the M68HC11 board can handle only up to FIVE VOLTS. Anything higher than that will burn the port. A simple voltage divider circuit needs to reduce the 10 volt battery supply down to proper levels. This voltage divider circuit is now a fudge factor for the A/D port on the M68HC11 board. The full range of A/D numbers that decides if the batteries are ten volts or six volts must be found experimentally. This is done by using a variable DC power supply and changing the supply from ten volts down to six volts, as you record the A/D number that corresponds to the battery level. With such a wide range of numbers in the A/D port, the designer has a wide range of different behaviors for the robot to emulate. Each different A/D number can be assigned to a different behavior. Data table 1, listed below, was constructed by varying the battery level and reading the A/D port on the M68HC11 board.

Battery Level (volts)	A/D port

(A/D number)	Battery Level (volts)	A/D port

(A/D number)
9.5	216	7.5	171
9	209	7	159
8.5	196	6.5	149
8	185	6	<149

Data Table 1. Varying the battery level also changes the A/D number.

6.1. Dark Light.

A fully charged battery would have an A/D number such as 216 or higher, and software will decide what behaviors to be expressed based on that number. In this example, a fully charged battery means the robot is full and does not need recharging. So, software will decide to have the robot roam around in the dark places of a room by the use of the CdS cells.

6.2. Bright Light.

The other extreme of the spectrum is the dead batteries. A dead battery level is defined by the designer and is defined as seven volts for this project. Seven volts gives 2XL a cushion so that it can find the recharging station before it completely dies. As the batteries wear down, software will detects this and tells the robot to change behaviors. The robot will then decide to come out of the dark areas of hiding and go into the lighted areas of a room.

6.3. Docking to a recharger.

As the A/D port detects a low battery level, 2XL decides to get recharged. With the use of the CdS cells to find the bright spot in the room, the robot will go to that spot and get its batteries recharged. There are thousands of different ways to actually connect the robot to a recharging station. This is a VERY TOUCHY SUBJECT. Each designer has their own opinion as to which way is best. 2XL has separate positive and negative insulated bumpers attached to it that serve as the connection to the recharger. At the recharging station, there is a plastic pipe that mounts two spring loaded copper shims that will connect to the robot for the recharge. The experiment worked well for the robot to mate with the recharging station, but the batteries were not actually recharged this way. I recharged the batteries the standard way of pulling them out of the robot. This is still in experimental stages and we all know about experiments and design work!

7. Conclusion.

The objective of this class was to come up with a third sensor for the robot. The other two sensors were the sharp sensors for object avoidance and the shaft encoders for straight line applications. To adventure out and make a new design for the robot was very challenging and risk taking. But risk taking can be fun and adventurous.

This project was very challenging, in that I was trying to have an autonomous agent observe its battery level and do different behaviors accordingly. The software program that monitors the battery level through a resistor divider circuit WORKS. As the batteries ware down, the program sets a flag for the robot to exhibit three different behaviors. I could have programmed a different behavior for each 1/2 volt decrement of the batteries, but where do you draw the line on the amount of behaviors an agent has in an experiment?	The CdS cells detect the light, but not the way I had expected. The robot does not turn fast enough as it comes out of the dark and into the lighted areas. The speed of the robot is so fast that the CdS cells can not adjust to the light change quick enough. If I had to do it again, I would look into photodiodes or phototransistors. Either one of these should have a faster response time to light changes.

Future work in this type of behavior could include the improvement of the light behaviors and maybe the use of different photosensors that can detect those nasty chair legs. Yes, my robot did hit each and every chair leg at home and at school. My next goal is to have my robot spot those chair legs. DESIGN WORK IS FUN, NO RULES!

8. References

[1] Fred Martin, The 6.270 Robot Builders's Guide, MIT Media Lab, Cambridge, MA, 1992.

[2] Joseph Jones & Anita Flynn, Mobile Robots: Inspiration to Implementation, A.K. Peters Publishers, Wellesley, MA, 1993.

[3] Pattie Maes, Designing Autonomous Agents; Theory and Practice from Biology to Engineering and Back, MIT Press, Cambridge, MA, 1990.

[4] Advanced Micro Devices, PAL Device Data Book and Design Guide, Advanced Micro Devices, Inc., Sunnyvale, CA,1993.

9. Acknowledgements:

Thanks to all the people who worked close to me throughout the semester on building the robot. A special thanks to Dr. Doty who guided me in the right direction from the start of this semester. I always wanted to be different from the class, to take another route to an approach, and Dr. Doty let me go my different way with words of encouragement. He let me take my ideas and try them out on my robot. He always said there are no rules in a design problem.

To Dr. Arroyo, who was always there listening to my ideas, no matter how far fetched they sounded. I have enjoyed listening to his speeches and his ideas on how to approach several problems that I had throughout the semester.

Also, thanks to the three T.A.'s, Bruce, Scott, and Kevin, with whom I was in contact. Thanks to Bruce for his object avoidance program. With a very small adjustment from his program, it worked great on my robot! Thanks to Scott for his idea of a recharging station. I would have never come up with that idea as my third sensor. And thanks to Kevin. Your not the last T.A. on the list but maybe the first in my mind when I needed some help thought the semester.

To Motorola, thanks for all the donations that you give to MIL. Keep up the donations that you give to the school. The students thank you very much. The M68HC11 board did everything that I needed it to do. Your product is GREAT!

To my family, Tina and Ryan. Thanks for the computer time and for letting me write this report. Thanks to Tina, without whom I would have never made it through school. Thanks for putting up with me during this semester. And all the ones in the past. This report finally has your name in it. Ryan, your a great son! I have taken some of your ideas and implemented them on our robot, 2XL. Some of your ideas were better than mine, but I did not want to tell you that. I give you an A+ for your effort.

Finally, thanks to Adam Gant who spent countless hours proof reading and criticizing this report. I enjoyed the hours of laughter at my grammar and sentence structure. Adam, I thank you very much for you work, and good luck in you career.

Appendix C: Glossary

1. 2XL	Name of Robot

2. CdS cells	Cadmium-Sulfide photocells

3. CMOS	Complementary MOSFET

4. EVBU	Universal Evaluation Board

5. IR	Infrared

6. KHz	Kilo Hertz

7. LED	Light Emitting Diode

8. MIL	Machine Intelligence Lab

9. T.A.	Teachers Aid

Appendix D: Suppliers

1)	Electronics Plus

2026 SW 34th

Gainesville, Florida 32608

(904) 371-3223

2)	Radio Shack

3315 SW Archer Rd

Gainesville, Florida 32608

(904) 375-2426

3)	Skipper Electronics

3708 Newberry Rd

Gainesville, Florida 32608

(904) 373-6796

E. Course Recommendations.

Need to teach more about IC programming. (Lots of it)

Only use the two books: Mobile Robots , and The 6.270 Robot Builders Guide

Maybe include some weekly reports as presentations in front of the class.

Have the new one credit hour continuation class do presentations in front of the regular robotics class. This way they can see up close a platform design and have an idea of there own platform from the start of the semester.

By having a follow up class it will take the robotics class up to the next level.