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

welmore

  • Newby
  • *
  • Posts: 9
Classic Monitoring with a raspberry pi
« on: October 26, 2017, 12:44:45 AM »
Greeting.  I have been working with Binkino on a web based Classic monitoring project.
It works with a raspberry pi that reads the Classics and provided a web based display.
This project assumes two Classics with a Wizbang jr attached to Classic #1.
You will need a raspberrypi loaded with Apache and PHP.
The attached zip file has all the files you will need.
Unzip the file into a folder named "Solar" in your host root folder.  Mine is "/var/www".
In the Solar folder, create a folder named "Data".
Open the permissions on the Data folder.
In "Logging.php" edit;
$Solar1="192.168.0.121" for your Classic #1 IP address. 
$Solar2="192.168.0.122" for your Classic #2 IP address.

On the pi, open a browser and start "IP address of your pi /Solar/Logging.php".
If youget error messages and the data is mostly zeros, you are not connecting to the Classics.
Keep this running.
It will create a "current.txt" file in the Data folder.  This file is the most recent data from the Classics and is used by the monitoring pages.
If this file is not created, check your permissions.
On the same pi or any computer on the same network, open another browser and start "IP address of your pi /Solar/Solar_Monitoring.php" or "IP address of your pi /Solar/Solar_Monitoring_Gauges.php".  You should see the display.

Some data will not be valid until "Logging.php" has been running past midnight.
"Logging.php" also creates a "Solar_log.dat" file.  This file is update every midnight with the prior days highs, lows and end of day data.  It is saved in CSV format.
"Logging.php" also creates files named "year month day .txt" .  These files save all teh data read from the Classics. .  It is saved in CSV format.
 I plan on providing a review page that will use these files.

I tried to comment out the files I wrote to aid you if you want to tweek them.  I attached a file "registers used" which has information about the variables used.
Binkino also created a  nice display also.  It uses the same Logging.php and current.txt files.

If  you have questions, comment please reply to this post, or email me at wade_elmore@comcast.net.
Have fun.

binkino

  • Full Member
  • ***
  • Posts: 241
    • BinKino's PV
Re: Classic Monitoring with a raspberry pi
« Reply #1 on: October 26, 2017, 07:12:39 AM »
Thats great ;)

So here are my files with date 26 OCT 2017

Here you find the Monitoring files, with my changes.
Place the files from the zip in the same folder like the installed files.
With my files, you need a sub-directory "js" (gauge.min.js) so the js file don't has to be loaded from external source
and "lc" with all the graphics for the "LCARS" pages -  here are 2 more zip in attachment of this post.
For the gauges and the old LCARS version, you need the sub-folder "pic" with the content of the pic.zip file.

The files are showing the state of today - so they are not perfect and finished yet.
But they can be a good start for everyone, who is interested in it.

I tried to clean up all this crazy spaghetti looking code, but also not perfect and if you have recommendations, please let me know. I did it on the way I can do it and trying and looking for code and maths that works.

And keep in mind, the temperatures are in °C Celsius, not Fahrenheit (exp. the original page from Wade) and the namings are in german. If there are questions, please also ask.

IMPORTANT: the Lcars Graphics, like I use the one in the right side for coming use, I have copied from the web and changede the graphics a bit. So if you publish the page, keep this in mind, so you don't run in trouble.

« Last Edit: October 26, 2017, 10:06:07 AM by binkino »
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

binkino

  • Full Member
  • ***
  • Posts: 241
    • BinKino's PV
Re: Classic Monitoring with a raspberry pi
« Reply #2 on: October 26, 2017, 10:34:29 AM »
I recommend:
For new beginners, please use the source page from Wade, write down the Classic-Numbers you need to know, when you want to display a value. Helped me so much. So you don't have to search thru other files ...
-> see attached photo
With this note you have a excellent quick view, which data# for which value you need to set in the code.
Also you can look thru the php files, and see how single displayed values are displayed.
In the first versions, we used a pure PHP form, then switched over to use the header for the code information and scripts, following html code with php code inserts. This also makes it possible, to edit the pages in an WYSIWYG editor (like Frontpage 2000/2003) and do fine tuning later in source text code.

