You are viewing outdated content for BUG. If you have a BUG Y.T. edition or 2.0 series device, please visit our updated wiki: http://wiki.buglabs.net



AutoBUG

From BUG Wiki

Jump to: navigation, search

Contents

Intro

Here is a brief description on how to make your own autoBUG. AutoBUG combines the BUG's hardware and connectivity (GPS, GSM, accelerometer, etc.) with data from a car via its CAN BUS. This system turns the car into a hotspot node on a network. The current iteration of this project should run on any GEN 2 Prius, which is one of the most fun and hackable cars around. See below for some advice on how this project could be modified to run on other cars.

List of Supplies

  1. A BUGbase w/ BUGview & BUGvonHippel & BUG3G (optional BUGlocate for recording GPS data)
  2. ODB II Diagonstic Cable (You will end up hacking it as described later). I found the following via a quick Google search for "ODB II to Serial Cable": http://www.suntekstore.com/OBD2-16Pin-to-DB9-Serial-Port-Adapter-Cable-.html
  3. CANUSB cable - http://www.canusb.com/
  4. A Gen 2 Prius or other car where the CAN data is available and has been decoded.

Software Setup

You need a couple of pieces of software to get this thing working. If you have an r1.4.3 BUG, you should not need any new drivers or software modules. When everything is hooked up correctly, your CAN USB cable should show up as an USB serial port, usually at /dev/ttyUSB0.

What you need

  1. The autoBUG application: http://buglabs.net/applications/autoBUG
    • This is the main application that does all the work.
  2. The RxTx emulator application: http://buglabs.net/applications/com.buglabs.emulator.rxtx
  3. The RxTx jni package for the BUG: http://bugcommunity.com/downloads/com.buglabs.bug.jni.rxtx.jar

Details on the autoBUG application

This is the main Java BUG application for autoBUG. You can download it into your SDK and modify it to your needs. It is currently set up to work with a Gen 2 Prius. If you have the CAN codes for another car, you should be able to modify it for that vehicle. If you do so, you want to modify autobug.CANParser.java.

AutoBUG's parser only uses a few of the codes that the Prius provides. You can download the current list of codes here, which were originally deciphered through the painstaking work of Attila Vass. Please see the Acknowledgements section for more props.

The serial port /dev/ttyUSB0 is where the CAN USB cable usually shows up when plugged into the BUG if there are no other USB serial devices plugged in. This is currently hard-coded into the application. Keep this in mind if you are having trouble. The USB serial device may have been added at at a different spot (such as /dev/ttyUSB1) and you need to modify the constant in autobug.Activator.java accordingly.

One last note on how this application works -- Most of the work is done via Java Tasks which save their data in a thread safe object called CANData. In this way, new functionality can easily be added or made optional (such as GPS).

Hardware Setup

Hacking the ODB II Cable

You need to re-wire the ODB II cable based on the following diagram:

Image:Wiring.gif

Connecting it up

Connect all the wires before turning on the car or booting the BUG. Make sure all the rxtx jni package and the autoBUG application have been installed on the BUG. Make sure the correct modules (at least the LCD and VonHippel modules) are connected to the BUG.

The big end of your hacked ODB II cable hooks into the diagnostic port which, on a GEN 2 Prius, is under the dash on the driver's side, just to the right of the steering wheel. The RS232 side of the cable plugs into the CANUSB adapter. Finally the USB side plugs into the BUG's VonHippel USB port.

Turn the car on, then boot the BUG. If the CANUSB adapter is working, you should see a green light on the adapter itself.

Once the BUG boots, the autoBUG screen should launch. If it is correctly receiving data, it should appear on the screen. For fun, retro numbers are used to display numeric values.

Acknowledgements

  • This project was begun by Mr. Devon Jones: http://www.evilsoft.org/. He was the first to use the BUG in a car and wrote the first version of autoBUG in Python. He gladly shared his knowledge and source code with us to get us going. Devon was also kind enough to loan his car and occasional chauffeur skills on many occasions. Thanks Devon!
  • We've never met Attila Vass: http://www.vassfamily.net/, but without his work, this project would have been nearly impossible. Attila's Prius website is loaded with info. He also did the hard work of decoding the Prius CAN messages and created the ODB II wiring diagram above.
  • The creators of Java RxTx: http://users.frii.com/jarvi/rxtx/. This is the best serial library for Java around and it runs on PhoneME.
  • And of course, the Bug Labs team: http://buglabs.net/team.

Resources