Docsity

Dead Reckoning Robot Project | Computer Systems Design | CPSC 483, Study Guides, Projects, Research of Computer Science

Partial preview of the text

Download Dead Reckoning Robot Project | Computer Systems Design | CPSC 483 and more Study Guides, Projects, Research Computer Science in PDF only on Docsity!

Implementation Notes:

Dead Reckoning Robot

Senior Design

Spring 2003

Texas A&M University

Lee Fithian

Ajay Joseph

Steven Parkinson

Saba Rizvi

1 Introduction

This section describes a description of the intended audience, the purpose of this document and a description of the topics covered.

1.1 Audience

This document is designed to present the reasoning behind the design used for the Dead Reckoning Robot project. The level of detail presented in this document is much more through than that of the Users Manual document.

The increased detail is to spare future engineers and scientist working on the project from the burden of reverse engineering the project when making modifications or adding to the design.

1.2 Section Descriptions

This section describes the purpose of each of the sections contained within this document. Following the Introduction is a description of why the Mark III robot with an OOPic microcontroller was used as the basis of the project.

Following the description of the Mark III robot is a section with information about each of the sensors. The section for each sensor includes the following subsections:

  • Device Information o Description of the manufacture of the sensor. o Resources for information about the sensor.
  • OOPic Interface o Description of the physical interface to the OOPic microcontroller board. o Description of the details of the software component of the interface.
  • Issues o Description of issues encountered while interfacing the sensor.

2 Mark III Complete Kit (OOPic Version)

This section describes reasons the Mark III robot and OOPic microprocessor were chosen. Also included in this section is a description of the modifications made to the chassis to facilitate the addition of the sensors.

2.1 OOPic Microcontroller

The OOPic microcontroller was chosen for several of its convenient features. These features include:

  • Simple to Program.
  • Wide variety of built in functions.
  • Quantity of I/O ports.
  • Cost.

The OOPic microcontroller is programmed using a subset of three different popular programming languages. The languages available are Visual Basic, Java and C. Visual Basic is the language used in this project. The ability to quickly create programs using object oriented techniques is the main factor contributing to the use of Visual Basic.

Because the OOPic microcontroller is a mature product there is support within the OOPic libraries for a wide variety of hardware available for robotics. By utilizing support within the OOPic the design team greatly decreased the code development time required.

The OOPic also has advantages over many other products available because it has a large number of I/O ports arranged on a standard 40 pin header. Seven of these ports are available for sampling analog values using the A/D converted built into the OOPic.

The low cost of the OOPic board contributed to the selection of this microcontroller.

2.2 Mark III Robot

The Mark III Robot is used as the basis of the Dead Reckoning Robot. The Mark III robot is available in a complete kit which includes:

  • Servos, modified for continuous motion as the source of propulsion.
  • Electronics, including the OOPic microcontroller.
  • Chassis
  • Wheels

The Mark III is easy to modify to meet the requirements of the design. By using the Mark III kit the design team avoided sinking a large amount of time into the development of

The pieces cut are then bent into a ‘L’ shape. Holes are drilled into the metal corresponding to the holes in the chassis. The holes referred used on the chassis were the two which attached the scoop to the main part of the chassis and the on the lip of the main part of the body opposite to the scoop.

It is recommended that the holes drilled in the L-brackets which attach to the chassis be made wide so that the distance the encoder is from the wheel can be easily adjusted when attaching the encoders.

Care must be taken such that when the encoders are attached the code wheel does not contact any surfaces within the encoder. This damages the code wheel. If this situation exists it will often cause a ‘squeaking’ noise when the encoders are turning.

2.3.3 40 Pin Cable

To avoid an unsightly and unmanageable number of wires from the bottom of the upper PCB to the OOPic forty pin interface a standard forty pin IDE header is soldered to the upper PCB. An IDE cable is cut to the necessary length and connects the forty pin header on the OOPic to the forty pin header on the upper PCB. The wires from each of the sensors go to the forty pin header on the upper PCB.

