ece 511 project report v6jkaps/courses/ece511-f14/project/...ece 511 project report anti-stupid car...

12
ECE 511 Project Report Anti-Stupid Car Submitted by GROUP 11 Jonathan Mitchell Brandon Beall Divid Chawla Abstract The purpose of the project was to design a simple remote control car that is able to prevent itself from impacting stationary objects while in movement. This is both a fun project and provides a useful test platform for obstacle avoidance schemes. The car is based on a cheap off the shelf 4 wheeled body that was augmented with our own motor controllers and sensors for movement and obstacle detection. In addition a wireless RF remote using an analog 2-axis joystick was created to user input. All components have been individually tested and working. The RF link, Joystick, and Motors have all successfully been integrated and tested.

Upload: others

Post on 20-Apr-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ECE 511 Project Report V6jkaps/courses/ece511-f14/project/...ECE 511 Project Report Anti-Stupid Car Submitted by GROUP 11 Jonathan Mitchell Brandon Beall Divid Chawla Abstract The

ECE 511 Project Report

Anti-Stupid Car

Submitted by GROUP 11

Jonathan Mitchell Brandon Beall Divid Chawla

Abstract

The purpose of the project was to design a simple remote control car that is able to prevent itself

from impacting stationary objects while in movement. This is both a fun project and provides a

useful test platform for obstacle avoidance schemes. The car is based on a cheap off the shelf 4

wheeled body that was augmented with our own motor controllers and sensors for movement and

obstacle detection. In addition a wireless RF remote using an analog 2-axis joystick was created

to user input. All components have been individually tested and working. The RF link, Joystick,

and Motors have all successfully been integrated and tested.

Page 2: ECE 511 Project Report V6jkaps/courses/ece511-f14/project/...ECE 511 Project Report Anti-Stupid Car Submitted by GROUP 11 Jonathan Mitchell Brandon Beall Divid Chawla Abstract The

Table of Contents

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

Motivation....................................................................................................................................... 3

Solution........................................................................................................................................... 3

Components .................................................................................................................................... 4

Remote ........................................................................................................................................ 4

Joystick ................................................................................................................................... 4

RF TX Link............................................................................................................................. 5

Car............................................................................................................................................... 6

Sensor - HC-SR04 Ultrasonic Sensor:.................................................................................... 6

RF RX Link............................................................................................................................. 7

Chassis and Motors ................................................................................................................. 7

Motor Controllers.................................................................................................................... 8

Results and Conclusion................................................................................................................... 8

Appendix A: Team Member Tasking ............................................................................................. 9

Jon Mitchell ................................................................................................................................ 9

Brandon Beall ............................................................................................................................. 9

Divid Chawla .............................................................................................................................. 9

Appendix B: Parts List.................................................................................................................... 9

Appendix C: Schematic ................................................................................................................ 10

Appendix D: References ............................................................................................................... 12

Table of Figures

Figure 1 - High Level Block Diagram showing both the Remote and Car major components...... 3

Figure 2 - Close-up of the remote control....................................................................................... 4

Figure 3 - Joystick Voltage Divider................................................................................................ 4

Figure 4 - Joystick Quadrant Mapping ........................................................................................... 5

Figure 5 - RF Transmitter ............................................................................................................... 5

Figure 6 - HC-SR04 SENSOR........................................................................................................ 6

Figure 7 - Timing Diagram (Elec Freaks)....................................................................................... 6

Figure 8 - RF Receiver.................................................................................................................... 7

Figure 9 - Chassis and motors......................................................................................................... 7

Figure 10 - Motor Controller .......................................................................................................... 8

Figure 11 - Remote Schematic Diagram....................................................................................... 10

Figure 12 - Car and Sensor Schematic.......................................................................................... 11

Page 3: ECE 511 Project Report V6jkaps/courses/ece511-f14/project/...ECE 511 Project Report Anti-Stupid Car Submitted by GROUP 11 Jonathan Mitchell Brandon Beall Divid Chawla Abstract The

Motivation

The primary motivation for this project was that it is always fun to make something that moves. There is just a little extra satisfaction when done with a project being able to see it physically move in front of you. The problem is when someone else plays a little too rough with it crashing into objects. This brings the secondary motivation, a means to avoiding a crash! This has multiple uses from just a toy that can save itself from even the most torturous kid, to full size cars and other autonomous robots being able to avoid obstacles.

