pip4048 + raspberry pi + influxdb + grafana

Joaquinsfy

New member
Joined
Oct 9, 2016
Messages
19
Hi guys

I will share the information about my installation.

Hardware
Raspberry pi 3

image_wlfrfo.jpg

serial to ttl
image_lioapd.jpg

custom cable

image_ivxzwp.jpg


Software
Raspbian as operating system
influxdb as database
grafana as visualization
Node.js https://pastebin.com/hwMZvRh4 (code)

Result:


image_bdqarv.jpg


Configure the serial + tll

Install influxdb + grafana

http://engineer.john-whittington.co.uk/2016/11/raspberry-pi-data-logger-influxdb-grafana/

I'm writing a full document about my powerwall based on Peter information, with some little changes, i will use RECBMS instead Batrium, but it's a "Copy" of his installation, when i have ready the full document, i will attach to this thread.

Now i have working 20kw , waiting for to install 12x 320 w solar panels.


image_ojzjfn.jpg


Thanks Guys
 

daromer

Moderator
Staff member
Joined
Oct 8, 2016
Messages
5,384
Did you test running it directly from the USB port? Ie the hidraw* that comes up on the PI?
 

Joaquinsfy

New member
Joined
Oct 9, 2016
Messages
19
@daromer No, i don't try the USB port, sorry

Now i have working with same Raspberry pi 3 3 services.

1. PIP4048
2. SMAPPEE (google it , please)
3. REC-BMS (pican2)

and all in the same dashboard....
 

daromer

Moderator
Staff member
Joined
Oct 8, 2016
Messages
5,384
Cool! Good work.


Of course.. I had to plug in and out it and now i can access it. Stupid thing :D
 

nexsuperne101

New member
Joined
Dec 19, 2016
Messages
21
I have followed the guide, and managed to get the grafana screen to come up on port 3000.
What I don't understand is what node.js is for, is that the JSON script for the graphs and stuff for Grafana?

I also can't add the logger as a datasource, as there is no option in the menu block of the grafana webpage.

I copy and pasted the script into a text file and saved it as logger.py. This is in my pi folder. At least I have got further than yesterday on windows, as I didn't even have the black Grafana screen. I added the 2 lines of code to make the server start to the config.txt file using sudo nano. I don't know if that was where it was supposed to go, but it was the only thing I could think of that runs a boot script.

I am quite pleased that I managed to get this far, even if it was parrot fashion! Not bad for an Electrician :)
 

daromer

Moderator
Staff member
Joined
Oct 8, 2016
Messages
5,384
Its not that easy im afraid hehe. Nodejs scriptet fetches data from the inverter and then delivers it to influxdb. So you need to install influx and configure that with grafana.

I have an image up and running now. Included support for above script and with support for running without the serial adapter. Ie works with USB directly.
 

nexsuperne101

New member
Joined
Dec 19, 2016
Messages
21
I got a bit further. It had an error with non-ascii character at line 20, 21 and 22. So I deleted those characters.

Next error was import error for "automationhat" (not defined). Now I am stuck, again.... :)

This was in the logger.py file, whilst trying to run python logger.py

This line fails as well, i think it is a dead link? sudo pip install influxdb

sudo pip install influxdb
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 356, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2476, in load_entry_point
return ep.load()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2190, in load
['__name__'])
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 74, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/usr/lib/python2.7/dist-packages/pip/vcs/mercurial.py", line 9, in <module>
from pip.download import path_to_url
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 25, in <module>
from requests.compat import IncompleteRead
ImportError: cannot import name IncompleteRead

I had to change one of the influxdb source packages, as it had been updated
 

nexsuperne101

New member
Joined
Dec 19, 2016
Messages
21
daromer said:
Its not that easy im afraid hehe. Nodejs scriptet fetches data from the inverter and then delivers it to influxdb. So you need to install influx and configure that with grafana.

I have an image up and running now. Included support for above script and with support for running without the serial adapter. Ie works with USB directly.

Cool, let me know when you want to do a test run, as my Pi 3 is here, and the serial MAX3232 to TTL card will be here in about an hour :)
 

Joaquinsfy

New member
Joined
Oct 9, 2016
Messages
19
Hi guys,

@nexsupene101 the node.js script reads the serial port connected to the PIP and send data to influxdb



