F14: Team5-Self Driving Car - AUG

From Embedded Systems Learning Academy
Revision as of 06:31, 16 December 2014 by Proj user12 (talk | contribs) (Issue 1)

Jump to: navigation, search

Self Driving Car

Fig 2. Build in Progress

Abstract

Objective and Scope

Team Members & Responsibilities

  1. Sensor Controller (2 Members) - [Bailey Wu, Rishabh Sareen]
  2. Motor Controller (2 Members) - [Abraham Ruiz, Sree Harsha, Arpit Amin]
  3. I/O Unit (2 Members) - [Yoni Klein, Tejeswar]
  4. Communication Bridge + Android (3 Members) - [Shaw Ken Chang, Arnold Bajet Jr., Thomas Pantels]
  5. Geographical Controller (3 Members) - [Himanshu Saini, Divya Kamath]
  6. Master Controller (3 Members) - [Akash Ayare, Sree Harsha, Karthik Vadiraja]

Introduction

Schedule

Geographical Controller

Sl. No Start Date End Date Task Status Actual Completion Date
1 1-Oct-2014 14-Oct-2014 Order Components and Make a schedule Completed 14-Oct-2014
2 8-Oct-2014 14-Oct-2014 Decide commands that Geographical Controller will support Completed 14-Oct-2014
3 7-Oct-2014 14-Oct-2014 Complete CAN RX task and subscription handling. Verify communication with other controllers Completed 21-Oct-2014
4 14-Oct-2014 24-Oct-2014 Interface GPS module and Compass and develop drivers if needed Completed 28-Oct-2014
5 24-Oct-2014 30-Oct-2014 Design and develop algorithm to calculate heading and bearing from GPS coordinates Completed. 30-Oct-2014
6 24-Oct-2014 5-Nov-2014 Work on calibration of compass and heading calculation In Progress
7 1-Nov-2014 10-Nov-2014 Test with the central and Bluetooth controller communication works. Working on steering algorithm in central using geo data
8 10-Nov-2014 25-Nov-2014 Begin testing with fully assembled car In Progress
9 25-Nov-2014 10-Dec-2014 Final Testing and changes as needed


Sensor Controller

Sl. No Start Date End Date Task Status Actual Completion Date
1 10/3/2014 10/10/2014 Order ultrasonic sensor parts and develop simple test code for the sensors Done 10/10/2014
2 10/10/2014 10/17/2014 Wire the ultrasonic sensors, develop and implement the sensors using analog to digital converter Done 10/17/2014
3 10/17/2014 10/24/2014 Collaborate with the other sub teams to finish the CAN bus communication and allow the self driving car to drive autonomously Done 10/24/2014
4 10/24/2014 11/1/2014 Develop, implement and test the ultrasonic sensors using the pulse width modulation and universal asynchronous receiver/transmitter Done 11/1/2014
5 11/2/2014 11/9/2014 Develop, implement and test the front and back infrared sensors using analog to digital converter Done 11/9/2014
6 11/10/2014 11/17/2014 Develop, implement and test the current/voltage sensor for the battery packs of the self driving car using I2C Scheduled Removed
7 11/18/2014 11/25/2014 Collaborate with the other sub teams to make sure that the sensors are in working condition Done 11/25/2014
8 11/26/2014 12/5/2014 Collaborate with the other sub teams to debug any problems that may encountered Done 12/5/2014
9 12/6/2014 12/13/2014 Prepare for Demo Scheduled


IO Controller

Sl. No Start Date End Date Task Status Actual Completion Date
1 10/7/2014 10/14/2014 Research and order LCD appropriate for this project Finished 10/11/2014
2 10/7/2014 10/17/2014 Implement CAN RX/Subscription task Finished 10/13/2014
3 10/7/2014 10/17/2014 Finalize Task Architecture In Progress
4 10/18/2014 10/21/2014 Interface and test LCD Finished 10/20/2014
5 10/21/2014 10/28/2014 Implement special button features
6 10/21/2014 10/28/2014 Implement auto scrolling feature
7 10/28/2014 11/4/2014 Design LCD UI with buttons


Communication Bridge + Android

