Author Topic: Classic Monitoring with a raspberry pi  (Read 4432 times)

welmore

  • Newby
  • *
  • Posts: 15
Re: Classic Monitoring with a raspberry pi
« Reply #15 on: April 22, 2018, 12:16:19 PM »
Here is an updated "Logging.php" file.

   There are some new comments added.
   The issues with the "Solar_Log.dat" file is fixed.  The old version caused multiple entries each day.
   New code to update and display the "history.txt" file was added.

At the bottom of "Solar_Monitoring_Gauges_plus.php" is the code to ready and display the history information.

<?php
//Display history
$HistoryLog = fopen ($dir."history.txt","r");
for ($a = 0; $a <= 6; $a++){
   $History[$a] = fgetcsv($HistoryLog);
}
fclose($HistoryLog);
echo('<br><table><tr><td ALIGN=Center>Date<td ALIGN=Center>S1 Peak<td ALIGN=Center>S1 kWhr<td ALIGN=Center>S2 Peak<td ALIGN=Center>S2 kWhr');
for ($a = 0; $a <= 6; $a++){
   echo('<TR>');
   $HDay=$History[$a];
   echo('<td ALIGN=Center>'.substr($HDay[0],4,2).'/'.substr($HDay[0],6,2));
        echo('<td ALIGN=Center>'.$HDay[1]);
        echo('<td ALIGN=Center>'.number_format($HDay[2],$decimals=1));
        echo('<td ALIGN=Center>'.$HDay[3]);
        echo('<td ALIGN=Center>'.number_format($HDay[4],$decimals=1));
}
echo('</table>');



?>

Feel free to rearrange as you wish.

The "history.txt" file needs to be in your "Data/" folder there the "current.txt" file is.

The existing history data is from my system.  It will rotate out in 7 days.

Each day, around midnight, the "Logging.php" program will update the "history.txt" file, add a daily record to "Solar_log.dat" and reset the daily highs and lows saved in Dlog_Data
  • .


Contact me with questions, comments, or suggestions.

Have a great day

Others interested, I will supply all required files and instructions on request.

binkino

  • Sr. Member
  • ****
  • Posts: 254
    • BinKino's PV
Re: Classic Monitoring with a raspberry pi
« Reply #16 on: April 23, 2018, 02:34:20 PM »
Thanks Wade, that makes it so complete and perfect now,
have added the code to one of my gauges page and to my Lcars page and now waiting for it collects some days data and then I will see, how I can finetune it on my Lcars page.
(see link below)
If someone want to have the code for one of my pages too, let me know in comment / post here
PV-OUTPUT: http://pvoutput.org/list.jsp?id=38617
Classic Lite 200 + Classic 200 + Westech Combi 3000 + 3x4x240Wp + 1x4x255Wp + 575 AH EPzS
http://a68k.de:81/Solar/Monitor_LC.php

Jose Miranda

  • Newby
  • *
  • Posts: 28
Re: Classic Monitoring with a raspberry pi
« Reply #17 on: May 13, 2019, 09:26:09 AM »
Hi guys. Is this code being maintained somewhere? Where can I get the latest code?

ClassicCrazy

  • Hero Member
  • *****
  • Posts: 2175
Re: Classic Monitoring with a raspberry pi
« Reply #18 on: May 13, 2019, 01:12:40 PM »
Hi guys. Is this code being maintained somewhere? Where can I get the latest code?

If using a Pi I would move on to using Node -Red - seems a more powerful tool to use and easier too.
There is a post on Node-Red on forums here.

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

Steve_S

  • Newby
  • *
  • Posts: 26
Re: Classic Monitoring with a raspberry pi
« Reply #19 on: May 26, 2019, 10:42:01 AM »
I'm just catching up on the forum here and saw this and I am very intrigued indeed.   

While I don't mind the software for my C-200 and it's useable, it's just a tad "lacking" shall we say.  Now I don't have a Raspberry but have been pondering getting into them over the last couple of years as I've realized they can be used for many things.  I'd like to be able to setup a Pi that could gather the stats from my C200 and if possible from my new Samlex EVO-4024 Inverter which I could then access from my PC.  Although, I'm not sure of the Samlex capabilities the spec's state the following:
Quote
RJ-45 Jacks for Communication Ports “COMM 1” and “COMM 2” - for rS-485 networking and MODbUS Serial Communication Protocol (for future use)   RJ-45 Jacks for Communication Ports “COM 3” and “COM 4” - for “CANbus” Serial Communication Protocol (for future use)