For all those who want to setup a PI from scratch for this purpose, I will do a "how to" ... based on my PI.
Also with examples of code, links to all used things.
(But give me some days to do this, possible end of next week. Or I make a video ... we will see... If weather is good, I first have to finish some work on my cars)
Then, you should be able to transfer this also to other PIs. We find solutions for other PIs as well, they mostly work here too.
There are differences; but at the end it is all Linux /based and only small diffs we don't really have to think about.

For my system, I use a BananaPI M1 (2core) and yesterday I have received the BananaPI M2 (4core). On this M2 I will show the way to the goal.
I have tried the cheaper OrangePI but I am running against walls with it; a nightmare! So don't waste your time and money.
(finding a working image is an adventure. OSes are not running stable. CPU has also 1Ghz, but while the BananaPI idles about 10% the OrangePI is on 40% and very quick on 100% and freezes for seconds and/or crashes. But it is your decision.)

At this point, finally my opinion:
RasPI is the "yellow of the eg". No discussion from my side :)
But next cheaper and working Board (and has also Sata on board, that was important for me) is the BananaPI ...  and in all its flavors.
Okay, on BananaPI you don't have the best support (see topic: screen resolutions ... 1024x768 and 1280x720 with bad tricks only) but it is much much better, then for OrangePI.



Edit: I have been playing around with the BANANA PI M2 BERRY and it runs well, BUT it don't recognize my monitor while booting and in the loaded OS. Only, if I unplug the HDMI and plug it in again. That is no way for me.
So I am back on my BANANA PI M1 and will see, what else is on the marked.
On the M1 it also runs well. The CPU power with 1Ghz and 1GB of ram is limited, but it runs 100% stable here.
« Last Edit: October 29, 2017, 05:58:46 PM by binkino »
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

ClassicCrazy

  • Hero Member
  • *****
  • Posts: 1445
Re: Classic Monitoring with a raspberry pi
« Reply #3 on: October 26, 2017, 12:08:11 PM »
Thanks Wade and Bikino . I am planning to trying these out in the future when I get some time.

Bikino - have you tested the power requirements of the various boards you have tried ? I just checked my older Raspberry Pi B that has wifi dongle and weather station dongle plugged in and is running the Weewx weather program and it takes about 2.7 watts .

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

binkino

  • Full Member
  • ***
  • Posts: 241
    • BinKino's PV
Re: Classic Monitoring with a raspberry pi
« Reply #4 on: October 26, 2017, 01:04:43 PM »
yes I can measure this. will post it later when I am back home (~ 5hrs)



in the web I found a German page about the Banana PI as a NAS (like I used it before)
https://nas-selber-bauen.de/energieverbrauch-des-banana-pi-nas/

Booting (min.)                3.7 watts
Booting (max.)                4.3 watts
Idle (cheap PSU)             3.7 watts
Idle (Anker PSU)             3.4 watts
Idle (sleeping HDD / cheap PSU)    2.8 watts
Idle (sleeping HDD / Anker PSU)    2.6 watts
Max. computing power          5.2 watts
Max. data transfer (SD-card)       4.8 watts
Max. data transfer (HDD)          5.8 watts
Max. computing power + data transfer (HDD)    6.2 watts

I hope my translation makes sense :D

--------------------------------------------------------------------------

I was hoping, I can start all 3 PIs with one image, so I have the same OS and programs and load on all of them, didn't work.
Need more time, but I can tell ...
The Orange PI takes 0.085 A when no card and OS not loaded, when OS loaded and is starting all the things, it goes up to 0.62 A (3.1 watts)
The Banana PI M2 takes 0.06 A when no card and OS not loaded.

Have now downloaded an image, installed and wrote a "how to" (this will follow tomorrow after some hours of sleep and re-read it haha)


The M2 takes 0.3 to 0.4 Ampere while booting and when running, between 0.25 and 0.42 Amps
At 5 volts this is in watts: 1.25 to 2.6 Watts.
If you add some more hardware, this will increase the power hunger.
I think, they all are close similar in power consumption.


Thanks to 2 more cores on this PI, the browser starts much faster and only goes up to 75% while starting, then down to < 10 % only. Sometimes 17% when it is getting datas.

Only thing I miss on the M2 is the missing connections for a battery ... works like a UPS ...
(have not seen the connections on the PCB for now ...)

