# How 2 collect data from controller canbus 2 raspPI?



## vaporer (Sep 6, 2016)

*How 2 collect data from controllers canbus to the raspPI?*

Hello 2 you all. New guy here. First time reader, and first time poster. Done smaller diy ev-projects before. But that has been all about kits and well guided manuals. This time I am all in and starting from scratch 

For a DIY e-atv side-by-side project I am struggling to understand how I can gather data from the controller's can bus to a raspberryPI. From the PI I plan to collect, and store data so I can display those data on a "dashboard" along with hall sensor data, thermistor data and battery data. For display a cheap chinese tablet will have to do. 

I am not expecting people to solve this for me, but I do hope I can get pointers in the right direction as to where I should start my reading and what I need to learn in order to use the data I collect. 

I know there are libraries for can bus for raspPI and arduino but from where I stand today I am not sure how those libraries will help me. So much to learn for me and I am really eager to get started but I don't where to start  what I mean is that I would like to learn to understand the protocol, and how to harvest the data, not just download a library and cut and paste. 

Looking for either tips on books, online classes, tutorials, or other sources that can take me from close to zero understanding of the tasks ahead to being to hammer things into shape and get things working. 

I have done some programming earlier with python but only basic stuff, the only other thing about code I know is html, and php. I just barely got my fingers wet with the rapsberryPI. I am ok to work with databases, but where do I start to learn what is need to collect data and display data from controller/motor/battery?

All I have so far is this for the controller, it list the data that I can collect. 

*J1939/Can bus 2.0B*


The running direction (forward/backward)
The high and low speed
Mode selection (eco-normal-boost)
Speed low byte (motor rpm)
Speed high byte (motor rpm)
Low power consumption mode
Subtotal mileage. low byte
Subtotal mileage. high byte
DC voltage- low byte
DC voltage - high byte
Motor current- low byte
Motor current - high byte
Fault codes (about 15 different codes or so)

What I wish to display is pretty basic stuff. Average consumption, real time consumption, real time Amp, real time V, max/min A, battery status, remaining battery, range left, wh usage, motor RPM, wheel speed, wheel speed hi/lo, total km driven, total km driven this trip, motor temperature, controller temperature, and fet temperature. 

I got a fair timeline for this project. Most of the welding is done, parts are mounted, spot welder assembled for DIY 18650 battery pack. Left is wiring, BMS, spot welding a pack, and sorting out the can bus and display the collected data. Project must complete by spring/early summer 2017.


----------



## Roy Von Rogers (Mar 21, 2009)

Go to http://evtv.me/, there is information that may be helpful. 

From what I understand you would be better off to use an Arduino board.

The also have a forum with very good info.

Roy


----------



## vaporer (Sep 6, 2016)

Hm that forum seems like it aims a little higher then what I am doing. 
I am just putting together a fun to ride cheapo DIY electric S-b-S ATV. 
I think I stick to this forum. The other will be much to steep learning curve 

I came across this article so I have ordered most of what is needed for the raspberry PI route. I will start thinkering with the PI as I have at least a little knowledge of PI. 

I will start there and if I get stuck'd or can't do what I set out to do, I might switch to arduino later. 

If I am being ignorant and overlooking the obvious let me know. I think aduino is more advanced the rapsberry PI but from what I gathered so far it seems raspPI also will be able to collect data.


----------



## Roy Von Rogers (Mar 21, 2009)

There is actually a discussion of why to use an Arduino versus a PI from an expert on the subject, in one of the blogs, look around and you will find it.

Also apply to get in to the forum, there is plenty of info that would help you on whatever you decide to use.

Roy


----------



## vaporer (Sep 6, 2016)

Roy Von Rogers said:


> There is actually a discussion of why to use an Arduino versus a PI from an expert on the subject, in one of the blogs, look around and you will find it.
> 
> Also apply to get in to the forum, there is plenty of info that would help you on whatever you decide to use.
> 
> Roy


Thx Roy will do


----------



## vaporer (Sep 6, 2016)

Don't know if my English language is really bad or I am totally messing up my search terms but I can't really find anything on that http://evtv.me/ site related to arduino vs raspberry pi. 

It seems like a hard to navigate site, and even though they got a forum not many users and not very active forum, according to statistic. At most they topped out with 49 people logged in at once. And most it seems to revolt around Tesla, and other hi specced builds. Far beyond what I am doing, and those guys have way more skills then me so it feels like I need to understand a little more basic before I join that crowd. 

I think I will have to go old school for this and stop by my local library and ask for an analog book made from paper on the subject.


----------



## [email protected] (Nov 28, 2020)

Same problem , did you figure out ? @vaporer


----------

