CAN Hacking: The Hardware

can-hacking-hardware

So far we have discussed the basics of CAN, in-vehicle networks, and protocols used over CAN. We’re going to wrap up with a discussion of CAN tools, and parts to build your own CAN hardware.

Wiring

Unfortunately, there’s no set standard for CAN connections. The most common connector for high-speed CAN is a DE-9, with CAN high on pin 7 and CAN low on pin 2. However cables will differ, and many are incompatible.

CAN needs to be terminated, preferably by a 120 ohm resistance on either end of the bus. In practice, you can stick a single 120 ohm resistor across the bus to deal with termination.

Tools

A good CAN tool will let you transmit and receive CAN messages, interpret live data using CAN databases, and talk CAN protocols. The tools with this feature set are proprietary and expensive, but some hacker friendly options exist.

GoodThopter

The GoodThopter12

Based on [Travis Goodspeed's] GoodFET, the GoodThopter by [Q] uses the Microchip MCP2515 CAN to SPI controller to access the bus. The open hardware tool lets you send and receive messages using Python scripts.

CAN Bus Triple

CAN Bus Triple

The CAN Bus Triple device provides an interface to three CAN buses, and can be programmed in an environment similar to Arduino. The open source code provided lets you muck with the second generation Mazda 3. Unfortunately, the hardware does not appear to be open source.

Saleae Logic

Saleae Logic

It’s not open source, but the Saleae Logic is a very handy and cheap tool for looking at CAN buses. It can capture, decode, and display CAN traffic. This is most useful when you’re building your own CAN hardware.

DIY

The Parts

If you want to design your own hardware for CAN, you’ll need two things: a CAN controller, and a CAN transceiver.

The CAN controller generates and interprets CAN messages. There’s many microcontrollers on the market with built-in CAN controllers, such as the Atmel ATmega32M1, Freescale S08D, and the TI Tiva C Series. When using a built-in CAN controller, you’ll have to use an external oscillator, internal oscillators are not sufficiently accurate for high-speed CAN. If you want to add CAN to an existing microcontroller, the MCP2515 is an option. It’s a standalone CAN controller that communicates over SPI.

The transceiver translates signals from the controller to the bus, and from the bus to the transceiver. Different transceivers are needed for high-speed and low-speed CAN networks. The NXP TJA1050 works with high-speed buses, and the ON Semi NCV7356 works with low-speed, single wire buses.

Dev Boards

There’s a ton of development boards out there featuring microcontrollers with a CAN controller. The Arduino Due‘s SAM3 processor has a controller, but there’s no transceiver on the board. You can pick up a CAN bus shield, and the Due CAN Library to get started.

The ChipKIT Max32 is similar to the Due. It has two CAN controllers, but you’ll need to provide external transceivers to actually get on a bus. Fortunately there’s a shield for that. The ChipKIT is officially supported by Ford’s OpenXC Platform, so you can grab their firmware.

That concludes our discussion of CAN Hacking. Hopefully you’re now ready to go out and experiment with the protocol. If you have questions, send them along to our tip line with “CAN Hacking” in the subject, and we’ll compile some answers. If you liked this series and want to suggest a topic for the next set of posts we’d love to hear that as well!

CAN Hacking

Put your dev board to work as a demoscene display

If you’re looking for a way to push your comfort zone with that slick new microcontroller you’ve been working with we think [Morgan Gangwere] has the answer. He took his chipKit development board and used it as a demoscene platform.

Demoscene refers to audio and visual demos written to squeeze as much entertainment out of a given platform as possible. We’ve seen demos for a lot of different platforms; for instance, here’s a Propeller chip demo. But this use of the onboard OLED screen brings a smile to our faces. With well under 100 lines of code [Morgan] implemented several different video effects (the music heard in the clip after the break is not being produced by the board). There is a star field which serves as the background. Over the top of it a scrolling message is displayed following a sine wave shape. The speed at which it scrolls is set by the trimpot, which you can see adjusted about 50 seconds into the clip.

[Read more...]

Taking a dump from some old hardware

NYC Resistor shows you how to have some fun with electronics from the junk bin. Their post called The Joy of Dumping encourages you to look around for older memory chips and see what they’ve been hiding away for all these years.

The targets of their hunt are EPROM chips. Note the single ‘E’. These are Erasable Programmable Read-Only Memory chips, and predate EEPROM which adds “Electrically” to the beginning of the acronym.  You used to use a UV light source to erase the older types of memory. In fact we’ve seen some EPROM erasers as projects from time to time. These shouldn’t be too hard to find as they were prevalent as cheap storage back in the 1980′s.

If the quartz window on the top of the chips has been shielded from ambient UV light, you should still be able to read them and it’s as easy as hooking up your Arduino. Is it useful? Not really, but it still can be neat to interface with what might otherwise never make its way back out of the junk box.

Building a better circuit for renewable energy harvesting

[David], [Ian], and [Sajjad] finished and submitted their entry to the ChipKIT challenge just under the wire. They designed and built a maximum power tracking circuit for use with renewable sources. That is to say, this is a voltage regulator for use with solar cells and other generative sources like wind or water power. The idea is to use the best concepts of switch-mode power supply design, but replace the more wasteful parts with circuits that can harness and roll the loss back into the output.

We have to admit, following their development choices from the write-up at the top is a bit rocky. But luckily they filmed an in-depth description of the design choices, as well as a demonstration of the circuit along with various test measurements. If you’ve got twenty minutes and some patience all will become clear in the video after the break.

This will go along great with that bucket-based hydro generator you built.

[Read more...]

ChipKIT temperature shield supports a dozen sensors

chipkit_temp_board

[Will] wrote in to share a useful add-on he designed for the ChipKIT UNO 32, a 12-port temperature sensor board.

Constructed for one of his customers, the shield accepts any 2-wire 10k thermistor sensors, outputting the readings to a small LCD screen. The screen is supported by some code put together by his associate [crenn], but you are not limited to solely displaying the temperatures there. Since this module piggybacks on top of the ChipKIT the same fashion as any standard shield, you clearly have the ability to use and manipulate the data at will. With 12 ports on board this would work well for a house-wide temperature monitoring system, or perhaps in a complex brewing setup.

Both the temperature shield and LCD boards have been released under the Open Source Hardware License, so you can easily build your own if you have the means, though [Will] has a few extras he’s willing to sell if you need one quickly.

Meet the Pinguino – a completely open PIC-based dev platform

pinguino

[Phillip Torrone] from Make recently sat down with [Jean-Pierre Mandon] and [Tsvetan Usunov], creators of the Pinguino, to hear more about their product. While the name might not sound familiar, we’re pretty sure you’ll be seeing more of this development platform as time goes on.

Essentially created by makers for makers, the Pinguino is a 32-bit PIC based Arduino-compatible prototyping platform, much like Microchip’s chipKIT. The Pinguino boasts 100% Arduino compatibility just as the chipKIT, though their tool chain has been built from scratch, meaning it is completely open source. The Pinguino even include an on-board microSD slot and a built-in Li-Po charger – two huge features that make this a solid chipKit competitor.

Phil discusses the history of the Pinguino with the pair, diving into technical differences between the two platforms, as well as where they plan on taking the platform in the future. It’s certainly an interesting read for anyone interested in open software and hardware that has been considering giving the chipKIT a try.

Addressing Microchip’s open source problem

microchip_call_for_open_source

Hackaday alum and owner of Dangerous Prototypes [Ian Lesnet] recently wrote an editorial piece calling out Microchip on some of their less than friendly attitudes towards open source.

[Ian] and his company use PIC microcontrollers extensively in their projects, and they have quite a high opinion of their products overall. The gripe that he has (and thinks you should have too) is regarding Microchip’s approach to open source.

You see, Microchip invested in the Arduino IDE and released the chipKIT, a 32-bit Arduino compatible development board, along with big promises of “playing nice” with the open source community. The problem, according to [Ian], is that while Microchip’s compilers are based on GCC, they “keep some special sauce locked up”, which means that certain parts of the chipKIT toolchain are not open. Many in the community, including [Ian] had high hopes for the chipKIT based on the successes seen by Atmel’s open source initiatives, but many things are still locked up behind closed licenses.

An example of this unfriendly attitude towards open source can be seen in Digilent’s recently released network shield. It supports Ethernet and USB features of the chipKIT MEGA, but the TCP/IP and USB stacks are completely closed source. Digilent pushed hard to get the ability to release open drivers for the board, but it was a battle they ultimately lost. This behavior creates roadblocks for seasoned developers of open source products such as Dangerous Prototypes, as well as the curious beginner, which is why [Ian] is making a point in bringing these issues to light.

[Ian] urges Microchip to give something significant back to the community they are tapping, a result which can only be achieved by speaking up. Be sure to check out his editorial, and if after reading it you have any interest in letting your voice be heard, drop Microchip a line and let them know that their one-way relationship with the open source community is something you would like see change.