« Last Edit: October 29, 2017, 09:37:25 PM by binkino »
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

welmore

  • Newby
  • *
  • Posts: 9
Re: Classic Monitoring with a raspberry pi
« Reply #5 on: October 28, 2017, 05:37:12 PM »
I discovered a bug. 

The Classics reset some of the registers at midnight, according to their clocks. 

The 'Logging.php' program keeps high and low data for each day.  'Logging.php' resets the data when the date changes, according to the pi's clock.

If the pi's clock is ahead of the Classics clock, the prior days Classic registers gets saved to the new day.

I have a fix.  I changed 'Logging.php' so it reads the time  and date from the Classics, not the pi.  I have it resetting the high and low data and starting the new daily log when Classic #1 changes dates and both Classics time is 00:00. 

Note: Even with the follow me cable and Classic #2 told to get its time from Classic #1, there can be slight differences in the time.

I am testing the patch over night and will post it when it passes.

This fix to 'Logging.php' does not require any changes to the monitoring programs.

estragon

  • Newby
  • *
  • Posts: 21
Re: Classic Monitoring with a raspberry pi
« Reply #6 on: November 06, 2017, 05:12:43 PM »
I'm looking at using a Rpi3 to monitor, mainly unattended over the winter.  In past years, I've had problems with snow covering panels, and even the Classics self-consumption has been a problem, so the Rpi consumption, even at ~5w or a bit under, could be just adding to the problem. 

To address the Rpi power consumption, I've added a "SleepyPi2" from SpellFoundry.com in the UK.  It's basically an Arduino with a real time clock that can turn the Rpi on and off (proper shutdown) according to time of day, time elapsed, etc.  It will also have to control power to hub, router, WAN router, and cellphone booster.  The idea is to wake up once a day, read stuff from the Classics, report status, maybe wait for a bit in case I want to log on remotely, turn stuff off, and go back to sleep.  If I really wanted to save power, I could get it to just read battery voltages and go back to sleep if everything's okay, but I think I'll work on getting it to do daily reporting for now.

I just got the gear, but so far it looks like it should do the job. 
Off-grid. 
Main daytime system ~4kw panels into 2xMNClassic150 370ah 48v bank 2xOutback 3548 inverter 120v + 240v autotransformer
Night system ~1kw panels into 1xMNClassic150 700ah 12v bank morningstar 300w inverter

Westbranch

  • Hero Member
  • *****
  • Posts: 2516
  • Building System (sort of) 1 weekend at a time
Re: Classic Monitoring with a raspberry pi
« Reply #7 on: November 06, 2017, 08:02:29 PM »
looks like they run on 5v and sip their amps....

Other Raspberry Pi models
Pi Model   Pi State   Power Consumption
model 3 B   HDMI off, LEDs off, onboard WiFi   250 mA (1.2W)
model 2 B   HDMI off, LEDs off   200 mA (1.0W)
model 2 B   HDMI off, LEDs off, USB WiFi   240 mA (1.2W)
Zero   HDMI off, LED off   80 mA (0.4W)

KID FW1811 560W >C&D 24V 900Ah AGM
CL150 29032 V.2126-NW2097-GP2133 175A E-Panel WBjr, 3Px4s 140W > 24V 900Ah AGM,
2 Cisco WRT54GL i/c DD-WRT Rtr, NetGr DS104Hub Hughes 1100 Sat. Modem
Cotek ST1500 Inv  want a 24V  ROSIE Inverter
OmniCharge3024  Eu1/2/3000iGens
West Chilcotin 1680+W to come

ClassicCrazy

  • Hero Member
  • *****
  • Posts: 1445
Re: Classic Monitoring with a raspberry pi
« Reply #8 on: November 06, 2017, 09:27:43 PM »
I am tempted to get a Pi Zero W ( the new  model ) and see if it would run my Weewx weather program - I looked it up and it sounded like someone simply took SD card out of a regular Pi and put it in the Pi Zero W and it ran okay .  Ha - nothing works that easy ! They only cost $10 but you can only buy one at a time now so shipping probably jacks the price up - that is why I was hoping the supply would increase so I could get more than one .

If it works then I could get on the Midnite monitor project sometime.
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