Hi everyone, I've canbus Raise in my car connected to the head unit via two cables, one of them with 5V current is responsible for transmitting signal that I want to filter (specifically - blocking turn signal in certain situations). I connected GND, cable from canbus to A6, cable to head unit to A5 and wrote simple code inside loop:
val = analogRead(A6);
Serial.println(val);
analogWrite(A5, val);
All I get is 1023 in the monitor and signal from pin A5 does nothing in head unit.
I would be grateful for any hints and ideas how to do it. All I found is building canbus with Arduino from scratch while I already have a canbus, just need to alter it's signal.
Canbus cannot be directly connected to the Arduino.
You need a Can controller and a Can transceiver both of which can be found in a shield such as this one:
Yes, you need to build a arduino Canbus to talk to your cars Canbus and those tutorials show you how to send and receive Can signals.
This is the real hard part.
First you will need to identify which of the thousands of can signals the car will be sending is the one you want.......
Interesting question without a lot of insight by the OP. Sorry but we do not have the ability to see what you have in front of you. I also would guess you do not know either and are just poking around. None of my cars have a head unit, what vehicle do you have that has that?
Hi, thank you for your replies! You're right, I wasn't specific.
To make story short: I would like to block turn signal message that comes from existing canbus decoder (brand name Raise).
Further explanation: one of the cables from the canbus decoder conveys signal to the head unit with android. I got an idea to use Arduino and connected that cable to RX (ofc GND to GND aswell). I'm receiving so far something like � E7, it alters when I turn the blinker/use steering wheel controls/open or close doors etc. That � is probably the question of setting baud rate, I'm working on it and would be grateful for any hints.
In that case, is it still necessary to use CAN-BUS Shield v2?
Canbus uses 2 wires neither of which is ground. They are known as canH and canL.
The Can controller and transceiver do much more than convert the Can signal to a SPI signal that the arduino can understand. They also handle all the communication issues that will be encountered. I highly suggest you read some tutorials and learn how it works.
Right now it is like you are trying to play chess at a advanced level but haven't yet learned how any of the pieces move.
It's not as simple as that.
All devices(nodes) on a Can bus receive all messages sent on the Can bus.
Therefore you cannot block a single message and replace it with your own.
This is certainly a very advanced project and will likely require months of research on your part.
I know about GND, it's a separate cable. I also know about can high and low, but it's the source that is located before canbus decoder in a quadlock wiring harness (like in a socket for elm dongle).
So I asume that what comes from decoder is decoded data, not a raw signal that comes from can H and L. Otherwise canbus decoder is located in the radio itself and I bought a useless empty box instead of canbus decoder. Correct me if I'm wrong.
It should look like that (again correct me if I understand it wrong).
If I cut RX cable canbus messages don't get through. I connected that cable to RX on Arduino and I'm receiving messages like � E7. I can send it further to android app and I don't know for example display a toast every time I use the turn signal. But that's not the point. Point is to simply pass it through Arduino's TX back on the other part of the cable that leads to the radio's RX. And that doesn't seem to be working with the code above. Maybe different logic, maybe specific baud rate (I tested it on every possible that Arduino offers from 600 up to 2000000 [yes that one also works - tested it]). That's why I'm here.
I do not believe the radio is the source of the turn signal on the CAN bus. you have to intercept it before it gets on the bus because after it has been sent the nodes will respond.
As far as the adapter if it does not work contact the sales source and ask for help or a refund.
You posted some stuff but none of has a lot of information. You are also correct in that I will need lol (Lots Of Luck) to figure out how to do what you want. Also explain how the turn signal gets into the "head" Radio? You are there and can see, touch, and feel the hardware we cannot and if we do not have it it is even more difficult. No I do not have that hardware.
Looking at your "quadlock connector" I see that it has both Can high and Can low.
So the decoder is not actually connecting to your "head unit"
it is just where the designers of the decoder chose to get a connection to the Can bus.
To find out the protocol of that Rx/Tx connection you will need to find that in the documentation of the decoder.
The method you are attempting is not going to work and you just alienated the real expert who could of actually helped. But before that he did give you a big clue on how it needs to be done.
Since I'm sure you were to concerned about an imagined sleight to notice I'll reprint it.
from what I could find online about this "CAN BUS DECODER", it act as a translator for your head unit and is specific to the vehicle brand.
If this is correct, then you may already need to know the message definitions at the RX/TX (signals that go to the head unit)
however I strongly suspect (and that you were unable to tell us) that the PROTOCOL on RX/TX is still CAN - easy enough to check if you have a multimeter- just measure the resistance between RX/TX when plugged into your head unit (without power to head unit!)
so IMHO you would need x2 CAN sheilds for you arduino: x1 to intercept the CAN messages and x1 to transmit back out to the head unit so that you can then control what is sent out to the head unit.
hope that helps...
PS: as it seem that you are not native english, could I ask what is your native language?
Well, whole system without connected Arduino works as intended (to clarify I mean the decoder connected to the radio which is "how the turn signal gets into the "head" Radio").
While sherzaad actually thoroughly explained what is what in his answer (thank you, Polish btw), gilshultz made an impression like I allegedly had written somewhere that turn signal message on the bus comes from the radio and my decoder doesn't work.
About intercepting it - that's what I was actually trying do to!
Being aware that I'm not going to solve that problem alone I politely asked a question, did my best to answer you with all the supplementary information I could gather (believe me, Chinese sellers are not helpful) and you keep mocking me with all that chess stuff and imaginary sleight. Really? Thank you for your help anyway.
As previously mentioned you probably will need the CAN shield after all.
so taking a step back, confirm RX/TX lines is actually using CAN. then, ASSUMING it is CAN get something like this one and just try to read what is coming out of RX/TX
Ok, to whom it might concern, here comes the solution.
A little background: I couldn't define those two cables that come from my can bus decoder that I initially took as RX and TX. Some people on XDA claim that it has UART signal and that they can read it with Arduino's RX and TX pins on 38400 baud rate. In some cases it's described as CAN RX and CAN TX. I think it depends on the radio.
I had measured it's resistance and it showed 33K Ohm on the multimeter (in comparison CAN L and H have ~65 Ohm). I even tried to connect them directly to the MCP2515 chip's TX and RX pins with no success.
Good advice, leave them alone, unless you have a vast manual of your radio and decoder (mine came with nothing) or you're a real expert with ability to read with understanding (not necessarily with Lots Of Luck).
SOLUTION:
Buy two MCP2515 modules (cheap ones will do).
Cut CAN H and L cables that go from the quadlock connector to the decoder and connect everything as on the picture below (only INT and CS have different pins on Arduino):