When it is necessary to remove the upper PCB the IDE cable can simply be disconnected. This eliminates the needs to wrap all the wires to the forty pin header on the OOPic board each time the upper PCB is removed.

2.3.4 Power Supply

During testing the rate of power drain prevented the design team from working for the time periods necessary. A 9 V, 300 mA power supply is used to decrease the dependency on battery available and recharge rates.

3 Accelerometer

This section provides information about the accelerometer which was chosen for the design of the Dead Reckoning Robot. The subsections below contain information about the device itself; hardware and software details of the OOPic interface and issues that arose during integration of the sensor.

3.1 Device Information

The ADXL202E was the accelerometer that was chosen to be used in this dead reckoning robot. It is a dual axis accelerometer which has a measurement range of +/- 2g.

The acceleration can be read in 2 different ways. The first way uses Duty Cycle Modulated signals in which a pulse T1, which measures the acceleration is compared to the total period of the whole signal, T2. A ratio of 50% relates to zero acceleration in that axis. In either the positive or negative direction, a 12.5% step from the center (50%) would correspond to +/- 1 g, respectively.

Figure 1: Accelerometer DCM Output

The second way the accelerometer can be read is in analog mode. An analog to digital converter would be needed for each axes output.

  • ADXL202E Accelerometer Product Page o http://www.analog.com/Analog_Root/productPage/productHome/0,2121,g eneric%253DADXL202%2526level4%253D%25252D1%2526level1% 3D212%2526level2%253D213%2526level3%253D%25252D1%2526reso urceWebLawID%253D0,00.html

3.2 OOPic Interface

This section describes the details of the interface to the OOPic microcontroller.

3.2.1 Physical Interface

This section provides the details of the physical electronic interface for this sensor.

3.2.1.3 Circuit Diagram

Figure 2: Accelerometer Circuit Schematic

Slight modifications were made to this schematic. R5 and R7 were replaced with a 1. MΏ resistor.

3.2.1.4 Pinout

The following table describes how the accelerometer was connected to our 40 pin OOPic connector.

Note that the OOPic PIN is not the same number as the OOPic I/O line.

Accelerometer Pin Description OOPic Pin 3 GND 24 6 Y Filter (Y Output Analog) 9 7 X Filter (X Output Analog) 13 8 +5 VDD 22

3.2.2 Software Interface

In order to use the use the digital output of the accelerometer, a fast enough counter must be used. Unfortunately the OOPic’s counter was not fast enough to accommodate the

accelerometer’s output signal. Another method using another chip, the PAK VIIa, was attempted, but did not work out (see issues). The analog outputs were then used for the measurements.

The following code shows how to instantiate the A/D converter object necessary to read the outputs of the accelerometer. The oA2D10 object is part of the OOPic library.

Dim xvolt As New oA2D Sub Main() distTrav = 0 totalRates = 0 positiveRate = 0 cntNew = 0 do currentRate = xvolt.value if (currentRate > zeroRateX) then positiveRate = positiveRate + 1 totalRates = totalRates + currentRate avgRate = totalRates / positiveRate end if vel = (((((avgRate - zeroRateX) * 980) / 63) * cntNew) / 283) distTrav = distTrav + ((vel * cntNew * k) / 283) cntNew = count.value - cntNew loop while (distTrav < (x * k)) End Sub

This code segment records all acceleration values and keeps averaging them so that a velocity can be found. This velocity is then integrated to achieve the distance traveled. This is achieved with the aid of a virtual circuit clock that is always running. Time can measured with a simple conversion of count ticks to seconds.

3.3 Issues

This section describes problems the design team encountered.

3.3.1 Socket Mount

This was mentioned in the physical interface section.

3.3.2 PAK VIIa

In order to try and use the digital output of the accelerometer, a PAK VIIa chip was purchased. The PAK takes a PWM signal as an input and can count how long the signal is high or low. It then outputs a 16 bit value of how long the signal was high or low. Each bit represents 5 μs. This would have been a nice solution for us to measure the signals from the accelerometer. After multiple tests and communication with the PAK manufacturer, the chip was found to be defective. This forced us to use the analog method to retrieve values from the accelerometer.

