S15: Real Time Brake Assist (RTBA)

From Embedded Systems Learning Academy
Revision as of 04:35, 21 May 2015 by Proj user10 (talk | contribs) (Issues Found)

Jump to: navigation, search

Grading Criteria

  • How well is Software & Hardware Design described?
  • How well can this report be used to reproduce this project?
  • Code Quality
  • Overall Report Quality:
    • Software Block Diagrams
    • Hardware Block Diagrams
      Schematic Quality
    • Quality of technical challenges and solutions adopted.

Real Time Brake Assist (RTBA)

Abstract

Real time brake assist is an automotive application that helps the user in calculating a safe braking distance with respect to the car in the front. The system makes use of a LiDAR sensor for judging the car’s proximity to the car ahead of it and uses the diagnostic port (OBDII) to pull up the car’s current speed from the ECU. Based on the collected data, it will calculate the safe braking distance and will provide visual indicators for the same.

Objectives & Introduction

What we would like to accomplish is the following:

  • Provide a user friendly solution to brake assistance by analyzing car's data through OBD-II.
    • Lidar to detect distance.
    • OBD-II interface with SJSU One Board.
    • Special I2C circuitry for wiring the lidar from the front of the car to inside of the car.
  • Provide a simple mobile application which reads the OBD-II data through bluetooth as additional feature to the braking solution. It would provide the following indicators:
    • Car Speed(mph)
    • Braking Distance(ft)
    • Proximity(ft)
    • Safety Warning
  • Additional Features:
    • TBD

Team Members & Responsibilities

  • Sahil Kataria
    • Architecture Design, Hardware & Software Development, Integration
  • Julio Fuentes
    • I2C Communication, Hardware Development
  • Shaw Ken Chang
    • Android App/Bluetooth bridge, System Integration, brake algorithm, new features.
  • Naghma Anwar
    • CAN Communication, Software Development

Schedule

Show a simple table or figures that show your scheduled as planned before you started working on the project. Then in another table column, write down the actual schedule so that readers can see the planned vs. actual goals. The point of the schedule is for readers to assess how to pace themselves if they are doing a similar project.

Week # Start Date End Date Task Status Result
1 03/10/15 03/16/15
  • Get the parts:
    • Order LIDAR-Lite module from sparkfun
    • Order CAN transceiver chip
    • Acquire OBD2 extender cables
Completed
  • As of 03/16/15
    • All parts arrived on time
2 03/17/15 03/23/15
  • Have a group meeting:
    • Work on architecture design
    • Assign tasks to each group member
Completed
  • As of 03/23/15
    • Project design finalized
    • Members were assigned their tasks
3 03/24/15 03/30/15
  • Design a small DB9 to CAN transceiver connector board
  • Get all the parts that is required to be soldered on the connector board
  • Finish hardware soldering
Completed
  • As of 03/30/15
    • Connector board ready for testing
4 03/31/15 04/06/15
  • Do some research on OBD-II
  • Find out what PID commands are needed to fetch vehicle speed from car's ECU
  • Write code to send proper command to OBD-II port using CAN communication
Completed
  • As of 04/06/15
    • Code written
    • Ready for testing
5 04/07/15 04/13/15
  • Work on I2C communication between LIDAR-lite module and SJOne board
  • Start developing android app to display speed, distance, proximity and safety alert information
  • Set up a repository on GitLab and start collaborating.
Completed
  • As of 04/13/15
    • GitLab collaboration started
    • Bluetooth android bridge: function check was done and basic software was written but at the moment throwing some error
6 04/14/15 04/20/15
  • Do some research on differential driver for the I2C to make sure that the signals reach reliably to the front of the car
  • Start testing for CAN communication between OBD2 port and SJOne board
  • Start testing for I2C communication between LiDAR-lite and SJOne board
Ongoing
  • As of 4/21/2015
    • Bluetooth android bridge: rewrite the android UI and android bluetooth read function for more stable communication.
    • I2C communication successfully established between LiDAR and SJOne board
    • CAN communication throwing error
7 04/21/15 04/27/15
  • Design an algorithm to calculate the safe braking distance
  • Display this information on android app to notify the user
  • Assign different colors to each state: Yellow (safe distance), Orange (safe but not too safe), Red (danger zone, car should stop immediately)
Completed
  • As of 5/11/2015
    • Algorithm developed. Took longer than expected because of stuck CAN communication
8 04/28/15 05/04/15
  • Start calibrating the safe braking distance
  • Fine tune the distance and speed
  • Make android app more informative and user friendly by adding sound alerts
Ongoing
  • As of 5/4/2015
9 05/05/15 05/11/15
  • Final Testing
Ongoing
10 05/12/15 05/25/15
  • Project Demo
Scheduled

Parts List & Cost

Give a simple list of the cost of your project broken down by components. Do not write long stories here.

Item# Part Desciption Vendor Part Number Qty Cost
1 LIDAR Lite sparkfun.com SEN-13167 1 $89.95
2 SJOne Board SCE 1 $80.00
3 I2C Diff Buffer NXP PCA9615DPJ 2 $2.99
4 CAN Trasceiver Philips TJA1050T 1 $1.03
5 12V-5V DC-DC REG Murata 7805SR-C 1 $9.90
6 3.3V LDO REG ON Semiconductor NCP4683DSQ33T1G 1 $0.92
7 Prototype board Twin Industries 800-45 1 $12.99
8 Bluetooth Module Sparkfun RN41-XV 1 $29.99

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

