Author Topic: Node-Red, ModBus, InfluxDB, Grafana on Raspberry Pi - Solar System Monitoring  (Read 423 times)

dgd

  • Hero Member
  • *****
  • Posts: 1722
    • Lorylink
I have had a while to read up on these software packages for the Pi3. The modbus library is good although I would prefer its use via a direct serial port connection to the Classic rather then some Ethernet to serial conversion. Doesn’t seem to onerous to implement once the various timings are sorted out.
The InfluxDB and Grafana look interesting but I’m left with the probably incorrect impression that they are an awful lot of overhead for dealing with just a relatively few data from the Classic. Maybe I’m just too old fashioned but using a data structure managed by some simple C code to extract and store Classic data over time OR for a real time metered display looks like an easy approach. Grafana is just a graphics package, looks like it can make some whizzy displays but I’d like to see some better or bettered dashboard metering (of have I missed this).
Anyway, I look forward to seeing how yous progress (CC and Steve) as I want to learn.
In meantime I will tidy up my Pi3 c code, document and post my simple Classic monitoring tool for Pi via serial port.
Dgd
Classic 250, 150,  20 140w, 6 250w PVs, 2Kw turbine, MN ac Clipper, Epanel/MNdc, Trace SW3024E (1997), Century 1050Ah 24V FLA (1999). Arduino power monitoring and web server.  Off grid since 4/2000
West Auckland, New Zealand

ClassicCrazy

  • Hero Member
  • *****
  • Posts: 2169
Not sure what you mean dgd by a lot of overhead - the Pi Zero W only costs about $10 and uses about 1 watt or less. I don't know though if it has enough processing power to run the Grafana and all though . Even though I have a pi zero W I have been so far using Pi 3 B+ to experiment with the node red - though I also often just use my windows computer with node red too since it is usually always running in the daytime anyway.
I haven't tried hooking the pi up to serial on Classic - well I did try but I figured out that since I have the Classics in Follow Me I can't get serial data . Maybe I will try putting both the Classics as independent controllers and see if I can get the serial data going - like you say should work a lot better than modbus IP .

Larry
system one
Classic 150 , 5s4p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal for 24v pack , Outback 3524 inverter
system two
Classic 150 ,5s 135 watt Kyocero , 16s Calb 100AH LiFePO4 , Outback VFX 3648 inverter
system three
Midnite KID MPPT 24 DC in to  12 volt AGM batterie

dgd

  • Hero Member
  • *****
  • Posts: 1722
    • Lorylink
CC, sorry I didn’t mean power usage or money investment in Pi3, instead I meant cpu cycles as I have found the Pi tends to run out of grunt which can often lead to lock ups or weird results. The overhead of a DB inc it’s language interpreter then a well featured graphics generator all running real time data extraction and display, I think will push the Pi3. Maybe Im wrong but we will see when I get time to install everything.
With my Pi3 I was thinking of using it dedicated to classic data extraction and offering that data as some web pages, but even with minimum web server code the Pi3 resource is getting stretched.
Dgd
Classic 250, 150,  20 140w, 6 250w PVs, 2Kw turbine, MN ac Clipper, Epanel/MNdc, Trace SW3024E (1997), Century 1050Ah 24V FLA (1999). Arduino power monitoring and web server.  Off grid since 4/2000
West Auckland, New Zealand

Steve_S

  • Newby
  • *
  • Posts: 26
At this point, I have Node-Red running, pulling Modbus via TCPIP with no issue, the Modbus lib I am using can also do serial but why If you can get it via IP.  With NodeRed, InfluxDB & Grafana running on my Pi3, it sees spikes of 12% when writing to Influx and 20% if I am working software on my browser.  I do not use the browser in the Pi for more than just settings, I use my lappie to connect to the Pi.  The Pi can handle this well enough as a "server" but don't think you'll be browsing or doing much more on it with all of this running.

The writes are but a blink literally and don't create IO bottlenecks BUT I am running off an SSD drive, which likely has a positive effect on that.

My Nodered flow is simple enough, it's only pulling the data I want, setting it up and dumping it to Influx.  The basic Dash (nodered) was just to see a quick & dirty "it is working" screen.   I was originally thinking of writing a program in C# which was cross platform BUT with RasPI and all these goodies that simplify it and being all FREE it's a no brainer to go this route.  There is a CATCH for me though.  My Samlex gear can also talk Modbus BUT I had to sign an NDA to get their data & specs, so I won;'t be able to share that part for now, till things are sorted.

SOMETHING FOR PI FOLKS !
As mentioned, I went with an SSD drive on my Pi and it is terrific to use it... I followed instructions from Andreas Speiss on YouTube and all went according to plan BUT I just came across this which solves a LOT of quirks & foibles.