Other uses for the Pi could be to manage my heat recovery / air exchanger ventilator (fan speeds related to temps) and such.  I know that's beyond the scope of this topic but I'm hoping you would be able to recommend a good Pi bundle (there are so darned many, it's nuts!) that could / would best accommodate me.

Thanks
Steve
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: 2175
Re: Classic Monitoring with a raspberry pi
« Reply #20 on: May 26, 2019, 01:31:41 PM »
You probably want the latest and greatest Raspberry Pi 3 B + model.
If you want to wait a bit there is supposed to be a Raspberry Pi 4 coming out but I don't know details.
As to where to purchase - depends on if you want to get the complete kit with power supply, a case, the sd card, etc or just the board which is abut $35 . Get the kit if you don't have all that other stuff laying around and the case is a good idea.
Lots of places to look for what you get for the money - Amazon, Adafruit, Ebay, Ali Express. Make sure you don't get an old Raspberry Pi 3 model - it has to be 3 B+
https://www.adafruit.com/category/105
Also a good quality SD card makes a big difference


For what you want to do Node Red is the way to go so if you can figure that out you have it made . Lots of tutorials on Node Red - I like Andreas Spiess on Youtube .
here is his latest video but look back at the others
https://youtu.be/z1y6j8-V7J0

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

Steve_S

  • Newby
  • *
  • Posts: 26
Re: Classic Monitoring with a raspberry pi
« Reply #21 on: May 26, 2019, 04:27:46 PM »
Thanks for the speedy response Classic Crazy.

RE-Edit:

I just purchased the CanaKit Raspberry Pi 3 B+ (B Plus) Starter Kit (32 GB EVO+ Edition, Premium Black Case)
https://www.canakit.com/raspberry-pi/pi-3-model-b-plus-kits

According to Tom's Hardware (which is usually pretty darn on the ball) the Pi 4 won't be out till 2020...
REF https://www.tomshardware.com/news/raspberry-pi-4-everything-we-know,38539.html

Looking forward to getting the package next Friday, hopefully it rains so I can play with it ;-)
« Last Edit: May 26, 2019, 07:08:35 PM by Steve_S »
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: 2175
Re: Classic Monitoring with a raspberry pi
« Reply #22 on: May 27, 2019, 03:05:53 PM »
Thanks for the speedy response Classic Crazy.

RE-Edit:

I just purchased the CanaKit Raspberry Pi 3 B+ (B Plus) Starter Kit (32 GB EVO+ Edition, Premium Black Case)
https://www.canakit.com/raspberry-pi/pi-3-model-b-plus-kits

According to Tom's Hardware (which is usually pretty darn on the ball) the Pi 4 won't be out till 2020...
REF https://www.tomshardware.com/news/raspberry-pi-4-everything-we-know,38539.html

Looking forward to getting the package next Friday, hopefully it rains so I can play with it ;-)
Keep us posted on your project - check out section on here about hooking Classic up for Node Red.

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

Steve_S

  • Newby
  • *
  • Posts: 26
Re: Classic Monitoring with a raspberry pi
« Reply #23 on: May 31, 2019, 02:45:54 PM »
The CanaKit Raspberry Pi 3B+ arrived with all it's goodies.  Amazing little piece of kit I must say, went together in < 5 minutes and was up & running in 10 !  Heck it even drives my LG 47" LED TV (which is what I use for a screen).  Love that I can use a wireless Logitech Keyboard & Mouse without hassle, that's a big saver.

