Download as pdf or txt
Download as pdf or txt
You are on page 1of 31

instructables

Yes We CAN BUS With Arduino in 30 Seconds!

by omarCartera

Hello Arduinos!
This Instructable is trying to summarize what I ended up with after a long time of search, tutorials, trials and
datasheets to build a functional CAN BUS node. I will try to keep it as easy and concise as possible to get you
straight to a properly working setup, saving your time for further developments afterwards.
The first 3 steps are the basic ones that will initiate a CAN BUS at your home, the rest of the steps are a little bit
advanced and real-life CAN situations.
CAN BUS is a two-wire, half-duplex communication protocol that is widely used in Automotive industry. One of its
greatest advantages is that it connects any number of ECUs (or microcontrollers) in your car through the two-wire
bus, CAN High and CAN Low, reducing the weight of wires that could be gained by using point-to-point
communication between ECUs.
Enough talking and let's grease our hands!

You can continue reading about CAN from wiki (https://en.wikipedia.org/wiki/CAN_bus) as it really gives a very
good and sufficient introduction to the topic.

Yes We CAN BUS With Arduino in 30 Seconds!: Page 1


Step 1: Build the Hardware

We could buy any of the plug-and-play Arduino CAN shields, but building the hardware ourselves is easy, more
fun and cost reduction, bro.
What you need to build one node:
x1 Breadboard.
x1 MCP2515 (http://ww1.microchip.com/downloads/en/DeviceDoc/21667f.pdf) Microchip CAN
Controller.
x1 MCP2551 (http://ww1.microchip.com/downloads/en/DeviceDoc/21801e.pdf) Microchip CAN
Transceiver.
x1 20K Resistor.
x1 10K Resistor.
x1 100 Resistor.
x1 16 MHz Crystal Oscillator.
x2 27 pF Capacitors.
x3 LEDs.
x3 220 Resistors.

Schematic key:
CAN H: CAN High and is connected to the CAN High wire of the bus.
CAN L: CAN Low and is connected to the CAN Low wire of the bus.
VCC: 5V power source from the Arduino.
GND: connected to Arduino's ground pin.
UNO X: as X is an integer, means connect this pin to Arduino's digital pin X.
Here, our setup is using 3 means of communication protocols:
1) UART: to talk to your computer's Serial monitor.
2) SPI: to talk to the CAN controller.
3) CAN: to talk to other neighbours in the bus.
Wire up your components to the board according to the schematics attached above and let's move to the next
step.