In the last 3 days i made a progress...

I connected my REC-BMS , to the raspberry pi3 using a PICAN2 board, (all in the same raspberry pi3)

http://skpang.co.uk/catalog/pican2-canbus-board-for-raspberry-pi-23-p-1475.html

Now i have the cell info in the same grafana panel.

the raspberry pi 3 is working on..

1. Read / write data from PIP. (serial port)
2. read data from BMS (CAN BUS) PICAn2
3. read data from DS18B20 temperature sensor.
4. read data from SMAPPEE, this device can read data from power utility, now i have control about power coming from utility and power coming from batteries (please google it), if some needs the code i will publish it :)
5. store all the data (influxdb)
6 grafana server.

Not bad for a 100 usd computer..

Next week i will add another REC-BMS to control 2 packs of 14 cell each one, i have just 0.08v differences between cells :)


next step , maybe is home automation , siri kit, open ev , (for electric car), charge the car when more power available.. i don't know..





image_yfwgaq.jpg




image_lcoxre.jpg



daromer said:
Its not that easy im afraid hehe. Nodejs scriptet fetches data from the inverter and then delivers it to influxdb. So you need to install influx and configure that with grafana.

I have an image up and running now. Included support for above script and with support for running without the serial adapter. Ie works with USB directly.

What do you change to use the USB directly? just plug the usb to pip and change the port in the code? which port do you use?

Thanks!
 

daromer

Moderator
Staff member
Joined
Oct 8, 2016
Messages
5,384
Hey

Good work
Kind of yes but still no. Thing is that the USB units end up as a Cypress Semiconductor USB to Serial ie a HID device. Hid devices will have or get you alot of crap and since there is not much error handling in your code it did not work out :)
But yes its just a matter of using /dev/hidrawx for it.

Js is not also perhaps the best to handle serial ports but it do work. I have done some minor work in it before but the reason I use it is that it works on most systems and its damn simple. It can also easily be used with electron so that is one good thing :)

I also fits good in a stack with NodeRed/mqtt and so forth and that i like. This did fit perfectly to my existing work on the rasp and it confirmed that it should work when you have done it. So i thanks again!


Regarding the main issue. The data coming in is sometimes scrambled so it was hard to rely on the length. I had to find first and last char that i know would define a line and then check length or the first parameters. I actually have it running against PCM/Hybrid/PIP now and it does it job. The other have different protocols though. But i had done work with it in c# and python before so i just ported the protocol data over.
 

Fredd

New member
Joined
Jun 7, 2017
Messages
2
Hi! :)

I have set up pip4048 + 2x pcm60x + raspberry pi + influxdb + grafana but i need the scrypt for the REC BMS, i have the same Pi-Can module as you recommended.
What settings are you running on the REC BMS?

F
 

Joaquinsfy

New member
Joined
Oct 9, 2016
Messages
19
Fredd said:
Hi! :)

I have set up pip4048 + 2x pcm60x + raspberry pi + influxdb + grafana but i need the scrypt for the REC BMS, i have the same Pi-Can module as you recommended.
What settings are you running on the REC BMS?

F


Fredd, do you have 1 or 2 rec-bms?

You don't need to have special settings in the REC-BMS.
Attached is a version with 1 REC-Bms, if you have problems, please PM

https://pastebin.com/2HUfdyGG

thanks
 

Fredd

New member
Joined
Jun 7, 2017
Messages
2
Thanks! :)
I will test it out now.
Only 1x REC but maybe more in the future.

F
 

Joaquinsfy

New member
Joined
Oct 9, 2016
Messages
19
Fredd,
the can messages are identified with an id, like 0x031,0x032 ... etc. if you have more than 1 bms, you need that every bms has differentes id, just ask to the guys of rec-bms, and they will change the id of the messages with differents one, like bms 1= can message=031, bms2 = can message =131, ...
 

daromer

Moderator
Staff member
Joined
Oct 8, 2016
Messages
5,384

magnetepazzo

New member
Joined
Aug 6, 2019
Messages
2
Hi guys I'm new user, I have 2 pip 4048 in parallel mode and I see only now this beautiful post. I'm not very expert user and not have understand how it's work , can you explain me how it's possible to make this to monitoring my inverter with raspberry? Thanks to all for helping . Have a nice day ?
 
Top