Andreas Spiess on YouTube is amazing, he's my kinda guy for sure... Thank Goodness I have YouTube-DL & the YoutubeDLfronEnd for windows  REF:  https://cresstone.com/apps/youtubeDLFrontEnd/ so I downloaded all his relevant video's (far faster than viewing online and with a Satellite Internet Service, much better to DL and watch at my leisure.  One key issue raised by Andreas is speed & performance with the DB's storing all the logged data to an SD card and that can be worked around.  One Option is to use a USB connected SSD or high performance drives with much more capacity and greater reliability AND you can actually boot from them too with the native OS.

I've been delving into Node Red which certainly looks to be the right tool BUT I'm going farther with this and going to use Grafana & InfluxDB and possibly another bit of software.

You made reference to a possible Pi 4 version coming out.  Well I've been doing more research and asking questions and the Tom's review is correct and it will be a while BUT !  Yep, there is a BUT in there...   Have you looked at Orange Pi ? 

Now they have faster models using a slightly different ARM processor, all Raspberry stuff works on them, fully compatible.  They also have models with a variety of features & functions as well and the pricing is equally as attractive to boot.  One BIG HUGE BONUS is that several models come with 2GB on board plus more and they have some more flexibility for attached devices.   

Check this out:
Orange Pi Plus 2E  @  http://www.orangepi.org/orangepiplus2e/
Orange Pi 3 @ http://www.orangepi.org/Orange%20Pi%203/   (note it has a Quad Core 1.8 Ghz CPU and up to 2GB Ram).

I believe I will be posting in the other thread related to Node-Red and more as that will be more relative to where I am going with this.  Hopefully, I'll be able to connect my Classic & my Samlex Inverter to my software AND if there are some good souls out there with other Inverter/Chargers and Solar Related devices like controllers, they'll share the Modbus info so I can setup a DB with various models of gear...  Time will tell and I'm not in a Rush to do this, it's hobby thing so Bad Weather Days  & "Winter" or when I'm bored (doesn't happen that often).

Have a Marvelous Day everyone.
Steve
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: 2175
Re: Classic Monitoring with a raspberry pi
« Reply #24 on: May 31, 2019, 03:07:35 PM »
Great Steve - looking forward to seeing your contributions on the Node - Red section soon.
I kind of dropped it for the summer now that I am busy with outside stuff.
I have been using a Pi Zero W on all the time that just runs Weewx program that interfaces with my weather station - it just works and is very stable and other than updating Pi stuff now and then I don't mess with it much.
I log into via SSH from my computer and if I want to get into it graphical I can use VNC server for that using my laptop - so don't need any wires going into it - all works via it's wifi link.
One note on the Node - Red - when I first used it I had serial link to the Classic but after I set up my Classics on Follow Me the serial link doesn't work any longer . So I need to now use modbus connection over IP which then limits to one application - like if you use Local Status App then that is the one - you need to disconnect to use Node Red over IP or if you used Grahams Android Classic monitoring app then that would be the only one and you could need to disconnect that . Just keep that in mind if you have problems connecting over IP only one connection at a time .

I never looked at the Orange Pi . As long as it works with same amount of support for Raspberry Pi that is okay.
I have a Pi 3 B+ here that should keep me busy for awhile in addition to the Pi Zero W - I also have another one of those to use with Motion Eye and a video camera that plugs into the pi camera slot .

Lots to do !
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

smartdave

  • Newby
  • *
  • Posts: 1
Re: Classic Monitoring with a raspberry pi
« Reply #25 on: June 06, 2019, 01:17:46 AM »
There seem to be a few code zips in this thread.

Coming late to the party I guess...
Do I need a Full LAMP stack?  Or just Apache and php?

What are the latest version of code that have been written?  I have a classic 200

Thanks

Dave

ClassicCrazy

  • Hero Member
  • *****
  • Posts: 2175
Re: Classic Monitoring with a raspberry pi
« Reply #26 on: June 06, 2019, 10:48:34 AM »
There seem to be a few code zips in this thread.

Coming late to the party I guess...
Do I need a Full LAMP stack?  Or just Apache and php?

What are the latest version of code that have been written?  I have a classic 200

Thanks

Dave

I would suggest  checking out  Node Red - it has more capabilities . There is another thread about that .
http://midniteftp.com/forum/index.php?topic=4081.0

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

Steve_S

  • Newby
  • *
  • Posts: 26
Re: Classic Monitoring with a raspberry pi
« Reply #27 on: June 06, 2019, 01:08:04 PM »
There seem to be a few code zips in this thread.

Coming late to the party I guess...
Do I need a Full LAMP stack?  Or just Apache and php?

What are the latest version of code that have been written?  I have a classic 200

I'm just setting up my new Pi 3B+ for this purpose as well as monitoring a few other things.  I've taken this project a bit further as I am incorporating the following: 

Raspian OS
- Node-Red
- Node-Red Dashboard   https://flows.nodered.org/node/node-red-dashboard
- Node-Red-contrib-modbus 4.1.3  (includes Serial & TCP) https://flows.nodered.org/node/node-red-contrib-modbus
- InfluxDB Time Relational Database  https://www.influxdata.com/
- Node-Red-contrib-influxdb 0.2.2  https://flows.nodered.org/node/node-red-contrib-influxdb
- Grafana Analytics & Monitoring https://grafana.com/

