ECE497 Project CANBus

From eLinux.org
Jump to: navigation, search

thumb‎ Embedded Linux Class by Mark A. Yoder


Team members: Adam Wiesler

Grading Template

I'm using the following template to grade. Each slot is 10 points. 0 = Missing, 5=OK, 10=Wow!

00 Executive Summary
00 Installation Instructions 
00 User Instructions
00 Highlights
00 Theory of Operation
00 Work Breakdown
00 Future Work
00 Conclusions
00 Demo
00 Late
Comments: I'm looking forward to seeing this.

Score:  10/100

(Inline Comment)

Executive Summary

The goal of this project is to 1) configure the canbus and socketcan on the beaglebone blue and 2) develop an internally hosted webapp that allows the user to monitor parameters that are being published on the canbus. This project hopes to serve as a debug tool for Rose Hulman's FSAE team, RoseGPE.

Currently, the system works such that there is a server on the Beaglebone that serves a webpage. When the webpage is loaded onto the client, it requests a single CAN frame every 100ms and plots it onto a graph for the user to observe.

Everything that I set out to accomplish in this project works, however in the future I would like to add the ability to monitor multiple CAN frames at one, and abstract the user from the raw data. That is to say that instead of trying to remember that "Steering Wheel Button 1" is CAN ID 0x542, byte 2 bit 3, for example,the end user would simply have to select from a dropdown "Steering Wheel Button 1" and everything else is done automatically. This will be a bit of an undertaking as it requires a framework for defining all of the various messages in a car to be developed.

Overall I was very pleased with the outcome of this project. In addition to decoding CAN data, I learned a lot about the newer web frameworks, building the project from the ground up, employing, angular.js, bootstrap, highcharts, and jquery. The platform I built can be expanded upon in the future to add the other functionality that I mentioned above.

Packaging

To test this project I am using a small dsPIC based board I made that has LEDs, buttons, analog inputs, etc. that can be used to generate can messages for testing. A JST cable was made up to connect these two boards together.

The BeagleBone Blue has an integrated CAN transciever chip, allowing the board to be connected to any CAN device with only one wire. If a Black is to be used, an external Transciever chip must be used. In the case of the blue, the external board was connected to the 4-pin JST connector labeled "CAN."

The video below will show the entire setup. In the future, I would like to make a small case that has an integrated battery so the entire system could become portable. For this project however, this was not a requirement.

Installation Instructions

Prerequisites:

  • Node
  • NPM
  • BeagleBone Running a recent distribution (will already include all kernel drivers for CAN)

First, create a new directory and clone my repo:

bone$ git clone https://github.com/adamwiesler/ECE497AW.git

navigate into "project_CANbus/Webapp"

bone$ cd project_CANbus/Webapp/

use NPM to install prerequistes:

bone$ sudo npm install

That should be it! Everything else come with the repo download automatically

User Instructions

To use the webapp, first CAN has to be enable. To do this, CD into "project_CANbus" and run the script "enableCAN"

bone$ sudo ./enableCAN

This will enable the canbus and connect it as a network interface.

Next, start the server:

bone$ node /project_CANbus/Server.js

At this point, the server should be running and the webapp can be accessed by opening a browser and going to http://IPADDRESS:9090/

Highlights

This project was designed to be a framework to build CAN connected webapps upon. Overall, the implementation is very extendable, allowing for future expansion. The server side was built upon express.js, using that as a server. Web sockets (not socket.io) were implemented for client-server communication. SocketCAN was used to communicate with the CANbus. The Client side employs bootstrap for the webpage layout, Angular.js for displaying the data, and highcharts for plotting. In addition, jquery and some custom CSS were employed.

For a demo of the project, please checkout this video.

Theory of Operation

The project is built upon a standard Server-Client Platform. The beaglebone serves up a webpage, which the client requests. In addition, everytime a new CAN message comes in over the bus, the server adds it to a list. When the client loads the webpage, it starts a timer and periodically emits a request to the server to send the most recent CAN packet that it has received. The server, upon getting this request, packages the CAN packet and emits it to the client. The client receives this packet, then updates the various elements of the webpage including the chart, text indicator, and LEDs.

Work Breakdown

All work was done by Adam Wiesler

All Tasks have been completed:

  • Hardware - Around one hour was spent on building and testing a cable to be used to connect the CAN generating test board to the BeagleBone
  • CAN Configuration - A few hours was spent getting the CANbust configured and writing test programs in JS to test receiving CAN
  • Server-Side programming - Half of the remaining time was spent writing the server that records the CAN data, serves a webpage, and sends CAN data to the Client
  • All remaining time was spent writing the Client side interface that requests data from the server, and then displays it

Future Work

As briefly mentioned above, in the future I would like to see the project expanded upon as to abstract the user even further from the CAN data. This would allow the user to simply request to view "Steering Wheel Button 1" or "Exaust Temperature 2" instead of plotting a single ID and Byte. This approach should also allow for different data representations, such as 12bit temperature values being distributed over multiple bytes.

In addition, I would like to see the ability to plot multiple objects at once on the graph. This should be simple to add once the above is completed.

Conclusions

Overall, this project was a success. I set out with the goal of reading CAN data from a bus and displaying it on a webpage. I was able to accomplish this in such a way that allows the functionality (such as more abstraction and additional plots, as mentioned in "Future Work" of the to be expanded upon in the future without too much difficulty. I was hoping to also improve my web programming skills with this project, and successfully accomplished that goal, having learned a lot about how modern webpages are put together.




thumb‎ Embedded Linux Class by Mark A. Yoder