Sl. No Start Date End Date Task Status Actual Completion Date
1 16-Sep-2014 23-Sep-2014 Test bluetooth module using computer serial port and an android app(simple bluetooth terminal app downloaded from google play). Test the real life range and stability of the bluetooth module (HC-06). Modify the bluetooth chat example to work with the bluetooth module. Done 20-Sep-2014
2 28-Sep-2014 12-Oct-2014 Draw UI design layouts for a basic android application that can view Google map as well as send GPS data through bluetooth by clicking on the map. Study google maps API and make a simple app that will post a short toast that shows the GPS location after a long press event. Done 12-Oct-2014
3 7-Oct-2014 11-Oct-2014 Interface bluetooth module with SJSUOne board and able to verify that the connection is stable and that transaction via the bluetooth is accurate. This is done by adding a test button where if you press the button it send a command to the board. After receiving the command, the board should react with a response (LED light and/or text response to the android phone) Done 19-Oct-2014
4 11-Oct-2014 19-Oct-2014 Integrate Google Maps and Bluetooth component together in Android app. After a long press on the map, the user should be prompted to start the car and set the location as the places the user selected. Add a textView to display the location selected by pressing on the map. Add a button for sending location to the car. Done 27-Oct-2014
5 19-Oct-2014 26-Oct-2014 CAN infrastructure implmentation: Use our team's common CAN infrasturcture code and modify it specifically for our controller. First created the CAN communication table and then modify the infracturacture code to implement the broacasting as well as filtering of neccessary data. This only focuses on broadcasting a stop/start command and the destination GPS data (set by android) as well as getting car's current location data from the geological controller. Done 07-Nov-2014
6 26-Oct-2014 1-Nov-2014 Test and implement car information reading as well as other functions of Android app In Progress
7 2-Nov-2014 4-Nov-2014 Iterate UI design In Progress
8 5-Nov-2014 16-Nov-2014 Implement 2nd UI design In Progress


Motor Controller

Sl. No Start Date End Date Task Status Actual Completion Date
1 10/1/2014 10/8/2014 PWM2 (used to control motors) and PWM3 (used to control servo) interface with the car servo and motor. Write a test code to operate the servo and motor from the terminal command. Completed and Tested 10/11/2014
2 10/9/2014 10/18/2014 Design and code CAN receive task for subscription. Check for basic CAN message commands for throttle and steer control. Completed and tested 10/26/2014
3 10/19/2014 10/28/2014 Design the CAN message table for motor control and servo control Completed and tested 10/26/2014
4 10/29/2014 11/07/2014 Design acceleration Vs steer control function for smooth run. Check for other factors involved. Completed and tested 11/22/2014
5 11/08/2014 11/14/2014 Research on RPM sensor. Interface the RPM sensor to calculate the Speed. Test the RPM sensor by running the car at different speed Completed and tested with a hall sensor 11/22/2014
6 11/15/2014 11/21/2014 Fine tune motor control code and integrate with all the controllers for proper working. Completed and tested 11/22/2014
7 11/22/2014 11/28/2014 Test and check if more features can be added to improve performance. Completed and tested Completed and tested 11/28/2014
8 11/29/2014 12/05/2014 Testing and Debugging. Completed and tested 12/05/2014
9 12/06/2014 12/18/2014 Final Testing and getting the car ready for Demo. On Going

Central Controller

Sl. No Start Date End Date Task Status Actual Completion Date
1 16-Sep-2014 23-Sep-2014 Develop API for CAN bus communication. Done 23-Sep-2014
2 11-Oct-2014 15-Oct-2014 Develop communication table for all controllers. In Progress
3 15-Oct-2014 20-Oct-2014 Broadcast message and target message setup. In Progress
4 21-Oct-2014 28-Oct-2014 Co-ordinate all controllers and take major decisions. Planned
5 28-Oct-2014 11-Nov-2014 Complete Building and fine-tuning of RC car. Planned
6 21-Oct-2014 11-Nov-2014 Develop coordination mechanism to ensure controllers are initialized and ready In Progress
7 21-Oct-2014 28-Oct-2014 Develop kill switch In Progress
8 14-Oct-2014 21-Oct-2014 Build external power distribution circuit Done 21-Oct-2014
9 28-Oct-2014 04-Nov-2014 Coordination algorithm between steering and throttle for smooth turns Planned
10 04-Nov-2014 11-Nov-2014 Collision avoidance and cliff detection algorithms Planned
11 04-Nov-2014 11-Nov-2014 Intermediate unit and functional tests Planned
12 21-Oct-2014 4-Nov-2014 Initialize all boards with GPS-time Planned
13 11-Nov-2014 25-Nov-2014 Functional tests and algorithm adjustments Planned
14 25-Nov-2014 02-Dec-2014 Fine tuning and stretch goals (headlights, parallel parking, etc.) Planned
15 02-Dec-2014 09-Dec-2014 Prepare for demo Planned

Parts List & Cost

