Arduino Control/Integrate Aftermarket Accessories Via the CAN-BUS


Introduction: Arduino Control/Integrate Aftermarket Accessories Via the CAN-BUS

If you wanted to control aftermarket accessories using the existing controls in your vehicle you would have to connect a relay to end where an existing factory accessory is connected to.

For an example:
You have a 4x4 and want to add aftermarket spot lights, So you need to then connect a relay to an existing light, which will click the relay and let more power through to the aftermarket lights. This means you have to splice and cut into the existing factory wiring of your vehicle.

With this instructable you can tap into the can bus (in my case the can bus wires at the back of the radio)
The radio has a can-bus because its controllable via other accessories such as the steering wheel buttons, so instead of cutting into it you can buy a female-to-make connector and then tap into the connector.

You need the following.
Arduino UNO.
SeeedStudio CAN-BUS Shield.
Arduino IDE with the SeeedStudio CAN-BUS Library.
Relay Shield, can be a single channel, but I used an 8 channel relay board.

The Arduino Code (At the end of this instructable)

Step 1: Another Example of Its Use.

See the picture.

Some vehicles knows how much power the factory bulbs in the Blinkers,Brakes and headlights are supposed to consume, anything under and over it will shutdown the circuit.

So If you wanted to add a trailer , you also need to by the wiring harness which basically does exactly this, and they are very pricey!

Step 2: See This Instructable in Action

Ive created an example prototype on youtube of this.

It monitors the CAN-BUS for the message that turns on the lights, and then DigitalWrite to the pin of your choice.
The Arduino's IO pin is connected to an 8Channel Relay board which can be used to turn on accessories.

In the video i'm controlling the relay by turning on the main beams.

Enjoy! Happy CAN-BUS Hacking!

More Information about this project can be viewed in this forum thread on

The Arduino Code.

#include <br>#include "mcp_can.h"
INT32U canId = 0x000;
unsigned char len = 0;
unsigned char buf[8];
char str[20];
String CanMessage="";
int HeadLightsDetected=0;
int RelayCHN01=7;
void setup()
     pinMode(RelayCHN01, OUTPUT);
    if(CAN_OK == CAN.begin(CAN_125KBPS))
        Serial.println("CAN BUS Shield init ok!");
        Serial.println("CAN BUS Shield init fail");
        Serial.println("Init CAN BUS Shield again");
        goto START_INIT;
void loop()
    if(CAN_MSGAVAIL == CAN.checkReceive())  
        CAN.readMsgBuf(&len, buf); 
        canId = CAN.getCanId();
        //Detect Main Beam HeadLisghts
        if (canId==680)
          //Build Complete Message Without CAN ID From BUS
          for(int i = 0; i
void TESTRElay()
digitalWrite(RelayCHN01, HIGH);
digitalWrite(RelayCHN01, LOW);
digitalWrite(RelayCHN01, HIGH);
digitalWrite(RelayCHN01, LOW);
digitalWrite(RelayCHN01, HIGH);
digitalWrite(RelayCHN01, LOW);
digitalWrite(RelayCHN01, HIGH);
digitalWrite(RelayCHN01, LOW);



    • Woodworking Contest

      Woodworking Contest
    • Make it Move Contest

      Make it Move Contest
    • Planter Challenge

      Planter Challenge

    We have a be nice policy.
    Please be positive and constructive.




    Very good approach and I believe just the right tool in gaining access to the instrument gauge cluster of a 2009 Mazda Miata. Upon changing the OEM engine control unit (ECU) to a DTA-Fast fully programmable ECU and followed the manufacturers installation and wiring instructions the miata strarted on it's default program set by the manufacturerthe gauges though didn't.

    1 reply

    I believe this may help me in gaining access to the gauges. Any suggestions would be much appreciated. Thanks so much!

    I forgot to mention that the twin relays are necessary as the Bosch DC motors are run with a single pair from a twin relay that switches polarity.

    Hello and thanks for the posting. Can I input the switches from the seat control directly into the UNO board? I want to run my Audi A8 drivers seat here at home, sitting in front of my computer, with a 220 to 12 volt power supply, needing exactly 8 output switches to run the Bosch dc motors inside the seat. I can explain more if you are interested in my problem. Thanks. I am a retired US veteran in Estonia, I need a better seat, furniture makers suck big time. The auto industry has done more ergo-metric engineering in their great car seats.

    2 replies

    Hi There. (BTW I updated the video link is should now work)

    Umm I dont know if this project will help you., could you not just control each motor separately by feeding them 12v using a simple switch for each motor ?

    Yes that would work, but it would be cool to use the switches in the side of the seat, instead of building a panel with ten switches in it.

    Each switch has a single wire output that ohms out at 400 in one direction and 800 in the other. While I would not need all the memory, and such that comes with the controller/memory board in the chair, I need to interpret the switch output and feed it into the h bridge twin relay to run the motors. There are eight motors in the seat.

    Very good, thanks for sharing.

    I did find a small typo at the beginning "buy a female-to-make connector"