Pages

Autonomous Tank

Autonomous Tank



Introduction

We aim at building an autonomous vehicle, “Homer”, which can stroll around an environment (e.g. our lab, or an environment that we build) without getting stuck at obstacles. That implies that we need a robust algorithm that tells the vehicle how to steer when it gets into different obstacle situations.   The goal would be to demonstrate a vehicle that will run by itself and not get stuck or bump into any obstructions.  

High Level Description

The following is a high-level description of Homer (our Autonomous tank) :

belts
Separate DC motors
Micro-controller AT90S8515, motor-control circuits (one set for each motor), sensor circuits, batteries, …
Infra-red sensors
GP2D02
 





            A “big picture” of Homer

We used separate speed controllers for the two DC motors which turn the belts separately. Homer turns, or even rotates about an axis, when the motors are run at different speeds. By using the H-bridge speed controller circuit and supplying the circuit with Pulse Width Modulation (PWM) signal as described below, the motors can run at a range of speeds or even backwards. Comparing to the usual car designs which use steering front wheels, this design is preferable because
1.      It allows high flexibility in the vehicle movement. It is not constrained by the maximum turning angles of the front wheels.
2.      It allows rotation that is useful in getting away from obstacles.
3.      It is mechanically easy to built (We think the steering front wheels are hard to build).
We use three infra-red sensors to measure distances from obstacles. The sensor sends out infra-red pulses and then receives back the reflected signal, and afterwards the distance information is output as serial bits.  We need to read in these serial bits into the Atmel microcontroller and convert them to a distance by ourselves in our code. The SHARP GP2D02 measures distances in the range 10cm – 80cm and therefore was suitable for our design.   SHARP GP2D02 sensor interface with our Atmel microcontroller will be discussed in detail in the Program/HW design section.  
We do not have access to the machine shop and hence it is hard to build the physical components of the vehicle by ourselves. Therefore, we purchased a completed toy track vehicle (e.g. tank), and then remove the internal parts and install our own circuitry. 

Program/Hardware Design

Sharp GP2D02 Infra-red Range Sensors
Interfacing the Sharp GP2D02 infra-red range sensors were fairly straight forward.  Following the timing diagram in the specification sheet from Sharp, I programmed the microcontroller to output a control signal Vin (input signal into the GP2D02) for the infra-red sensor.  Since the Vin pin on the sensor is initially in the OFF-state and floats high, the microcontroller outputs the Vin signal to be low to turn on the sensor.  The measurement is initiated by forcing the Vin signal to logic low for at least 70ms or until the Vout(output signal from the GP2D02) becomes logic high.  Once that occurs, we need to start clocking in the serial bits from the sensor.  The microcontroller must toggle the Vin signal at the rate of 0.1ms.  We toggle the Vin signal a total of 9 times and we clock in the serial bits on the positive clock edge from Vout.  Once the entire byte is read we need to reset the sensor for another reading.   Resetting occurs when we float Vin high for at least 1.5ms; after resetting we repeat the process over again for another distance reading.  
The serial bits that were read into the microcontroller were converted into a distance of centimeters.  We calibrated the sensors using a linearization formula.  The sensors output has an inverse relationship to the distance of an object.  That is the further the object, the small the serial bits.  Since we don't really need the sensors to be too accurate, we only need to know the ranges of the objects from our sensors, we can linearize the curve.  We calibrated the sensors individually for two distances(15cm & 30cm).  Therefore any distances between 15cm and 30cm, we are confidant of its accuracy (In fact we it seems to be accurate from 10cm to 30cm).  Any distance beyond 30cm, we start to see some deviation from linearized curve.  We will consider any distance beyond 30cm to be infinite.  
NOTE: Linearization Formula was referenced fromhttp://www.barello.net/Papers/GP2D02/multiplexing_gp2d02_sensors.htm
D = Kg/(X-Ko)
Kg is the gain, or overall shape of the curve described by Kg/X
Ko is an offset, shifting the curve up or down.

Let D and X be the distance and output, respectively of your first measurement.
Let D' and X' be the distance and output, respectively, of the second measurement.

