UtilitechAS / amsreader-firmware

ESP8266 and ESP32 compatible firmware to read, interpret and publish data to MQTT from smart electrical meters, both DLMS and DSMR is supported
Other
381 stars 73 forks source link

han connection issues #235

Closed knutmyr closed 2 years ago

knutmyr commented 2 years ago

Hi Struggling to get this to work. I have tried an esp32 and 8266 without any luck. I'm using this https://www.aliexpress.com/item/33009939864.html?spm=a2g0o.9042311.0.0.27424c4dLlBe5Z adapter. I connected TX from adapter to GPIO16. Debug log don't give me much to work with. While booting HAN is green, then yellow but stop and stay at red... I've tried most baud rate and port setting combinations. Suspect the uart board is not working, gonna order the one in wiki pages and hope that solves it. If not anybody has any good ideas?

knutmyr commented 2 years ago

(D) (loop)(C1) Used 0 ms to update temperature (D) (AmsWebServer)Serving /data.json over http... (D) (AmsWebServer)Serving /data.json over http... (D) (AmsWebServer)Serving /data.json over http... (D) (loop)(C1) Used 0 ms to update temperature (D) (AmsWebServer)Serving /data.json over http... (D) (AmsWebServer)Serving /data.json over http... (D) (AmsWebServer)Serving /data.json over http... (D) (loop)(C1) Used 0 ms to update temperature (D) (AmsWebServer)Serving /data.json over http... (D) (AmsWebServer)Serving /data.json over http... (D) (AmsWebServer)Serving /gpio.html over http... (D) (AmsWebServer)Handling save method from http (D) (AmsWebServer)Received GPIO config (I) (AmsWebServer)Saving configuration now... (I) (AmsWebServer)Successfully saved. (I) (setupHanPort) Setting up HAN on pin 16 with baud 2400 and parity 11 (D) (setupHanPort)(C1) Hardware serial (D) (AmsWebServer)Serving /index.html over http... (D) (AmsWebServer)Serving /data.json over http... (D) (AmsWebServer)Serving /dayplot.json over http... (D) (AmsWebServer)Serving /monthplot.json over http... (D) (loop)(C1) Used 0 ms to update temperature

tronde-ams commented 2 years ago

Do you have the big one or the small one?

Both seems to have optocoupler outputs. How do you connect your module to the ESP? Optocouplers are normally floating with regard to power supply, so it can be you must connect more than TX.

If possible, show a detailed picture of your adapter and your ESP. I am quite certain this is easy to fix, but we need to be sure about your hardware.

knutmyr commented 2 years ago

20220212_192811 20220212_192759 20220212_192503 20220212_192302 20220212_192257 This is how it's connected right now, just read somewhere uart2 was reserved. I tested esp TX to an rpi3, and that worked just fine. I also tested this board on the rpi, didn't get any reading from it there either. Tested with od command and minicom

tronde-ams commented 2 years ago

I have the same ESP32.

RX2 is GPIO16. Try connecting TX from HAN to RX2 and leave RX from HAN unconnected.

If thhis fails, try to switch RX and TX from HAN. Sometimes the Chinese mix up these two. Vin to 3V3 as it seems like you have is correect, and GND to GND is also correct.

My board is configured as generic ESP32. I have not tried the other config options.

knutmyr commented 2 years ago

Tried connecting both ways again, still red HAN. Leaves me to think there is 2 possible options: 1 bad mubs ttl adapter or 2 not opened HAN port. But cant tell since i dont know what to expect from debug and controller

tronde-ams commented 2 years ago

Try to invert signal under configuration -> meter. 2022-02-13_020005

If you have a voltmeter, try to measure voltage at input to the chinese adapter. Should be about +24V when no data and about 12...15V when data.

What kind of meter do you have? Aidon, Kamstrup or Nuri/Kaifa?

And yes, not opened HAN-port is an option.

knutmyr commented 2 years ago

I have an Landis gyr with embriq interface. Will go to someone which has an open port working on tibber and see if there is a diff. Had dame issue with USB mbus adapter on my rpi too. When measuring I have constant 27V, never drops, but thought that might be cuz drops were too short

tronde-ams commented 2 years ago

You are not in Norway? Or is it a privately owned meter?

Please give more detailed information about the type of your meter and your grid company.

We know that some foreign meter must have some kind of hard-wiring on the HAN-port before they send data, even if the port is open. You should be able to see that data is available with a voltmeter if the port is active.

We also know that privately owned meters usually don't work with this ESP-adapter because they use a different data format. MBUS is just a hardware standard.

knutmyr commented 2 years ago

I'm in Norway, just figured ut was better to do this in English if others have issues. 20220213_145141 This is my meter. Going to a friend's soon to test there, he has a working tibber connected

gskjold commented 2 years ago

What grid operator are you on? I have never seen one of these in Norway.

Unless your esp32 board is very different from other boards, you should connect RX2 to TX on your mbus adapter board and set UART2 in GPIO config. RX0 is usually shared with USB-TTL chip which does a pulldown while idle. See wiki for more details.

tronde-ams commented 2 years ago

I have three similar ESP32 boards up and running and can confirm RX2 is GPIO16. All of mine are configured as generic ESP without any need for change in config to read HAN. It can be your adapter inverts the signal, but I understand you have tested that.

Landis & Gyr meters are not mentioned in the documentation from NVE, so it can be they use a different data format?

Do your friend also have Landis & Gyr?

bardahlm commented 2 years ago

https://support.tibber.com/nb/articles/5688861-hvilke-strommalere-fungerer-pulse-pa has some info about that meter

knutmyr commented 2 years ago

Final update... my friend has same meter. And I can confirm it works. I just need to get this box and put in between, which should been delivered when they opened my port. 20220213_180204

tronde-ams commented 2 years ago

I found a manual for the Politerm800 module. It might give some useful info for future use. Brukermanual for Politerm800.pdf

gskjold commented 2 years ago

If I read chapter 3.2 correctly, the meter itself puts out a payload via serial port with IEC62056-21 format which is interpreted by the PT800 module. My software should be able to read that format directly. That being said, I do not know of anyone who use it with that format, it have just been tested in my lab.

ArnieO commented 2 years ago

@knutmyr
Interesting to see a Landis Gyr in Norway! Which grid company is this?

tronde-ams commented 2 years ago

I understand that this meter is widespread in the Netherlands and that they read it by means of a series to USB converter.

Embriq seems to be a company that handles data collection and remote control for some grid companies.

Since the Norwegian HAN port is different from most of Europe, I guess they have modified one of the optional modules for this meter, and labeled it with their logo. A permanent +27V was mentioned. I guess the embriq module is modified to supply 27V instead of (or in addition to) 5V, and that this is used by the OP027a adapter to generate the MBUS signal.

I found two manuals for the E350 meter.

e350_series_2.pdf Landis+Gyr E350 Users Manual English.pdf

knutmyr commented 2 years ago

@knutmyr Interesting to see a Landis Gyr in Norway! Which grid company is this?

This is Klive, former known as Nord-Østerdal kraftlag.

knutmyr commented 2 years ago

Contacted them today, the black Rejlers box is an old version of the HAN module for this meter. They tried again today to open port, but still no luck. Have an agreement tomorrow morning with a guy from grid company to test HAN module and change it or the whole meter. There is an module under the cover on my meter, but they have secured the screws. Hopefully it will be all working after visit tomorrow

ArnieO commented 2 years ago

Apparently, exploitation of the HAN port on those meters requires on-site intervention by an operator from the grid company - at no cost for the user. This sounds like an expensive solution for the grid company and a nuisance for the user. On the other meter types used in Norway (Kamstrup, Kaifa/Nuri, Aidon) the HAN port is opened remotely using the communication system the grid company uses to collect data from the meters.

From https://www.klive.no/han-porten/: image

knutmyr commented 2 years ago

All fixed today. It was the module they plugged into the meter. Changed it and it's up. This is the old meter they used, newer ones have this fixed so they only open port from office

ArnieO commented 2 years ago

All fixed today. It was the module they plugged into the meter. Changed it and it's up. This is the old meter they used, newer ones have this fixed so they only open port from office

Does this imply that the statement on Klive web page ("målermontør fra Klive må installere et kort i måleren din") is obsolete?

knutmyr commented 2 years ago

Yes and no. Depends if you have old or new meter. They just changed all of the older ones, which didn't support hourly readout to the newest version with integrated HAN port

ArnieO commented 2 years ago

Yes and no. Depends if you have old or new meter. They just changed all of the older ones, which didn't support hourly readout to the newest version with integrated HAN port

So the Politerm800 module is replaced by a module with integrated HAN port? A photo would be greatly appreciated!

knutmyr commented 2 years ago

20220216_091407 20220216_091446 The new 801 interface

ArnieO commented 2 years ago

@knutmyr Perfect - thank you!