1.
undefined
2.
Yes We CAN BUS With Arduino in 30 Seconds!: Page 2
undefined
2.
undefined
3.
undefined
4.
undefined
5.
undefined
6.
undefined
7.
undefined
8.
undefined
9.
undefined
10.
undefined
11.
undefined
12.
undefined
13.
undefined
14.
undefined
15.
undefined
16.
undefined
17.
undefined
18.
undefined
19.
undefined
20.
undefined
21.
undefined
22.
undefined
23.
undefined
24.
undefined
25.
undefined
26.
undefined
27.
undefined
28.
undefined
29.
undefined
30.
undefined
31.
undefined
32.
undefined
33.
undefined
34.
undefined
35.
undefined
36.
undefined
37.
undefined
38.
undefined
39.
undefined
40.
undefined
41.
undefined
42.
undefined
43.
undefined
Yes We CAN BUS With Arduino in 30 Seconds!: Page 3
undefined
44.
undefined
45.
undefined
46.
undefined
47.
undefined
48.
undefined
49.
undefined
50.
undefined
51.
undefined
52.
undefined
53.
undefined
54.
undefined
55.
undefined
56.
undefined
57.
undefined
58.
undefined
59.
undefined
60.
undefined
61.
undefined
62.
undefined
63.
undefined
64.
undefined
65.
undefined
66.
undefined
67.
undefined
68.
undefined
69.
undefined
70.
undefined
71.
undefined
72.
undefined
73.
undefined
74.
undefined
75.
undefined
76.
undefined
77.
undefined
78.
undefined
79.
undefined
80.
undefined
81.
undefined
82.
undefined
83.
undefined
84.
undefined
85.
undefined
Yes We CAN BUS With Arduino in 30 Seconds!: Page 4
undefined
86.
undefined
87.
undefined
88.
undefined
89.
undefined
90.
undefined
91.
undefined
92.
undefined
93.
undefined
94.
undefined
95.
undefined
96.
undefined
97.
undefined
98.
undefined
99.
undefined
100.
undefined
101.
undefined
102.
undefined
103.
undefined
104.
undefined
105.
undefined
106.
undefined
107.
undefined
108.
undefined
109.
undefined
110.
undefined
111.
undefined
112.
undefined
113.
undefined
114.
undefined
115.
undefined
116.
undefined
117.
undefined
118.
undefined
119.
undefined
120.
undefined
121.
undefined
122.
undefined
123.
undefined
124.
undefined
125.
undefined
126.
undefined
127.
undefined
Yes We CAN BUS With Arduino in 30 Seconds!: Page 5
127.
undefined
128.
undefined
129.
undefined
130.
undefined
131.
undefined
132.
undefined
133.
undefined
134.
undefined
135.
undefined
136.
undefined
137.
undefined
138.
undefined
139.
undefined
140.
undefined
141.
undefined
142.
undefined
143.
undefined
144.
undefined
145.
undefined
146.
undefined
147.
undefined
148.
undefined
149.
undefined
150.
undefined
151.
undefined
152.
undefined
153.
undefined
154.
undefined
155.
undefined
156.
undefined
157.
undefined
158.
undefined
159.
undefined
160.
undefined
161.
undefined
162.
undefined
163.
undefined
164.
undefined
165.
undefined
166.
undefined
167.
undefined
168.
undefined
169.
Yes We CAN BUS With Arduino in 30 Seconds!: Page 6
169.
undefined
170.
undefined
171.
undefined
172.
undefined
173.
undefined
174.
undefined
175.
undefined
176.
undefined
177.
undefined
178.
undefined
179.
undefined
180.
undefined
181.
undefined
182.
undefined
183.
undefined
184.
undefined
185.
undefined
186.
undefined
187.
undefined
188.
undefined
189.
undefined
190.
undefined
191.
undefined
192.
undefined
193.
undefined
194.
undefined
195.
undefined
196.
undefined
197.
undefined
198.
undefined
199.
undefined
200.
undefined
201.
undefined
202.
undefined
203.
undefined
204.
undefined
205.
undefined
206.
undefined
207.
undefined
208.
undefined
209.
undefined
210.
undefined
211.
Yes We CAN BUS With Arduino in 30 Seconds!: Page 7
211.
undefined
212.
undefined
213.
undefined
214.
undefined
215.
undefined
216.
undefined
217.
undefined
218.
undefined
219.
undefined
220.
undefined
221.
undefined
222.
undefined
223.
undefined
224.
undefined
225.
undefined
226.
undefined
227.
undefined
228.
undefined
229.
undefined
230.
undefined
231.
undefined
232.
undefined
233.
undefined
234.
undefined
235.
undefined
236.
undefined
237.
undefined
238.
undefined
239.
undefined
240.
undefined
241.
undefined
242.
undefined
243.
undefined
244.
undefined
245.
undefined
246.
undefined
247.
undefined
248.
undefined
249.
undefined
250.
undefined
251.
undefined
252.
undefined
253.
Yes We CAN BUS With Arduino in 30 Seconds!: Page 8
undefined
253.
undefined
254.
undefined
255.
undefined
256.
undefined
257.
undefined
258.
undefined
259.
undefined
260.
undefined
261.
undefined
262.
undefined
263.
undefined
264.
undefined
265.
undefined
266.
undefined
267.
undefined
268.
undefined
269.
undefined
270.
undefined
271.
undefined
272.
undefined
273.
undefined
274.
undefined
275.
undefined
276.
undefined
277.
undefined
278.
undefined
279.
undefined
280.
undefined
281.
undefined
282.
undefined
283.
undefined
284.
undefined
285.
undefined
286.
undefined
287.
undefined
288.
undefined
289.
undefined
290.
undefined
291.
undefined
292.
undefined
293.
undefined
294.
undefined
Yes We CAN BUS With Arduino in 30 Seconds!: Page 9
undefined
295.
undefined
296.
undefined
297.
undefined
298.
undefined
299.
undefined
300.
undefined
301.
undefined
302.
undefined
303.
undefined
304.
undefined
305.
undefined
306.
undefined
307.
undefined
308.
undefined
309.
undefined
310.
undefined
311.
undefined
312.
undefined
313.
undefined
314.
undefined
315.
undefined
316.
undefined
317.
undefined
318.
undefined
319.
undefined
320.
undefined
321.
undefined
322.
undefined
323.
undefined
324.
undefined
325.
undefined
326.
undefined
327.
undefined
328.
undefined
329.
undefined
330.
undefined
331.
undefined
332.
undefined
333.
undefined
334.
undefined
335.
undefined
336.
undefined
Yes We CAN BUS With Arduino in 30 Seconds!: Page 10
undefined
337.
undefined
338.
undefined
339.
undefined
340.
undefined
341.
undefined
342.
undefined
343.
undefined
344.
undefined
345.
undefined
346.
undefined
347.
undefined
348.
undefined
349.
undefined
350.
undefined
351.
undefined
352.
undefined
353.
undefined
354.
undefined
355.
undefined
356.
undefined
357.
undefined
358.
undefined
359.
undefined
360.
undefined
361.
undefined
362.
undefined
363.
undefined
364.
undefined
365.
undefined
366.
undefined
367.
undefined
368.
undefined
369.
undefined
370.
undefined
371.
undefined
372.
undefined
373.
undefined
374.
undefined
375.
undefined
376.
undefined
377.
undefined
378.
undefined
Yes We CAN BUS With Arduino in 30 Seconds!: Page 11
378.
undefined
379.
undefined
380.
undefined
381.
undefined
382.
undefined
383.
undefined
384.
undefined
385.
undefined
386.
undefined
387.
undefined
388.
undefined
389.
undefined
390.
undefined
391.
undefined
392.
undefined
393.
undefined
394.
undefined
395.
undefined
396.
undefined
397.
undefined
398.
undefined
399.
undefined
400.
undefined
401.
undefined
402.
undefined
403.
undefined
404.
undefined
405.
undefined
406.
undefined
407.
undefined
408.
undefined
409.
undefined
410.
undefined
411.
undefined
412.
undefined
413.
undefined
414.
undefined
415.
undefined
416.
undefined
417.
undefined
418.
undefined
419.
undefined
420.
Yes We CAN BUS With Arduino in 30 Seconds!: Page 12
420.
undefined
421.
undefined
422.
undefined
423.
undefined
424.
undefined
425.
undefined
426.
undefined
427.
undefined
428.
undefined
429.
undefined
430.
undefined
431.
undefined
432.
undefined
433.
undefined
434.
undefined
435.
undefined
436.
undefined
437.
undefined
438.
undefined
439.
undefined
440.
undefined
441.
undefined
442.
undefined
443.
undefined
444.
undefined
445.
undefined
446.
undefined
447.
undefined
448.
undefined
449.
undefined
450.
undefined
451.
undefined
452.
undefined
453.
undefined
454.
undefined
455.
undefined
456.
undefined
457.
undefined
458.
undefined
459.
undefined
460.
undefined
461.
undefined
462.
Yes We CAN BUS With Arduino in 30 Seconds!: Page 13
462.
undefined
463.
undefined
464.
undefined
465.
undefined
466.
undefined
467.
undefined
468.
undefined
469.
undefined
470.
undefined
471.
undefined
472.
undefined
473.
undefined
474.
undefined
475.
undefined
476.
undefined
477.
undefined
478.
undefined
479.
undefined
480.
undefined
481.
undefined
482.
undefined
483.
undefined
484.
undefined
485.
undefined
486.
undefined
487.
undefined
488.
undefined
489.
undefined
490.
undefined
491.
undefined
492.
undefined
493.
undefined
494.
undefined
495.
undefined
496.
undefined
497.
undefined
498.
undefined
499.
undefined
500.
undefined
501.
undefined
502.
undefined
503.
undefined
504.
Yes We CAN BUS With Arduino in 30 Seconds!: Page 14
undefined
504.
undefined
505.
undefined
506.
undefined
507.
undefined
508.
undefined
509.
undefined
510.
undefined
511.
undefined
512.
undefined
513.
undefined
514.
undefined
515.
undefined
516.
undefined
517.
undefined
518.
undefined
519.
undefined
520.
undefined
521.
undefined
522.
undefined
523.
undefined
524.
undefined
525.
undefined
526.
undefined
527.
undefined
528.
undefined
529.
undefined
530.
undefined
531.
undefined
532.
undefined
533.
undefined
534.
undefined
535.
undefined
536.
undefined
537.
undefined
538.
undefined
539.
undefined
540.
undefined
541.
undefined
542.
undefined
543.
undefined
544.
undefined
545.
undefined
Yes We CAN BUS With Arduino in 30 Seconds!: Page 15
undefined
546.
undefined
547.
undefined
548.
undefined
549.
undefined
550.
undefined
551.
undefined
552.
undefined
553.
undefined
554.
undefined
555.
undefined
556.
undefined
557.
undefined
558.
undefined
559.
undefined
560.
undefined
561.
undefined
562.
undefined
563.
undefined
564.
undefined
565.
undefined
566.
undefined
567.
undefined
568.
undefined
569.
undefined
570.
undefined
571.
undefined
572.
undefined
573.
undefined
574.
undefined
575.
undefined
576.
undefined
577.
undefined
578.
undefined
579.
undefined
580.
undefined
581.
undefined
582.
undefined
583.
undefined
584.
undefined
585.
undefined
586.
undefined
587.
undefined
Yes We CAN BUS With Arduino in 30 Seconds!: Page 16
undefined
588.
undefined
589.
undefined
590.
undefined
591.
undefined
592.
undefined
593.
undefined
594.
undefined
595.
undefined
596.
undefined
597.
undefined
598.
undefined
599.
undefined
600.
undefined
601.
undefined
602.
undefined
603.
undefined
604.
undefined
605.
undefined
606.
undefined
607.
undefined
608.
undefined
609.
undefined
610.
undefined
611.
undefined
612.
undefined
613.
undefined
614.
undefined
615.
undefined
616.
undefined
617.
undefined
618.
undefined
619.
undefined
620.
undefined
621.
undefined
622.
undefined
623.
undefined
624.
undefined
625.
undefined
626.
undefined
627.
undefined
628.
undefined
629.
undefined
Yes We CAN BUS With Arduino in 30 Seconds!: Page 17
629.
undefined
630.
undefined
631.
undefined
632.
undefined
633.
undefined
634.
undefined
635.
undefined
636.
undefined
637.
undefined
638.
undefined
639.
undefined
640.
undefined
641.
undefined
642.
undefined
643.
undefined
644.
undefined
645.
undefined
646.
undefined
647.
undefined
648.
undefined
649.
undefined
650.
undefined
651.
undefined
652.
undefined
653.
undefined
654.
undefined
655.
undefined
656.
undefined
657.
undefined
658.
undefined
659.
undefined
660.
undefined
661.
undefined
662.
undefined
663.
undefined
664.
undefined
665.
undefined
666.
undefined
667.
undefined
668.
undefined
669.
undefined
670.
undefined
671.
Yes We CAN BUS With Arduino in 30 Seconds!: Page 18
671.
undefined
672.
undefined
673.
undefined
674.
undefined
675.
undefined
676.
undefined
677.
undefined
678.
undefined
679.
undefined
680.
undefined
681.
undefined
682.
undefined
683.
undefined
684.
undefined
685.
undefined
686.
undefined
687.
undefined
688.
undefined
689.
undefined
690.
undefined
691.
undefined
692.
undefined
693.
undefined
694.
undefined
695.
undefined
696.
undefined
697.
undefined
698.
undefined
699.
undefined
700.
undefined
701.
undefined
702.
undefined
703.
undefined
704.
undefined
705.
undefined
706.
undefined
707.
undefined
708.
undefined
709.
undefined
710.
undefined
711.
undefined
712.
undefined
713.
Yes We CAN BUS With Arduino in 30 Seconds!: Page 19
713.
undefined
714.
undefined
715.
undefined
716.
undefined
717.
undefined
718.
undefined
719.
undefined
720.
undefined
721.
undefined
722.
undefined
723.
undefined
724.
undefined
725.
undefined
726.
undefined
727.
undefined
728.
undefined
729.
undefined
730.
undefined
731.
undefined
732.
undefined
733.
undefined
734.
undefined
735.
undefined
736.
undefined
737.
undefined
738.
undefined
739.
undefined
740.
undefined
741.
undefined
742.
undefined
743.
undefined
744.
undefined
745.
undefined
746.
undefined
747.
undefined
748.
undefined
749.
undefined
750.
undefined
751.
undefined
752.
undefined
753.
undefined
754.
undefined
755.
Yes We CAN BUS With Arduino in 30 Seconds!: Page 20
undefined
755.
undefined
756.
undefined
757.
undefined
758.
undefined
759.
undefined
760.
undefined
761.
undefined
762.
undefined
763.
undefined
764.
undefined
765.
undefined
766.
undefined
767.
undefined
768.
undefined
769.
undefined
770.
undefined
771.
undefined
772.
undefined
773.
undefined
774.
undefined
775.
undefined
776.
undefined
777.
undefined
778.
undefined
779.
undefined
780.
undefined
781.
undefined
782.
undefined
783.
undefined
784.
undefined

