EEL 4924 Electrical Engineering Design (Senior Design ... · PDF fileEEL 4924 Electrical...

21
1 EEL 4924 Electrical Engineering Design (Senior Design) Project Final Design Report 22 April 2013 Project Title: Touch Path Vehicle Team Members: Name: Willie Leung Name: Naman Patel Abstract: Our project consists of a touchscreen display and a RC car. Users will be allowed to draw a path on the touchscreen and the car will execute this path as close as possible. We will be using two microcontrollers, one for the touchscreen and one for the car. We will be building the electrical parts of the car ourselves which will include two brushed motor for going forward and back as well as to operate the steering. The touchscreen will send commands to the car using XBee through the UART interface. The X-Bee on the RC Car will receive these data and send it to Microcontroller on the PCB located on RC car. Microcontroller will decode the data and send information to motors to control the Car.

Transcript of EEL 4924 Electrical Engineering Design (Senior Design ... · PDF fileEEL 4924 Electrical...

1

EEL 4924 Electrical Engineering Design

(Senior Design)

Project Final Design Report

22 April 2013

Project Title:

Touch Path Vehicle

Team Members:

Name:

Willie Leung

Name:

Naman Patel

Abstract:

Our project consists of a touchscreen display and a RC car. Users will be allowed to draw a path

on the touchscreen and the car will execute this path as close as possible. We will be using two

microcontrollers, one for the touchscreen and one for the car. We will be building the electrical

parts of the car ourselves which will include two brushed motor for going forward and back as

well as to operate the steering. The touchscreen will send commands to the car using XBee

through the UART interface. The X-Bee on the RC Car will receive these data and send it to

Microcontroller on the PCB located on RC car. Microcontroller will decode the data and send

information to motors to control the Car.

2

Table of Content:

Abstract.........................................................................................................................1

Applications...................................................................................................................3

Features and Technical Information..............................................................................4

Detailed Block Diagram.................................................................................................7

Software Description......................................................................................................9

Part List.........................................................................................................................11

Problems.......................................................................................................................13

Conclusions...................................................................................................................15

Altium Diagrams............................................................................................................16

Figures:

LCD/Touch Screen..........................................................................................................5

Vehicle.............................................................................................................................6

Charging Circuit...............................................................................................................6

Block Diagram LCD.........................................................................................................7

Block Diagram Vehicle....................................................................................................8

Flowchart LCD................................................................................................................9

Flowchart Vehicle............................................................................................................10

Encoder Design...............................................................................................................13

H-Bridge Schematics.......................................................................................................16

Vehicle Schematics.........................................................................................................17

Vehicle_H-Bridge PCB.....................................................................................................18

Charging Circuit Schematics...........................................................................................19

Charging Circuit PCB......................................................................................................19

LCD/Touchscreen Schematics......................................................................................20

LCD/Touchscreen PCB.................................................................................................21

3

Applications:

Our project has applications in fields where a robot must travel down a specific path

designated by the user. For example, a mine field where a robot must travel around a certain path

in order to find hidden mines. Or a search and rescue mission where there is only one specific

path leading to the person or thing needing to be extracted.

For entertainment purposes, a color pen or marker can be fit into the car to draw the path

on plain paper. It will obviously not be replacement for the human art or preciseness of human

hands.

After some searching we did uncover a similar project online. They too planned to have a

RC car follow a path determined on a touchscreen. However, they communicated between the

two with regular RF transmit receive pairs. We plan on using XBee for faster transmit speeds.

Also, the method in which to determine the angle between points on the touch screen will be

different.

4

Features and Technical Information

The basic structure of our project is a LCD combined with a resistive touch panel

controlling a two wheeled differential vehicle some distance away.

LCD:

The main objective of the LCD/touch panel is to convert touch screen input into an

instruction for the vehicle. We have to collect touch screen inputs and convert this data into a

coordinate system in which we calculate the correct angles to turn. Microprocessor will be

connected to the touch panel through four pins. These pins have to be correctly toggled between

ground, VCC, ADC input and floating to correctly read the X and Y positions of a touch. A TI

chip was better suited for this because of their ability to switch pins to act as different functions

as required.

In order to obtain the correct angle to turn, we calculate the X and Y distances between

two neighboring points and use the arctangent function to get an angle between the points. We

then scale this, add some error corrections, and make a minimum threshold so we only turn as

much as necessary. Finally, the angle to turn is sent over UART to the xbee to be transmitted to

the vehicle along with the distance to travel which is simply the distance between the two points

on the screen scaled to about 3cm per 5 distances.

Vehicle:

The vehicle receives angle and distance using X-Bee. Atmega644 is used to analyze this

data. The angle received is compared to north and converted to a relative location the vehicle can

use. Some basic Trigonometry and Geometry concepts were used to achieve this conversion.

After calculating turning angle, vehicle starts to turn that angle using differential wheels

and a compass module connected to Atmega644. Wheel encoders were used to turn fast to get

close to the correct angle and then compass module was used to achieve angle accuracy. The

compass module refreshes data at rate of 10 Hz so the slow turning was necessary to prioritize

accuracy over speed. Once vehicle has turned at the correct angle, it will calculate the distance

that has to be moved. Wheel encoders are used to control the amount of distance vehicle has

moved since the distance may vary according to battery level. Once the desired distance has been

achieved, vehicle will wait for next set of data.

We have a couple of different modes for the vehicle: manual, fast, and accurate. We can

control the vehicle directly like an RC car using the LCD/touch panel in manual mode. In fast

mode, we disable the compass and turn only based on the encoders; its inaccurate but very fast

turning. Finally, we enable the compass to have much more accurate turning accurate mode; it

might be very slow, but is very accurate. We also have a sonar that stops the vehicle when theres

an obstacle in the way.

Charger:

5

We are using two NiMH batteries to power the LCD/touch panel and vehicle. In order to

save money buying batteries over and over, we made an intelligent fast charger. The charger will

charge the batteries at ~500mA and will switch over to trickle charge mode when the battery is

almost full. This way, the battery is charged quickly and will not lose charge when full.

6

7

Detailed Block Diagrams:

8

9

Software Description:

10

11

Part List:

Part Name Part Number Quantity Price

Microprocessor TMS320F28035 1 $12.00

Microprocessor Atmega644 1 Samples

LCD NHD-320240WG

1 $73.50

LCD CFAH1602Z-YYH-ET

1 Samples

Touch Panel TS-

320240BRNO

1 $16.50

Compass Module

HMC6352 1 $35.95

Sonar MB 1240 1 $39.99

Wheel Encoder --------------- 2 $14.95

XBee WRL-08664 2 $19.99

N-Channel MOSFET

IRF640 4 Lab

P-Channel MOSFET

IRF9540 4 Lab

5V voltage regulator

LM2940 2 Lab

3.3V voltage regulator

LM3940 2 Lab

Brushed Motor ------------- 2 $9.99

7.2V battery ------------- 1 $10.00

6V battery ------------- 1 $9.00

BJT Lab

12

Resistor 100K 8 Lab

Capacitor 2.2uF 5 Lab

Capacitor 1uF 1 Lab

Comparator 1 $0.50

12V adapter 12V/1A 1 $8.00

PCB 1 2 $33.00

Total Cost: $361.38

If all the parts were bought in bulk, the cost of the project would reduce to $187.32 per unit.

13

Problems and how we solved them:

1.

•At the beginning, we were relying on timing to calculate the distance and the turning angle, but

after the first week of controlling the car, we realized that the motor was not outputting

symmetric torque all the time.

• The output of the motor changed as battery life went down. The weight of the different parts

loaded on the car was also affecting it.

•Solution: We decided to use encoders to calculate the distance traveled by car. This would give

us better accuracy, but we noticed that the tires were slipping so we were not getting reliable

result at a longer run.

•We equipped the car with compass module to detect any change in direction due to tire slip. The

compass module was also helpful in determining certain angles as the car turned.

2.

•Compass Module is connected to microprocessor using I2C interface

•I2C Data transfer was not performing as expected.

•I2C data transmission from microprocessor (master) to Compass (slave) was as expected but

data received from slave was not accurate.

•Data received should be heading angle in two separate bytes. Compass was only giving one byte

reading to microprocessor.

•Problem was solved by using oscilloscope, LSA and various software manipulation techniques.

14

Problem was found to be related to not sending acknowledgement bit to slave after receiving first

byte of data.

3.

•Another issue we noticed was compass module being not reinitialized after resetting power

supply. Three days were spent debugging the problem.

•We came to know that initialization of compass module needed some delay before it starts

working. 1-second delay was added and compass started working.

•LCD, X-Bee and software techniques learned from previous problem were used to debug this

issue.

4.

One of the limitations of a resistive touch screen is its unstable measurements when pressed too

lightly. To help leverage this, we are sampling multiple times per detected push and taking an

average.

5.

X-Bee communication was not consistent. After large set of data, we would lose one byte of data

in communication and this would cause vehicle to freeze. After changing some parameters of

the X-Bee, it seems to solve the problem. We also made a non-standard baud rate to achieve 0%

error in baud rates after scaling the speed of the processors.

15

Conclusion

Overall, we achieved what we wanted for the project. The accuracy of the turning could

be fine-tuned some more and the LCD/touch panel could be make more friendly looking, but the

more important electrical parts seem to be working well. For something not too overly

complicated, it sure took many sleepless nights, but some parts of us do agree that this was the

best hands on experience we had in school. If it weren’t for the pressure of not graduating, we

could almost say it was a fun class.

In conclusion, we felt like this was a good experience as to what being an engineer is all

about. Also, we learned that we had little to no concept of how to make things move like we

wanted to--but good thing that is a job for mechanical engineers and not us. If there’s one thing

that we learned the best it’s that there’s always going to be some kind of problem that we did not

account for and in order to fix it under the allowed time constraints, we had to compensate for

something else. But, that is what Engineering is all about after all.

16

17

18

19

20

21