Geekworm Raspberry Pi 3 B+/3B SATA HDD/SSD Storage Expansion Board, X820 V3.0 USB 3.0 Mobile Hard Disk Module for 2.5 Inch SATA HDD/SSD/Raspberry Pi 3 Model B+ (B Plus)/3 B/ROCK64/Tinker Board https://www.amazon.com/Geekworm-Raspberry-Storage-Expansion-Compatible/dp/B073CGQD9C/ref=sr_1_19?keywords=Orange+Pi&qid=1560892223&s=gateway&sr=8-19   and it is ONLY $28   Plus Geekworm has cases with fans and expansion modules to house your Pi & attached kit, all very reasonably priced and most affordable.

SIDE NOTE: There are Banana Pi's & Orange Pi's which have faster CPU's and up to 4GB Ram onboard which are 100% compatible with Raspberry, same form factor and compatible with the extra goodies.  Prices are very very close to RasPi's as well, so not a big leap if that's a point of contention.
Classic-200, Samlex EVO-4024 Inverter/Charger, 2080W of Canadian Solar CS-260P in 2 strings of 4,  8x Rolls Surette S-550 24V/856Ah battery bank.
System Detail: http://midniteftp.com/forum/index.php?topic=4643.0

Raster

  • Newby
  • *
  • Posts: 3
Great. I am trying to do the same thing for my (future) solar system: Rpi + Node-Red + InfluxDB  + Grafana. Arduinos will run various sensors: temp, voltage, and GPS (for  time). The IDE for the Arduino runs on the Rpi. Don't know if the RPi has enough horsepower, but so far it does. The Arduino is powered and communicates on a USB port on the RPi. So far, I have the Node-Red dashboard running showing some sample sensors from the Arduino. Haven't started on InfluxDB and Grafana. What is nice is that the dashboard is viewable by any browser. All this software is free, and RPis and Arduinos are very inexpensive and low power (3-4 watts at present). Definitely will look up Andreas on YT.

Vic

  • Hero Member
  • *****
  • Posts: 2126
Hello Steve_S,

Am tardy in thanking you for generously sharing your work.  At this point,  it is way over my head,   but hope to delve into the R pi more,   if we ever catch up on too many other projects.

Am also following CC Larry,   and dgd's projects,   Thanks,   all,   Vic
Off Grid - Two systems -- 4 SW+ 5548s, Surrette 4KS25 1280 AH X2@48V, 11.1 KW STC PV, 3X MidNite Classic 150 w/ WBjrs, Beta KID on S-530s, MX-60s, MN Bkrs/Boxes.  Thanks MN for Great Products/Service/Support!

Steve_S

  • Newby
  • *
  • Posts: 26
Quick update / response...
I'm still tinkering with this BUT it is low priority at the moment, that miserable time of year is coming and too much to do in the meantime.   
I've received my USR RS232/RS485 -> TCPIP (for Modbus) converter which will interface with my Samlex EVO4024 Inverter so I can extract data via Modbus...   Very interesting little kit, looking forward to tinkering with that, I chose that route instead of a "hat" for the RasPi as I wanted a tad more flexibility.

Here is a TWIST:   As my Powerhouse is in a separate building 75' away, I've decided to run a 24VDC->12VDC converter (direct from my battery bank) to a pair of Cigarette Lighter Sockets which will, hold some ANKER 12V-USB Adapters which will power the RasPi (5v/2.5A) The USR (5v/1a) and my Router which is 12V/1.0A while leaving the Satellite Modem in the can on a switch.  This will allow the DC Devices to operate even when the inverter is off  and without going through the losses of converting up & down.

Influx DB:   I have gotten it to store the Classic Data quite nicely but I'm going t tweak that out to give me better data without the clutter...  so I guess I'll be doing some SQL processes for that....   

Not really much more progress than what has been posted here at this point... but I will be working on it once the next 4 projects are completed.
Classic-200, Samlex EVO-4024 Inverter/Charger, 2080W of Canadian Solar CS-260P in 2 strings of 4,  8x Rolls Surette S-550 24V/856Ah battery bank.
System Detail: http://midniteftp.com/forum/index.php?topic=4643.0

ClassicCrazy

  • Hero Member
  • *****
  • Posts: 2169
Sounds like a good plan to use the 24 to 12 converter to power your stuff directly like that . Pretty much how I do my DC loads. I also use the small $1  buck converters to drop 12v to  3v or whatever other voltage I need since they are adjustable . I have eliminated the batteries on weather stations, etc by just soldering a couple wires onto the battery connectors - one of those buck converters will power a lot of devices . I seem to collect lots  wireless temperature gauge at garage sales when they are less than a buck - then plug them all in for the fun of it. Fun ! https://www.ebay.com/itm/1-5PCS-LM2596S-3A-DC-DC-Power-Supply-Buck-Converter-Adjustable-Step-Down-Module/262770509484?hash=item3d2e57c6ac:m:mkmg3y3Hc7Nb2pOqFK7-7ZQ

Larry
« Last Edit: July 30, 2019, 01:18:58 PM by ClassicCrazy »
system one
Classic 150 , 5s4p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal for 24v pack , Outback 3524 inverter
system two
Classic 150 ,5s 135 watt Kyocero , 16s Calb 100AH LiFePO4 , Outback VFX 3648 inverter
system three
Midnite KID MPPT 24 DC in to  12 volt AGM batterie