![]() |
Forum Index : Microcontroller and PC projects : VS6048 Solar CC Wifi Monitoring System
![]() ![]() |
|||||
Author | Message | ||||
azhaque Senior Member ![]() Joined: 21/02/2017 Location: PakistanPosts: 131 |
|
||||
palcal![]() Guru ![]() Joined: 12/10/2011 Location: AustraliaPosts: 1993 |
Take it from me Mik it won't be long before you wonder where you ever got the time to go to work. I've been retired 8 years and always have something to do. Paul. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
I got married after I/we retired. No time to before retirement. It filled in a bit of time. That was 12 years ago. Still retired and still married. Jim VK7JH MMedit |
||||
Paul_L Guru ![]() Joined: 03/03/2016 Location: United StatesPosts: 769 |
You guys are a bunch of amateurs. I've been retired for 27 years now. It took a little adjusting for a few months but that was because it happened suddenly when Pan Am went bankrupt. It gets easier as time goes by. Batteries, of any kind, are not efficient energy storage gadgets. They waste a lot of power by getting hot, both on charge and discharge. Pumped storage is much more efficient. All you need is a mountain and a valley. They're thinking about it in Tasmania, https://www.renewableenergyworld.com/articles/2018/08/hydro-tasmania-eyes-pumped-hydro-to-shore-up-renewables.html and for the Hoover Dam. https://www.sfgate.com/business/article/3-billion-plan-Hoover-Dam-giant-battery-Garcetti-13112087.php#photo-14251193 The US has 10 pumped storage plants each over 1 GW with a total capacity of 14.764 GW. https://en.wikipedia.org/wiki/List_of_pumped-storage_hydroelectric_power_stations But, if you don't have a mountain nearby that nobody's using it is a little impractical. Paul in NY |
||||
azhaque Senior Member ![]() Joined: 21/02/2017 Location: PakistanPosts: 131 |
Hello everyone, Progress to report, of the last 2-3 days. Got the ESP8266 to run a webserver displaying dummy data, on my home network. This Network runs on an old Linksys router (pic below). ![]() The Arduino/ESP8266 code is given below #include <ESP8266WiFi.h> #include <WiFiClient.h> #include <ESP8266WebServer.h> // Replace with your network credentials const char* ssid = "TeenZaitoon"; const char* password = "OliveGrove2018"; ESP8266WebServer server(80); //instantiate server at port 80 (http port) String page = ""; double Adata; double data48A; double data48B; void setup(void){ pinMode(A0, INPUT); delay(100); Serial.begin(115200); WiFi.begin(ssid, password); //begin WiFi connection Serial.println(""); // Wait for connection while (WiFi.status() != WL_CONNECTED) { delay(50); Serial.print("."); } Serial.println(""); Serial.print("Connected to "); Serial.println(ssid); Serial.print("IP address: "); Serial.println(WiFi.localIP()); server.on("/", [](){ page = "<h1>Olive-Grove Solar Power Stats</h1><h3>Analogue: "+String(Adata)+"</h3><h4>ChargeCont-A: "+String(data48A)+"</h4><h5>ChargeCont-B: "+String(data48B)+"</h5>"; server.send(200, "text/html", page); }); server.begin(); } void loop(void){ Adata = analogRead(A0)-5; data48A += 3; data48B += 7; delay(150); server.handleClient(); } ar Power Stats</h1><h3>Analogue: "+String(Adata)+"</h3><h4>ChargeCont-A: "+String(data48A)+"</h4><h5>ChargeCont-B: "+String(data48B)+"</h5>"; server.send(200, "text/html", page); }); server.begin(); } void loop(void){ Adata = analogRead(A0); data48A += 3; data48B += 7; delay(150); server.handleClient(); } Picture of the data on my Chrome browser ![]() Perusal of the Code would show that the output is essentially dummy data. This would be substituted by the actual data from the MODBUS outputs of the Charge Controllers. The photo below shows the simulated output voltage (0- 5 VDC) from the ACS758 that will indicate battery current, both charging and discharging. ![]() Next step is to test out the MODBUS system and write its software. Regards all round. azhaque |
||||
azhaque Senior Member ![]() Joined: 21/02/2017 Location: PakistanPosts: 131 |
Hi there, Further progress to report. Got the SoftwareSerial library system for ESP8266 up and running. This Library allows one to emulate an extra UART on the 8266. I need the extra UART to connect to the channel for the second CC. O/P video on Youtube. https://www.youtube.com/watch?v=xfXNs84Q56I azhaque |
||||
azhaque Senior Member ![]() Joined: 21/02/2017 Location: PakistanPosts: 131 |
Progress slow due to time constraints. Had to mount Arduino mega board with the 8266 veroboard. This is because I can't risk connecting the prototype to the CC for the fear that the CC maybe damaged during testing plunging the home into darkness. Now Arduino would run the modbus slave sketch for testing. Last week spent on making a new mounting. Pic below azhaque |
||||
azhaque Senior Member ![]() Joined: 21/02/2017 Location: PakistanPosts: 131 |
Sorry all for the delay in posting an update. I now have the circuit working which collects VS6048 Charge Controller data via MODBUS. The microcontroller is an ESP8266-12E used in a NodeMCU development board. Youtube video attached here Next step is to put the data on the home network using the built in wifi in the ESP. Regards azhaque |
||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3378 |
Nice. Is that an RS-485 module on the right of your perfboard, connecting to the charge controller using the green ethernet cable (stripped at the perfboard end? Or perhaps as you suggest, a MODBUS module (or are they the same?). PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
azhaque Senior Member ![]() Joined: 21/02/2017 Location: PakistanPosts: 131 |
Or perhaps as you suggest, a MODBUS module (or are they the same?). Hi Lizby, You guessed it right. That is indeed the MODBUS module using a MAX485 IC. Very cheap of low quality but works for me. This is a link to similar units on Amazon. I also attach the datasheet/writeup about the innards of the VS6048 CC, very graciously shared by EPEVER/EPSOLAR. Should be useful for those who would like to continue on this line of work. Regards azhaque 2018-11-07_121825_BSeriesControllerProtocolv2.4.zip |
||||
azhaque Senior Member ![]() Joined: 21/02/2017 Location: PakistanPosts: 131 |
Greetings all, Update pls. Got the software up and running. Data from the Epsolar VS6048BN charge controller using MODBUS protocol is fed to the ESP8266. The ESP payloads it on a wifi system feeding into the home network. The pic below shows the ESP circuit sitting on the stairs on a make shift arrangement, just outside the garage door. Initially tried it inside the garage but the system doesn't work because garage door is steel and grounds the wifi radio signal. The green cable is from the charge controller carrying the MODBUS data. It is over 3 meters long and there seems to be no issue in data transmission. ![]() The image below is the Router sitting inside the lounge. The signal is easily received in all the rooms, including the basement. ![]() A short Video about the live data on screen on the laptop. Now to clean up/improve the ESP code and make proper weatherproof housing for the ESP for placement outside the garage, in the open. Regards |
||||
akashh Senior Member ![]() Joined: 19/01/2014 Location: IndiaPosts: 115 |
Hi, Looks good. It reminds me of how I started Wattmon almost six years ago. I had worked with the same current sensor but opted for a Hall effect sensor that didn't require a physical wired connection after having some trouble with solder joints and just the general inconvenience of having to disconnect the cables every time it required a fix. As for SoC I use the coulomb counting method which is not terribly accurate but usually gives a decent indication of charge, and can be further improved by setting the Peukert constant. Please do not view this as an advertisement for the Wattmon but rather as an alternative to developing the system from scratch if it gets too much. If you wish to know more you can PM me or check out the website at www.wattmon.com All the best Akash |
||||
azhaque Senior Member ![]() Joined: 21/02/2017 Location: PakistanPosts: 131 |
Akashh, Namastay from Islamabad. The wattmon is a real wow. However my system is a piddly copy of the wattmon. Keep up the good work. Aurangzeb Haque |
||||
azhaque Senior Member ![]() Joined: 21/02/2017 Location: PakistanPosts: 131 |
Hi everyone, Seasons greetings. The project is moving on albeit at a slow speed. Since my last post I have been able to improve the software further and put the data on THINGSPEAK, which maybe seen here. The initial design was based on the ESP8266 running a web-server. The problem was that the server would run for two to three hours and then crash. After a power recycle it would start again but crash a couple of hours later. Research showed that it is caused by a problem in the software libraries, called 'memory leak'. Any way I have changed tack and rehashed the firmware to run the ESP in STATION mode. Now the ESP; a. Collects the data from the VS6048 Charge Controller on MODBUS; b. Processes it and hands the data over wifi to my modem/router (photo below) c. The modem sends it thru the local mobile internet facility (called ZONG - a Chinese company ![]() Next step is to modify the software to pick up the data from the second EPSolar VS6048 Charge Controller, also connected to the battery. The data would be consolidated and then sent over to the IOT Thingspeak for display. I have also begun making a PCB for it on EASY-EDA. Hopefully I should get it finalized in the next week or so. #include <ESP8266WiFi.h> #include <WiFiClient.h> #include <ESP8266WebServer.h> #include <ModbusMaster.h> // Zong Wifi Credentials const char *ssid = "ZONG MBB-E5573-E9A6"; const char *password = "************"; /* Thingspeak keys 1. Write Key : *************** 2. Read Key : **************** */ const char *host = "api.thingspeak.com"; String apiKey = "**************"; //ENTER YOUR API KEY <<<<<<<<<<< #define MAX485_DE D2 #define MAX485_RE D1 #define PANEL_VOLTS 0x00 #define PANEL_AMPS 0x01 #define PANEL_POWER_L 0x02 #define PANEL_POWER_H 0x03 #define BATT_VOLTS 0x04 #define BATT_AMPS 0x05 #define BATT_POWER_L 0x06 #define BATT_POWER_H 0x07 #define LOAD_VOLTS 0x0C #define LOAD_AMPS 0x0D #define LOAD_POWER_L 0x0E #define LOAD_POWER_H 0x0F #define BATT_TEMP 0x10 #define DEV_TEMP 0x11 #define BATT_SOC 0x12 #define TODAY_ENERGY_L 0x00 #define TODAY_ENERGY_H 0x01 #define MONTH_ENERGY_L 0x02 #define MONTH_ENERGY_H 0x03 #define YEAR_ENERGY_L 0x04 #define YEAR_ENERGY_H 0x05 int deviceID = 1; float PV_VData; String PV_VDataS; float PV_IData; String PV_IDataS; float PV_PData; String PV_PDataS; float Batt_VData; String Batt_VDataS; float Batt_IData; String Batt_IDataS; float Batt_PData; String Batt_PDataS; float Load_VData; String Load_VDataS; float Load_IData; String Load_IDataS; float Load_PData; String Load_PDataS; float Energy_TData; String Enery_TDataS; float Energy_MData; String Energy_MDataS; float Energy_YData; String Energy_YDataS; float BattTemp; int BattSOC; float CCTemp; int Caunter=10; // instantiate ModbusMaster object ModbusMaster node; void setup() { Serial.begin(115200); while (!Serial) { ; } pinMode(MAX485_RE, OUTPUT); pinMode(MAX485_DE, OUTPUT); // Init in receive mode digitalWrite(MAX485_RE, 0); digitalWrite(MAX485_DE, 0); node.begin(1, Serial); //deviceID = 1 selects the first Charge Controller. // Callbacks node.preTransmission(preTransmission); node.postTransmission(postTransmission); WiFi.mode(WIFI_STA); // Setup as Station WiFi.begin(ssid, password); //Connect to your WiFi router //Serial.println(""); //Serial.print("Connecting"); // Wait for connection while (WiFi.status() != WL_CONNECTED) { delay(100); //Serial.print("."); } } //======================================================================= // Main Program Loop //======================================================================= void loop() { WiFiClient client; const int httpPort = 80; //Port 80 is commonly used for www //--------------------------------------------------------------------- //Connect to host, host(web site) is define at top if(!client.connect(host, httpPort)){ //Serial.println("Connection Failed"); delay(300); return; //Keep retrying until we get connected } ///////MODBUS - STARTS HERE////////// uint8_t result; /////////////// Read 19 registers starting at 0x3100//////// node.clearResponseBuffer(); result = node.readInputRegisters(0x3100, 15); if (result == node.ku8MBSuccess) { PV_VData = node.getResponseBuffer(PANEL_VOLTS)/100.0f; PV_IData = node.getResponseBuffer(PANEL_AMPS)/100.0f; PV_PData = (((node.getResponseBuffer(PANEL_POWER_H)*65536) + (node.getResponseBuffer(PANEL_POWER_L)))/100.0f); Batt_VData = node.getResponseBuffer(BATT_VOLTS)/100.0f; Batt_IData = node.getResponseBuffer(BATT_AMPS)/100.0f; Batt_PData = (((node.getResponseBuffer(BATT_POWER_H)*65536) + (node.getResponseBuffer(BATT_POWER_L)))/100.0f); Load_VData = node.getResponseBuffer(LOAD_VOLTS)/100.0f; Load_IData = node.getResponseBuffer(LOAD_AMPS)/100.0f; Load_PData = (((node.getResponseBuffer(LOAD_POWER_H)*65536) + (node.getResponseBuffer(LOAD_POWER_L)))/100.0f); BattTemp = node.getResponseBuffer(BATT_TEMP)/100.0f; CCTemp = node.getResponseBuffer(DEV_TEMP)/100.0f; BattSOC = node.getResponseBuffer(BATT_SOC); /////////////// END Read 19 registers starting at 0x3100 //////// } else { Serial.print("Miss read, ret val:"); Serial.println(result, HEX); } /////////////// Read 6 registers starting at 0x330C//////// node.clearResponseBuffer(); result = node.readInputRegisters(0x330C, 6); if (result == node.ku8MBSuccess) { Energy_TData = (((node.getResponseBuffer(TODAY_ENERGY_H)*65536) + (node.getResponseBuffer(TODAY_ENERGY_L)))/100.0f); Energy_MData = (((node.getResponseBuffer(MONTH_ENERGY_H)*65536) + (node.getResponseBuffer(MONTH_ENERGY_L)))/100.0f); Energy_YData = (((node.getResponseBuffer(YEAR_ENERGY_H)*65536) + (node.getResponseBuffer(YEAR_ENERGY_L)))/100.0f); } else { Serial.print("Miss read, ret val:"); Serial.println(result, HEX); } ///////MODBUS-ENDS HERE////////// /*/--------------------------------------------------------------------- StringPVData[0] = String(PVData[0],1); StringPVData[1] = String(PVData[1],1); StringPVData[2] = String(PVData[2],1); StringPVData[3] = String(PVData[3],1); StringBattData[0]= String(BattData[0],1); StringBattData[1]= String(BattData[1],1); StringBattData[2]= String(BattData[2],1); StringBattData[3]= String(BattData[3],1); StringLoadData[0]= String(LoadData[0],1); StringLoadData[1]= String(LoadData[1],1); StringEnergyData[0]= String(EnergyData[0],1); StringEnergyData[1]= String(EnergyData[1],1); StringEnergyData[2]= String(EnergyData[2],1); */ //Make GET request as pet HTTP GET Protocol format String ADCData; float adcvalue = analogRead(A0); //Read Analog value of LDR ADCData = String(adcvalue); //String to interger conversion //String Link="GET /update?api_key="+apiKey+"&field1="+ADCData+"&field2="+Rand+"&field3="+R2;""; //Requeste webpage String Link ="GET /update?api_key="+apiKey+"&field1="+String(PV_VData)+"&field2="+String(PV_IData)+"&field3="+String(Batt_VData)+"&field4= "+String(Batt_IData);""; Link = Link + " HTTP/1.1\r\n" + "Host: " + host + "\r\n" + "Connection: close\r\n\r\n"; client.print(Link); delay(100); //--------------------------------------------------------------------- //Wait for server to respond with timeout of 5 Seconds int timeout=0; while((!client.available()) && (timeout < 1000)) //Wait 5 seconds for data { delay(10); //Use this with time out timeout++; } //--------------------------------------------------------------------- //If data is available before time out read it. if(timeout < 500) { while(client.available()){ Serial.println(client.readString()); //Response from ThingSpeak } } else { Serial.println("Request timeout.."); } delay(30000); //Read Web Page every 5 seconds } void preTransmission() { digitalWrite(MAX485_RE, 1); digitalWrite(MAX485_DE, 1); } void postTransmission() { digitalWrite(MAX485_RE, 0); digitalWrite(MAX485_DE, 0); } The pdf file for the circuit schematic is also attached.2018-11-19_144017_Schematic_NodeMCU-based-EPSOLAR-VS6048-Charge-Controller-Monitoring-Project_Sheet-1_20181119093050.pdf Regards all round and seasons greetings. azhaque |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 4044 |
Please describe the memory leak in detail. (E.g. what caused it? Your bug or whose? How do you avoid it?) John |
||||
![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |