Harley Davidson Radio Muter (Part 1)

Basic Idea

A friend of mine, who is doing customizations for motorcycles, asked me if I would be able to do some CAN Bus programming. He was looking for a device that could mute the radio on a Harley Davidson when the intercom is being used. The activation of the intercom would be indicated via a pin high / pin low signal.

As it so happened, I started digging into CAN Bus with one of those ELM327 dongles and my Android phone just a few weeks before he asked me (this will be the topic of another post, promised). So I was quite excited to do something useful with the knowledge I just recently gained, getting to solve a real world problem challenge ;o)

Hardware

Olimex Header Board with circuit board below

Olimex AVR-H128-CAN header board with circuit board below

I decided to go for the AVR-H128-CAN header board by Olimex, which is not too expensive and comes in a nice format (even though it is missing some holes to install the board with spacers instead of having it “floating” around). The board is based on the Atmel AT90CAN128 and one of the things I like the most about Atmel is that they are not only providing the hardware but also tons of documentation and even a software library to start with. (I might as well have gone with any other MCU (German, translated), like the Atmega328P, which is being used in the Arduino Uno, but the AT90CAN128 (as the name is already suggesting) comes with a built-in CAN controller. With the Atmega328P you would need to add a CAN controller (e.g. Microchip MCP2515) to the circuit. All you have to add to it is a CAN transceiver (e.g. Microchip MCP 2551) and you are good to go.

radio muter

Schematic of the Radio Muter

Software

I’m not going into detail about CAN bus communication, since there is already A LOT of documentation around. But this much shall be said: If you want to talk to a CAN bus, appart from the hardware you also need message IDs and message data. This was something Harald already got from Harley Davidson, so sniffing the CAN bus was not necessary anymore. The ID for the radio commands is 0x383 and the data for muting / unmuting the radio is just two bytes, either 0x08 0x1E or 0x08 0x1C.

The software can be found in my github repository.

MCU Programming

From there it was pretty straight forward… or was it? Well, since I chose a non-Arduino approach I also wanted to avoid the Arduino overhead that comes with the IDE and toolchain. With notepad++ as my favorite text source code editor I decided to use WinAVR to compile the source code.

The biggest challenge was to create a makefile, which is one of the many things Arduino is hiding from keeping transparent to you (there was a quite nice article about this on hackaday). The next challenge was uploading the binary to the board. Using the mySmartUsb light dongle and the on board ICSP was quite easy, but then you also have to deal with fuses. Setting them wrong could either damage the MCU or lock it up. But again, there is so much information around, I won’t waste your time elaborating about this.

myAVR is offering two tools to be used with the dongle: myAVR_ProgTool and myavr_support_box. (to be continued)

Advertisements

About Michael Melchior

Husband, Father, computer scientist, commercial helicopter pilot. Full of ideas and open minded, I try to see challenges in what others call problems.
This entry was posted in Projects and tagged , , . Bookmark the permalink.

3 Responses to Harley Davidson Radio Muter (Part 1)

  1. Pingback: Harley Davidson Radio Muter (Part 2) | Michael Melchior

  2. Denis Pereira says:

    Hi,

    I am new to arduino and am planning on reading Harley CAN bus data such as engine RPM.
    In your post you mention you have the message Id’s from Harley Davidson. Can you share any info on that? It would be much appreciated.
    Thanks

    • Hi Denis,
      thanks for your message. Unfortunately I only had the one message ID for the radio muting. But I am pretty sure that the engine RPM is among the standardized IDs you can find all over the Internet.
      Cheers,

      Michael.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s