User:1sfoerster/enes100/fall2013/p2ECU

Problem Statement (Finish description)

 * 1) Worked on getting the Code Reader to talk to the ECU
 * 2) Found a starting point for future projects (CAN bus)

Conceive

 * A nice contribution to this project are these videos we found of DARPA hackers that flooded the can bus and controlled the car by a laptop.These videos can be found below.


 * Carjackers Hack a Toyota Prius
 * Documentation of the Prius Hack
 * DARPA Hackers Take Control of a Prius
 * can bus primer

Initial Concept

 * Computers in vehicles:
 * Cars, trucks, wheelchairs, golf carts, kids toys
 * Lack of standards: security through obscurity
 * Goal: open up the ECU so that others can better understand them and modify their vehicles.
 * Future → customizable vehicles
 * Add horsepower - add noise suppression so can increase power
 * Customize dashboard - mileage control

Design
The first team on the ECU project started with a tire pressure sensor add-on.
 * Goal: reverse engineering
 * Found that tire has to spin at 15 mph in order to turn on, or use huge magnets.
 * Next step: build system to spin tire at 15 mph
 * Failed due to complexity of system

Implementation
Starting point for this project: new code scanner device from team member Adel, and a donated 1996 Isuzu Hombre ECU.

Previously, we had only the ECU from the truck due to it being sold before we could retrieve the sensors.

The first thing we did was revise the wiring setup from last week, including all 11 wires we determined to be the possible matches to the 6 OBD wires. Previously, we only used one wire of each color from the ECU side to connect with the OBD, so five ECU wires were left unused. We instead grouped all the wires of each color together and connected them all to the OBD because they are probably all used by the code reader.

We also determined from the wiring documentation that the three pink wires, A5, B2, and C18, were likely to be the power lines. They are labeled on the wiring diagram as "hot" or "hot at all times," which implies that they carry power and are probably the wires that put power through the ECU to the OBD connector and allow them to communicate. After testing the current through each, we learned that B2 carries much more current than the other two pink wires, and required an increase in allowed current from the voltmeter to prevent the code reader from shutting off on contact. We tried using all 7 possible combinations of the three wires, connecting them to the orange line which we supplied positive power to, but none of them changed the results; the code reader still returned a connection error.

After spending some time documenting the wires coming from the ECU, we discovered that power is not delivered to it straightforward like a power cord. Instead, there are a variety of wires that carry power.

We initially supplied power to the OBD connector directly, but that returned a connection error on the scanner. Therefore, we determined that the scanner cannot send data to the ECU; it can only receive data. In order to communicate with the ECU, power needs to come through it instead of the OBD connector. However, there were 54 physical wires to sort through for power lines, and searching for them proved to be time consuming. Since the power comes through multiple wires which we were unable to identify, this was a major stopping point.

Wiring
We spent some time studying the wiring diagram to see if we could identify the power lines.

The ignition coil assembly takes power from a pink wire, unnamed in the diagram, and information from the ECU via wires C31 and C32.

Electricity Scaffolding
Connecting a wire directly to the positive and negative ends of a battery will cause a short and the battery will become hot. A circuit needs a load to prevent shorts. A load is anything that takes energy from the battery and converts it to a different form, like a light bulb converting the electricity to light and heat energy or a motor converting the electricity to kinetic energy.

Conventional flow, where electricity in a circuit flows from the positive end of a battery to the negative end, was proposed by Benjamin Franklin. However, the electricity actually flows from negative to positive and is known as electron flow. This is because current is made up of electrons that move extremely slowly individually, but the energy travels quickly due to the power source causing them to vibrate and transfer that energy down the path of electrons.

We learned that shorts can be harmful to both the circuit and people who touch it, but the small amount of current going through the ECU wires isn't enough to cause concern. We are working with a wire grade of about 18-22 so they don't carry enough current to be dangerous.

Arduino UNO
After installing the necessary software (v1.0.5) and drivers (dpinst-amd64) for the Arduino from arduino.cc, we found that it came with example codes to play with. We found a tutorial for one here that explains how to use an LED Blink code.

Following the tutorial, we opened the file named Blink.ino, which brought up a short code with comments included that explained what each line did. Then we set the board type to Arduino UNO and, after connecting the board to the computer's USB port, uploaded the code. The first upload failed because it returned an error due to an invalid serial port. The tutorial suggested using the port COM3 or higher, so in the error window we tried the upload again using COM3 (it was the only available option). This time, the LED blinked successfully.

Video of second run (I did not encounter the upload error this time)

Arduino Basic Programming
Arduino programs are called "sketches" and the most basic one blinks an LED on the board. The first piece of code is the declaration stage, and identifies the variables. The second step is the void setup, which is important for running the code - it does not return data to anything, hence the word "void." The last and main piece of a basic code is the void loop, which is repeated over and over as long as the Arduino is powered on.

Wiring Documentation
The Arduino programming was put on hold to finish a complete documentation of the ECU wires. We used this wiring diagram of the ECU to create a spreadsheet showing the names of the wires, their colors, and their functions in the vehicle as listed in the diagram. Each plug had a casing that opened up in the back to show the numbers next to each wire. We determined the letter name of each plug in my last project documentation by using these numbers and wire colors to match them with the wiring diagram. Once we had all the wire names listed in the spreadsheet, we entered their colors and then looked at the wiring diagram to see where they carry power/data to or from. To determine whether the wires carried power/info to or from the ECU, we used the names of the destinations; "sensor" typically meant a device that measured the status of a particular system to relay information to the central computer, and words like "valve," "indicator lamp," and "injector" are associated with outputs, or things that the ECU sends data to to control.

Wiring spreadsheet

Next Steps
Next steps of this project:
 * Find another junk vehicle for its ECU and associated sensors
 * Use the CAN bus to establish communication between the ECU and code scanner
 * Buy a handheld Auto scanner found | here.