Continuing the discussion from Eastron Energy SDM220 Meter - EmonTX Direct Pulse Counting?:
I saw that too and was rather interested. I’m waiting on the 2 relay ESP board from Martin to be ready
Continuing the discussion from Eastron Energy SDM220 Meter - EmonTX Direct Pulse Counting?:
I saw that too and was rather interested. I’m waiting on the 2 relay ESP board from Martin to be ready
If we are going to collate info, then I would reference also the previous SDM630 thread:
https://openenergymonitor.org/emon/node/5743
This also caught my eye reading RS485 from inverter:
http://www.esp8266.com/viewtopic.php?p=19707
It seems a path well trodden anyway, I am still waiting for my RS485<->USB from China and although I have the SDM mounted in the new consumer unit for my garage, I have still not finished running the cable so the electrician can come connect it all up and sign it off - so no testing yet.
I was going to order a esp01 to test with but not got around to it yet, lets hope someone comes along with some EmonESP details soon… happy to buy some hardware and alpha test
@TrystanLea is working on a emonesp for heatpump monitoring. Details here:
GitHub - TrystanLea/EmonESP: ESP8266 WIFI serial to emoncms link
Thanks Glyn… wonder why GitHub did not find “EmonESP” last night, will take a look, and order a board up for some experimentation
EDIT: Oh GIT is only 3 hours old that will be why
yes the idea here is to create a simple ESP8266 based serial to emoncms.org cloud link, to be used as part of the heatpump monitor here https://heatpumpmonitor.org/ but also possibly an adaptation of the emontx in time.
I had initially used Martin’s code here GitHub - openenergymonitor/ESP8266_Relay_Board: 1CH MQTT WiFi Relay/Thermostat Board but the licence did not really make it possible to build it further, I also got a bit stuck trying to modify esp-link to add a emoncms broadcaster GitHub - jeelabs/esp-link: esp8266 wifi-serial bridge, outbound TCP, and arduino/AVR/LPC/NXP programmer which could be a really nice solution… I then found Chris Howell’s OpenEVSE work GitHub - chris1howell/OpenEVSE_RAPI_WiFi_ESP8266: RAPI client/Server for ESP8266 WiFi Module which sends data from an EVSE charging station to emoncms!
My current solution builds on Chris Howell’s work with an extended single page interface, wifi network selection and the ability to switch into Access Point + Client mode so that its possible to get the IP address of the unit on the WIFI network it connects too. It also displays the latest values sent over serial from the attached Atmega.
The code is up here and installation/upload notes:
The next step is to test and establish the reliability of this, I’ve had mixed results so far with some of the prototype heatpump monitors loosing wifi connection and requiring a reset.
Thanks for the additional details Trystan
I have two ESP-12E boards inbound from China so I am going to have a play with this, my intention is to try and get the SDM220 to log back to emoncms with the ESP (need to wrap head around RS485 conversion first).
Longer term I also want to get a variable-rate EVSE going like the OpenEVSE one.
Once I get it in test will let you know what the WiFi performance is like… I read the antenna on the board is good but I wonder if your issue could be related to strong local signals on the same channel?
Chris Howell from OpenEVSE who’s work EmonESP is based on just added HTTPS support and over the air update to this see: Added Authentication by chris1howell · Pull Request #1 · TrystanLea/EmonESP · GitHub
Trystan,
Took a quick look at the code and one reason that you may be losing the wifi connection is that it seems as though you only switch from from AP+STA to just STA if you click on a button once you are in client-view mode in the html.
I have found that if you don’t specifically set STA mode for wifi once you are up and running then wifi can be a bit flaky, so it may be a good idea to change the logic so that once you’re in client-view mode you can click a button to turn AP mode back on rather than having a button to turn it off and therefore being in AP+STA mode whilst you are running.
It was a quick look, so please correct me if I missed something in the code and html.
Simon
Here is an adaptation for emontx using a similar method to OpenEVSE.
And the serial processing and URL creation for the ESP8266.
if (wifi_mode == 0 && privateKey != 0){
if ((millis() - Timer) >= 30000){
Timer = millis();
Serial.flush();
Serial.println("$GP \r");
delay(100);
while(Serial.available()) {
String apiString = Serial.readStringUntil('\r');
if ( apiString.startsWith("$OK ") ) {
String qapi;
qapi = apiString.substring(apiString.indexOf(' '));
ct1 = qapi.toInt();
String qapi1;
int firstapiCmd = apiString.indexOf(' ');
qapi1 = apiString.substring(apiString.indexOf(' ', firstapiCmd + 1 ));
ct2 = qapi1.toInt();
String qapi2;
qapi2 = apiString.substring(apiString.lastIndexOf(' '));
ct3 = qapi2.toInt();
}
}
delay(100);
Serial.flush();
Serial.print("$GV \r");
delay(100);
while(Serial.available()) {
String apiString = Serial.readStringUntil('\r');
Serial.print(apiString);
if ( apiString.startsWith("$OK") ) {
String qapi;
qapi = apiString.substring(apiString.indexOf(' '));
volt = qapi.toInt();
}
}
delay(100);
Serial.flush();
Serial.print("$GT \r");
delay(100);
while(Serial.available()) {
String apiString = Serial.readStringUntil('\r');
Serial.print(apiString);
if (apiString.startsWith("$OK") ) {
String qapi;
qapi = apiString.substring(apiString.indexOf(' '));
temp1 = qapi.toInt();
String qapi1;
int firstapiCmd = apiString.indexOf(' ');
qapi1 = apiString.substring(apiString.indexOf(' ', firstapiCmd + 1 ));
temp2 = qapi1.toInt();
String qapi2;
qapi2 = apiString.substring(apiString.lastIndexOf(' '));
temp3 = qapi2.toInt();
}
}
// Use WiFiClient class to create TCP connections
WiFiClient client;
const int httpPort = 80;
if (!client.connect(host, httpPort)) {
return;
}
// We now create a URL for Emoncms api data upload request
String url = e_url;
String url_ct1 = inputID_CT1;
url_ct1 += ct1;
url_ct1 += ",";
String url_ct2 = inputID_CT2;
url_ct2 += ct2;
url_ct2 += ",";
String url_ct3 = inputID_CT3;
url_ct3 += ct3;
url_ct3 += ",";
String url_volt = inputID_VOLT;
url_volt += volt;
url_volt += ",";
String url_temp1 = inputID_TEMP1;
url_temp1 += temp1;
url_temp1 += ",";
String url_temp2 = inputID_TEMP2;
url_temp2 += temp2;
url_temp2 += ",";
String url_temp3 = inputID_TEMP3;
url_temp3 += temp3;
url += node;
url += "&json={";
url += url_ct1;
url += url_ct2;
url += url_ct3;
url += url_volt;
url += url_temp1;
url += url_temp2;
url += url_temp3;
url += "}&apikey=";
url += privateKey.c_str();
// This will send the request to the server
client.print(String("GET ") + url + " HTTP/1.1\r\n" + "Host: " + host + "\r\n" + "Connection: close\r\n\r\n");
delay(10);
while(client.available()){
String line = client.readStringUntil('\r');
}
}
Thanks @Bramco it should only go into STA + AP on initial config, it’s to aid the config process so that you can easily find the ip address. After that on any reboot it will go to STA only.
@chris1howell great thanks! and again for your work on this in general!
It is my pleasure to give back, from one Open Source Hardware/Software project to another…
I think my next project will be a application specific dashboard “MyElectricVehicle”. Any tips? I guess I should start by learning HTML, JavaScript and PHP.
Great! The best place to start is probably by modifying the myelectric dashboard. Happy to help answer any questions on it. What do you have in mind to show on the dashboard?
I just loaded the App module on my backup/development virtual server and started looking at MyElectric and MySolar.
I want to display the normal power Graph, temperature, and kwh usage. I will start messing around and keep you updated…
I have been thinking about the same thing - what are you thinking @chris1howell have another colour to overlay on the graph for the EVSE charging?
I was pondering if it works best to start with mysolar or not - really you want to know how much of the charging is from onsite generation via the graph if possible.
Don’t have a separate feed/input yet for the car charging… so not really got very far other than pondering the options…
Hello.
I have NodeMCU, RS485 converter and 3 phase energy meter with Modbus - (sdm530-modbus)
Where can I find working program for micro controller? I only can write simple code for Arduino so programming Modbus is too difficult for me…