Qty Description Manufacturer Part Number Total Cost
3 LV-MaxSonar-EZ1 High Performance Ultrasonic Rangefinder MaxBotix Inc MB1010 49.90
1 Analog Distance Sensor Sharp Free

Backup Parts & cost

Qty Description Manufacturer Part Number Total Cost

Design & Implementation

Motor Controller

Summary

This module takes command input from central controller and steers the car to its destination; in addition, It has two main controlling parameters : Throttle and Steering. Throttle input moves the car forward and backward. Steer input turns the wheel left and right. The central controller takes feedback from the sensors and makes decision to move the car. Accordingly, it sends CAN commands accepted by the motor controller for navigation, and real time RPM signal to the controller.

Working

The car initially accepts the start command to begin navigation. Commands can then come to move the car forward or backward, steer left or right depending on intelligent decisions made by the central controller. The motor control has intelligence to avoid jerks and ensure smoother transitions between commands.

Kill switch

The remote control and receiver module pair up to provide a signal coverage of more than 100 meters. We make use of this to design our kill switch. When a constant PWM signal of 1000us is received from the remote, the car is in 'ARMED' state and moves the car according to CAN commands. The user has to hold the trigger gun for this state constantly and the car moves. When the user releases the trigger gun, the car stops receiving the PWM signal of 1000us and the car goes to 'DISARMED' state. In short, pull the trigger gun - ARMED, release the trigger gun - DISARMED.

RPM

The RPM sensor is based on a hall sensor switch which detect the North and South pole of a magnet located in the main shaft in the car. The hall sensor part number is 3177, and it has three pin. This sensor is uni-polar which give an output high signal when the sensor captures the North pole of the magnet; subsequently, the sensor give output low signal when the sensor captures the South pole of the magnet. Therefore, by using a the 3177 and a magnet in the shaft. the SJOne board can capture the output signal from the hall sensor as it toggles per shaft revolution. It is important to notice that the output signal of the 3177 is an open collector; therefore, we need a 10 Kohm resistor connected to Vcc. The following table shows the pinout of the 3177:

3177 Pinout
Pin Description Connected to
1 Vcc ( 4.5 V to 18 V) SJONE P1_22
2 Ground SJONE Ground
3 Output SJONE P1_22 with a 10 KOhm


The following Block diagram shows an overview of the connection between the SJOne board, ESC, and the Hall sensor:


Controller Communication Table

Controller ID Table
Controller ID Controller
0x01 Master Controller
0x02 Geographical Controller
0x03 Motor Controller
0x04 Sensor Controller
0x05 IO Controller
0x06 Communication (Bluetooth Bridge/Android App) Controller
Central Controller Communication Table
Sl. No Message Number Purpose Data layout
1 0x501 Send Throttle and steering to motor throttle

steering

2 0x502 Start car
3 0x503 Stop car
4 0x101 Broadcast request revision
5 0x102 Broadcast Set time
6 0x103 Request TX count (broadcast)
7 0x104 Request RX count (broadcast)
8 0x105 Send TX count (LCD)
9 0x106 Send RX count (LCD)
10 0x107 All controllers initialize
Communication (Bluetooth Bridge/Android App) Controller Communication Table
Sl. No Message Number Purpose Data layout
1 0x301 Broadcast Start command
2 0x302 Broadcast Stop command
3 0x303 Broadcast GPS destination set by Android byte [0-3] : (float), Longitude

byte [4-7] : (float), Latitude

Sensor Controller Communication Table
Sl. No Message Number Purpose Data layout
1 0x501 Broadcast front sensors values byte[0]: Right ultrasonic sensor value in inches

byte[1]: Front ultrasonic sensor value in inches

byte[2]: Left ultrasonic sensor value in inches

byte[3]: Front bottom infrared sensor value in inches

2 0x502 Broadcast back infrared sensor value byte[0]: Back infrared sensor value in inches
3 0x503 Broadcast battery sensor value byte[0]: current/voltage sensor value in percentage
4 0x504 Broadcast light sensor value byte[0]: light sensor value as integer
5 0x505 Broadcast tilt sensor value byte[0]: X-Axis tilt sensor value as integer

byte[1]: Y-Axis tilt sensor value as integer

byte[2]: Z-Axis tilt sensor value as integer

