Guide to CAN for toddlers (or people with arduino UNO)

Post Reply
0tik
Posts: 30
Joined: Tue Jan 04, 2022 11:55 pm
Has thanked: 8 times
Been thanked: 3 times

Guide to CAN for toddlers (or people with arduino UNO)

Post by 0tik »

So it all began with a video of someone spoofing Imiev's SOC and this github https://github.com/dkotin/can_2515/tree/master/b and this is why I own an arduino uno. I have acquired adc flying bms from the local shop recently. Turns out CAN is not as easy as it might seem. If you see someone having a solution then just use it and don't waste time tinkering around blindly. Sadly I am stuck with Arduino uno and 2 MCP2515 and want to exhaust every possible way to make it work that way. After 2 days I have figured out that I had placed wrongly SI and SO pins. Before that I was getting gibberish on arduino IDE terminal. After swapping them There was less gibberish but hey! thanks to https://openinverter.org/wiki/Getting_s ... rduino_Uno this page I figured out how to connect to CANHacker. Before reading more, do as wiki guide says. This way you get to learn how Arduino works. If you don't see
Enter setting mode success
set rate success!!
Enter Normal Mode Success!!
CAN BUS Shield init ok!
dont worry. I did not neither. Now open example "canbus-monitor" instead of "receive_check". Close arduino IDE as only one program can be connected to arduino at once. Open CANHacker which can be downloaded here https://github.com/Seeed-Studio/Seeed_A ... us-monitor
Go to settings, set proper port, the same used in arduino IDE. Now it should connect. Nothing shows up but when I bend pins on the MCP2515 dongle, random data appears. Make sure your connections are solid! Setting CAN baud rate to 1mb gives pic related. Did you knew It needed 1mb/s can baudrate? I sure as hell did not. I bed in reality nobody knows. Everybody makes their software with particular applications in mind and don't even think about such things. Openinverter_can_tool and SavvyCAN will not work for now but feel free to maketo install them and make it work. You will learn something from that. Who knew sitting in front of a computer screen for 4 days could give such awesome results :) Another thing i figured out today is that if you don't have any 120ohm resistors around just use second MCP2515 dongle with built in resistor jumper. Yet another funny thing is that Gregski reminded me of Okocim. I forgot it even exist anymore. Tastes like cheapo beer. Not bad by any means. Beer is like pizza. It is difficult to land bad one. It just is unremarkable and there's plethora of better brands. Perhaps beer is the solution to progress.
Now the next step is buying Arduino DUE with SN65HVD230 transceiver to copycat Gregski and connect with SavvyCAN. But dont crucify me if this doesn't work because someone here viewtopic.php?p=60208#p60208 was having problems with SN65HVD230 and had to use SN65HVD234 instead; buying Outlander OBC or even better yet - writing my own code for duino to integrate battery with my ebike (this one is a joke).
Attachments
photo_2023-09-19_21-54-54.jpg
eureka.jpg
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 234 times
Contact:

Re: Guide to CAN for toddlers (or people with arduino UNO)

Post by arber333 »

0tik wrote: Tue Sep 19, 2023 8:08 pm .....
Now the next step is buying Arduino DUE with SN65HVD230 transceiver to copycat Gregski and connect with SavvyCAN. But dont crucify me if this doesn't work because someone here viewtopic.php?p=60208#p60208 was having problems with SN65HVD230 and had to use SN65HVD234 instead; buying Outlander OBC or even better yet - writing my own code for duino to integrate battery with my ebike (this one is a joke).
I recommend you buy a simple CAN analyzer to visualize what you get from CAN lines.
Well my Canalyst II went to device heaven... it just wont setup and sense CAN traffic on either channel. Considering i use it from 2016 it is not surprising. So i went on observing where i could find suitable replacement. I didnt want to just buy a replacement. That would be too easy. I wanted to find what else is there...

This one seemed promising despite a little childish look:
https://www.aliexpress.com/item/1005004 ... yz1LkTOXXe
ECAN-U01.jpg
And it really is easy to use. Once in the software you select USB port and which input of the device to open and at what speed.
CAN analyzer sw.jpg
CAN analyzer sw1.jpg
You can use filters on IDs or on individual bytes within messages.
You can record the output with filters to a file.
0tik
Posts: 30
Joined: Tue Jan 04, 2022 11:55 pm
Has thanked: 8 times
Been thanked: 3 times

Re: Guide to CAN for toddlers (or people with arduino UNO)

Post by 0tik »

Looks like I will not be buying arduino due. It is necessary for SavvyCAN. OIC demands one of those adapters https://python-can.readthedocs.io/en/st ... faces.html. I don't have any device that makes use of those programs so there's no point in buying DUE for now. Outlander's OBC is off because If i ever had a use for an OBC it would be 22kw Brusa. I don't have money for one at the moment so it stays as a new year resolution for now. Looks like the joke was not a joke in the end. I am going to try and make arduino display parameters from Johannes BMS. After that I'd add inputs/outputs to manage safety of dis/charging.
First, the library and sketch code mentioned before displays can data in standard format. We want extended format. This library outputs extended format. https://github.com/coryjfowler/MCP_CAN_lib. So far this endeavor feels like trying to get through the wall by hitting it with my head. But I do have a thick skull so I'm positive I will get through one day.
doobedoobedo
Posts: 260
Joined: Sat Jan 12, 2019 12:39 am
Location: UK

Re: Guide to CAN for toddlers (or people with arduino UNO)

Post by doobedoobedo »

If you're using UNO or any other 328p based Arduino then you need to take account of endianness. The arm based ones like the DUE are the same as OI so you don't need to worry about it.
Post Reply