The Real Time Break assist hardware consists of the three boards. The SJ-ONE board provides the LPC1758 ARM based CPU with the integrated CAN and I2C interface controllers used for communication. The second board referred as “Board #1” in the hardware diagram provides the CAN PHY, 12V to 5V voltage regulation and the I2C differential driver. The third board is located in the front of the car and provides power and proper I2C connectivity to the Linder laser distance sensor. The user interface is implemented through an android based device that connects to the SJ-ONE board through a Bluetooth module.

Hardware Diagram

S15 244 Grp9 hwdiagram2.jpg

Hardware Interface

Interface to Lidar Laser Distance Sensor

The Linder laser distance sensor requires 5V and I2C interface operating at a maximum rate of 100Kbps for communication. To provide a reliable and low cost communication to the sensor, a PCA9615 differential driver was chosen. The PCA9615 provides the noise immunity and capability to drive long cables necessary for this application. For cable connectivity, a standard CAT5 RJ45 cable was used because of its low cost and twisted pair connectivity for differential signals. The diagram below shows the connectivity of the differential pairs. In order to provide the maximum differential swing, VDDB1 and VDDB2 should be connected to 5V and use 120ohms for R1 and 60 ohms for R2. VDDA1 and VDDA2 should be pulled up to 3.3V as required by the I2C interface. The PCA9615 provides separate voltage pins for the I2C interface which should be 3.3V and for the differential signaling which should be 5V.

Diff Signals for I2C


The RJ45 cable and connections should be selected so that each of the differential signals is connected to a corresponding twisted pair. Also, 5V power and ground should be connected so that they use a twisted pair and therefore keep the capacitive coupling through the cabling. The figure below shows the RJ45 pin assignment, as well as the twisted pair cable coloring found in traditional CAT5 cables.

RJ45 Connectivity


CAN interface to OBDII Connector

S15 244 Grp9 CAN.jpg

Bluetooth/Android Bridge

Bluetooth Module

For this project we chose RN41XV Bluetooth module. This is a Bluetooth module with Zigbee footprint and it fits SJSUone board perfectly. This is one of the main reason why we use this module. We can easily access the Bluetooth module through UART 2 or UART3 – depending on the board setting. Features of RN41XV:

  • Fully certified Bluetooth® version 2.1 module, supports version 2.1 + Enhanced Data Rate (EDR)
  • Backwards-compatible with Bluetooth version 2.0, 1.2, and 1.1
  • Pin compatible with widely used 2 x 10 (2mm) socket typically used for 802.15.4 applications
  • Low power: 30 mA connected, < 10 mA sniff mode
  • UART (SPP or HCI) and USB (HCI only) data connection interfaces
  • Sustained SPP data rates: 240 Kbps (slave), 300 Kbps (master)
  • HCI data rates: 1.5 Mbps sustained, 3.0 Mbps burst in HCI mode
  • Embedded Bluetooth stack profiles included (requires no host stack): GAP, SDP, RFCOMM, and L2CAP protocols, with SPP, HID and DUN profile support
  • Bluetooth SIG certified
  • Chip antenna on-board

Since we are using android to connect to the module, having SPP support is important. There are many projects on the web describing how to connect android to a Bluetooth module and they are more or less similar. The things that differs are only hardware specifications such as the range and what types of protocols and profiles it can support. Based on the specification sheet, RN41XV has range up to 100 meters, this is plenty for our application. We expect that users will use an android phone to connect to the main embedded device within 1m-2m distance.

Testing Bluetooth Bridge

Test Strategy:

  1. Functionality test1: Using PC terminal app and android terminal app, check the range and see if data can be transferred as expected.
  2. Functionality test2: Setup the module to communicate with SJSUone board through UART3 port and then connect the module to android phone using android terminal app.
  3. Functionality test3: Do the same thing as test2 but use our own android app instead.

Android Application Design

The objective for our application UI is to be make it simple and easy to use. The following screen capture shows the UI.

This application has the following components:

  1. Initial page to select a bluetooth module to connect to
  2. Bluetooth communication manager to read and parse bytes of data when there are data on the buffer readay to be read
  3. Indicators to show the car speed in mph, calculated safe braking distance in ft based on the current speed, and the proximity sensor reading in units of ft.
  4. Indicator to warn the user when the car's distance is less than the safe braking distance. The indicators include a warning image telling the user to slow down and also sound alert to warn the user with beeping sounds

Implementation

-steps to communicate to bluetooth/android bridge -steps to communicate to OBDII/CAN -braking Algorithm 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.

Include sub-sections that list out a problem and solution, such as:

Issues Found

CAN Broadcast Address

The broadcast address of 0x7DF referred on the Wikipedia (http://en.wikipedia.org/wiki/OBD-II_PIDs) is for 11 bit communication and is outdated. This broadcast address does not work. We could not find information on broadcast address for 29 bit communication. To bypass this blocking issue, we used an OBDII reader and examined what it was sending to find the particular broadcast and response address of our test cars.

Flooding of CAN Messages (TBD)

After establishing communication with the car, we noticed that we were receiving only a couple of replies from the car. This appears to be due to the fact that we do not have the hardware filter implemented. The CAN controller is flooded with messages from the car and is dropping most of the packets. We are currently investigating how to implement the hardware filter.

Incorrect Value Displayed on Android Application

This happens in the beginning when we first try to integrate all of the components together. The output was incorrect with our initial SJSUone firmware because the software was sending floating point values to the android when android was expecting integer bytes. Later we change the output to unsigned integer char and that solved the issue. Other solutions could be done on the android end where we can convert the floating point values to strings. Another problem we see with our initial firmware is that we thought a value was passed correctly when it is not. We were supposed to assign a value to a variable but we didn't so we got a value of 0 for the proximity value. This is fixed by simply assigning the value fetched from freeRTOS queue correctly.

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