Solution To solve this problem we had to create a remote and car, then pimp out our ride with a sensor suite to protect it from inattentive operators. A high level block diagram of this is shown in Figure 1. Starting with the remote, a small 2-axis analog thumb joystick interfaces with the smallest MSP430 Launchpad we could find. This created a small remote that easily fits in ones hands. To allow the remote to communicate with the car, a UART based RF transmitter was added to the remote to create a serial bridge to the Car. The car has a UART based RF receiver that interface to a larger MSP430 Launchpad so that we had extra outputs and timers available. The cars MSP430 also takes the input from the acoustic range finder sensors. This is a timed delayed pulse that represents the time it takes for a tone to bounce off an object and return. Finally there are two dual motor H-Bridge controllers to allow the MSP430’s PWM control to power four different motors, two on each side.

Figure 1 - High Level Block Diagram showing both the Remote and Car major components

Joystick MSP430 MSP-EXP430G2

RF - TX 2x Analog

1.5V Max

UART

MSP430 MSP-EXP430F5529LP

Remote

Car

Sensors RF - RX

DC Motor H-Bridge H-Bridge DC Motor

2x PWM 2x PWM

Timed

Pulse

UART

3V 3V

Page 4: ECE 511 Project Report V6jkaps/courses/ece511-f14/project/...ECE 511 Project Report Anti-Stupid Car Submitted by GROUP 11 Jonathan Mitchell Brandon Beall Divid Chawla Abstract The

Components

Remote

The remote shown in Figure 2, shows the analog joystick mounted on the smaller MSP430 Launchpad.

Figure 2 - Close-up of the remote control

Joystick The Joystick is a 2-axis analog user input, moving the joystick actually moves two variable resistors built into it. All the way up is the most resistance, all the way down is a complete short circuit. The same is true for left and right. To interface with the MSP430 two analog inputs are used with them configured to use the 1.5V internal reference as full scale. They are measured using the ADC consecutive read function so that the two values are captured as close in time as possible. During the reading process the processor is put into low power mode 0 during the ADC collection. A voltage divider, as shown in Figure 3, is employed to convert the varying resistor to a varying voltage that changes between 0 and 1.5Volts. With the variable resistor in the joystick covering a range of 10KΩ down to 0 ohms, a 12 KΩ resistor was used to provide a maximum output of 1.5V when a 3.3 Volt supply is used. This does not create an even split in the 1.5V range, center is ~1 Volt since the joystick reads ~5 KΩ. This is calculated with the following equation:

( ) joystick

joystick

RRk

Vout ∗+

=12

3.3

To get a consistent range the data is bit shifted to the right in the following manor. If the input voltage is less than 1V then it is shifted 1 bit in all other cases 0.5 Volts is subtracted to get the data centered in a 1 volt range. The input data is a maximum of 10 bits long, to decrease the sensitivity the data is bit shifted to the right by 5 bits, reducing the overall result to 5 bits. This leaves the maximum value at 31, but because we shifted the data to the lower 2/3’s of the range, the max value should be, and is limited to 20. Dropping the lower 5 bits of the data removes the error associated with the joystick self return to center that is not always consistent. The only down side is the speed is limited to a total of 20 steps, including both forward and backward and left and right.

Figure 3 - Joystick Voltage Divider

Page 5: ECE 511 Project Report V6jkaps/courses/ece511-f14/project/...ECE 511 Project Report Anti-Stupid Car Submitted by GROUP 11 Jonathan Mitchell Brandon Beall Divid Chawla Abstract The

Finally to convert the data from forward/backward and left/right to individual wheel speeds, a lookup table is employed. The joystick inputs are broken up into quadrants as shown in Figure 4, this allows for a smaller lookup table to be used and then modified slightly. For instance the difference between quadrant 1 and 2 are the left and right wheel commands are simply swapped. Then the difference from quadrant 1 and 4 or 2 and 3 is the motor directions are inverted. In the end, this creates fast processing of the analog inputs since no multiplication or division is used!

Figure 4 - Joystick Quadrant Mapping

RF TX Link

The RF Transmitter is a simple transmission device with only 4 pins:

1.) VCC (3.3V)

2.) Data In (UART)

3.) GND (Ground)

4.) Antenna

Figure 5 - RF Transmitter

The maximum distance, point to point, is roughly 500 feet, but this requires 12V of input into the

VCC. With 3.3V the maximum working distance was roughly 100 feet. It transmits at 4800 bps.

