CAN Hacking: Protocols

We’ve gone over the basics of CAN and looked into how CAN databases work. Now we will look at a few protocols that are commonly used over CAN.

In the last article we looked at CAN databases, where each bit of a message is mapped to a specific meaning. For example, bit 1 of a CAN message with ID 0x400 might represent whether the engine is currently running or not.

However, for more complex communications we need to use protocols. These can map many meanings to a single CAN ID by agreeing on a structure for sending and receiving data.

Continue reading “CAN Hacking: Protocols”

CAN Hacking: The In-vehicle Network

Last time, we discussed how in-vehicle networks work over CAN. Now we’ll look into the protocol and how it’s used in the automotive industry.

The Bus

On the hardware side, there’s two types of CAN: differential (or high-speed) and single wire. Differential uses two wires and can operate up to 1 Mbps. Single wire runs on a single wire, and at lower speeds, but is cheaper to implement. Differential is used in more critical applications, such as engine control, and single wire is used for less important things, such as HVAC and window control.

Many controllers can connect to the same bus in a multi-master configuration. All messages are broadcast to every controller on the bus.

An oversimplified in-vehicle network
An oversimplified in-vehicle network

Continue reading “CAN Hacking: The In-vehicle Network”

CAN Hacking: Introductions

We’re introducing a new series on CAN and automotive hacking. First, we’ll introduce CAN and discuss how in-vehicle networks work.

In 1986, Bosch introduced the Controller Area Network protocol. It was designed specifically for in-vehicle networks between automotive controllers. CAN became a popular option for networking controllers in automotive, industrial, and robotics applications. Starting in 2008, all vehicles sold in the US must use CAN.

Modern vehicles are distributed control systems, with controllers designed to handle specific tasks. For example, a door control module would take care of locks and windows. CAN allows these controllers to communicate. It also allows for external systems to perform diagnostic tasks by connecting to the in-vehicle network.

Some examples of CAN communication in a vehicle include:

  • The engine control module sending the current engine speed to the instrument cluster, where it is displayed on a tachometer.
  • The driver’s door controller sending a message to another door controller to actuate the window.
  • A firmware upgrade for a controller, sent from a diagnostics tool.

CAN is usually used with little or no security, except for the obscurity of the communications. We can use CAN to USB interfaces to listen to the traffic, and then decode it. We can also use these tools to send forged messages, or to perform diagnostic actions. Unfortunately, most of the tools for dealing with CAN are proprietary, and very expensive. The diagnostics protocols are standards, but not open ones. They must be purchased from the International Organization for Standardization.

Next time, we’ll get into the structure of CAN frames, and how traffic is encoded on the bus.

 [Image via Wikipedia]

CAN Hacking

Guest Rant: From Bits To Atoms

I’ve been a software developer for quite a while. When you spend long enough inside a particular world, it’s easy to wind up with an ever-narrowing perspective. You start seeing everything from a software point of view. As the saying goes, when your only tool is a hammer, you tend to treat every problem as NP-Complete. Or something. I forget how that goes.

Anyway, the point is, it’s always good to broaden one’s horizons, and solve as many different kinds of problems as possible. To that end, I started to get into hobby electronics recently. The journey has been very enlightening in a number of ways.

Continue reading “Guest Rant: From Bits To Atoms”

SparkFun Ponders Women In STEM Fields

sparkfun-ada-loveless-day

Tuesday was [Ada Lovelace] day and to recognize it SparkFun posted an article about women in their workforce and the STEM initiative. [Ada Lovelace] is credited with forging a path for women in mathematics and computing. The STEM acronym represents a movement to get more of America’s students into Science, Technology, Engineering, and Mathematics fields in order to keep up with the rest of the developed world. But part of the issue includes drastically increasing the interest of young women in these fields and their access to it. The thing is, I feel the same way about the community at Hackaday.

Obviously some of the biggest names in the hobby electronics and engineering enthusiast industry are women. The name that seems to top lists is always [Limor Fried] who you may know better as [Lady Ada]. She founded Adafruit industries. But there are couple of other notables that stick out in our minds. [Jeri Ellsworth] has been huge name around here forever. Just this week Hackaday was celebrating the Kickstarter for her latest project. [Becky Stern] has had a ton of awesome project featured, mostly in conjunction with her work at Adafruit but her knitting machine hack when she was with MAKE has always stuck out in our minds. And of course, there’s [Quinn Dunki] who has long been building her own 6502 computer from the ground up (Incidentally we’re running a Guest Rant from her at midday on Friday).

What I’m missing is the grass-roots hacks from women. I know they’re out there because I see them at monthly meetings at the local hackerspace. We featured [Caroline’s] bathymetric book, and [Robin]’s collaboration that produced solar powered supercap jewelry. Both are members of Sector67.

So I call for all Hackaday readers to make this a friendly environment for anyone who wants to participate. If you’re a female reader who has been lurking around rather than sending in links to your gnarly hacks please take the plunge and send us a tip! If your female friends have awesome projects, offer to help them document it for a feature. You may not have thought of it, but sharing your projects makes you a role model for young readers.

By trade I’m an orchestra musician — a field that was completely closed off to women until well into the last century. While gender equality hasn’t been reached in all orchestras, the Regional Orchestras I have and do play with, show equal representation of gender throughout. Let’s make the same thing happen with STEM!

HaDuino: Open Your Beer Using Arduino

Frankly we’re tired of Arduino having a bad name here at Hackaday. So [Brian Benchoff] came up with a way to make it useful to a wider audience. His creation, which we call the HaDuino, lets you use the Arduino clone to open a tasty bottle of beer.

Continue reading “HaDuino: Open Your Beer Using Arduino”