4 Compass

This section provides information about the compass which was chosen for the design of the Dead Reckoning Robot. The subsections below contain information about the device itself; hardware and software details of the OOPic interface and issues that arose during integration of the sensor.

4.1 Device Information

The compass chosen for use in this design is the Devantech CMPS03. It has a resolution of 0.1 degrees and an accuracy of 3 – 4 degrees. The heading of the robot can be obtained in one of two ways. A PWM signal can be read from pin 4 or the I2C interface can be used with pins 2 and 3.

  • CMPS03 Product Page o http://www.robot-electronics.co.uk/htm/cmps3doc.shtml

4.2 OOPic Interface

This section describes the details of the interface to the OOPic microcontroller.

4.2.1 Physical Interface

This section provides the details of the physical electronic interface for this sensor.

4.2.1.1 Physical Location

The position of the compass was determined mainly due to the positions of the other sensors. The accelerometer and the gyroscope need to be as close to the center of the robot as possible. The compass was then placed in the middle of the robot, but closer to the front edge of the sensor PCB.

4.2.1.2 Pinout

The following table describes how the compass was connected to our 40 pin OOPic connector.

Note that the OOPic PIN is not the same number as an OOPic I/O line.

Compass Pin Description OOPic Pin 1 +5 VCC 21 2 SCL (I2C Interface) 3 3 SDA (I2C Interface) 1 9 GND 23

4.2.2 Software Interface

The use of the I2C interface was a huge advantage in coding for the compass. The bearing read by the compass is stored within registers and that value can be directly read thru the I2C interface. Registers 2 and 3 contain the 16 bit bearing and is sent to the OOPic high byte first.

The OOPic has an I2C object which is used to identify the compass. The following is sample code on how to get a bearing reading from the compass.

Dim compass As New oI2C ' Create the compass objects Dim heading As new oWord ' Somewhere to store the reading

Sub Main() Compass.Node = 96 ' Decimal of Hex address 0xC0 shifted right by 1

Compass.Mode = cv10bit ' I2C mode is 10-Bit Addressing.

Compass.NoInc = 1 ' Don't increment Compass.Location = 2 ' Address of single byte bearing

Compass.Width = cv16bit ' Compass Data is 2-byte wide.

Compass.Location = 2 ' Address of word bearing

Bearing = Compass.Value ‘Get bearing from register

End Sub

4.3 Issues

This section describes problems the design team encountered.

4.3.1 Reliability Indoors

When testing the compass in the lab, an interesting anomaly was found. With the aid of a map compass, the lab floor was found to have many different directions giving a north reading. The magnetic field was never consistent anywhere in the room. We attributed this to the many computers giving some magnetic rays and to wires in the floor and ceilings. When the robot was tested outside, the reliability increased dramatically.

4.3.2 Powering the Compass

The compass needs a nominal 15 mA to operate. At times though, 400 mA current is needed. The OOPic power lines only provide 75 mA. Since the spike in current occurs so infrequently, this issue did not command much time. As of yet, no problems have yet to come to our attention, yet it is a slight concern.

5 GND

Encoder Right Pin 1 A 2 B 3 Index 4 VCC (Power Supply) 5 GND

The 2.5 V Precision Reference was not included in the connections to the OOPic because there were not enough 10 bit A/D inputs available. This could be connected to one of the 3 remaining A/D converters available on the OOPic.

5.2.2 Software Interface

The encoder values obtained are digital pulses that are converted to cm traveled by the encoders. Using these values, we can navigate the robot to a desired location or find how far a robot has traveled. The following code shows how to instantiate the converter object that makes it easy to read the output of the encoders. The oQencode object is part of the OOPic library. More information on this object can be found on the OOPic website. Dim encodeL As New oQencode Dim encodeR As New oQencode Sub Main() encodeR.IOLine1 = 25 encodeR.IOLine2 = 24 encodeR.signed = 1 encodeR.Operate = cvTrue

