Eastron SDM 630 Energy
Moderators: grovkillen, Stuntteam, TD-er
Re: Eastron SDM 630 Energy
When you switch the combobox in the task configuration for this Eastron task to another serial port, you also should see a Software Serial option.
When this is selected, a few more input fields will become visible allowing you to set a GPIO pin for RX and TX.
I meant the "Checksum (pass/fail)" as this shows at least that some data is being seen.
I'm not sure if the device will send out data without being asked for, so I'm a bit curious to what data the Eastron task is then claiming to receive.
So the fact you're seeing at least some "failed" messages, would suggest the meter is receiving some commands...
Or the ESP is receiving a lot of garbage from somewhere.
About the MAX485's ability to operate on 3V3...
Most MAX485 chips being sold are not the ones made specific for lower voltages. The 3V3 is then slightly below the lowest acceptable voltage. However the chip will probably work just fine on 3V3, but some might not be so tolerant.
Anyway, the 3V3 is below the specs mentioned in the datasheet.
When this is selected, a few more input fields will become visible allowing you to set a GPIO pin for RX and TX.
I meant the "Checksum (pass/fail)" as this shows at least that some data is being seen.
I'm not sure if the device will send out data without being asked for, so I'm a bit curious to what data the Eastron task is then claiming to receive.
So the fact you're seeing at least some "failed" messages, would suggest the meter is receiving some commands...
Or the ESP is receiving a lot of garbage from somewhere.
About the MAX485's ability to operate on 3V3...
Most MAX485 chips being sold are not the ones made specific for lower voltages. The 3V3 is then slightly below the lowest acceptable voltage. However the chip will probably work just fine on 3V3, but some might not be so tolerant.
Anyway, the 3V3 is below the specs mentioned in the datasheet.
Re: Eastron SDM 630 Energy
In the mean time you answered:
I tried to select D1 for RX and D2 for TX.. But even when I try with my keyboard, the cursor skips those choices.
Whats wrong that I cannot select the value I need? Sorry, I marked the wrong choice. Should be D1
About the MAX485's ability to operate on 3V3...
PostNL mailed me this afternoon that the new nodeMCU's will arrive tomorrow. I suppose they will have 5V on Vin.
I tried to select D1 for RX and D2 for TX.. But even when I try with my keyboard, the cursor skips those choices.
Whats wrong that I cannot select the value I need? Sorry, I marked the wrong choice. Should be D1
About the MAX485's ability to operate on 3V3...
PostNL mailed me this afternoon that the new nodeMCU's will arrive tomorrow. I suppose they will have 5V on Vin.
Re: Eastron SDM 630 Energy
Dear
I have tried the newer versions of the bin's. Non of them are working for mee. In wat version are we working?
I have tried the newer versions of the bin's. Non of them are working for mee. In wat version are we working?
Re: Eastron SDM 630 Energy
Those options with extra text behind them (like "SDA") are disabled when they are configured elsewhere.
As I mentioned, the GPIO-4 and -5 are by default configured for I2C as SDA/SCL and thus if you want to use them, you need to remove those GPIO configurations first from the I2C configuration on the Hardware tab.
Re: Eastron SDM 630 Energy
Ok. I changed to software serial.
Wiring:
DI (groen)-> RX -> D2
RO (wit) -> TX -> D1
This is the log:
I changed D2 en D1 in the software but same results.
Wiring:
DI (groen)-> RX -> D2
RO (wit) -> TX -> D1
This is the log:
Code: Select all
WiFiStatus 3 ESPeasy internal wifi status: Conn. IP Init
254840: EASTRON: (1,4) Voltage (V) Phase 1: nan
256374: EASTRON: (1,4) Voltage (V) Phase 2: nan
259561: EVENT: SDM630#Voltage_L1=nan
259564: EVENT: SDM630#Voltage_L2=nan
259566: EVENT: SDM630#Voltage_L3=nan
259568: EVENT: SDM630#Amperes_L1=nan
269840: EASTRON: (1,4) Voltage (V) Phase 1: nan
271374: EASTRON: (1,4) Voltage (V) Phase 2: nan
274559: EVENT: SDM630#Voltage_L1=nan
274562: EVENT: SDM630#Voltage_L2=nan
274565: EVENT: Clock#Time=Mon,19:35
274567: EVENT: SDM630#Voltage_L3=nan
274568: EVENT: SDM630#Amperes_L1=nan
274620: WD : Uptime 5 ConnectFailures 0 FreeMem 22128 WiFiStatus 3 ESPeasy internal wifi status: Conn. IP Init
" to clipboard!
Re: Eastron SDM 630 Energy
I have that one installed. But when i activate the task for the meter it chrashes. Even when the meter is not connected
Re: Eastron SDM 630 Energy
Tried the setup with the SW serial. Now it doesn't crash but the same result. Know measurements.
I was to happy too soon. Load went to 100% and the esp crashes
Re: Eastron SDM 630 Energy
OK, I guess something either is wrong with the plugin, or we're missing something small which is hard to diagnose remote like this.
I think I have to recreate a setup here.
Only thing is, I don't have the 630, but only the 220 (I think...)
I will try to make such a setup tomorrow.
N.B. I have also ordered a "scheidingstrafo" so I can work on mains voltage without risking damage to my PC or myself.
Hopefully that one will be delivered tomorrow.
I think I have to recreate a setup here.
Only thing is, I don't have the 630, but only the 220 (I think...)
I will try to make such a setup tomorrow.
N.B. I have also ordered a "scheidingstrafo" so I can work on mains voltage without risking damage to my PC or myself.
Hopefully that one will be delivered tomorrow.
Re: Eastron SDM 630 Energy
Sounds great! If I can test something, let me know.
At the moment my alternative to read the meter is a Python-script on a Pi 4, developed for the older version of the SDM630 and a 1F model SDM120. I changed the value of registers according to the documentation of the SDM630 from https://www.google.com/url?sa=t&rct=j&q ... i=89978449. That works quite ok.The real part starts at page 29..
But I am not satisfied about the way Domoticz displays the data. That's the reason to go for ESP Easy.
Tnx for all your effort, good luck and looking forward to your results.
mvg
Pieter
At the moment my alternative to read the meter is a Python-script on a Pi 4, developed for the older version of the SDM630 and a 1F model SDM120. I changed the value of registers according to the documentation of the SDM630 from https://www.google.com/url?sa=t&rct=j&q ... i=89978449. That works quite ok.The real part starts at page 29..
But I am not satisfied about the way Domoticz displays the data. That's the reason to go for ESP Easy.
Tnx for all your effort, good luck and looking forward to your results.
mvg
Pieter
Re: Eastron SDM 630 Energy
Bij mij werkt de SDM630 nu
bedankt TD-er voor je werk
bedankt TD-er voor je werk
Re: Eastron SDM 630 Energy
Well... if you have a moment
In the old code, the modbus call was made and the code was waiting for a reply.
This was done for all 4 registers needed per Eastron task and thus could take upto 2.5 seconds (!!) per call to PLUGIN_READ (run at "Interval" nr of seconds)
This was 'blocking' code, like nothing else could be done on the ESP during this.
Things would run behind schedule, buffers may fill up as they aren't dealt with and things may timeout.
So now I made this all asynchronous.
Every Eastron task will add its requested registers (+ modbus address) to a list and this list is queried 10x per second.
If you have your module set to 9600 baud, you can get an answer from the module in just under 100 msec, so essentially upto 10 registers per second can be read.
In every PLUGIN_TEN_PER_SECOND call this is being done:
- If not waiting: Send out request for register in the first entry of the list.
- else: See if answer is ready, if not, you're done for now.
- If there is an answer, pop the first entry from the list and push it to the back of the list.
- Send out request for register in the first entry of the list.
This way the call to PLUGIN_TEN_PER_SECOND only takes a few msec and thus does not block execution of the rest of the code.
When you need to change a setting on the module, this list handling must be stopped, so that's why you need to call "Eastron,pause" first.
The PLUGIN_READ (which does send out events and sends data to the controllers) just picks the last read registers of its task and sends them.
Since we do read the registers much more frequently, the logged peaks when using 'stats' is updated every time registers are being read. So the peak values may be values you have never seen in the data sent to the controllers.
In the old code, the modbus call was made and the code was waiting for a reply.
This was done for all 4 registers needed per Eastron task and thus could take upto 2.5 seconds (!!) per call to PLUGIN_READ (run at "Interval" nr of seconds)
This was 'blocking' code, like nothing else could be done on the ESP during this.
Things would run behind schedule, buffers may fill up as they aren't dealt with and things may timeout.
So now I made this all asynchronous.
Every Eastron task will add its requested registers (+ modbus address) to a list and this list is queried 10x per second.
If you have your module set to 9600 baud, you can get an answer from the module in just under 100 msec, so essentially upto 10 registers per second can be read.
In every PLUGIN_TEN_PER_SECOND call this is being done:
- If not waiting: Send out request for register in the first entry of the list.
- else: See if answer is ready, if not, you're done for now.
- If there is an answer, pop the first entry from the list and push it to the back of the list.
- Send out request for register in the first entry of the list.
This way the call to PLUGIN_TEN_PER_SECOND only takes a few msec and thus does not block execution of the rest of the code.
When you need to change a setting on the module, this list handling must be stopped, so that's why you need to call "Eastron,pause" first.
The PLUGIN_READ (which does send out events and sends data to the controllers) just picks the last read registers of its task and sends them.
Since we do read the registers much more frequently, the logged peaks when using 'stats' is updated every time registers are being read. So the peak values may be values you have never seen in the data sent to the controllers.
Re: Eastron SDM 630 Energy
Of course I have time! Thanks for all your time, effort and explanation.
This morning I read a bit about this problem. I tried to download your latest or best beta-version of the energy-plugin in https://github.com/letscontrolit/ESPEasy/issues/4745. And from your home-site.. But I was not sure about how to connect the wires between MAX485 to RS485 and the ESP8266.. So I guessed..
I made progress... Now I get a value. But too low. And checksum is bad.. My meter is up and connected to the MAX485.
This are my settings:
имг
имг
Oeps: In a screenshot I discover the wiring you used... I will give that a try!
I realise that maybe I am bit early to test. But I was hopefull because @Frank was happy with your solution.
Wondering what could be the cause. Maybe wrong wiring? Different version of the SDM630. I use a Modbus V3.
I hope you can me info where to load the right software and how to configure it.
This morning I read a bit about this problem. I tried to download your latest or best beta-version of the energy-plugin in https://github.com/letscontrolit/ESPEasy/issues/4745. And from your home-site.. But I was not sure about how to connect the wires between MAX485 to RS485 and the ESP8266.. So I guessed..
I made progress... Now I get a value. But too low. And checksum is bad.. My meter is up and connected to the MAX485.
This are my settings:
имг
имг
Oeps: In a screenshot I discover the wiring you used... I will give that a try!
I realise that maybe I am bit early to test. But I was hopefull because @Frank was happy with your solution.
Wondering what could be the cause. Maybe wrong wiring? Different version of the SDM630. I use a Modbus V3.
I hope you can me info where to load the right software and how to configure it.
Re: Eastron SDM 630 Energy
Have you looked at the documentation?
https://espeasy.readthedocs.io/en/lates ... #p078-page
Are both DE/RE pins connected to GPIO-12?
RX connected to RO?
TX connected to DI?
Is the baud rate correct? And Modbus address?
Did you disable "ESPEasy Serial Console" on the tools->Advanced page?
https://espeasy.readthedocs.io/en/lates ... #p078-page
Are both DE/RE pins connected to GPIO-12?
RX connected to RO?
TX connected to DI?
Is the baud rate correct? And Modbus address?
Did you disable "ESPEasy Serial Console" on the tools->Advanced page?
Re: Eastron SDM 630 Energy
Why did you think I did mention it so explicitly?
Happened to me also quite a few more times than I would dare to admit
Re: Eastron SDM 630 Energy
That's why there is a market for a "scheidingstrafo". For the better feeling.
Re: Eastron SDM 630 Energy
Yep, I have ordered this one a week ago: https://www.amazon.de/gp/product/B07JM5 ... UTF8&psc=1
Very very nice unit.
It even has a soft start, so you're not likely to trigger any leak current protection.
But I guess that will be less likely at 500VA, still nice to have feature.
Re: Eastron SDM 630 Energy
You have way too many read errors on the serial bus.
Have you tried to set it to SW Serial using the same GPIO pins as I also suggested in the other topic?
Have you tried to set it to SW Serial using the same GPIO pins as I also suggested in the other topic?
Re: Eastron SDM 630 Energy
Sorry Gijs, not yet. Too many steps together for me. I will try that in a while.
Yes: chesum (pass/fail) is bad..
And let you know it here. Of course.
Yes: chesum (pass/fail) is bad..
And let you know it here. Of course.
Re: Eastron SDM 630 Energy
Gijs,
You pointed out the bad checksum values to me. And asked to change the Serial Port to SW Serial.
I am not an expert. So I think about what and how to change. But maybe I forgot something or made a mistake. Sorry for that.
I Enabled Serial Port Console:
I changed every task:
This is the wiring:
This are the results..
You pointed out the bad checksum values to me. And asked to change the Serial Port to SW Serial.
I am not an expert. So I think about what and how to change. But maybe I forgot something or made a mistake. Sorry for that.
I Enabled Serial Port Console:
I changed every task:
This is the wiring:
This are the results..
Re: Eastron SDM 630 Energy
which version of espeasy are you using?
Re: Eastron SDM 630 Energy
1) Serial console should be disabled when using the port/pins for serial communication on a device/task. (Uncheck that checkbox, please)
2) No results visible here...?
/Ton (PayPal.me)
Re: Eastron SDM 630 Energy
Both builds are quite outdated, please get a more recent version, like the current mega branch build (today): https://github.com/letscontrolit/ESPEas ... 5850022962frank wrote: ↑14 Aug 2023, 20:49 i have this one and it works
https://github.com/letscontrolit/ESPEas ... 5728205521
/Ton (PayPal.me)
Re: Eastron SDM 630 Energy
OK, since you have the pins on the ESP quite accessible via screw terminals, can you try other pins (using SW serial, or else you can't change the pins)
Let's first disable all other tasks for Eastron, as you have at least on task 3 the RX and TX pins swapped in the config.
So first let's see how it will work with 1 task and if that's working, we should start looking at the other tasks.
Let's first disable all other tasks for Eastron, as you have at least on task 3 the RX and TX pins swapped in the config.
So first let's see how it will work with 1 task and if that's working, we should start looking at the other tasks.
Re: Eastron SDM 630 Energy
Thanks guys for all hints. I will pick this hobby up later in next weekend. Leaving for other hobby.
Let you know the results.
Let you know the results.
Re: Eastron SDM 630 Energy
I erased and flashed another ESP8266 with the latest firmware (20230820_energy) and configured only 1 task with SW Serial.TD-er wrote: ↑14 Aug 2023, 22:27 OK, since you have the pins on the ESP quite accessible via screw terminals, can you try other pins (using SW serial, or else you can't change the pins)
Let's first disable all other tasks for Eastron, as you have at least on task 3 the RX and TX pins swapped in the config.
So first let's see how it will work with 1 task and if that's working, we should start looking at the other tasks.
ESP RX D9 - wit - MAX485 TX (RO)
ESP TX D10 - groen - MAX485 RX (DI)
ESP D5 - geel - MAX485 RE/DE
I get no communication, no data.
So I went back to the HW-settings. It is better than nothing.
Re: Eastron SDM 630 Energy
Hmm that's really strange.
Is it possible the A/B might have been swapped between the MAX485 board and the Eastron?
Not sure if that will actually make a difference between SW/HW serial, but I really can't explain the issues you're seeing, so I start to make wild guesses.
Is it possible the A/B might have been swapped between the MAX485 board and the Eastron?
Not sure if that will actually make a difference between SW/HW serial, but I really can't explain the issues you're seeing, so I start to make wild guesses.
Re: Eastron SDM 630 Energy
I have 2 MCU's flashed with the same firmware:
One with HW serial config and one with SW serial config.
I swapped them on the screw-terminal board. I did not swap any wiring.
As all wiring is oke for HW serial, it should be correct for SW config.
As I was still thinking about the many errors/fails, I did a test earlier this afternoon: with the HW serial config board, I swapped the A/B wiring between the meter and the MAX485. That was clear right away: no data at all.Is it possible the A/B might have been swapped between the MAX485 board and the Eastron?
Not sure if that will actually make a difference between SW/HW serial, but I really can't explain the issues you're seeing, so I start to make wild guesses.
So if you really want me to do that test for the SW serial config version: just let me know.
Another wild guess:
Could interference from the "high voltage" cables be a reason for this bad behaviour? The A/B-wiring has no shielding.
Re: Eastron SDM 630 Energy
I don't expect, the high voltage lines may interfere here.
But when in doubt, you could try to twist the wires.
So the A and B wires twisted around each other.
RS485 is a differential signal, so any noise picked up on one line should have the opposite effect on the other wire and thus cancel out.
But twisting the wires should not make things worse.
And you can also connect the GND from the ESP to the GND pin of the Eastron (GND next to the A/B pins, just to be sure to not connect it to the mains earth pin)
But when in doubt, you could try to twist the wires.
So the A and B wires twisted around each other.
RS485 is a differential signal, so any noise picked up on one line should have the opposite effect on the other wire and thus cancel out.
But twisting the wires should not make things worse.
And you can also connect the GND from the ESP to the GND pin of the Eastron (GND next to the A/B pins, just to be sure to not connect it to the mains earth pin)
Re: Eastron SDM 630 Energy
Hi all, especially Gijs,
Yesterday I mounted the ESP and MAX485 TTL to RS485 on connectors to a circuitboard and build that in a case. All close to the meter. This afternoon I looked into ESPeasy and I was surprised that the readings of modbus were excellent!
I changed the negative values of current and power positive by the ABS()-function in a rule. I tested the new config by loading the EV and there was no delay in presenting values. The interface feels quick! So I am very happy with the results!
I want to thank Gijs (and other members) for all your effort to make this project a big succes!
Yesterday I mounted the ESP and MAX485 TTL to RS485 on connectors to a circuitboard and build that in a case. All close to the meter. This afternoon I looked into ESPeasy and I was surprised that the readings of modbus were excellent!
I changed the negative values of current and power positive by the ABS()-function in a rule. I tested the new config by loading the EV and there was no delay in presenting values. The interface feels quick! So I am very happy with the results!
I want to thank Gijs (and other members) for all your effort to make this project a big succes!
Re: Eastron SDM 630 Energy
Ah good to see it is finally working.
So I assume it was some kind of wire picking up noise?
Well we'll never know, but it is working now, so who cares
So I assume it was some kind of wire picking up noise?
Well we'll never know, but it is working now, so who cares
Re: Eastron SDM 630 Energy
This is working and that is great.
Does annyone has anny thoughts of how to get the info into Domoticz?
Does annyone has anny thoughts of how to get the info into Domoticz?
Re: Eastron SDM 630 Energy
On the ESPEasy side you can configure either a Domoticz HTTP Controller or Domoticz MQTT Controller (that also needs a MQTT broker at the Domoticz side, usually Mosquitto), but that sounds more like a Domoticz question, not an ESPEasy question?
The last screenshot above shows the Ctr (IDX) column, where Domoticz IDX values are configured for the Domoticz Virtual sensors, that receive the values from ESPEasy.
/Ton (PayPal.me)
Re: Eastron SDM 630 Energy
I get the info into domoticz. But making it workable in domoticz is a challange
Re: Eastron SDM 630 Energy
Ah, yes, you'll have to work with the scripting in Domoticz to do some fancy stuff, that can indeed be challenging
/Ton (PayPal.me)
Re: Eastron SDM 630 Energy
Correct en i hoped someone already made it
Re: Eastron SDM 630 Energy
You mean something like this?
To clearify why I use the abs(): that's because the meter is not feed in on top... So I got negative values.
Hope, this will help you forward? Otherwise, let me know!
Code: Select all
On SDM630_L1#All Do // Receives 4 arguments, 1st one is already sent to the controller, so can be ignored
Publish,domoticz/in,'{"command":"udevice","idx":2282,"nvalue":0,"svalue":"%eventvalue2%"}' // Current L1
Let,1,abs(%eventvalue3%)
Let,5,abs(%eventvalue4%)
// LogEntry, 'Abs of [%eventvalue3%] = [var#1]'
Publish,domoticz/in,'{"command":"udevice","idx":2286,"nvalue":0,"svalue":"[var#1]"}' //Power L1
Publish,domoticz/in,'{"command":"udevice","idx":2289,"nvalue":0,"svalue":"[var#5]"}' //Total Active Power
Endon
On SDM630_L2#All Do // Receives 4 arguments, 1st one is already sent to the controller, so can be ignored
Publish,domoticz/in,'{"command":"udevice","idx":2283,"nvalue":0,"svalue":"%eventvalue2%"}' // Current L2
Let,2,abs(%eventvalue3%)
Publish,domoticz/in,'{"command":"udevice","idx":2287,"nvalue":0,"svalue":"[var#2]"}' //Power L2//
Publish,domoticz/in,'{"command":"udevice","idx":2285,"nvalue":0,"svalue":"%eventvalue4%"}' //Total Amps van 3 fases
Endon
On SDM630_L3#All Do // Receives 4 arguments, 1st one is already sent to the controller, so can be ignored
Publish,domoticz/in,'{"command":"udevice","idx":2284,"nvalue":0,"svalue":"%eventvalue2%"}' // Current L3
Let,3,abs(%eventvalue3%)
Publish,domoticz/in,'{"command":"udevice","idx":2288,"nvalue":0,"svalue":"[var#3]"}' //Power L3
Let,4,abs([SDM630_L1#W])
Let,5,([SDM630_L3#kWh]*1000)
// Publish,domoticz/in,'{"command":"udevice","idx":76,"nvalue":0,"svalue":"[var#4];[SDM630_L3#kWh]"}' //Total Power;Total kW
Publish,domoticz/in,'{"command":"udevice","idx":2294,"nvalue":0,"svalue":"[var#5]"}' //Total Power;Total kW was IDX2290
Publish,domoticz/in,'{"command":"udevice","idx":2290,"nvalue":0,"svalue":"[var#4];[var#5]"}' //Total Power;Total kW was IDX2290
// Publish,domoticz/in,'{"command":"udevice","idx":2294,"nvalue":0,"svalue":"[SDM630_L3#kWh]"}' //Total Power;Total kW
Publish,domoticz/in,'{"command":"udevice","idx":2292,"nvalue":0,"svalue":"[SDM630_L3#kWh]"}' //Total Power;Total kW
Endon
Hope, this will help you forward? Otherwise, let me know!
Re: Eastron SDM 630 Energy
Shouldn't you multiply by -1 then, to just invert the value, in case current starts flowing in the other direction?
/Ton (PayPal.me)
Re: Eastron SDM 630 Energy
Both solutions do their job for me. Like several nice roads to Rome Through France for example
Re: Eastron SDM 630 Energy
Looks like that it is wat i am looking for.
To customize i have to change the following:
SDM630_L1
idx":2282,"
"%eventvalue2%"
Is this : domoticz/in to send it to mqtt in Domoticz?
To customize i have to change the following:
SDM630_L1
idx":2282,"
"%eventvalue2%"
Is this : domoticz/in to send it to mqtt in Domoticz?
Re: Eastron SDM 630 Energy
Yep the topic to publish to is "domoticz/in"
N.B. Make sure not to use a leading / in the topic.
Also you still need to have a MQTT controller configured as the publish command uses the same connection to the MQTT broker as setup by the MQTT controller.
N.B. Make sure not to use a leading / in the topic.
Also you still need to have a MQTT controller configured as the publish command uses the same connection to the MQTT broker as setup by the MQTT controller.
Re: Eastron SDM 630 Energy
thx for the help. I got it working now
Who is online
Users browsing this forum: No registered users and 1 guest