OpenMarine
My first Live demo of a Wifi solar- and battery monitor in OpenPlotter - Printable Version

+- OpenMarine (https://forum.openmarine.net)
+-- Forum: OpenPlotter (https://forum.openmarine.net/forumdisplay.php?fid=1)
+--- Forum: General discussion (https://forum.openmarine.net/forumdisplay.php?fid=2)
+--- Thread: My first Live demo of a Wifi solar- and battery monitor in OpenPlotter (/showthread.php?tid=686)

Pages: 1 2


My first Live demo of a Wifi solar- and battery monitor in OpenPlotter - tocan - 2017-08-15

It took some time but i gotit to run. The Live Demo is available at

http://arztde.dynvpn.de/epsolar/

All description is in German but i let translate it with robots to 30 languages
To get the COM data of my EPsolar Tracer into the Raspberry Pi i did not use a RS485 USB UART cable. I did solder a Wifi connection desription here:

http://donau-grundel-schiff.de/2017/08/09/der-kampf-ums-kabel-iot-internet-of-things-haelt-einzug-auf-meinem-boot-mit-openplotter-und-dem-esp8266.html

For the connection to the Raspberry Pi i use a virtual COM port.

The links go often to english resources including GIT.
How to do is a description here:
http://donau-grundel-schiff.de/2017/07/23/der-beste-universelle-solar-und-batteriemonitor-nicht-nur-fuer-boote-mit-video.html

I did install at the raspberry a mysql database and a Nginx webserver. Scriptlanguage is php for now.

Ideas how to go on:
1. I use as switches Sonoff SV so the idea is to go on this way and install Alexa Echo at the raspberry.
2. Read about MQTT and Node Red to learn how to transfer the data from the database directely into Signal K

I hope the idea with the virtual COM Port is usefull for others. In general you an onect anything that way.

I hope also that in discussion someone help me for better integration. There exist a code for node red but i do not know how to handle it and how to work with it because never used node red. Maybee someone can guide me for the first steps. I do use now Openplotter 0.10.x alpha beause i fear the updates from last time.

Code:
[
   {
       "id": "540ef0ed.76002",
       "type": "mysql",
       "z": "41bc4e86.a2c73",
       "mydb": "4c3e4c8a.898584",
       "name": "Solardata",
       "x": 442,
       "y": 1418,
       "wires": [
           [
               "dab8ec4a.48d97"
           ]
       ]
   },
   {
       "id": "97a4a648.fd044",
       "type": "inject",
       "z": "41bc4e86.a2c73",
       "name": "",
       "topic": "SELECT SUM((SELECT `Battery voltage` FROM stats WHERE Controller = 1 ORDER BY `timestamp` DESC LIMIT 1) + (SELECT `Battery voltage` FROM stats WHERE Controller = 2 ORDER BY `timestamp` DESC LIMIT 1))/2 AS `Battery Voltage`, SUM((SELECT `Battery charging power` FROM stats WHERE Controller = 1 ORDER BY `timestamp` DESC LIMIT 1) + (SELECT `Battery charging power` FROM stats WHERE Controller = 2 ORDER BY `timestamp` DESC LIMIT 1)) AS `Battery Charging power`, SUM((SELECT `Load power` FROM stats WHERE Controller = 1 ORDER BY `timestamp` DESC LIMIT 1)) AS `Load power`",
       "payload": "",
       "payloadType": "str",
       "repeat": "60",
       "crontab": "",
       "once": true,
       "x": 209,
       "y": 1347,
       "wires": [
           [
               "540ef0ed.76002"
           ]
       ]
   },
   {
       "id": "8d0012a4.32f418",
       "type": "ui_gauge",
       "z": "41bc4e86.a2c73",
       "name": "Battery Voltage",
       "group": "9f358bc8.315728",
       "order": 1,
       "width": "6",
       "height": "6",
       "gtype": "gage",
       "title": "Battery Voltage",
       "label": "Volts",
       "format": "{{value}}",
       "min": "10",
       "max": "15",
       "colors": [
           "#b50012",
           "#00e606",
           "#ca3838"
       ],
       "seg1": "11",
       "seg2": "14.3",
       "x": 1100,
       "y": 1275,
       "wires": []
   },
   {
       "id": "143a1fa7.c76eb",
       "type": "debug",
       "z": "41bc4e86.a2c73",
       "name": "",
       "active": false,
       "console": "false",
       "complete": "false",
       "x": 1041,
       "y": 1476,
       "wires": []
   },
   {
       "id": "dab8ec4a.48d97",
       "type": "function",
       "z": "41bc4e86.a2c73",
       "name": "parse data",
       "func": "var voltage = msg.payload[0]['Battery Voltage'].toFixed(2);\nvar power = msg.payload[0]['Battery Charging power'].toFixed(2);\nvar loadpower = msg.payload[0]['Load power'].toFixed(2);\n\nmsg.topic = \"Voltage\";\nmsg.payload = voltage;\n\nvar msg1 = {topic:\"Charging Power\", payload: power};\nvar msg2 = {topic:\"Load Power\", payload: loadpower};\nvar msg3 = {topic:\"Voltage\", payload: voltage};\n\nreturn [msg, msg1, [msg1,msg2,msg3]];",
       "outputs": "3",
       "noerr": 0,
       "x": 625.9794921875,
       "y": 1332.0484619140625,
       "wires": [
           [
               "8d0012a4.32f418",
               "143a1fa7.c76eb"
           ],
           [
               "143a1fa7.c76eb",
               "b1566728.7253b"
           ],
           [
               "91e58ef9.5d602"
           ]
       ]
   },
   {
       "id": "91e58ef9.5d602",
       "type": "ui_chart",
       "z": "41bc4e86.a2c73",
       "name": "Performance",
       "group": "9f358bc8.315728",
       "order": 3,
       "width": "6",
       "height": "5",
       "label": "Recent Performance",
       "chartType": "line",
       "legend": "false",
       "xformat": "HH:mm",
       "interpolate": "linear",
       "nodata": "",
       "ymin": "0",
       "ymax": "",
       "removeOlder": "36",
       "removeOlderPoints": "",
       "removeOlderUnit": "3600",
       "cutout": 0,
       "colors": [
           "#1f77b4",
           "#aec7e8",
           "#ff7f0e",
           "#2ca02c",
           "#98df8a",
           "#d62728",
           "#ff9896",
           "#9467bd",
           "#c5b0d5"
       ],
       "x": 1120,
       "y": 1391,
       "wires": [
           [],
           []
       ]
   },
   {
       "id": "b1566728.7253b",
       "type": "ui_gauge",
       "z": "41bc4e86.a2c73",
       "name": "Charging Power",
       "group": "9f358bc8.315728",
       "order": 2,
       "width": "6",
       "height": "6",
       "gtype": "gage",
       "title": "Charging Power",
       "label": "Watts",
       "format": "{{value}}",
       "min": "0",
       "max": "750",
       "colors": [
           "#00e606",
           "#00e606",
           "#ca3838"
       ],
       "seg1": "",
       "seg2": "700",
       "x": 1105,
       "y": 1323,
       "wires": []
   },
   {
       "id": "4c3e4c8a.898584",
       "type": "MySQLdatabase",
       "z": "",
       "host": "192.168.123.10",
       "port": "3306",
       "db": "solardata",
       "tz": ""
   },
   {
       "id": "9f358bc8.315728",
       "type": "ui_group",
       "z": "",
       "name": "Solar Stuff",
       "tab": "ff53e552.1dc31",
       "order": 2,
       "disp": true,
       "width": "18"
   },
   {
       "id": "ff53e552.1dc31",
       "type": "ui_tab",
       "z": "",
       "name": "Home",
       "icon": "dashboard"
   }
]



RE: My first Live demo of a Wifi solar- and battery monitor in OpenPlotter - shark24 - 2017-08-16

I'm sorry but I can't make a sense of this flood of information. I'm missing hard facts and the layout of the website with all the paragraphs that aren't related to the topic isn't very helpful either.
Besides I don't understand your IoT concept for small vessels like ours. Who needs Alexa on his boat? I know it's a matter of taste but my priorities for the RPi on the boat are first a bulletproof system and second a low energy consumption.

Why are you using a microcontroller to connect sensors, which can be attached to the RPi directly? You write about sparing wires but how do you want to power your microcontrollers, won't you need a cable shaft in any case?

Anyhow - I'm playing with esp8266 and esp32 as well and my approach would be mqtt to get the data from the esp to the pi. It's running mosquitto anyway. The data can be easily handled by node-red, nodejs, python, signalk, and so on. There are so many build in ways that I don't get why you wouldn't use it instead of the virtual serial port and php.


RE: My first Live demo of a Wifi solar- and battery monitor in OpenPlotter - tocan - 2017-08-16

With a virtual serialport i can get data all over the year and can handle them also if i far away. i will have changes in my boat i need not to bring in long cables for connetions. Try a vitron to use wireless with blutooth and you will have any failure. My intention is to go the way directely in the signal k server without wires. my intention is that i use different systems and i understand this as an addon.

The demo is a first step. and next step is to bring the mysql stored data to signal k and from there for example to wilhelm sk what i plan to integrate. unfortunal in this way i can seperate opencpn because its nearly useless for my at the rivers in europe.

i use openplotter for the moment mainly as base platform as an underground. switches and sensors i will do with fhem. and if i got the data in signal kall will be good.

yesterday i did look the first time to make it online and did integrate sonoff devies as switch.

main fact is that i installed alexa on a windows pc now. i did not bought a device. i will as a next step in next 6 weeks integrate it in raspberry. as you have seen in the videos that esp-link have mqtt integrated.

but i never did something with mqtt now and also node red. and i hope with this forum for a step by step advice to get. current data are stored in mysql database and maybee someone helps me to bring this data to node red and mqtt as a step by step instruction and help.

shark bring 50 sensors and 50 switches with cable to yours GPIO and if there is a failure find out where there is the mistake and do it via the internet.

if i am 3000 km away and the mother of my wife forgot in september to switch of the fridge or something is than i like to do it over the internet. i an phone to my boat and push a code in and all is done. Also if there is no internet available.

OK than anwer please how to get the data from esp to mosquito and than to the pi and how you do it bring than in signal k.

this is one step for current data. i work with history data this can be another approach. for me the epever manage internal the batteries and i canwork also with a shunt battery monitor.

what i need now is help to get the stored data to node red and signal k. rest is just question of personal phylosophy.

i think in majority users have solar on their boat and there is nothing integrate and no solution in openplotter available for monitoring and the relay and switch section is also empty. tell me a way how you will do this. for the moment its so that i did compare my solution with a victron solution and i think i get more for the half of the price. i do not see a big difference to take the modbus data out of the pi with a RS485 USB cable. This costs me 50 $ that i an use it with raspberry pi because the missing drivers of the cheap solutions. with my wifi solution i am very happy.


RE: My first Live demo of a Wifi solar- and battery monitor in OpenPlotter - shark24 - 2017-08-16

(2017-08-16, 02:21 PM)tocan Wrote: With a virtual serialport i can get data all over the year and can handle them also if i far away. i will have changes in my boat i need not to bring in long cables for connetions.

This is the basic idea of smart homes, boats, what ever. I don't see the dependency between the idea and the virtual serial port.

(2017-08-16, 02:21 PM)tocan Wrote: Try a vitron to use wireless with blutooth and you will have any failure.
I don't know how to "use wireless with blue tooth" but I agree, it will certainly end in failure.

(2017-08-16, 02:21 PM)tocan Wrote: shark bring 50 sensors and 50 switches with cable to yours GPIO and if there is a failure find out where there is the mistake and do it via the internet.
Indeed the GPIO-Pins are limited in numbers. There are some ways to extend the pins like the usage of a shift register for simple switches and so on. I've experimented with other microcontrollers and the pi e.g. by using firmata. For my home the combination of the pi and esp communicating via mqtt works perfect but currently i don't think i would implement it in my boat that way. There is a simple reason: I don't have electric sockets in my boat.
If I use microcontrollers beside the pi I need to provide the electricity so I have to install wires anyway. Because of i2c and shift registers I haven't reached the limit of my pi.

(2017-08-16, 02:21 PM)tocan Wrote: OK than anwer please how to get the data from esp to mosquito and than to the pi and how you do it bring than in signal k.
You can program your own mqtt client in C, use a scripting language like javascript (mongoose os / espruino) or python (micropython) or you flash some ready made software like ESPEasy. Mosquitto is running on the pi so your data is on the pi when mosquitto gets it. To get the data into signalk you can use a signalk mqtt plugin or write your own script or use node-red.

(2017-08-16, 02:21 PM)tocan Wrote: this is one step for current data. i work with history data this can be another approach.
...
what i need now is help to get the stored data to node red and signal k. rest is just question of personal phylosophy.
"Signal K is a modern and open data format for marine use" (signalk.org)
I guess its good for live data. Historical data is stored somewhere e.g. in a db and plotted by your favourite Software/Programming language. Why do you need signalk for that? If you still want to send historical data to your signalk server you just need a small routine like a script or node-red to get the data and use mqtt or websocket to push it to the server
(2017-08-16, 02:21 PM)tocan Wrote: i think in majority  users have solar on their boat and there is nothing integrate and no solution in openplotter available for monitoring and the relay and switch section is also empty. tell me a way how you will do this. for the moment its so that i did compare my solution with a victron solution and i think i get more for the half of the price. i do not see a big difference to take the modbus data out of the pi with a RS485 USB cable. This costs me 50 $ that i an use it with raspberry pi because the missing drivers of the cheap solutions. with my wifi solution i am very happy.
People use different solar controllers and there are various ways to to connect em to the pi so I guess there isn't a right or wrong way to do this. Personally I guess I'll avoid the wifi connection when I'll build my own solar solution.


RE: My first Live demo of a Wifi solar- and battery monitor in OpenPlotter - PaddyB - 2017-08-16

After some experimenting I found sqlite to be a good database to use on openplotter. Integrates easily with node red then you can copy the single database file onto another machine to do what you want with it. Setting up is made easy with a web page running on the Pi, google php sqlite admin.

Sent from my SGP511 using Tapatalk


RE: My first Live demo of a Wifi solar- and battery monitor in OpenPlotter - tocan - 2017-08-16

(2017-08-16, 11:59 AM)shark24 Wrote: I'm sorry but I can't make a sense of this flood of information. I'm missing hard facts and the layout of the website with all the paragraphs that aren't related to the topic isn't very helpful either.
Besides I don't understand your IoT concept for small vessels like ours. Who needs Alexa on his boat? I know it's a matter of taste but my priorities for the RPi on the boat are first a bulletproof system and second a low energy consumption.

Why are you using a microcontroller to connect sensors, which can be attached to the RPi directly? You write about sparing wires but how do you want to power your microcontrollers, won't you need a cable shaft in any case?

Anyhow - I'm playing with esp8266 and esp32 as well and my approach would be mqtt to get the data from the esp to the pi. It's running mosquitto anyway. The data can be easily handled by node-red, nodejs, python, signalk, and so on. There are so many build in ways that I don't get why you wouldn't use it instead of the virtual serial port and php.
To sort it out:
1. There are 3 articles for now. 
1 - is to start with the hardware and how to solder and flash it. Ok i can take a cable and a 1$ RSS 485 adapter for one euro but will not run with raspberry because of the drivers and i have to go anyways via the virtual port. In fact i do not have a Item to connect via NMEA 2000 and here i need a 66 $ stick or something like actisense for mor than 100 $.

This can be done with a virtual COM anyways. I have no chance to prove this for now but the esp is it worth to give this way a try.


2. Article 2 is about how to set up an interface for the EP Ever solar controller on the raspberry pi and what i found are the php libaries and in the article are all the links to the resources and because victron what have the most users maybe let produce as oem by epsolar there should be some compatibility.

i have a dashboard and in the webdemo the actors are not active. I have the modbus libary http://www.solarpoweredhome.co.uk/1733_modbus_protocol.pdf

and you can use also as phyton programmer the phymodbus libary. For me was the php way more easy and nice for a first proof of concept.

3. Its more easy to learn how to with videos and you have to see them in combination. And at the german resources i did try to show in german videos how i was working for because the english videos are linked inside the description.

4. My vessel is 10 meters and its enough to make there a home automation solution. I am not in a Marina and do not have Land electricity. It will be placed in danube delta at least to a village where there is no street. And for now its not clear i have Internet connection that give me status reports when i am in germany. Alexa is something to play yes because i am using since years TTS and STT with google and if there is Internet than i can go the MQTT way.

for navigation openplotter with the kap files in european rivers is not much helpful but there is no influence because of opencpn. i guess openstreetmap and tiles is more helpfull in combination with openseamap.

5. Power is enough on the boat by solar
I run for the moment 480 W solarshed and 500AH Batteries plus 100AH Starter Battery. This means relatively independat also in wintertime to let the raspberry work. And the EsP is running directely with the EPever. Modbus provides the electricity it needs. same temperature sensor in the fridge just a battery. Power dow of the raspberry with 2 Super Capacitors 2,7V and 20 F. In Case of to much snow on the roof just as example.

Yours concept works as long you have internet with MQTT. With FHEM and a normal phoneline it will work without. I saw a lot of discussions this summer. People on the boat, roaming did not work and they get no new sim on their way for days and sometimes for weeks and this in the netherlands and on the way to berlin.

7. Alexa is just that i would not like now hardware 12 v switches to implement for lights and some devices. there are 3 rooms and in every comes an old android tablet on the wall. And in case of to much sun for the displays it can be nice to have a voice control. Its a gadged shure.

6. I need help to integrate my solution more into Openplotter
I did open Node Red the first time yesterday and do not like to destroy the given example.

So i do not know how to start. What doing first?


RE: My first Live demo of a Wifi solar- and battery monitor in OpenPlotter - shark24 - 2017-08-16

(2017-08-16, 06:31 PM)tocan Wrote: 1 - is to start with the hardware and how to solder and flash it. Ok i can take a cable and a 1$ RSS 485 adapter for one euro but will not run with raspberry because of the drivers and i have to go anyways via the virtual port. In fact i do not have a Item to connect via NMEA 2000 and here i need a 66 $ stick or something like actisense for mor than 100 $.
This can be done with a virtual COM anyways. I have no chance to prove this for now but the esp is it worth to give this way a try.
The "new" ESP32 has CAN on board btw.

(2017-08-16, 06:31 PM)tocan Wrote: 3. Its more easy to learn how to with videos and you have to see them in combination. And at the german resources i did try to show in german videos how i was working for because the english videos are linked inside the description.
I'm a native German speaker and your videos aren't that helpfull to me. I appreciate your affort but the quality is quite poor in respect of an educational purpose.

(2017-08-16, 06:31 PM)tocan Wrote: 4. My vessel is 10 meters and its enough to make there a home automation solution. I am not in a Marina and do not have Land electricity. It will be placed in danube delta at least to a village where there is no street. And for now its not clear i have Internet connection that give me status reports when i am in germany. Alexa is something to play yes because i am using since years TTS and STT with google and if there is Internet than i can go the MQTT way.
10m is quite cosy I would think about home automation for +50ft but again thats my personal opinion.

(2017-08-16, 06:31 PM)tocan Wrote: for navigation openplotter with the kap files in european rivers is not much helpful but there is no influence because of opencpn. i guess openstreetmap and tiles is more helpfull in combination with openseamap.
I agree on this, like I told you in your older thread about the river maps.

(2017-08-16, 06:31 PM)tocan Wrote: Yours concept works as long you have internet with MQTT. With FHEM and a normal phoneline it will work without. I saw a lot of discussions this summer. People on the boat, roaming did not work and they get no new sim on their way for days and sometimes for weeks and this in the netherlands and on the way to berlin.
MQTT is just a protocol! You dont need Internet to use: MQTT https://de.wikipedia.org/wiki/MQTT

(2017-08-16, 06:31 PM)tocan Wrote: So i do not know how to start. What doing first?
Read basic node-red tutorials and work your way to write/read to/from a DB. Read about the dashboard and try to display your data.


RE: My first Live demo of a Wifi solar- and battery monitor in OpenPlotter - tocan - 2017-08-16

- The "new" ESP32 has CAN on board btw.

did buy my first one a wemo but no urgend need for the moment. But ESP 32 is the future. For me as a "Dau" (most stupid user) its a reasonable level.

- I'm a native German speaker and your videos aren't that helpfull to me. I appreciate your affort but the quality is quite poor in respect of an educational purpose.

Did not see that you did make better ones. And like the translations i did make a start. Better than just to consume. For the moment i can not make better ones and the available ones are just in english.

10m is quite cosy I would think about home automation for +50ft but again thats my personal opinion.
I like home automation things also as "Dau" i get reasonable results. Openplotter was one start how to do the things a more easy way. And with FHEM i can do it with the raspberry also and if i run in difficulties there are no attacks more than help.

I agree on this, like I told you in your older thread about the river maps.
Shure OpenCPN is usefull. but for plotter rivers and not all that use Openplotter run with a sailboat. I guess in europe the most use their boats for rivers and so on. Until i did not found a reasonable solution will run just as a side system with openplotter.

MQTT is just a protocol! You dont need Internet to use: MQTT https://de.wikipedia.org/wiki/MQTT
I am aware for this but its still not clear enough for me.

Read basic node-red tutorials and work your way to write/read to/from a DB. Read about the dashboard and try to display your data.
I apprechiate this idea. 7 posts of yours 24 in yours activity are that way to comment my effort. the rest is done to correct some java script errors with node red. So i think you have some background in programming and electronics that others do not have.

For the moment its so that i will go the way on with my playground i have that piece of software that fits my needs. i guess it will be interesting for others to have a reasonable solar system on their boat. With grafana i will be close to wilhelm sk that just need a signal k server. scott did write me in the winter he will maybe transfer it to android and because the most chargers use the same modbus in case of success there needs not much adaption...

i have not to run and think next year i will have a reasononable integration.


RE: My first Live demo of a Wifi solar- and battery monitor in OpenPlotter - shark24 - 2017-08-19

(2017-08-16, 11:41 PM)tocan Wrote: Did not see that you did make better ones. And like the translations i did make a start. Better than just to consume.
Sorry my specialty aren't chauvinistic, blurry, jittery videos of me telling my wife how to do things right...
The idea of letting a robot translate an online documentation to 120 languages, when everyone can just use google translate was a start right...
I'm not just consuming but helping people in areas in which I have certain skills...


RE: My first Live demo of a Wifi solar- and battery monitor in OpenPlotter - tocan - 2017-08-19

(2017-08-19, 07:55 AM)shark24 Wrote: I'm not just consuming but helping people in areas in which I have certain skills...
Everyone have its skills. So maybee you can tell me if there is ngingx installed and the influxdb with grafana how to use them. Grafana-Server need port 3000 and this is jused by Signal K also. does make it sense to change the port of Signal K and how i do change this port.

I would not go for the first easy step to put it in the cloud on a dedicated server. For the moment i do it that way i start the pi and than grafana blocks me signal k service and all inside the openplotter administration. if i stop grafana server than signal k and raspberry pi is available.

There is some idea to solve my river chart problem maybe with a tile server https://www.nebel.de/de/content/daten-auf-der-eigenen-landkarte
Nginx need not so much resources

here i did founf also the grafana solution
https://www.nebel.de/de/content/der-eigene-iot-cloud-server
Here did find the grafana demo and be impressed about the flexability
https://www.nebel.de/grafana/dashboard/db/dwalin-sense-hat

Any ideas for installation files (change port 3000 from signal k away is possible?