daniel-jong / esp8266_p1meter

DSMR5 P1 meter to mqtt using esp8266
GNU General Public License v3.0
144 stars 54 forks source link

Not working on Iskra AM550 - any progress? #9

Open AdmiralStipe opened 2 years ago

AdmiralStipe commented 2 years ago

Hi, Daniel, I also tried it on Iskra AM550, but I only got some garbage data via serial port (looks like "⸮⸮ ⸮ ⸮ ⸮ ⸮⸮⸮ ⸮ ⸮ ⸮⸮⸮ ⸮ ⸮⸮ ⸮ ⸮ ⸮⸮⸮ ⸮ ⸮ ⸮⸮"). In general it's working (all status messages are OK including MQTT status report), it's seems just unable to interpret the data that it receives. I've read that you had troubles running it with AM550 too - did you come to any useful solution?

Addition - serial port log: Swapping UART0 RX to inverted Serial port is ready to recieve. read_eeprom()read_eeprom()read_eeprom()read_eeprom()read_eeprom()*WM: [3] allocating params bytes: 20 *WM: [2] Added Parameter: host *WM: [2] Added Parameter: port *WM: [2] Added Parameter: user *WM: [2] Added Parameter: pass *WM: [1] AutoConnect *WM: [2] Connecting as wifi client... *WM: [3] STA static IP: *WM: [2] setSTAConfig static ip not set, skipping *WM: [1] Connecting to SAVED AP: MYNETWORKNAME *WM: [3] Using Password: MYPASSWORD *WM: [3] WiFi station enable *WM: [3] enableSTA PERSISTENT ON *WM: [1] connectTimeout not set, ESP waitForConnectResult... *WM: [2] Connection result: WL_CONNECTED *WM: [3] lastconxresult: WL_CONNECTED *WM: [1] AutoConnect: SUCCESS *WM: [1] STA IP Address: 192.168.1.98 Connected to WIFI... Arduino OTA activated. Arduino OTA finished Starting MDNS responder service MQTT connecting to: 192.168.1.100:1883 *WM: [3] freeing allocated params! *WM: [3] unloading MQTT connection attempt 1 / 10 ... MQTT connected! MQTT root topic: home/power/p1meter

Abdelmounaim18 commented 2 years ago

Hi @daniel-jong, I have the exact same issue as @AdmiralStipe. Everything is hooked up right, flash was succesfull and then nothing. This is the only thing i am seeing in the serial monitor:

Swapping UART0 RX to inverted Serial port is ready to recieve. read_eeprom()read_eeprom()read_eeprom()read_eeprom()read_eeprom()WM: [3] allocating params bytes: 20 WM: [2] Added Parameter: host WM: [2] Added Parameter: port WM: [2] Added Parameter: user WM: [2] Added Parameter: pass WM: [1] AutoConnect WM: [2] Connecting as wifi client... WM: [3] STA static IP: WM: [2] setSTAConfig static ip not set, skipping WM: [1] Connecting to SAVED AP: xxxxxxxx WM: [3] Using Password: xxxxxxxxx WM: [3] WiFi station enable WM: [3] enableSTA PERSISTENT ON WM: [1] connectTimeout not set, ESP waitForConnectResult... WM: [2] Connection result: WL_CONNECTED WM: [3] lastconxresult: WL_CONNECTED WM: [1] AutoConnect: SUCCESS WM: [1] STA IP Address: 192.168.xxx.xxx Connected to WIFI... Arduino OTA activated. Arduino OTA finished Starting MDNS responder service MQTT connecting to: 192.168.xxx.xxx:xxxx WM: [3] freeing allocated params! WM: [3] unloading MQTT connection attempt 1 / 10 ... MQTT connected! MQTT root topic: sensors/power/p1meter

Hope there is some sort of fix for this 😞

spoetnik commented 2 years ago

Hi @daniel-jong, I have the exact same issue as @AdmiralStipe. Everything is hooked up right, flash was succesfull and then nothing. This is the only thing i am seeing in the serial monitor:

Swapping UART0 RX to inverted Serial port is ready to recieve. read_eeprom()read_eeprom()read_eeprom()read_eeprom()read_eeprom()WM: [3] allocating params bytes: 20 WM: [2] Added Parameter: host WM: [2] Added Parameter: port WM: [2] Added Parameter: user WM: [2] Added Parameter: pass WM: [1] AutoConnect WM: [2] Connecting as wifi client... WM: [3] STA static IP: WM: [2] setSTAConfig static ip not set, skipping WM: [1] Connecting to SAVED AP: xxxxxxxx WM: [3] Using Password: xxxxxxxxx WM: [3] WiFi station enable WM: [3] enableSTA PERSISTENT ON WM: [1] connectTimeout not set, ESP waitForConnectResult... WM: [2] Connection result: WL_CONNECTED WM: [3] lastconxresult: WL_CONNECTED WM: [1] AutoConnect: SUCCESS WM: [1] STA IP Address: 192.168.xxx.xxx Connected to WIFI... Arduino OTA activated. Arduino OTA finished Starting MDNS responder service MQTT connecting to: 192.168.xxx.xxx:xxxx WM: [3] freeing allocated params! WM: [3] unloading MQTT connection attempt 1 / 10 ... MQTT connected! MQTT root topic: sensors/power/p1meter

Hope there is some sort of fix for this 😞

Have you read the instruction about adding a 10K resistor between the second and fifth wire? Thats to activate the P1 port.

daniel-jong commented 2 years ago

Hey all, Sorry for the slow response, other stuff got a bit ahead of me there. I'm writing this in all hopes that you have since figured out what was wrong and have been able to create a working reader for you meter. But if you have not, or if someone else is reading this this might help.

First of, yes i have been able to get this project to work reliably on my AM550 back in June. But either the Iskra meter or my own soldering skills have fought me for every step!

I consider these struggles as mostly related to hardware issues (me being a software kinda guy, this is a de-facto). The things I have struggled with in the past are:

My Issue was similar to what you are seeing, little to no data. After the MQTT root topic: sensors/power/p1meter line you should start seeing telegrams every few seconds. I could see data flowing from the AM550 with a cheap logic analyzer but as soon as I connected the ESP's RX pin everything went silent. In the end I think I have ended up shorting my ESP8266 and only had a ESP32 in my spare parts bin.

After checking with a small sketch I was able to receive serial data on the ESP32 board and rewritten this library to be able to compile on an ESP32 (found in the esp32 branch).

The wiring setup in the Readme.md will work for my AM550, but I have only tested it using the ESP32. Like spoetnik says, dont forget the 10k resistor! I have to be honest and say I don't consider it likely I'll get around to testing an ESP8266 with the AM550 any time soon. But I have heard of others AM550 users that it does work for them.

Do let me know if you have had any success in getting something to run

AdmiralStipe commented 2 years ago

Hey all, Sorry for the slow response, other stuff got a bit ahead of me there. I'm writing this in all hopes that you have since figured out what was wrong and have been able to create a working reader for you meter.

Unfortunately I haven't moved a single step forward. Not sure if the issue is in the code or in the meter (at the moment I'm even not sure, if the data from my meter is encrypted or not - my distributor claims, it's not, but the manufacturer claims, it is !?!?)

The things I have struggled with in the past are:

  • Being stubborn and not soldering pin headers to the ESP, a breadboard friction will not work when you need it.
  • I had some solder flux remaining on the board that might have caused a short. So always double check your soldering and cleanup!
  • Talking about that, also make sure to double check that you haven't reversed the RJ12 cables. I think you can check this by checking the polarity of the 5v supply on RJ12 pins 1 and 6.

Checked all these things (including the wiring and the 10k resistor) and they are all OK.

After checking with a small sketch I was able to receive serial data on the ESP32 board and rewritten this library to be able to compile on an ESP32 (found in the esp32 branch).

I wan't to give it a shot with ESP32 too, do you mind sharing the code and the library? I assume the wiring is the same.

Another question about your meter: how old is it? Mine is 2020 and it seems, that older AM550 (up to 2017) have no issues with reading the port, but the newer ones do - not sure why, maybe some change in the code or actual encrypting of the port at later models...

AdmiralStipe commented 2 years ago

OK, found out some new things from the manufacturer... newer AM550 are not using the "old school" ASCII communication protocol (based on IEC1107) anymore, but are using safer (and encrypted) DLMS/COSEM protocol instead. If I understand correctly, your code uses plain ASCII UART communication protocol and I would need the DLMS one dor my meter. So, that's most likely the main reason your code is not working for me.

cucko commented 2 years ago

I can confirm that it works on Iskra am550 from 2021 with esp8266 board. the device is reading and sending valid data to mqtt.

elngejw commented 1 year ago

SOLVED: I found out that on my PCB the signal was already inverted. Therefore I canceled out the bold marked line below in esp8266_p1meter.ino

// Invert the RX serialport by setting a register value, this way the TX might continue normally allowing the serial monitor to read println's //USC0(UART0) = USC0(UART0) | BIT(UCRXI);

yvansandoz commented 1 year ago

@AdmiralStipe Did you find a workaround for the DLMS/COSEM protocol?