Motor/Servo Controller Communication Table
Sl. No Send Code Description Data
1 0x201 Heartbeat data Controller id 1 byte
2 0x201 Heartbeat data Controller id 1 byte
3 0x201 Heartbeat data Controller id 1 byte
4 0x202 Mem info data Sys-mem remaining 4bytes
5 0x501 RPM data send RPM (2 bytes)
6 0x502 Speed data send Speed (2bytes)
Sl. No Receive Code Description Response
1 0x300 Kill Receive only
2 0x301 Stop Receive only
3 0x302 Straight Receive only
4 0x307 move forward 25% Receive only
5 0x30C move forward 50% Receive only
6 0x311 move forward 75% Receive only
7 0x315 move forward 100% Receive only
8 0x31A move backward 25% Receive only
9 0x31F move backward 50% Receive only
10 0x324 move backward 75% Receive only
11 0x329 move backward 100% Receive only
12 0x334 Steer right 25% Receive only
13 0x339 Steer right 50% Receive only
14 0x33E Steer right 75% Receive only
15 0x343 Steer right 100% Receive only
16 0x348 Steer Left 25% Receive only
17 0x34D Steer left 50% Receive only
18 0x352 Steer left 75% Receive only
19 0x357 Steer left 100% Receive only
Io Controller Communication Table
Sl. No Message Number Purpose Destination
1 0x301 Start command for car Central Controller
2 0x302 Stop command for car Central Controller
3 0x303 Go to a predefined Destination. Central Controller
Geographical Controller Communication Table
Message Number Message Type Purpose Data layout
0x0301 Get Geo Data Request for GPS Data (lat,long)
0x0302 " Request for current compass heading and destination heading
0x0304 " Request Time
0x0601 Response to 0x3xx request GPS Data (lat,long)
dword[0] : [32-bit latitude]
dword[1] : [32-bit longitude] 
0x0602 " Compass heading and destination bearing
dword[0] : [32-bit compass heading]
dword[1] : [32-bit destination bearing] 
0x0504 " Time
dword[0] : [32-bit time 0x00hhmmss]
0x0501 Periodic Message GPS data, broadcast periodically
dword[0] : [32-bit longitude]
dword[1] : [32-bit latitude]  
0x0502 " Current and destination heading broadcast periodically
dword[0] : [32-bit compass heading]
dword[1] : [32-bit bearing]

Testing & Technical Challenges

Sensors

The first challenge was the positioning and spacing between the sensors. The sensors were mounted on a 3D printed bracket for initial testing but the angle between the brackets seemed to cause interference and was not giving optimum values. The sensors were then individually mounted further apart to reduce interference. The detection distance was tweaked by trial and error and finally settled on the value of 36 inches for the front, left and right sensors and 7 inches for the back sensor.

The second challenge was dealing with erroneous values. Using ADC to interface sensors lead to certain erroneous values that didn't have the desired effect and after some testing, the sensor interface was changed to pulse width. This lead to more robust values after filtering.

Another challenge was the initial skewed alignment. It was difficult to detect whether the direction of the running car was changing because of the motor response to sensor values or the alignment of the tires. The group eventually decided to get a new car that rectified the alignment issue.

Motor Controller

Issue 1

As we were using Electric Speed Control (ESC) to control the speed of motor we faced issues based on inconsistency of the speed. This could have been solved easily if we used H-bridge chip. When ESC was supplied with particular PWM signal it would work at desirable speed but when turning off the ESC and turning on the ESC the speed would change for the same PWM signal supplied. This inconsistency of the speed can easily damaged the motor as it was hard to predict when the motor will switch from forward to backward motion. So to fix this issue we had to connect the ESC to oscilloscope and turn on the transmitter. As soon as the transmitter is turned on the transmitter send a fix signal to ESC for some time that could have been in milli seconds. By doing this the ESC get initialized and once the ESC has initialized the transmitter can send a signal to go forward or reverse.

So we wrote a code to initialize the ESC. Before we sends the signal to ESC to move forward or reverse we send a fix PWM signal to ESC for one second to initialize ESC and this signal was sent from the main function.

Issue 2

The servo that came with the RC car wasn't fast enough to respond to left and right movement of the car. Car would hit the obstacle and than the wheel would rotate in opposite direction. So we change the servo with faster response time.

Sl. No Test Case Test Description Result

Challenges and Learning

Future Enhancement

Sensors

It would be ideal to add another infrared sensor to the front lower portion of the car for cliff detection. It would also be good to have a bigger 3D printed bracket to mount the sensors that match our measurements requirements. This would add to the visual appeal and also reduce tangling mess due to the wires.

Conclusion

Project Video

Project Source Code

References

Acknowledgement

References Used

  1. Preetpal Kang, Lecture notes of CMPE 243, Computer Engineering, Charles W. Davidson College of Engineering, San Jose State University, Aug-Dec 2014.
  2. en.wikipedia.org/