Car accident is the thing that nobody wants to see, so that safe driving is important to every driver. Sometimes drivers themselves do not realize dangerous driving happens. Therefore, if there's someone could alert them, the chance of car accident will largely be reduced. With our Vehicle Monitor Device, drivers will realized their driving status in real time and get alert when dangerous driving happens.
What it does
Vehicle Monitor Device is able to measure the speed, acceleration and angular speed of the vehicle. It records characteristics data of the car while driving, uploads these data to the cloud system and has voice alert function when the speed, angular speed or acceleration is out of limit. It can also save the user profile and car diagnostic data such as engine malfunction in SD card for later analysis.
On-Board Diagnostics (OBD) system
- Monitor vehicle speed, performance of the engine, detects malfunctions, etc.
Real-time voice alert
- Dangerous acceleration, speed, turn.
Save user profile & car diagnostic data in SD card
- Update firmware from user interface
- Plug into OBD port in the car
- Connect to wireless network (e.g. mobile hotspot)
How I built it
Brain storm and hardware search
- Project to record speed, acceleration, angular speed of vehicle and update data to the cloud
- Accelerometer(MMA8653), Gyroscope(FXAS21002C), OBD to UART intrepreter(STN1110), MCU including Wifi (SAMW25)
Schematic Design by Altium Designer
- Gyroscope and Accelerometer talk with MCU by I2C
- OBD module talks to MCU by UART, and talks to car by DB9 to OBD-II cable
- Power: Power Path Managment IC(BQ24075RGTRG4) takes voltage from USB port or battery(3.7) to ouput a 5.5V, and use LDO to convert 5.5V to 3.3V as power supply of all parts.
- OBD module, support all legislated OBD II protocols
PCB layout design by Altium Designer and parts selection(BOM)
- 60mm * 70mm
- 4 board layer stack(Top layer, Power Plane, Ground Plane, Bottom Layer)
- Custom footprint of gyroscope and OBD to UART interpreter
- Various connectors used when testing
- Compact and Neat
- Part mainly from Digikey
- Two file in SD card: application bin file and metadata file contains version number
- Application stored at 0x10000 in NVM. Compute CRC of current application in NVM and CRC of the bin file in SD card. If different, compare the version number stored in NVM and the one in metadata file. If version number in metadata file is larger, it means the firmware in SD card is the newest and MCU will write the bin file into NVM. Otherwise, MCU will not update the firmware since the one in SD card is the older one.
Node-red Dashboard and OTAFU
- Connect to MQTT broker and IBM cloud
- Show current speed, angular speed and acceleration of the vehicle
- Voice alert if data is out of limit
- Download a new application bin file to SD card
- Node Red Dashboard
CLI and Firmware Implementation
- Implement the code to make sensors work
Challenges I ran into
OBD module contains large amount of parts and it's hard to place all our project parts on one side.
Soltuion: Repeatedly adjust the circuit and properly place vias to make the board compact and neat.
Some chips we use do not have corresponding footprint sources online
Soltuion: Carefully read the datasheet and draw the footprint by ourselves
We first get familiar with I2C and UART, yet it's hard for us to talk with various sensors correctly.
Solution: Add corresponding ASF module of Atmel Studio to our project. Carefully check the circuits in PCB and turn the switches on to enable the sensors. Read sensors datasheet and write data to registers. We finally could scan I2C addresses of every sensors and read data from them.
Accomplishments that I'm proud of
We made an Altium project with no error at last and we get a PCB which is designed by ourselves.
Our PCB works functionally fine. All the voltage values are the expected values, and all sensors could work.
Our board could successfully connect the WIFI and interact with the cloud. It is an exact IOT project.
Bootloader works fine so that our board could update firmware.
What I learned
- Altium Designer, a really powerful PCB Design software
- Draw schematic and footprint
- Draw the layout of PCB
- Component selection and search based on function, power consumption and budget.
- Atmel Studio Programming
- I2C, UART protocol
- Power managment circuit
- MQTT protocol
- Bootloader design of IOT
What's next for Vehicle Monitor Device
- [x] Power for the PCB
- [x] Subsystem for our PCBA functions correctly
- [x] Bootloader works correctly. PCB could download and update firmware
- [x] Board could talk to the cloud
- [x] Read the acceleration from accelerometer and angular speed from gyroscope
- [x] Convert the raw data from sensors to values with units we expected
- [ ] Read various data from OBD-II protocol
- [ ] Create a driver profile including the vehicle's other characteristics like engine malfunction
- 6 of 8 goals have been achieved. The next steps are to make our board able to read the OBD message and obtain speed, diagnostic data like engine malfunction. Also, we need to convert the data from accelerometer and gyroscope to the value with proper units, for example, m/s^2.