loading

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 techtinker.co.za

http://techtinker.co.za/forum/viewtopic.php?f=14&t...

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()
{
     //INIT RELAY PIN
     pinMode(RelayCHN01, OUTPUT);
     //TEST RELAY PIN
     TESTRElay();
    Serial.begin(115200);
START_INIT:
    if(CAN_OK == CAN.begin(CAN_125KBPS))
    {
        Serial.println("CAN BUS Shield init ok!");
    }
    else
    {
        Serial.println("CAN BUS Shield init fail");
        Serial.println("Init CAN BUS Shield again");
        delay(100);
        goto START_INIT;
    }
}
void loop()
{
    if(CAN_MSGAVAIL == CAN.checkReceive())  
    {
        CAN.readMsgBuf(&len, buf); 
        CanMessage="";
        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);
delay(200);
digitalWrite(RelayCHN01, LOW);
delay(200);
digitalWrite(RelayCHN01, HIGH);
delay(200);
digitalWrite(RelayCHN01, LOW);
delay(200);
digitalWrite(RelayCHN01, HIGH);
delay(200);
digitalWrite(RelayCHN01, LOW);
delay(200);
digitalWrite(RelayCHN01, HIGH);
delay(200);
digitalWrite(RelayCHN01, LOW);
delay(200);
}
<p>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.</p>
<p>I believe this may help me in gaining access to the gauges. Any suggestions would be much appreciated. Thanks so much!</p>
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.
<p>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.</p>
<p>Hi There. (BTW I updated the video link is should now work)</p><p>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 ?</p>
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. <br><br>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. <br><br>
<p>Very good, thanks for sharing.</p><p>I did find a small typo at the beginning &quot;buy a female-to-make connector&quot;</p>

About This Instructable

3,773views

52favorites

License:

More by mviljoen2:Arduino Controlled Seed Incubator Jerrycan mount with parts bought from a hardware store. How to nativly run Netflix on a raspbery PI2  
Add instructable to: