A Mechantronics

Demonstration Project

By

Clay Davis

And

Richard Balsamel

Outline

I.           Introduction

II.         Background

1. Theory
2. Components

III.        Equipment

1. BOE with BS2
2. Project Design
3. Roadway Set Up
4. Circuit Design
5. Program Logic

IV.       Experimental Procedure

1. Study of Motion – Distance, Time, Velocity, and Acceleration
2. Velocity Control – A Smart Highway

V.         PBasic Programs

VI.        Project Cost Analysis

VII.       Suggested Activities

VIII.     Acknowledgements

IX.        References

I. Introduction:

Would it surprise you to learn that at this very moment you are moving at a speed of more than 100,000 kilometers per hour? The explanation is simple. Since you are on the earth, it carries you along as it speeds around the sun in its orbit. Therefore you share the earth’s orbital speed which is more than 100,000 kilometers per hour. This is an example of motion, which occurs all around us. Sometimes it is more obvious and we see it in the cars on the highway, in trees that sway in the wind, and with our everyday activities. Motion is easy to recognize, but it is hard to describe. This difficulty arises because motion involves rate, a quantity divided by time. In order to better understand motion, it is best to simultaneously demonstrate it while describing it mathematically. Thus, it would be great to have an apparatus, which could be easily manipulated to not only demonstrate motion but also describe it quantitatively. In this experiment such an apparatus was designed using a simple toy car on an electric tract attached to a servo-motor controlled by input data from a computer. Using this simple apparatus, motion can then be studied and some fundamental questions concerning it can be answered; what exactly is motion? What is relative motion? What is speed? How does speed differ from velocity? How is acceleration different from velocity? How are distance, speed, time, and acceleration related to each other? What is the effect of manipulating one component of motion on the others? These and other basic questions concerning motion are studied using the above apparatus.

II. Background:

2.1 Relative Motion in a Straight Line

Motion is relative. Everything moves, even things that appear to be at rest move. They move with respect to each other, or relative to the sun and stars. When you are sitting in a bus traveling at 45 kilometers per hour, you are moving with respect to the road, but not with respect to the seats, floor, or walls of the bus. Your speed with respect to the road is 45 kilometers per hour. Your speed with respect to the floor of the bus is zero. If another bus traveling 45 kilometers per hour should come towards you passing in the opposite direction, your speed with respect to that bus would be 90 kilometers per hour. This illustrates that with dealing with motion of a body, it is important to state with respect to what other body or frame of reference its motion is being described.

Straight Line Motion

The study of the motion of bodies that travel in a straight line is important because many complicated motions of bodies can be considered combinations of two or more straight-line motions and therefore can be analyzed in terms of straight-line motions.

2.2    Speed and Velocity

The speed of a body tells us how far it travels per unit of time. The average car travels 70 kilometers per hour. This means that the automobile travels a distance of 70 kilometers for every hour that it maintains its speed. Speeds are commonly measured in kilometers per hour, meters per second, and centimeters per second. The fastest speed possible is the speed of light, 3 x 108 meters per second. Like speed, velocity of a body gives a description of its motion. However, unlike speed the velocity of a body tells us two things about the moving object. It tells us two things about the body: its speed and its direction of motion. Thus the velocity of a car would be described as 70 kilometers per hour southward.

Average Speed and Instantaneous Speed

The average speed of a body is the distance traveled divided by the time traveled. The average speed is a very useful idea because generally on a trip we do not know the speed of travel from moment to moment because of changes in road condition, fatigue, …etc. Thus average speed can give us a good general idea of the speed of an object over a given amount of time.

Average speed = distance /time or v= d / t

The average speed of a car tells us nothing about the speed it may have from moment to moment during a trip. A speedometer reading of a car tells us the specific speed of the car at the moment one looks at the meter. Since this reading is an instantaneous reading at any moment during a trip, we generally refer to it as the instantaneous speed or the speed of the body during any specific time of the journey.

2.3 Uniform and Accelerated Motion

All the different kinds of motion, which we generally notice in the world, are of two types; uniform motion and accelerated motion.