I partitioned & formatted a 240GB SSD Sata Drive and set that as boot device because the DB will be storing a lot of data over time.  This makes my installation slightly different.

After installing everything with a Fresh Rasparian, node-red and the rest, I ran Peter Scargills "the script" and ensured that everything I wanted was selected  and let it update everything (this takes a while).  There were a few errors during that update so after a reboot, I restarted and reran it and all came out 100%.   The Script is GENIUS and strongly suggested.  Here it is:  https://tech.scargill.net/the-script/

There is no need for Apache / Lamp to act as a webserver as Node Red (dev & dashboard), Grafana communicate directly.  InfluxDB is a command-line interface.  IF you wanted to do this without Node-Red there is Modbus for Java & Python that would accommodate using regular webpages as in the other thread but that is IMO a more complicated approach.

This Tutorial / Overview got me started on this particular path.  Have a peek and look at some of his other videos which tie  many things together.  https://www.youtube.com/watch?v=JdV4x925au0&t=3s    Also, there is other YouTube vid's that cover Solar & Node-Red and more... 

I may actually do up an article on setting up a Pi for this purpose including how to setup an SSD or other HDD as the boot device as there is some out of date info that can lead down a wrong path.  Of course that will likely take some time as it's mid busy season now that summer is attempting to start !  (well it seems that way at this moment).

BTW:  I have been playing with the flows posted in here...  some good potential in all of this and room to really expand on.  I will be posting flows as I work my stuff out.

A note to ponder on:  I'm using a combo of Node-Red Dashboard because not only can that be used to present the data in Real Time (system status etc) but it also has facility send setting changes (with extreme caution) to the Modbus device (using the Modbus lib I posted).  The Grafana and InfluxDB is for the longer term view of performance & generation and allowing to generate a nice view that results from eh data collected.   Ultimately, I would like to have my Classic-200, the Samlex 4024 Inverter/Charger and my Weather Station all  plugged into the Pi and collecting data. 

Hope that Helps,  Good Luck.
Steve
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: 2175
Re: Classic Monitoring with a raspberry pi
« Reply #28 on: June 06, 2019, 06:17:04 PM »
That is fantastic Steve . You should start a new topic and copy your last post there . Then if you could share the flow I could try it out sometime since that is easy ( you did most of the work !) .
Thanks for sharing !
Do you think I should ask the moderators to make a new Node Red forum or just keep it on here ? I was putting my Node Red stuff on General opensource since it can be used with Windows and not just Raspberry Pi , although some of the things you are using like Grafana - maybe that only works with Linux ? 

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

Steve_S

  • Newby
  • *
  • Posts: 26
Re: Classic Monitoring with a raspberry pi
« Reply #29 on: June 06, 2019, 08:10:34 PM »
This is a Raspberry Pi Forum so Node-Red falls under that IMO.   BUT that being said, Node-Red IS cross Platform and works on Windows too but I don't know about everything else, I do believe that InfluxDB is also Multi Platform but Grafana ?

I will likely start my own thread series as I like to document a things as I go along.   I'm doing "upgrades" again this evening as I got a new Big Case, Fan (don't like CPU @ 61C) and an RTC clock so it keeps time for itself.

Because of my setup here... having a separate PowerHouse 60 feet from Cabin and having my solar rack even farther away I have to organise a few things up...  I want to be able to run this 7/24 BUT I do not want to have the satellite (I'm remote Sat is my internet etc) which is a power pig, so it will likely be located in the powerhouse & attached to my battery bank through the 12V circuit I have running off it...  I'll just have to find an "adapter" that will step that down to 5V-3A and another for the Router which I think is 4.5V

So far I have my flow talking to the Classic but that needs serious lovin to clean it up and once I have that the way I want, then I'll dashboard it with Node-red.  I really don't see too many issues with the Classic itself and sure am hoping the folks @ MidNite are considering all of this with their new Inverter/Chargers (B17 ?) too. 

My biggest issue at this time, is with Samlex Inc !  Their Inverter has Modbus but they've never released the information on it and are not forthcoming with that.  They are discussing it at Corporate now because I presented a case scenario which would increase their profile in the RE Sector.  Ironically, they have RJ45 connectors but I do not believe they are Ethernet but rather some form of Serial so I'll have to get an engineering type to look at that... maybe I'll have to use an RS485 port or something... ugh....
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