Yes We CAN BUS With Arduino in 30 Seconds!: Page 21


Step 2: Download and Install the CAN Library

In this Instructable, I'm using Seeed Studio open-source CAN Library (https://github.com/Seeed-
Studio/CAN_BUS_Shield) which you can download from their github as shown above.
Keep the downloaded file as zipped as it is (because Arduino likes this) and add the library to Arduino as shown
above, as well.
By this point you are ready to move to the next step to combine both software and hardware and try your Hello
CAN examples :D
I'm currently using the latest Arduino (1.8.3) but it works with the old versions as well.

Yes We CAN BUS With Arduino in 30 Seconds!: Page 22


Step 3: Upload Your First Code

The codes attached are basically the examples of the library itself but with a gentle touch of simplicity. I think that
both files are over-commented, but feel free to ask about any bit of code you find unclear, because when you solid
understand this basic example, you can follow up with the next few steps and even dig deeper and tweak the
codes as you like.
The file called Send packs 8 characters (8 bytes) into a message of the ID 0xF1, because I'm an F1 fan, and puts
it on the bus.
The file called Receive keeps polling the CAN receive buffers until any message comes in. It then breaks the
incoming data into an ID, data length and the data itself.
Yes, You CAN BUS now!

Yes We CAN BUS With Arduino in 30 Seconds!: Page 23