In uniform motion, both the speed and direction of the moving body remain the same. It is therefore described as being at constant velocity. When you are riding in your car on a straight road at a set speed you are moving in uniform motion. You cannot usually travel any great distance in a car at constant velocity. This is because of changing road condition and weather, one normally has to alter the speed, direction or both in order to get to a specific destination safely.

Motion with changing velocity is called accelerated motion. Generally, accelerated motion means "speeding up". In physics accelerated motion refers to any change of velocity. This could mean either a change in direction, speed, or both speed and direction.

Acceleration = D velocity/time or a= D v / t

Uniformly Accelerated motion

The simplest type of accelerated motion is that of a body moving in a straight line with constant acceleration. In this case, the body will speed up or slow down at a constant rate. If the body speeds up, we say that the acceleration is positive. If it slows down, we say the acceleration is negative.

2.4  Relating Acceleration, Speed , and Time

Acceleration is defined as the rate in which the velocity of a body changes. For a body moving in a straight line with constant acceleration, we can find the acceleration by dividing the change in the speed of the body that take place during a given time by the time. If vo is the speed of the body at the start and v is the final speed gained by the body after being uniformly accelerated for a time t, the constant acceleration a, is:

a =(v-vo)/t

Solving for v, we have

v=vo + at

2.5 Average Speed and Distance Traveled During Constant Acceleration

In general, the average speed vavg of a body undergoing constant acceleration for a given time t is midway between its initial speed vo and its final speed v, and is given by:

Vavg=(vo+v)/2 , V=vo+at

Vavg=vo+1/2at

D=vavgt=(vo+1/2at)t

D=vot +1/2at2

All problems involving bodies moving with constant acceleration in a straight line can be solved by using either or both of the following equation relationships:

(a) V=vo+at or a=(v-vo/t)

(b) D=vot + 1/2at2

Solving for t in (a) and substituting in (b) gives another useful relationship:

2.6  Components

1. Light Emitting Diodes

Diodes are semi – conductor devices that allow current to flow I only one direction. A typical use for diodes is rectifying alternating current to direct current . This project uses a form of diode called a Light Emitting Diode (LED). These diodes give off light when there is a potential difference across the diode in the forward (conducting) direction. The LED’s used for this project have an output in the infrared range. (9)  2. Phototransistors

Transistors are semi – conducting devices which serve two main functions; as amplifiers and as switches. (3) All transistors have three inputs: a base, an emitter, and a collector. There are two types: NPN and PNP depending upon the types of materials used to make the transistor. The nature and operation of transistors is well documented. (3) This project uses a type of NPN transistor called a phototransistor. If the transistor receives a potential at its base that is higher than the potential at the emitter, a current flows between the collector and the emitter. The transistors used in this project are very sensitive to infrared light. Receiving light keeps the base high compare to the emitter. When the light is blocked the base goes low, turning off the current. The combination of the LED and phototransistor serves as a "photogate" which detects the car as it passes through the gate by changing the state of a pin on the BS2 IC from high to low. A series of gates allows the motion to be monitored over time. (7)  3. Servo Motors

Motors are devices that convert electrical energy to mechanical energy. A full discussion of the operation of motors is available at several sources (1). A       servomotor is an excellent example of mechatronics, incorporating all the major fields in one device. It is a motor modified so that the amount and direction of its motion can be controlled. The addition of a gearbox (mechanical), motor and potentiometer(electro-mechanical), Control circuitry (electrical), and a control wire allows the microcontroller to access the motor (control interface and computing elements).

The servomotor used in this project is controlled by the Basic Stamp circuit, which sends out a command in PBasic, PULSOUT, to have the motor shaft rotate a set amount in a specific direction. (6)  4. Potentiometer

A potentiometer is a variable resistor. By adjusting the position of a contact, the resistance between the contact and a terminal is changed. There are several types, including linear, rotary, and digital. In the diagram below (2), as the contact c is rotated clockwise, the resistance between A and C increases while the resistance between B and C decreases. (8)  Rotary Potentiometer                                                                         A     C     B                A     C     B

III.  Equipment

A. Board of Education and Basic Stamp 2 Chip(5)