The data pin is connected to pin 1.1 on the MSP430. The software for this component is

designed to take the input from the joystick and send two byte packets containing the direction

and speed for the motors on each side of the car.

Page 6: ECE 511 Project Report V6jkaps/courses/ece511-f14/project/...ECE 511 Project Report Anti-Stupid Car Submitted by GROUP 11 Jonathan Mitchell Brandon Beall Divid Chawla Abstract The

Car

Sensor - HC-SR04 Ultrasonic Sensor: The ultrasonic sensors evaluate attributes of a target by interpreting the echoes from the sound waves. The HC-SR04 is a 4 pin sensors. 1. Vcc (+5V supply) 2. Trig (TTL input to trigger a measurement) 3. Echo (TTL output, pulse proportional to distance) 4. GND (Ground).

Figure 6 - HC-SR04 SENSOR

It has distance measuring range from 2cm to 450cm. The focus of the sensor is 15 degrees. In the project we use 4 ultrasonic sensors (2 in the front and 2 in the back) to have better obstacle detection coverage on both the sides. The module sends 10us pulse on Trig pin. In reaction to this, the sensor sends 8 sonic bursts to measure the distance. After sending the burst, sensor will raise the echo signal until it receives the echo back. That means the length of the echo signal corresponds to the time the burst was travelling forward and echoed back.

Figure 7 - Timing Diagram (Elec Freaks)

The sensor output signal (ECHO) on the HC-SR04 is rated at 5V. However, the input pin on the MSP430 is rated at 3.3V. Sending a 5V signal into that 3.3V input port could damage GPIO pins which is something we want to avoid. Hence, we use VOLTAGE DIVIDER to get the signal to 3.3V with 27K ohm and 15K ohm resisters in series.

The speed of sound is about 340 m per second (depends on temperature and air relative humidity). A good approximation is 29 us per cm (or 58 us per centimeter as it is for back and forward). Therefore, the distance of the obstacle is calculated by the formula Distance= (Duration/2)/29 where duration is the total time taken by a signal to reach to the echo pin.

Page 7: ECE 511 Project Report V6jkaps/courses/ece511-f14/project/...ECE 511 Project Report Anti-Stupid Car Submitted by GROUP 11 Jonathan Mitchell Brandon Beall Divid Chawla Abstract The

RF RX Link

The RF Reciever is a simple receiving device with 8 pins:

1.)GND (Ground)

2.)Digital Output

3.)Linear Output

4.)VCC (3.3V)

5.)VCC (3.3V)

6.)GND (Ground)

7.)GND (Ground)

8.)Antenna

Figure 8 - RF Receiver

The digital output pin is connected to pin 3.4 on the MSP430. The software for this component

uses an interrupt to see when the UART buffer has contents in it. If there is something in the

buffer, it is parsed. The parsing decides which motor is to be controlled, how fast is should go,

and in which direction. Once this has been decided the proper function call is performed.

Chassis and Motors The chassis is an off the shelf metal car that comes complete with 4 motors and a battery pack installed shown in Figure 9. Since all 4 wheels have motors and gear boxes there is too much resistance to only drive the front or rear pair of motors so we needed to drive all 4 wheels. This was not too bad since we could just duplicate the motor driver and share the control lines between the motor controllers. The motors are rated for 3.3V continuous operation, so we are limiting the PWM voltage to 3.3V so that for 100% duty cycle there is no concerns.

Figure 9 - Chassis and motors

Page 8: ECE 511 Project Report V6jkaps/courses/ece511-f14/project/...ECE 511 Project Report Anti-Stupid Car Submitted by GROUP 11 Jonathan Mitchell Brandon Beall Divid Chawla Abstract The

Motor Controllers The motor controllers, pictured in Figure 10, require a pair of PWM control signal for each motor channel. One signal is for forward and the other is reverse. If both lines are high at the same time the controller goes into a breaking mode when it restricts the motors spinning. In our project this function is not used, so when direction is changed the control line associated with the direction not traveled is pulled low before the direction of travel is selected. To generate the PWM signal the internal Timer A0 is used in count up mode and four capture and compare registers are used to generate the actual signal. These pins are configured in the reset/set mode so that as the timer counts up it resets when it hits the value set in the control register.

Figure 10 - Motor Controller