encodeL.IOLine1 = 15 encodeL.IOLine2 = 14 encodeL.signed = 1 encodeL.Operate = cvTrue End Sub

5.3 Issues

The only issue that the encoder had was mounting them on the wheels. It took a little planning and a little more effort than the rest of the sensors.

6 Gyroscope

This section provides information about the gyroscope which was chosen for the design of the Dead Reckoning Robot. The subsections below contain information about the device itself; hardware and software details of the OOPic interface and issues that arose during integration of the sensor.

6.1 Device Information

The gyroscope chosen for the design was the ADXRS300. This is a MEMS type gyroscope capable of measuring values of angular velocity in the range ± 300 °/s.

The design uses an evaluation board version of the gyroscope. The part number for this evaluation board is ADXRS300EB. This evaluation board includes several of the capacitors used to bias the gyroscope. Additionally the evaluation board comes in a standard 20 pin DIP package eliminating the time required for physically mounting the sensor on our PCB.

Analog Devices also makes a version of the gyroscope which measures ± 150 º/s. Using this devices would allow the angular velocity to be measured to a greater accuracy. The maximum angular velocity of the robot would have to limited though with this sensor.

The reason for this limitation is that when the wheels are turning in opposite directions the robot can easily exceed ± 150 º/s. Te described design choose to go with the lower resolution of the gyroscope with the larger measurement range.

The specifications for the gyroscope itself can be obtained from Analog Devices website. Links to Analog Devices’ homepage, the product page for the gyroscope and the product page for the evaluation board are as follows:

  • Analog Devices’ Homepage o http://www.analog.com/
  • ADXRS300 Gyroscope Product Page o http://www.analog.com/Analog_Root/productPage/productHome/0%2C 21%2CADXRS300%2C00.html
  • ADXRS300EB Gyroscope Evaluation Board Product Page o http://www.analog.com/Analog_Root/productPage/productHome/0,2121,g eneric%253DADXRS300%2526level4%253D%25252D1%2526level1% 53D292%2526level2%253D%25252D1%2526level3%253D%25252D1% 2526metaId%253D2656%2526resourceWebLawID%253D356,00.html

6.2 OOPic Interface

This section describes the details of the interface to the OOPic microcontroller.

13 PDD (+ Charge Pump Supply) 21

The 2.5 V Precision Reference was not included in the connections to the OOPic because there were not enough 10 bit A/D inputs available. This could be connected to one of the 3 remaining A/D converters available on the OOPic.

6.2.2 Software Interface

The gyroscope provides a simple analog output which represents the angular rate. Basically a value of 2.5 V indicates a rate of 0 º/s. An change in voltage on the RATEOUT output indicates a linearly related change in angular velocity. The value of the voltage relative to the 2.5 V bias value indicates the direction of the angular velocity.

Specific details on interpreting the values of the gyroscope can be found in the specification for the ADXLS300 available from Analog Devices’ website.

The following code shows how to instantiate the A/D converter object necessary to read the output of the gyroscope. The oA2D10 object is part of the OOPic library. More information on this object can be found on the OOPic website.

Dim rate As New oA2D Dim temp As New oA2D Dim rateAnalog as New oWord

Sub Main() rate.IOLine = 1 rate.Operate = cvTrue temp.IOLine = 2 temp.Operate = cvTrue End Sub

6.3 Issues

This section describes problems the design team encountered.

6.3.1 Powering the Gyroscope

The specifications for the gyroscope indicate that the analog supply is sensitive to noise, especially to that generated by digital circuits. The specification recommends that this power input be isolated from other devices.

Because of the limited number of power connections available in this design the analog power inputs for the gyroscope where in parallel to several other devices. This did not cause a problem during testing but is something that the user should be aware of.

User Manual:

Dead Reckoning Robot

Senior Design

Spring 2003

Texas A&M University

Lee Fithian

Ajay Joseph

Steve Parkinson

Saba Rizvi