Kg = (X'-X) D'D/(D-D')
Ko = (D'X' - DX)/(D' - D)


Since there are three sensors (Left, Center, Right) we have three Vout signals into the microcontroller.  All three sensors share the same Vin signal from the microcontroller.  Therefore, we take a distance reading for all three sensors at once.  It was necessary for us to use a diode between the microcontroller and the Vin signal into the sensor.  The microcontroller has  5V logic I/O, while the sensors require 3V logic.  According to the specifications, we cannot directly drive the sensors with 5V.  Hence we used a diode, since the sensor's OFF-state floats high(3V). 

Pulse Width Modulation

We use Pulse Width Modulated (PWM) signals to control the speed of the motors. Timer 1 is set to be in 10-bit PWM mode. To generate PWM signals with different pulse widths, we simply have to change the values stored in OCR1A and OCR1B. The PWM signals are then output via the OC1A and OC1B pins.
In our scheme, when we want the tank to go straight ahead, the outputs from OC1A and OC1B are both steady 5V (not modulated) so that they go with “full speed”, and when we want it to stop, the outputs would be 0V. Cases in between going “full speed” and stopping would results in different PWM signals.   

 
Central Decision Algorithm
Every 0.5 seconds (counted by timer0), the distance information from the sensors are processed in order to understand the instantaneous environment.  The sensor readings, which are float values on a continuous range, are compared to thresholds so that the ranges in which they lies are determined:
>= 7 cm && < 20 cm : range 1 (very close)
>= 20 cm && < 30 cm : range 2 (close)
>= 30 cm || <=7cm (infinite, nothing detected)

* Note that the sensors sometimes give values smaller than 7 cm when the distances are actually “infinity”, and that’s why we have the “<=7cm” condition.

Based on the 3 “ranges” determined as above, different control signals are generated. Different combinations of the three ranges form different “cases”, and in each cases, we assign predetermined direction bits (Port A0 and A1) values so that the motors will either turn in the forward or backward direction, and also the right predetermined PWM signals so that the motors will turn with the right speed. We predetermined the control signals in each case by experimentation and “common sense”.
In that sense, the control signals of the vehicle are updated every 0.5 seconds. We want to make sure that it is up-to-date enough to navigate the vehicle.

Power Supply
Since our project required us to demonstrate our vehicle driving around, we need the microcontroller off the development board.  Having a 9V battery, we used a power regulator from National semiconductors to supply the microcontroller with 5V.  In addition to the power regulator, 2 capacitors(0.2pF and 0.1pF) were also required to build the power regulator circuit for the microcontroller. 

We also have 6V powering our motors.  The both H-Bridge circuits (LEFT and RIGHT) are supplied with 6V;  while the microcontroller with 5V.  There is a common ground. 
Also, we used a 4Mhz crystal and two 22pF capacitors to drive our microcontroller clock. 

Results

The results of our project were good.  We were able to see that our autonomous vehicle was reacting correctly to obstacles.  The vehicle's motor was powered by 6V (the original toy was powered by 6V), but didn't really give us strong enough torque.  We have tried to build a voltage amplifier to boast the 6V supply to 9V into the motors.  However, 9V didn't really provide enough torque for the vechile to run smoothly.  Finally, we add 2 transistors to make the TIP31 and TIP32 into a darlington configuration. This configuration allowed more current to our motors. After this modification the tank was work very well.

We discussed possible future additions to the autonomous tank and came up with one major upgrade. We can make the vehicle capable of accepting an user destination and move to that destination while avoiding obstacles.  We would have to add a keypad, a LCD, and a electronic compass for such an upgrade. 

Overall, we feel that the project turned out well.

Source Code

Schematics

Microcontoller with sensors & Motor Controllers
Right Motor Control
Left Motor Control

Parts

Part
QTY
Sharp GP2D02
3
Toy Tank
1
4Mhz Crystal
1
22pF Capacitors
2
National Semiconductor Power Regulator
1
0.1pF Capacitor
1
0.2pF Capacitor
1
HD74HC00P (NOR GATES)
2
74HCT04 (NAN GATES)
2
1N914 (Diode)
9
TIP32 (Transistor for H-bridge)
4
TIP31 (Transistor for H-bridge)
4
1kOhm Resistor
8
9V battery
1
1.5V battery
4



0 comments:

Post a Comment

Share your knowledge

Related Posts Plugin for WordPress, Blogger...

Popular Projects

program for Dual DAC 8051 Microcontroller Based DC Motor Control A Microcontroller Based Turbidity Meter A m -Controller Based Thermostat ASCII to BCD conversion in 8051 AT90LS8515 Digital Message Machine Audio Frequency Response Analyzer Audio Homing Robot Automated Juice Mixer Automated Pet Feeder Autonomous Car Autonomous Parallel Parking RC Car Autonomous Search Robot Autonomous Tank Autonomous Vehicle Contrast Following Rover Autonomous navigating robot BCD number to ASCII in 8051 Balance Bot Blind Bot Blood Pressure Monitor Bloodshed Dev-C++ 5 Compiler/IDE Breath Alcohol Tester Converters on TI MSP430 CrossStudio MSP430 IDE Design of a Real-Time Digital Guitar Tuner Digital Oscilloscope Digital Stethoscope Digital clock project using PIC16C54A microcontroller Digital thermometer ECG monitoring system GPS Data Logger with Wireless Trigger Handwriting Recognition Systm Home Security System Home energy managment IAR Embedded Workbench IDE INFRARED TRACKING SYSTEM IntelliBOT Laser Communications System Line following van MSP-EXP430FG4618 Development Tool and the eZ430 kits MSP430FG4618 device implement a Buzzer tone generator MSP430FG4618 device implement a Real Time Clock MSP430FG4618 device implement a voltage ramp generator MSP430FG4618 device present a message on the LCD Basic Microcontroller(8051) Lab Mivo- RFID based mobile payment system Multi-Zone Fire Alarm System PC based temperature control PIC 16f877 RPM Meter PIC16C54 dual dice electronic project circuit PIC16F84A digital thermometer microcontroller project PIC16F886 horn driver PWM motor contoller with MSP430 Program Block data transfer in 8051 Program to add two BCD numbers in 8051 Program to check whether a 4th bit of a byte is 1 Program to convert ASCII to hex in 8051 Program to count from 0-9 in 8051 Program to count number of 1's in a given data byte in 8051 Program to divide an 8 bit no by another 8 bit number in 8051 Program to find largest of n numbers in 8051 Program to find the LCM of two numbers in 8051 Program to find the square of an 8 bit number in 8051 Program to generate 50msec delay in 8051 Program to implement BCD counter to count from 0-99 in 8051 Program to implement BCD counter to count from 99-0 in 8051 Program to interchange two blocks of data in 8051 Program to multiply 16 bit number by 8 bit number in 8051 Program to search an element in an array in 8051 Program to sort an array of 10 elements in 8051 Programming the ez430 Proximity Security System RAMP wave in 8051 RC Car Controller RObo Dog Radio-controlled Truck Retina color tracker Robotic Arm Controller with GUI Robotic Car Traction Control Safety-sensor vehicle Security Entrance System Self-Powered Solar Data Logger Snake Arm Ultrasonic Positioning Control System Store FFh if 1 Super Train Controller TI MSP430 Microcontrollers Timers on the MSP430 TouchPad Drawing Board Ultra-Sonic Parking Assistant Ultrasonic Parking Controller Ultrasonic Range finder Voice Activated Alarm Clock Voice Recognition Robotic Car Voting Machine Weather Station Web-Monitored Thermostat Wireless Drawing Device Wireless Telemetry Wireless message Communicator Write a C program to display the code of the key pressed in 8051 Zigbee Wireless Relay Control and Power Monitoring System add two multibyte numbers in 8051 convert a decimal number to hex number in 8051 convert an 8bit Hex number to decimal number in 8051 convert hex number to ASCII number in 8051 eZ430-F2013 Development Tool use SD16_A ADC eZ430-RF2500 Development Tool use ADC10 else store 00 in the same location in 8051 find the GCF of two numbers in 8051 find the average of 10 numbers in 8051 generate Fibonacci series in 8051 metal detector project microcontroller using IAR Embedded Workbench program for Elevator Interface in 8051 program for Stepper motor interface in 8051 spectrum analyser square wave in 8051 triangle wave in 8051 voice recognition security system

Sites U missed

Hint

Open Pictures in new page by right click on it, if it is not shown full image.