The Basic Stamp 2 circuit and the Board of Education project board are the microcontroller used for this project.(4)   The Basic Stamp is a special purpose mini computer that contains a mircocontroller chip and a small amount of memory to hold interpreters and programs. The BOE provides regulated +5 volts (Vdd) and ground (Vss) as well as connections to the 16 pins of the Basic Stamp IC. There is a small breadboard for circuitry and a DB9 connector for programming the BS2 IC and for serial communications while programs are running. Using a programming language, PBasic, the Stamp can be programmed to perform a variety of operations.

•   Board of Education                                                                                                          Basic Stamp 2

•

B. Project Design

This project is designed to monitor the motion of a car on a road. The program asks for three distances to be entered and then times the car as it passes through the photogates. The program then calculates the velocity for three intervals of time.

A second program allows for the input of a distance, an initial speed and a speed limit. The microcontroller then monitors the speed of the car as above, compares the speed to the "speed limit", and then, using a servo motor controlled potentiometer, reduces the car’s speed if necessary.

C. Roadway Set Up

A toy "slot car" roadway operated by four "d" cell batteries forms the set up for this project. The speed control for the cars consists of a linear potentiometer, which determine the potential across the car’s electric motor, and thus the car’s speed. Four LED/phototransistor sets were installed along the guardrails on one portion of the roadway. The LED’s are powered by the BOE’s power supply and the phototransistors are connected to four input pins of the BS2 . The speed control was replaced with a rotary potentiometer of similar value (20 Ohms). The shaft of the potentiometer was then connected to a servo motor to control its position and thus the speed of the car.  D. Circuit Design

1. The LED was connected to +5Volts through a 220 Ohm resistor to limit the current flowing through it
2.  2. The phototransistor was connected with the collector connected to +5 V and the emitter connected to ground through a 4.7 kilo-ohm resistor and also to an input pin on the BS2.

3. The servo motor was connected to +5 V, ground, and its control wire to an output pin on the BS2. E. Program Logic

1. Motion Analysis Program: This program uses four photogates. The program checks the status of the first gate, looping until it detects a "0" or blocked state. It then branches to a For…Next routine that checks the status of the second gate and increments a variable. When gate two goes to zero, indicating that the car has reached there, the value of the variable is stored and the program branches to another counting routine. This process repeats, giving times for gates 1 to 2, 2 to 3, and 3 to 4. The times are then converted to seconds and displayed. The three times and distances are then used to calculate and display three velocities.

2. Speed Control Program: in this program the velocity of the car is calculated as in the first program. This velocity is compared to a speed limit using an IF…Then statement. If the value is below the limit, the program loops back to the beginning and continues to monitor the velocity each time around the track. If the value is above the limit, the program branches to a subroutine that uses the PULSOUT command to rotate the servo motor (and potentiometer), reducing the speed of the car. The program then loops to the top and continues checking the velocity each time around, reducing it as necessary.

VI. Suggested Projects

1. Additional Activities with track
1. Incorporate traffic signals using LEDs
2. Use RCTIME command to measure actual times
3. Add rf transceivers and IR detectors to program a follower car
2. Real World Applications
1. Smart speed control system: Design a self -contained to automatically monitor and control the speed of cars.
2. Accident avoidance system: Design a system that automatically slows car whenever a car is closer than a set distance from another vehicle.

VII. Projects Cost Analysis

1. Construction materials:

1. Slot Car Track                             \$ 21.00

2. Wood Base                                 \$  6.00

3. Screws and Brackets                 \$  5.00

4. Paper covering                            \$  5.00

5. Plexiglas                                       \$10.00

2. Electrical Components

1. Potentiometer                              \$  4.00

2. Resistors:                                     \$  4.00

220 ohm (4)

4.7Kohm (4)

3. Phototransistors (4)                 \$  3.20

4. IR LEDs (4)                                \$  3.20

5. Db9 pin connector                   \$  4.00

6. Wire (approx. 10 ft)                  \$  3.00

7. Board of Education                 \$ 65.00

8. Basic Stamp 2 IC                     \$ 49.00

9. Servo Motor                            \$ 12.00

TOTAL:                                     \$ 195.00

VIII. Acknowledgements

IX. References