Download (https://cdn.instructables.com/ORIG/F1V/YKNY/J5X0MJVM/F1VYKNYJ5X0MJVM.ino)
http://www.instructables.com/ORIG/F1V/YKNY/J5X0MJVM/F1VYKNYJ5X0MJVM.ino

(https://cdn.instructables.com/ORIG/F1V/YKNY/J5X0MJVM/F1VYKNYJ5X0MJVM.ino)
Download (https://cdn.instructables.com/ORIG/FVF/4ZTO/J5X0MJVN/FVF4ZTOJ5X0MJVN.ino)
http://www.instructables.com/ORIG/FVF/4ZTO/J5X0MJVN/FVF4ZTOJ5X0MJVN.ino

(https://cdn.instructables.com/ORIG/FVF/4ZTO/J5X0MJVN/FVF4ZTOJ5X0MJVN.ino)

Yes We CAN BUS With Arduino in 30 Seconds!: Page 24


Step 4: CAN Is a Message-Based Protocol!

CAN is a message-based protocol, which means that the messages and their content are more important than the
sender ECU itself. So, the ECUs aren't given IDs, but each message has a unique ID in a specific bus. These IDs
are responsible for setting the priority of messages in case of two or more ECUs are trying to put their messages
on the bus. The LOWER decimal value ID has HIGHER priority.
Given that, the message with ID = 0x05 has more priority than our beloved message of the previous example with
ID = 0xF1.
A Big Example:
If we consider ourselves in a real car, we might assume that the message that informs a fatal problem in the
engine will be given the highest ever priority (Logical, no?). So, whatever ECU tries to send this message will win
the bus and continue sending its message while everyone else is just listening until it finishes.
At any time, every CAN BUS node sees the message being sent through the bus. But not all of them read it and
send it to their ECUs. That's because in our example the rear wing ECU or the front-right headlights ECU don't
care at all about a problem in the engine, so they see the message that contains engine failure and ignore it. On
the other hand, they are the only ECUs who read the messages like: retract the wing or shut the headlights.
And here it comes the idea of Message Filtering that lets an ECU reads only the messages useful to it and ignore
everything else. And since our code allows us to know the ID of the message, we can easily apply filtering.
The example file attached here adds only one if statement to the basic Receive file to read only the messages with
ID = 0xF2. Let this new code receive from the basic Send code and it will print nothing.

Download (https://cdn.instructables.com/ORIG/FSF/PVDR/J5X0MK0N/FSFPVDRJ5X0MK0N.ino)
http://www.instructables.com/ORIG/FSF/PVDR/J5X0MK0N/FSFPVDRJ5X0MK0N.ino

(https://cdn.instructables.com/ORIG/FSF/PVDR/J5X0MK0N/FSFPVDRJ5X0MK0N.ino)

Yes We CAN BUS With Arduino in 30 Seconds!: Page 25


Step 5: Extract Useful Signals From a CAN Message

By reaching this line now we:


1. Wired up the hardware circuit.
2. Sent and received CAN messages.
3. Filtered the stream of messages and read only those that interest us.

But all we were exchanging was a message containing useless 8 characters forming my nickname, ahem.
What if we wanted to exchange informative signals and simulate what might be happening in a real CAN BUS
from the dashboard ECU's point of view!
Because it would be waste of time, and bits actually, if you use the 8 data bytes to represent only one piece of
information, cars might pack many signals in one message, as shown in the picture above, telling you that for the
message of the ID = 0xF1:
The first whole byte represents the speed of the car with a maximum value of 255 mph.
The next 14 bits represent the engine revs up to 16383 RPM. Just to be able to work with an F1 car.
The next bit tells the dashboard to turn On/Off the check engine indicator.
The next bit tells whether the oil level is under a threshold or not to turn ON/OFF its indicator.
The rest of the bits are not used in our made-up message.

Check the attached files for the code, and come back here for the explanation.

For the first piece of information, as it fits in one byte and our code let us deal with every byte of the buffer
separately, all you need to do here is to extract the car speed directly from the first byte only, easy!
i.e. car_speed = buf[0];

For the rest cases where the signal bits take more or less than a byte, you will need bit manipulation to put those
bits in the right setup before reading them.
To read the RPM which lies in two different bytes (1 and 2) you need to do as follows:
First, read the higher byte (byte 1) into a two-byte integer, it will lay in the lower byte in engine_rpm.
unsigned int engine_rpm = buf[1];

Then, shift this value 8 bits to the left to put the higher byte you read in its right position.
engine_rpm = engine_rpm << 8;

Now, mask off all byte 2 bits except the first six bits used for the RPM signal.
char temp = buf[2] & 0x3F;

Here, we just need to add the higher byte to the lower one and get our final value.
engine_rpm = engine_rpm + temp;

To read the value of Check Engine and Oil bits, you will need to mask off all the bits but the one you want, piece
of cake!
Tataaaaaa! We correctly extracted all the information embedded in the message!

Yes We CAN BUS With Arduino in 30 Seconds!: Page 26


Download (https://cdn.instructables.com/ORIG/F0Q/WEEE/J5X0MGJE/F0QWEEEJ5X0MGJE.ino)
http://www.instructables.com/ORIG/F0Q/WEEE/J5X0MGJE/F0QWEEEJ5X0MGJE.ino

(https://cdn.instructables.com/ORIG/F0Q/WEEE/J5X0MGJE/F0QWEEEJ5X0MGJE.ino)
Download (https://cdn.instructables.com/ORIG/F14/W6JP/J5X0MGKX/F14W6JPJ5X0MGKX.ino)
http://www.instructables.com/ORIG/F14/W6JP/J5X0MGKX/F14W6JPJ5X0MGKX.ino

(https://cdn.instructables.com/ORIG/F14/W6JP/J5X0MGKX/F14W6JPJ5X0MGKX.ino)

Step 6: The Evolution of Breadboard to PCB

After testing and making sure that everything is working properly, I decided to start learning PCBs making by
converting this very project to a PCB.
Attached here are the Eagle files for the layout. The layout was designed, printed on a copper board but not yet
milled or tested, you can revise the design and give your comments below, you can also print it and make your
own PCB and then tell us what you ended up with. And you can even suggest enhancements to the layout design!

Yes We CAN BUS With Arduino in 30 Seconds!: Page 27


Yes We CAN BUS With Arduino in 30 Seconds!: Page 28
Download (https://cdn.instructables.com/ORIG/FBX/1XCK/J5X0KZ3V/FBX1XCKJ5X0KZ3V.rar)
http://www.instructables.com/ORIG/FBX/1XCK/J5X0KZ3V/FBX1XCKJ5X0KZ3V.rar

(https://cdn.instructables.com/ORIG/FBX/1XCK/J5X0KZ3V/FBX1XCKJ5X0KZ3V.rar)

Yes We CAN BUS With Arduino in 30 Seconds!: Page 29


Step 7: Have a Little Chat With Your Car

Have you ever been to your mechanic complaining from a mysterious light in your dashboard and you see him
plugging some device to your car ~magic happens~ that shows you a fault code describing in details what the non-
mysterious light means?!
Some say, with our CAN setup, we can talk to our cars through their OBD-II (https://en.wikipedia.org/wiki/On-
board_diagnostics#OBD-II) port, just like the mechanic in the previous paragraph, by sending the so called PIDs
(https://en.wikipedia.org/wiki/OBD-II_PIDs)to the OBD requesting some parameter from the car communication
buses and wait for the response message carrying the values you asked for.
An example covering this PID part is given in the examples section of the library, and the list of available PIDs is
available on wiki.
I didn't try it, but I will do this very soon. Take care of your connections and read about OBD before you plug
anything to your car.

Feel free to discuss anything with us below, we are all here to learn from each other, Peace!

Yes We CAN BUS With Arduino in 30 Seconds!: Page 30


Yes We CAN BUS With Arduino in 30 Seconds!: Page 31

You might also like