Results and Conclusion All parts are individually working, however currently only the RF link, Joystick and Motors were able to be fully integrated. Thus the project runs perfectly when the ultrasonic sensor logic is disabled. The motors move in the proper direction when compared to the input of the joystick, and the response time is what is expected from the RF receiver transmitter pair. The biggest problems were encountered during integration of all the subcomponents code. This is the biggest take away from this project is that the overall integration isn’t always as simple and more time should be devoted to this section. In conclusion this project has let the group learn more intimately how to address built in peripherals on a microcontroller, such as timers, ADC, and UART as well as I/O pins.

Page 9: ECE 511 Project Report V6jkaps/courses/ece511-f14/project/...ECE 511 Project Report Anti-Stupid Car Submitted by GROUP 11 Jonathan Mitchell Brandon Beall Divid Chawla Abstract The

Appendix A: Team Member Tasking

Jon Mitchell

Jon was in charge of the analog Joystick control input, the motor PWM control and the lead for the final assembly of the platforms hardware and schematics.

Brandon Beall

Brandon was in charge of the RF link, both RX and TX as well as the final integration of everyone’s code and aided in the assembly of the platform hardware.

Divid Chawla

Divid was in charge of the acoustic sensors and aided in the assembly of the platform hardware.

Appendix B: Parts List

Part # Description QTY Vendor

COM-09032 Thumb Joystick 1 Sparkfun

271-312 Assorted Resistors 1 Radio Shack

RB-Dag-83 Multi-Chassis 4WD Robot Kit 1 RobotShop WRL-10532 RF Link Receiver 1 Sparkfun WRL-10534 RF Link Transmitter 1 Sparkfun RB-Ite-54 HC-SR04 Ultrasonic Range Finder 1 RobotShop RB-Pol-189 Pololu DRV8833 Dual Motor Controller 2 RobotShop

MSP-EXP430G2 Small MSP430 LaunchPad dev board 1 Digikey MSP-EXP430F5529LP Large MSP430 LaunchPad dev board 1 Digikey RB-Pol-218 3.3V 600 mA DC-DC Regulator 2 RobotShop LM78M05 5V Linear Regulator 1 Digikey

Page 10: ECE 511 Project Report V6jkaps/courses/ece511-f14/project/...ECE 511 Project Report Anti-Stupid Car Submitted by GROUP 11 Jonathan Mitchell Brandon Beall Divid Chawla Abstract The

Appendix C: Schematic

Figure 11 - Remote Schematic Diagram

Page 11: ECE 511 Project Report V6jkaps/courses/ece511-f14/project/...ECE 511 Project Report Anti-Stupid Car Submitted by GROUP 11 Jonathan Mitchell Brandon Beall Divid Chawla Abstract The

Figure 12 - Car and Sensor Schematic

Page 12: ECE 511 Project Report V6jkaps/courses/ece511-f14/project/...ECE 511 Project Report Anti-Stupid Car Submitted by GROUP 11 Jonathan Mitchell Brandon Beall Divid Chawla Abstract The

Appendix D: References

Texas Instruments, March 2014, MSP-EXP430G2 LaunchPad Evaluation Kit User’s Guide

[PDF]. Available: http://www.ti.com/lit/ug/slau318e/slau318e.pdf

Texas Instruments, June 2014, MSP-EXP430F5529LP LaunchPad Development Kit User’s

Guide [PDF]. Available: http://www.ti.com/lit/ug/slau533b/slau533b.pdf

Texas Instruments, Revised May 2013, MSP430G2x53, MSP430G2x13 Mixed Signal

Microcontroller (Rev. J) [PDF]. Available: http://www.ti.com/lit/ds/symlink/msp430g2553.pdf

Texas Instruments, Revised May 2013, MSP430F551x, MSP430F552x Mixed Signal

Microcontroller (Rev. L) [PDF]. Available: http://www.ti.com/lit/ds/symlink/msp430f5529.pdf

The following demonstration code was used as reference from CCS compiler:

- MSP430F552x Demo - Timer0_A5, PWM TA1.1-2, Up Mode, DCO SMCLK

- MSP430G2x33/G2x53 Demo - ADC10, DTC Sample A2-0, AVcc, Single Sequence,

DCO

- MSP430F552x Demo - USCI_A0, 9600 UART, SMCLK, LPM0, Echo with over-

sampling

Elec Freaks, Ultrasonic Range Module HC-SR04 [PDF]. Available:

http://www.micropik.com/PDF/HCSR04.pdf