Difference between revisions of "F16: Thunderbolt"
Proj user14 (talk | contribs) (→Android Application Design) |
Proj user14 (talk | contribs) (→Android Application Design) |
||
Line 1,451: | Line 1,451: | ||
==== Android Application Design ==== | ==== Android Application Design ==== | ||
− | + | <br> | |
The Android application is built to let the user control the RC car to navigate it between the current location and the destination. The App lets the user select the destination and then chooses the shortest path available between the current location up to the destination. <br> It plots checkpoints between the two locations and sends it to the Geographical controller, which calculates the distance and turn angle between the current location and the next checkpoint and send to the Master which controls the motor controller. <br><br> | The Android application is built to let the user control the RC car to navigate it between the current location and the destination. The App lets the user select the destination and then chooses the shortest path available between the current location up to the destination. <br> It plots checkpoints between the two locations and sends it to the Geographical controller, which calculates the distance and turn angle between the current location and the next checkpoint and send to the Master which controls the motor controller. <br><br> | ||
Below are the buttons on the Android application that are available to the User | Below are the buttons on the Android application that are available to the User | ||
− | + | * '''ACTIVATE BLUETOOTH''' - User is prompted to Turn on Bluetooth on the phone. User can "allow" or "deny" the request | |
− | + | * '''DEACTIVATE BLUETOOTH''' - User can disable the Bluetooth | |
− | + | * '''CONNECT TO THUNDERBOLT''' - The device Bluetooth is paired with the Bluetooth module HC-05 on the car | |
− | + | * '''GOOGLE MAPS''' - The current car location is visible on the app and the User can select the destination | |
− | + | * '''START''' - Sends START signal to all controllers and sends the checkpoints to the GPS controller | |
− | + | * '''STOP ''' - Sends STOP Signal to all controllers | |
− | + | * '''RESET''' - Sends reset signal to all the controllers and all the SJOne boards are reset | |
− | + | <br> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
{| | {| | ||
|[[File:CmpE243 F16 Thunderbolt AndroidAppIcon.png|left|200px|thumb|Android App Icon]] | |[[File:CmpE243 F16 Thunderbolt AndroidAppIcon.png|left|200px|thumb|Android App Icon]] | ||
Line 1,504: | Line 1,475: | ||
'''Features of Android Application''' | '''Features of Android Application''' | ||
− | + | * App maintains stable Bluetooth connection even when app goes in background . It is a useful feature since the app can be interrupted by a phone call and you don't want to do the connection process all over again. | |
− | + | * It checks if your phone's Bluetooth is enabled or not. If it is disabled, it provides you the option to enable it through the app itself. | |
− | + | * It allows you to go to google maps activity only when your device maintains connection with the Bluetooth HC - 05 module. If the connection is broken the app takes you back to first activity and will ask you to connect again. | |
− | + | * To use Google Maps it is important that you need internet connection in order to plot routes. Before you are taken to google maps activity, it will check if you are connected to Wi-Fi or mobile data. If you are not, it will display a dialog box which has settings options and on clicking that option you will be taken to settings so that you can turn on the WIFI or data. | |
− | + | * The app has start and stop button to give start and stop commands to the car. | |
− | + | * We have also implemented reset functionality with a reset button. Clicking this button will send reset signal to all the SJOne boards and will also reload the google maps activity. The importance of doing this is to reset the system so that the entire process can be started from the beginning. | |
− | + | * We are displaying useful information such as the compass reading, speed and distance on the app which is very helpful in debugging and testing. | |
<br> | <br> |
Revision as of 07:38, 17 December 2016
Contents
- 1 Project Title
- 2 Abstract
- 3 Objectives & Introduction
- 4 Team Schedule
- 5 Team members and Responsibilities
- 6 Parts List & Cost
- 7 CAN Communication
- 8 Master Controller
- 9 Sensor Controller
- 10 Motor & I/O Controller
- 11 Geographical Controller
- 12 Android and Communication Bridge Controller
- 13 Conclusion
- 14 References
Project Title
Thunderbolt - a self driving RC car
Abstract
This section should be a couple lines to describe what your project does.
Objectives & Introduction
Show list of your objectives. This section includes the high level details of your project. You can write about the various sensors or peripherals you used to get your project completed.
Team Schedule
Color Legends :
- Common to all modules
- Master Controller
- Motor Controller
- Sensor Controller
- Geographical Controller
- Communication Bridge
Sr No | Start Date | End Date | Task | Status | Problems/Delays if any |
---|---|---|---|---|---|
1 | 09/14/2016 | 09/20/2016 |
|
Completed | |
2 | 09/21/2016 | 09/27/2016 |
|
Completed | |
3 | 09/28/2016 | 10/04/2016 |
|
Completed | |
4 | 10/05/2016 | 10/11/2016 |
|
Completed | |
5 | 10/12/2016 | 10/18/2016 |
|
Completed | |
6 | 10/19/2016 | 10/25/2016 |
|
Completed | |
7 | 10/26/2016 | 11/01/2016 |
|
Completed | |
8 | 11/02/2016 | 11/08/2016 |
|
Completed | |
9 | 11/09/2016 | 11/15/2016 |
|
Completed | |
10 | 11/16/2016 | 11/22/2016 |
|
Completed | |
11 | 11/23/2016 | 11/29/2016 |
|
Completed | |
12 | 11/30/2016 | 12/06/2016 |
|
Completed | |
13 | 12/07/2016 | 12/13/2016 |
|
In Progress |
Team members and Responsibilities
- Master Controller
- Abhishek Singh
- Saurabh Ravindra Deshmukh
- Neha Biradar
- Motor Controller
- Krishank Mehta
- Neha Biradar
- Saurabh Ravindra Deshmukh
- GPS/Compass Module
- Samiksha Ambekar
- Virginia Menezes
- Sensors
- Arthur Nguyen
- Rajeev Sawant
- Samiksha Ambekar
- Bluetooth
- Abhishek Singh
- Nikhil Namjoshi
- Android Application
- Nikhil Namjoshi
- Saurabh Ravindra Deshmukh
Parts List & Cost
Item# | Part Desciption | Vendor | Datasheet | Qty | Cost |
---|---|---|---|---|---|
1 | RC Car | from Preet | 1 | ||
2 | CAN Transceivers MCP2551-I/P | Microchip [1] | MCP2551-I/P Datasheet [2] | 8 | Free Samples |
3 | Sonar Sensor | Amazon [3] | Maxbotix EZ1 MB 1010 Datasheet [4] | 4 | $24.95 |
4 | GPS with SMA Connector | SparkFun [5] | Venus638FLPx Datasheet [6] | 1 | $49.95 |
5 | Compass (CMPS11) | Acroname [7] | 1 | $45.95 | |
6 | Antenna GPS Embedded SMA | Sparkfun [8] | 1 | $11.95 | |
7 | Bluetooth to Serial Port Module HC-05 | Gearbest.com [9] | 1 | $3.25 | |
8 | Magnets | Amazon.com [10] | 1 | $4.56 |
CAN Communication
DBC File
The DBC file implementation can be accessed at the following link:
https://gitlab.com/singh.abhishek21/Thunderbolt_CMPE243/blob/master/243.dbc
CAN Communication Table
PCAN Dongle and BusMaster
We have used BusMaster to monitor the CAN messages between the various controllers. The GUI is useful to log all the information and is very helpful in debugging various messages and conditions in real-time. The CAN bus USB adapter (PCAN Dongle) connects the CAN bus to the USB port of a computer, which also supplies the power to the adapter (no power supply needed) and Bus Master is used to display and debug the messages between the controllers.
Master Controller
Schedule
Sr No | Start Date | End Date | Task | Status | Actual Completed Date |
---|---|---|---|---|---|
1 | 10/12/2016 | 10/18/2016 |
|
Completed | |
2 | 10/19/2016 | 10/25/2016 |
|
Completed | |
3 | 10/25/2016 | 11/01/2016 |
|
Completed | |
4 | 11/02/2016 | 11/08/2016 |
|
In Progress | |
5 | 11/09/2016 | 11/15/2016 |
|
||
6 | 11/16/2016 | 11/22/2016 |
|
||
7 | 11/23/2016 | 11/29/2016 |
|
||
8 | 11/30/2016 | 12/06/2016 |
|
||
9 | 12/07/2016 | 12/13/2016 |
|
Design & Implementation
The design section can go over your hardware and software design. Organize this section using sub-sections that go over your design and implementation.
Hardware Design
Discuss your hardware design here. Show detailed schematics, and the interface here.
Hardware Interface
In this section, you can describe how your hardware communicates, such as which Buses used. You can discuss your driver implementation here, such that the Software Design section is isolated to talk about high level workings rather than inner working of your project.
Software Design
Show your software design. For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level. Do not show the details of the code. For example, do not show exact code, but you may show psuedocode and fragments of code. Keep in mind that you are showing DESIGN of your software, not the inner workings of it.
Implementation
This section includes implementation, but again, not the details, just the high level. For example, you can list the steps it takes to communicate over a sensor, or the steps needed to write a page of memory onto SPI Flash. You can include sub-sections for each of your component implementation.
Testing & Technical Challenges
Describe the challenges of your project. What advise would you give yourself or someone else if your project can be started from scratch again? Make a smooth transition to testing section and described what it took to test your project.
Sensor Controller
Group Members
- Arthur Nguyen
- Rajeev Sawant
Schedule
Sr No | Start Date | End Date | Task | Status | Actual Completion Date | Problems/Delays |
---|---|---|---|---|---|---|
1 | 10/05/2016 | 10/11/2016 |
|
Complete | 10/11/2016 | |
2 | 10/12/2016 | 10/18/2016 |
|
Complete | 10/18/2016 | |
3 | 10/19/2016 | 10/25/2016 |
|
Complete | 10/25/2016 | |
4 | 10/26/2016 | 11/01/2016 |
|
Complete | 11/01/2016 | |
5 | 11/02/2016 | 11/08/2016 |
|
Complete | 11/08/2016 | |
6 | 11/09/2016 | 11/15/2016 |
|
Complete | 11/15/2016 | |
7 | 11/16/2016 | 11/22/2016 |
|
Complete | 11/22/2016 | |
8 | 11/23/2016 | 11/29/2016 |
|
Complete | 11/29/2016 | Right and left sensor interference with each other. Must give separate triggering pins instead of combined triggering. |
8 | 11/30/2016 | 12/06/2016 |
|
Complete | 12/06/2016 |
Design & Implementation
This section goes over the design and implementation of the sensor controller. The sensor controller is the main controller for everything dealing with sensors. The sensor controller's main role is to provide data of objects around the car to the master controller in a sufficient amount of time. Knowing the proximity of objects around the car helps it navigate and maneuver around them in order to get to the destination without crashing. For this project, the car must be able to know what is to the right, middle, and left of the car in order to adjust accordingly. In rare cases, the car must be able to know the distance behind it for reversing out of certain situations. For this methodology, four sensors are used and positioned to get the right, middle, and left distances for the front, as well as one sensor for the back of the car.
Hardware Design
The main components of the sensor board consists of four ultrasonic sensors. Three sensors (left, middle, and right) are placed in the front of the car and one sensor is placed in the back.
MaxSonar MB1010 Sensor
The sensors are MB1010 LV-MaxSonar-EZ21 Ultrasonic Rangefinder sonar sensors, which can range from 6-inches to 254-inches with 1-inch resolution. Any object detected 6-inches or shorter is outputted as 6-inches. They are used in PW mode for outputting. The MaxSonar MB1010 sonar sensors require only four pins to be used in PW mode. The pins that need to be connected are the +5, GND, RX, and PW pins. The +5V and GND pins for the four sensors are all connected to the SJOne board's 3v3 and GND pins, respectively. Each of the sensors are triggered with a GPIO pin individually. The resulting output pin (PW) are connected to the PWM pins of the SJOne board individually. The sensors need to be triggered (high voltage pulse) for atlas 20 microseconds in order to start ranging. It finishes the ranging for PW in about 40 ms and the entire ranging in about 50 ms.
Mounting of Sensors
The stands for holding the sensors are curved such that the sensors are aimed with a positive slope and not horizontally. This decision is made in order to avoid interference with the ground due to the wide range of detection by the sensors. The middle front and back sensors are placed directly in the middle of the car. The left and right sensors are placed at a 45 degree angle to the middle and side of the car in order to detect objects closer to the front of the car near the sides. This decision is made due to the fact that the car is traveling forward, so being able to detect objects closer to the front of the car as soon as possible is of the utmost importance. We have 3D printed the supports for mounting the sensors as seen below. The software used is 123D Design.
Hardware Interface
Sr.No | SJOne Board | Sensors interface |
---|---|---|
1 | P2.0 (PWM) | TX Front |
2 | P2.1 (PWM) | TX Back |
3 | P 2.2 | TX Left |
4 | P 2.3 | TX Right |
5 | 3V3 | +5V (Sensors) |
6 | GND | GND (sensors) |
7 | P0.0 | CAN RX |
8 | P0.1 | CAN TX |
9 | P0.29 | Left Sensor (RX) |
10 | P0.30 | Front and Back Sensor (RX) |
11 | P1.19 | Right Sensor (RX) |
Software Design
Implementation
The idea behind implementing algorithm for sensor was to make sure that beam from the sensors do not collide with each other.
Thus we trigger front and back at one time, and right and left separately. This technique saves our 100 ms of time. Every sensor takes a calibration cycle of 49 ms.
Also we considered the initial power up delay of 250 ms. The sensor task scheduling is implemented using semaphore which can be seen in sensor.cpp file.
For getting values from sensor we keep the PWM pin high for 40ms (as per datasheet), this is the time for the sensor to send the beam and get the reflected beam back.
To inform the master that sensor is in working state , we send a Heartbeat signal to master which is implemented in 1HZ task.
We have implemented the following in the 100 Hz periodic task, which executes every 10 ms. The sensor function composes of three triggering (RX) sensors.
The triggering sensors are for the left sensor, middle and back sensors, and the right sensor, in that order. Each triggering occurs 60 ms between each other to avoid interference between sensors.
- When the count is zero (0 ms has passed from the beginning of ranging), the left sensor is first triggered for 20 microseconds.
- When the count is 6 (60 ms has passed from the beginning of ranging), the middle and back sensors are triggered for 20 microseconds.
- When the count is 12 (120 ms has passed from the beginning of ranging), the right sensor is triggered for 20 microseconds.
- Finally, when the count is 18 (180 ms has passed from the beginning of ranging), all sensors have completed ranging and all sensor data is updated, encoded, and sent over the CAN bus.
- The count is also reset to -1. The count is also incremented once at the end of this 100 Hz task.
Testing & Technical Challenges
1. Delay time of RX
Initially, we wanted to keep the timing for each sensor triggering to be as short as possible in order to send the sensor data to the master controller as quickly as possible. The triggering time between sensors was initially put at 20 ms. We did not see any problems due to having a one second delay between sensors in order to read the values from debug printf statements. However, once that printf delay was removed, the sensor data was not constant. We also tried a 40 ms delay since that was how long it took to trigger for PW. We still encountered problems and finally settled on the maximum of 50 ms delay between sensors.
2. Angle of sonar sensors
3. Senor interference with each other
Initially, we wanted to trigger the right and left sensors at the same time. We thought that there was ample distance between the sensors such that we can trigger them at the same time without interference. However, we continued to get unstable data, which may be due to wide sensing of the particular sensors we used, MB1010. We decided to trigger each sensor at a time with exception to triggering the middle and back sensors at the same time.
Motor & I/O Controller
Group Members
- Krishank Mehta
- Saurabh Deshmukh
- Neha Biradar
Schedule
Sr No | Start Date | End Date | Task | Status | Actual Completed Date | Problems Encountered if any |
---|---|---|---|---|---|---|
1 | 9/19/2016 | 9/27/2016 |
|
Completed | 9/25/2016 | |
2 | 9/28/2016 | 10/4/2016 |
|
Completed | 10/5/2016 | |
3 | 10/7/2016 | 10/10/2016 |
|
Completed | 10/10/2016 | Problem with finding the starting pwm pattern for DC Motor |
4 | 10/11/2016 | 10/18/2016 |
|
Completed | 10/17/2016 | |
5 | 10/20/2016 | 10/24/2016 |
|
Completed | 10/24/2016 | |
6 | 10/26/2016 | 10/28/2016 |
|
Completed | 11/26/2016 | |
7 | 11/01/2016 | 11/08/2016 |
|
Completed | 11/07/2016 | |
8 | 11/15/2016 | 11/18/2016 |
|
Completed | 11/07/2016 | |
9 | 11/18/2016 | 11/22/2016 |
|
Completed | 11/20/2016 |
Design & Implementation
The Motor IO controller works as per the commands from the Master controller. The motor module is responsible for the running on the car, its direction and speed. The IO module consists of LCD and backlights.
Hardware Design
Motor Module
The Motor module consists of servo motor, DC motor and speed sensor module. The servo motor is responsible for steering of the car and the DC motor is responsible for speed control.
The Master controller sends signals of drive, speed and steer to the motor controller to navigate the car, based on the information received from Sensors and GPS.
DC Motor
In the car, we have the ARRMA MEGA waterproof 35A ESC, combined with the 15T MEGA Brushed Motor.
The MEGA ESC is designed to be used with the supplied NiMh Battery Pack and can easily handle 2S LiPo battery packs or 7 cell 8.4V NiMh battery packs.
The ESC (Electronic Speed Control) is connected to the SJOne board to generate the PWM as shown in the block diagram below, which is connected to the DC Motor. It is powered by a ARRMA 6 Cell 2000mAh 7.2 volt NiMh Battery.
Servo Motor
The Servo motor in our car is ADS-5 Steering Servo, which will provide fast and consistent steering response on the most demanding surfaces. This servo provides 5kg/cm (70oz/inch) of torque.
The servo motor is connected to the SJOne board and provided PWM signal to control the steering of the car in 5 directions - far left, left, center, right, far right.
Speed Sensor
IO Module
The IO Module consists of two LCD Modules - Picaso Integrated Display Module and Serial Liquid Crystal Display Module and backlights based on the direction and movement of the car.
LCD Display - Picaso Integrated Display Module
We are using two LCD modules in the project. One of them is a gen4 3.2” Picaso Integrated Display Module, which features a TFT LCD Display.
The processor includes a microSD memory storage, 13 customizable GPIO, 2 serial ports and a Master I2C interface, along with multiple millisecond resolution timers, and Audio Generation.
The Model number we are using is gen4-uLCD-32PT.
The data from the Sensor controller, Motor controller and GPS controller is sent to the LCD Module through I2C.
LCD displays the following information:
Speedometer
LCD Display - Serial Liquid Crystal Display Module
The second LCD is a 4 line * 20 characters Serial Liquid Crystal Display Module. The Model number we are using is NHD-0420D3Z-NSW-BBW-V3.
This display uses a built-in PIC16F690 for serial communication. 100mS delay is required upon power-up for the built-in PIC to initialize the display controller.
The data from the Sensor controller, Motor controller and GPS controller is sent to the LCD Module through I2C.
LCD displays the following information:
1st Line - THUNDERBOLT 2nd Line - Sensor Controller Data - Left Sensor, Front Sensor, Right Sensor, Back Sensor Readings 3rd Line - Motor Controller Data - Direction, Speed, Distance 4th Line - GPS Controller Data - Final distance, distance to next checkpoint
Backlights
The direction and the movement of the car controls the backlight.
When the car is in drive or in reverse mode, the Green LED lights up.
When the car is in stop mode, the Red LED lights up.
When the car is steering to the right, the right indicator is lit, while when it is steering to the left, the left indicator is lit.
Hardware Interface
In this section, you can describe how your hardware communicates, such as which BUSes used. You can discuss your driver implementation here, such that the Software Design section is isolated to talk about high level workings rather than inner working of your project.
Schematic
Software Design
**Drive, Steer and Speed signals from Master to Motor controller
BO_ 209 MASTER_DRIVING_CAR: 8 MASTER SG_ MASTER_DRIVE_ENUM : 0|4@1+ (1,0) [0|0] "" MOTOR,COM_BRIDGE SG_ MASTER_STEER_ENUM : 4|4@1+ (1,0) [0|0] "" MOTOR,COM_BRIDGE SG_ MASTER_SPEED_ENUM : 8|4@1+ (1,0) [0|0] "" MOTOR,COM_BRIDGE
**Speed and distance travelled data from Motor to Master and Communication bridge controllers
BO_ 147 MOTOR_CAR_SPEED: 4 MOTOR SG_ MOTOR_SPEED_DATA_UNSIGNED : 0|8@1+ (1,0) [0|0] "" MASTER,COM_BRIDGE SG_ MOTOR_DISTANCE_FROM_START_POINT_UNSIGNED : 8|8@1+ (1,0) [0|0] "meters" MASTER,COM_BRIDGE
**Heartbeat signal from Motor to Master Controller
BO_ 339 MOTOR_HEARTBEAT: 2 MOTOR SG_ MOTOR_HEARTBEAT_UNSIGNED : 0|11@1+ (1,0) [0|0] "" MASTER
Implementation
Three signals - Drive, Speed and Steer signals are received by the Motor Controller from the Master.
Based on the signals received from the Master module, the motor is controlled.
Sr No. | Enum Signal name | Signal from Master to Motor | Motor Algorithm | Functionality |
---|---|---|---|---|
1 | Drive Signal |
|
|
|
2 | Speed Signal |
|
|
Speed of the car |
3 | Steer Signal |
|
|
Direction of the car |
Master-Motor IO Interface
Calculation of Speed and Distance
Testing & Technical Challenges
1. Ideally at 7.5% duty cycle PWM, the servo motor should be aligned to center position, but due to faulty hardware the servo motor is inclined towards right giving us wrong movement.
We solved this problem by setting the PWM to 7.2% duty cycle during initialization, which resulted in accurate center position
2. For D.C motor to start running, we have to initialize the ESC. Hence without providing 1.5ms pulse at the beginning, the motor will start running.
3. As the battery voltage decreases, the motor does not run at the same speed with the same PWM. Hence with the decrease in speed we increased the PWM pulse linearly
4. In order to run the motor in reverse direction (when the motor is currently running in the forward direction), it was required to apply reverse pulse, then a stop pulse and again a reverse pulse, back to back.
Geographical Controller
Group Members
- Samiksha Ambekar
- Virginia Menezes
Schedule
Sr No | Start Date | End Date | Task | Status | Actual Completed Date | Problems/Delay if any |
---|---|---|---|---|---|---|
1 | 09/14/2016 | 09/20/2016 |
|
Completed | 09/20/2016 | |
2 | 09/21/2016 | 09/27/2016 |
|
Completed | 09/27/2016 | |
3 | 09/28/2016 | 10/04/2016 |
|
Completed | 10/04/2016 | |
4 | 10/05/2016 | 10/11/2016 |
|
Completed | 10/11/2016 | |
5 | 10/12/2016 | 10/18/2016 |
|
Completed | 10/18/2016 | |
6 | 10/19/2016 | 10/25/2016 |
|
Completed | 10/20/2016 | |
7 | 10/26/2016 | 11/01/2016 |
|
Completed | 10/31/2016 | |
8 | 11/02/2016 | 11/08/2016 |
|
Completed | 11/07/2016 | |
9 | 11/09/2016 | 11/15/2016 |
|
Completed | 11/13/2016 | |
10 | 11/16/2016 | 11/22/2016 |
|
Completed | 11/20/2016 | |
11 | 11/23/2016 | 11/29/2016 |
|
In Progress | ||
12 | 11/30/2016 | 12/06/2016 |
|
In Progress | ||
13 | 12/07/2016 | 12/13/2016 |
|
Design & Implementation
The Geographical Controller is used to track the current location of the car and the turn angle to steer to the next checkpoint.
The module comprises of a GPS module and a compass.
Once the user choses the destination point on the Android application, the app will map the shortest path available from the current location to the destination and plot multiple checkpoints based on that. The coordinates of these checkpoints are sent to the GEO controller, which will calculate the distance between the current location of the car and the next checkpoint and the turn angle required to reach the next checkpoint and send this information to the Master controller.
Hardware Design
The GPS module used is SparkFun Venus GPS with SMA Connector [11]. And the Compass is CMPS11 - Tilt Compensated Compass Module [12].
GPS Module
The GPS Module we use in our project is SparkFun Venus GPS with SMA Connector based on Venus638FLPx IC.
There are three modes of operation based on how it is powered:
1. Cold start: If no external battery (VBAT) of 3V is connected to the module, it will take a longer time to start and get a fix.
2. Hot start: When VBAT is connected to the module, even if the GPS is turned off and turned on within a certain time, it will get its fix from the value stored in memory.
3. Warm start: If the GPS is not turned on within the time frame for hot start (typically 2 hours), it will take sometime to get satellite fix.
GPS Configuration
The GPS module sends out the information in standard NMEA-0183 format or SkyTraq Binary sentence format. The default rate is 9600 bps and is configurable up to 115200 bps. The update rate of this GPS module is up to 20Hz. This indicates how often it recalculates and reports its position.
We have configured the GPS module using the GPS Viewer software provided by Skytraq.
1. The rate of UART is set at 38400bps
2. Update rate of 5Hz
3. Also it is possible to choose which NMEA message format we want the data in. For our car, we are using the GPGGA (Global Positioning System Fix Data) message format.
Apart from configuration, all other information like data received from the GPS, if fix position, no. of satellites, latitude and longitude etc. all can be viewed through this software.
GGA Message Structure : $GPGGA,hhmmss.sss,ddmm.mmmm,a,dddmm.mmmm,a,x,xx,x.x,x.x,M,,,,xxxx*hh<CR><LF> Example data: $GPGGA,120218.899,2400.0000,N,12100.0000,E,0,00,0.0,0.0,M,0.0,M,,0000*69 where, $GPGGA -- Global Positioning System Fix Data (Sentence Identifier) 120218.899 -- UTC Time of position in hhmmss.sss format 2400.0000 -- Latitude in ddmm.mmmm format N -- Latitude hemisphere indicator, ‘N’ = North, ‘S’ = South 12100.0000 -- Longitude in dddmm.mmmm format E -- E/W Indicator 0 -- GPS quality indicator 0: position fix unavailable 1: valid position fix, SPS mode 2: valid position fix, differential GPS mode 3: GPS PPS Mode, fix valid 4: Real Time Kinematic. System used in RTK mode with fixed integers 5: Float RTK. Satellite system used in RTK mode. Floating integers 6: Estimated (dead reckoning) Mode 7: Manual Input Mode 8: Simulator Mode 00 -- Number of satellites in use (00~12) 0.0 -- HDOP (Horizontal dilution of precision), (00.0 ~ 99.9) 0.0,M -- Altitude in Meters - above mean sea level, (-9999.9 ~ 17999.9) 0.0,M -- Height of geoid above WGS84 ellipsoid (mean sea level), (-9999.9 ~ 17999.9) 0000 -- DGPS Station ID - Differential reference station ID, 0000 ~ 1023 NULL when DGPS not used *69 -- Checksum (begins with *)
Compass Module
The Compass Module we use in our project is CMPS11 - Tilt Compensated Compass Module.
It employs a 3-axis magnetometer, 3-axis gyro and a 3-axis accelerometer. A Kalman filter is used to combine the gyro and accelerometer to remove the errors caused by tilting of the PCB. The output of the three sensors measuring x, y and z components of the magnetic field, together with the pitch and roll are used to calculate the bearing. It requires a power supply of 3.6-5V. The module can be operated in two modes - serial or I2C. We have interfaced the CMPS11 module with SJOne board via I2C for communication.
Compass calibration
The calibration of the compass is very important. We mounted the compass on the car with the motor working to take into account the magnetic deviation caused by its EMI. Calibration mode is entered by sending a 3 byte sequence of 0xF0,0xF5 and 0xF6 to the command register in 3 separate I2C frames with a delay of 20ms between them. Once the CMPS11 is in calibration mode, the LED will start blinking. It should now be rotated in all directions in 3 dimensions. Once calibrated successfully, the calibration mode can be exited with command of 0xF8.
Hardware Interface
Schematic
Software Design
Algorithm
Distance Calculation
We are using Haversine formula to calculate the great-circle distance between two checkpoints – that is, the shortest distance over the earth’s surface
Distance = R ⋅ c c = 2 ⋅ atan2(√a, √(1−a)) a = sin²(Δφ/2) + cos φ1 ⋅ cos φ2 ⋅ sin²(Δλ/2) where, φ is latitude, λ is longitude, R is earth’s radius (mean radius = 6,371km), Note: Angles need to be in radians to pass to trignometric functions
Bearing
The final heading will differ from the initial heading by varying degrees according to distance and latitude. This can be calculated as follows:
Bearing (θ)(radians) = atan2(sin Δλ ⋅ cos φ2 , cos φ1 ⋅ sin φ2 − sin φ1 ⋅ cos φ2 ⋅ cos Δλ) where, φ1,λ1 is the start point, φ2,λ2 the end point Δλ is the difference in longitude
CAN Communication
Following table lists the signals sent by GPS to other controllers via CAN.
Sr. No. | Message Number | Destination | Message Name (MSG_FUNCTION) | Data Layout of Data Sent over CAN (byte[0] = total number of data bytes) |
---|---|---|---|---|
1 | 0x290 | Communication Bridge and I/O | GPS_ACKNOWLEDGEMENT |
- |
2 | 0x162 | Communication Bridge and I/O | CURRENT_LOCATION |
Msg : 30 bits : GPS_latitude Msg : 30 bits : GPS_longitude |
3 | 0x338 | Master | GPS_HEARTBEAT |
- |
4 | 0x146 | Master and Motor IO | GPS_MASTER_DATA |
Msg : 16 bits : turn angle Msg : 1 bit : isFinal Msg : 16 bits : distance to final destination Msg : 16 bits : distance to next checkpoint |
5 | 0x338 | Communication Bridge and I/O | GPS_COMPASS_HEADING |
- |
The following are the signals that are received or sent by the GEO Controller.
**Receive Checkpoints from Communication Bridge (Total number of checkpoints, current checkpoint number, latitude and longitude
BO_ 148 COM_BRIDGE_CHECK_POINT: 8 COM_BRIDGE SG_ COM_BRIDGE_MUX M : 0|2@1+ (1,0) [0|0] "" GPS SG_ COM_BRIDGE_TOTAL_COUNT_UNSIGNED : 2|8@1+ (1,0) [0|0] "" GPS SG_ COM_BRIDGE_CURRENT_COUNT_UNSIGNED : 10|8@1+ (1,0) [0|0] "count" GPS SG_ COM_BRIDGE_LATTITUDE_SIGNED m0 : 18|40@1+ (0.000001,-90) [-90|90] "degrees" GPS SG_ COM_BRIDGE_LONGITUDE_SIGNED m1 : 18|40@1+ (0.000001,-180) [-180|180] "degrees" GPS **Receive RESET signal from Com Bridge (Android device)
BO_ 10 COM_BRIDGE_RESET: 2 COM_BRIDGE SG_ COM_BRIDGE_RESET_UNSIGNED : 0|11@1+ (1,0) [0|0] "" MASTER,GPS,MOTOR,SENSOR **Receive START signal from Com Bridge (Android device)
BO_ 84 COM_BRIDGE_CLICKED_START: 2 COM_BRIDGE SG_ COM_BRIDGE_CLICKED_START_UNSIGNED : 0|11@1+ (1,0) [0|0] "" MASTER,GPS **Send acknowledgement to Com Bridge if all checkpoints have been received
BO_ 290 GPS_ACKNOWLEDGEMENT: 2 GPS SG_ GPS_ACKNOWLEDGEMENT_UNSIGNED : 0|11@1+ (1,0) [0|0] "" COM_BRIDGE **Send current location coordinates (latitude and longitude in decimal degrees) to Com Bridge
BO_ 162 GPS_CURRENT_LOCATION: 8 GPS SG_ GPS_LATTITUDE_SIGNED : 0|30@1+ (0.000001,-90) [-90|90] "degrees" COM_BRIDGE SG_ GPS_LONGITUDE_SIGNED : 30|30@1+ (0.000001,-180) [-180|180] "degrees" COM_BRIDGE **Send Heartbeat signal to Master
BO_ 338 GPS_HEARTBEAT: 2 GPS SG_ GPS_HEARTBEAT_UNSIGNED : 0|11@1+ (1,0) [0|0] "" MASTER **Send calculated data to Master and motor (Turn angle, Is final, distance to final destination, distance to next checkpoint
BO_ 146 GPS_MASTER_DATA: 7 GPS SG_ GEO_DATA_TURNANGLE_SIGNED : 0|16@1+ (0.1,-180) [-180|180] "degrees" MASTER,MOTOR SG_ GEO_DATA_ISFINAL_SIGNED : 16|1@1+ (1,0) [0|0] "" MASTER,MOTOR SG_ GEO_DATA_DISTANCE_TO_FINAL_DESTINATION_SIGNED : 17|16@1+ (0.1,0) [0|0] "meters" MASTER,MOTOR SG_ GEO_DATA_DISTANCE_TO_NEXT_CHECKPOINT_SIGNED : 33|16@1+ (0.01,0) [0|0] "meters" MASTER,MOTOR **Send Compass reading to Com Bridge
BO_ 300 GPS_COMPASS_HEADING: 3 GPS SG_ GEO_DATA_COMPASS_HEADING_UNSIGNED : 0|16@1+ (0.1,0) [0|359] "degrees" COM_BRIDGE **Receive Acknowledgement from Master when data is received successfully
BO_ 281 MASTER_ACKNOWLEDGEMENT: 2 MASTER SG_ ACKNOWLEDGEMENT_DATA_REACHED_UNSIGNED : 0|11@1+ (1,0) [0|0] "" GPS
Implementation
Testing & Technical Challenges
1. Unable to get a satellite fix on GPS module:
The first GPS module we received would not get a satellite fix. We spent a considerable amount of time outdoors to get a fix but it never did.
Finally we returned the product and ordered a new one. We got a feedback from the vendor Sparkfun that the GPS module was defective and so the issue.
The new module got a fix the first time within the first 20 minutes.
2. GPS gives imprecise current location:
There was a small yet noticeable difference between the location provided by the GPS module and the exact current location. The adjacent image shows a plot of the current location vs the route plotted.
We tried to fix this by increasing the update rate from 5Hz to 10Hz, but this failed the parsing of the data and we sometimes ended up getting incorrect latitude and longitude values.
Finally we configured the GPS module to pedestrian mode which gave precise current location.
3. Car not stopping at final destination:
As per our algorithm, once the car reaches the destination, the IS_FINAL flag should be set and the Master controller should send the STOP command to the motor controller.
But it is not possible that the car reaches the exact location i.e. achieves the exact coordinates in precision and so the IS_FINAL flag was never set, resulting the car never stopping even on reaching the final destination.
To fix this issue, we modified the algorithm that when the distance between the car and the final destination is between 3 meters, the IS_FINAL flag would be set, and thus the Master controller will send out STOP command, bringing the car to a halt.
Android and Communication Bridge Controller
Group Members
- Nikhil Namjoshi
- Saurabh Deshmukh
Schedule
Sr No | Start Date | End Date | Task | Status | Actual Completed Date |
---|---|---|---|---|---|
1 | 9/27/2016 | 10/4/2016 |
|
Complete | 10/4/2016 |
2 | 10/6/2016 | 10/8/2016 |
|
Complete | 10/8/2016 |
3 | 9/30/2016 | 10/2/2016 |
|
Complete | 10/2/2016 |
4 | 10/2/2016 | 10/6/2016 |
|
Complete | 10/6/2016 |
5 | 10/10/2016 | 10/25/2016 |
|
In Progress | |
6 | 10/25/2016 | 11/2/2016 |
|
Completed | 10/31/2016 |
7 | 11/3/2016 | 11/11/2016 |
|
||
8 | 11/12/2016 | 11/23/2016 |
|
||
9 | 11/26/2016 | 12/5/2016 |
|
Design & Implementation
An Android application is designed to control the RC car to help it navigate from the source to the destination and display useful information on it. The Communication Bridge Controller is responsible to connect the RC car to the Android application via Bluetooth. It provides the route information between source and destination chosen on the Android application. Once the source and destination is chosen, checkpoints between the two are fixed on the Google Maps and sent to the geographical controller. The checkpoints and destination information is then used by the Geographical controller to calculate the distance and turn angle the car has to travel for based on the current location and sent to the Master controller.
HC-06 Bluetooth Module[edit]
Hardware Design
Bluetooth Module
We are using Bluetooth module HC-05 to establish wireless communication between the car and the Android device.
This module is based on the Cambridge Silicon Radio BC417 2.4 GHz BlueTooth Radio chip. This is a complex chip which uses an external 8 Mbit flash memory
It includes the Radio and Memory chips, 26 MHz crystal, antenna and RF matching network.
The right section of the Bluetooth Board has connection pins for power and signals as well as a 5V to 3.3V Regulator, LED, and level shifting.
HC-05 PinOut :
- KEY: If brought HIGH before power is applied, forces AT Command Setup Mode. LED blinks slowly (2 seconds)
- VCC: +5V Power
- GND: Ground
- TXD: Transmit Serial Data from HC-05 to SJOne board UART RXD
- RXD: Receive Serial Data from SJOne board UART TXD
- STATE: Tells if connected or not
Hardware Interface
Bluetooth Controller Pin Connections
Sr.No | SJOne Pin Number | Bluetooth Pin Function |
---|---|---|
1 | TXD3 | RXD |
2 | RXD3 | TXD |
3 | VCC | Bluetooth VCC |
4 | GND | Bluetooth GND |
Software Design
Android Application Design
The Android application is built to let the user control the RC car to navigate it between the current location and the destination. The App lets the user select the destination and then chooses the shortest path available between the current location up to the destination.
It plots checkpoints between the two locations and sends it to the Geographical controller, which calculates the distance and turn angle between the current location and the next checkpoint and send to the Master which controls the motor controller.
Below are the buttons on the Android application that are available to the User
* ACTIVATE BLUETOOTH - User is prompted to Turn on Bluetooth on the phone. User can "allow" or "deny" the request * DEACTIVATE BLUETOOTH - User can disable the Bluetooth * CONNECT TO THUNDERBOLT - The device Bluetooth is paired with the Bluetooth module HC-05 on the car * GOOGLE MAPS - The current car location is visible on the app and the User can select the destination * START - Sends START signal to all controllers and sends the checkpoints to the GPS controller * STOP - Sends STOP Signal to all controllers * RESET - Sends reset signal to all the controllers and all the SJOne boards are reset
Features of Android Application
- App maintains stable Bluetooth connection even when app goes in background . It is a useful feature since the app can be interrupted by a phone call and you don't want to do the connection process all over again.
- It checks if your phone's Bluetooth is enabled or not. If it is disabled, it provides you the option to enable it through the app itself.
- It allows you to go to google maps activity only when your device maintains connection with the Bluetooth HC - 05 module. If the connection is broken the app takes you back to first activity and will ask you to connect again.
- To use Google Maps it is important that you need internet connection in order to plot routes. Before you are taken to google maps activity, it will check if you are connected to Wi-Fi or mobile data. If you are not, it will display a dialog box which has settings options and on clicking that option you will be taken to settings so that you can turn on the WIFI or data.
- The app has start and stop button to give start and stop commands to the car.
- We have also implemented reset functionality with a reset button. Clicking this button will send reset signal to all the SJOne boards and will also reload the google maps activity. The importance of doing this is to reset the system so that the entire process can be started from the beginning.
- We are displaying useful information such as the compass reading, speed and distance on the app which is very helpful in debugging and testing.
Implementation
Testing & Technical Challenges
Describe the challenges of your project. What advise would you give yourself or someone else if your project can be started from scratch again? Make a smooth transition to testing section and described what it took to test your project.
Conclusion
Conclude your project here. You can recap your testing and problems. You should address the "so what" part here to indicate what you ultimately learnt from this project. How has this project increased your knowledge?
Project Video
Upload a video of your project and post the link here.
Project Source Code
References
Acknowledgement
Any acknowledgement that you may wish to provide can be included here.
References Used
List any references used in project.
Appendix
You can list the references you used.