patience4711 / read-APSystems-YC600-QS1-DS3

Software for an esp8266 nodemcu to read data from APS inverters.
128 stars 24 forks source link

Debugging zigbee chip / coordinator #100

Closed fwolfst closed 1 year ago

fwolfst commented 1 year ago

Looks like a great project! I own a APSystems DS3-S, a Wemos D1 and two zigbee modules, but cannot get the coordinator up.

For me to debug, some questions: 1) The coordinator should start up independent of any inverter present in the vicinity, right? 2) Also the zigbee module can be tested via "10;ZBT=2710AABBCC" in the Console part of the application WITHOUT any inverter nearby, right? It should always respond with AABBCC right away? ^^ Basically I want to be able to debug at night, too :)

In the current state I do get starting ZB coordinator failed and no answer from "10;ZBT=2710AABBCC" (it just prints answer without the AABBCC). I thought that I somehow fried the zigbee module (flashing was super difficult), so I ordered a new one and asked the shipper to flash it with CC2530ZNP_2591-with-SBL.hex from the ...d3...-folder.

I was wondering if the pinout of the D1 (not mini) might be different? See attached my wiring. I am glad about any help and/or pointers to what I could try next and can provide screenshots.

image

patience4711 commented 1 year ago

@fwolfst Obviously the loopbacktest (and all other zigbee tests) should work without the presence of any inverter. So yes, the AABBCC should be returned right away. Your serial communication is not working. The dupontwires can be faulty, you should test them. Check that you did't reverse RX and TX

To be sure that the right firmware is on the zigbee, you can flash it yourself, with ccloader on your esp board. It's not so hard to do this. As for the pinout, it would surprise me if this was different but you can google that too.

fwolfst commented 1 year ago

@fwolfst Obviously the loopbacktest (and all other zigbee tests) should work without the presence of any inverter. So yes, the AABBCC should be returned right away. Your serial communication is not working.

Thanks for confirming this.

The dupontwires can be foulty, you should test them. Check that you did't reverse RX and TX

I had RX and TX switched for trial and error but it did not help, will replace cables tomorrow.

To be sure that the right firmware is on the zigbee, you can flash it yourself, with ccloader on your esp board. It's not so hard to do this. As for the pinout, it would surprise me if this was different but you can google that too.

Yes, I would try this next, but I don't have a Windows or Mac system ("only" Linuxes) and found that flashing of the first zigbee module (different build from what is in the photo) was really unreliable (and maybe did not work at all). I also had to patch CCLoader to allow for my USB-port. I then used an old raspberry - that looked more realiable. Should `CC2530ZNP-with-SBL.hex' also work for an CC2530 + 2591? From what I read, the 2591/2 are "range extender"s, I will work in pretty close range though (<5m).

patience4711 commented 1 year ago

@fwolfst According to this post https://github.com/patience4711/read-APSystems-YC600-QS1-DS3/issues/89#issuecomment-1492920304 the module CC2530 + 2591 will work. I don't know however what firmware he flashed on it. Likely it is CC2530ZNP_2591-with-SBL.hex from the folder DS3 in this zip

Your inverter is a D1-S ? I don't know this type but it is not said that it would work with this ESP-ECU.

fwolfst commented 1 year ago

Your inverter is a D1-S ? I don't know this type but it is not said that it would work with this ESP-ECU.

Inverter is a DS3-S. The ESP8266 board is a wemos D1 R1.

patience4711 commented 1 year ago

If you are unsure whether your device is compatible, you can do a loopback test. Connect rx and tx with a dupontcable. Now in the console type 10;diag, it should react with "set diagNose to 1", if not ype it again.

Now issue a command like 10;zbt=12345 and you should get an answer like in the image below, this is an echo of what has been send.

test

fwolfst commented 1 year ago

If you are unsure whether your device is compatible, you can do a loopback test. Connect rx and tx with a dupontcable. Now in the console type 10;diag, it should react with "set diagNose to 1", if not ype it again.

Now issue a command like 10;zbt=12345 and you should get an answer like in the image below, this is an echo of what has been send.

Ah, I didn't know that I need to set the diagnose level to 1 before trying the loopback. Anyway, I am pretty sure that the cc2530 is fried, new one will only arrive after easter, so I will have to take a break.

patience4711 commented 1 year ago

These things are in the wiki, you should have read it there.

As for your zigbee, if it isn't blackened, it might be just oke. You must do rough things to fry it. like a too high vcc.

fwolfst commented 1 year ago

Yes, I most likely put too high VCC. Even with a new module no change (setting diagnose level, then sending the test to loopback will print just answer without the payload (e.g. 1234). I start wondering if some of the pins 5,7,8 a borked. Might try with some LEDs. Aso, the button and LED on pin 3 and 4 are really still optional, right? As seen in my picture I only connect VCC,GND, 5->RST and 7->P3 to 8->P2 on the zigbee module.

patience4711 commented 1 year ago

The loopback does not answer. Insteat of using leds you can first try the hardware loopback test with the shortcut cable between rx and tx (see wiki). If you can't get this to work there must be problem with those pins. If that works then i think, even with wrong firmware on the zigbee, you should get an answer on the software loopbacktest.

If you connect a led to pin D5, this led should go out for a moment every time you start the coordinator.

Yes, the button and the led are optional.

fwolfst commented 1 year ago

Thanks @patience4711 . And indeed, much of it is in the wiki, sorry for overlooking that (I did read much of the wiki a couple of times).

I loaded "blink"-style programs on the board and connected a led and resistor. Managed to get the LEDs blinking on D5 (->RST) and D7, but just dimly lit on D8. Either that is because of how D8 is supposed to work, or its bonkers.

I then reflashed with the latest version. Completely disconnected the zigbee module and now shortcircuited both D7 and D8 on the board (these were connected to rx/tx on the zigbee modules) as well as the pins labeled RX-D0 and TX-D1 and issued the above commands. Still, there is no answer coming back. I digged a bit in the code: Serial.swap should use D7/D8 on a wemos d1, just like on the nodemcu.

image

So, I ordered a nodemcu - lets see. Thanks for your patience.

patience4711 commented 1 year ago

Just to be sure, did you set the pinmode to output when testing d8

fwolfst commented 1 year ago

Just to be sure, did you set the pinmode to output when testing d8

Will try tomorrow, but pretty sure yes. I just replaced the value of the variable when testing the differnt pins. NodeMCU is on the way, should also arrive today and be tested tomorrow.

fwolfst commented 1 year ago

Indeed, the console output from a quick test with the NodeMCU board (v3.4) looks completely different/good. I will confirm in the afternoon, and then this ticket can hopefully be closed. I will report if I can connect to the inverter (you were not sure if D3-S will work) over the course of the weekend.

patience4711 commented 1 year ago

You should know that inverters are not working when there is no dc powersupply (at least one working pv unit at daylight). So no pairing possible when it is dark.

fwolfst commented 1 year ago

So, loopback messages work now. With shortcircuit but also with zigbee module. Pairing does not work yet (the inverter is plugged in) - this might be due to the firmware on the zigbee (i have a module with range extender CC2591 but used the firmware without the range expender, lets see). Or, the DS3-S might be incompatible. You can close this issue, or leave it open if you want report (I would probably file a new one if pairing fails indefinately). Also, the Sticker on my inverter is for the "Identification number" - I assume this is the serial number. If this label is the same for all inverters it might be good to change the wiki / web interface to reflect that name.

joffito commented 1 year ago

i own a DS3-S and it works flawlessly. serial number is found on the sticker in the uppermost left corner. two stickers.

fwolfst commented 1 year ago

Finally. It works here, too. Now all we need is more sun. Thanks a lot. If I'd find time I would try to generalize the code that produces the html pages (e.g. always the same menu bar etc). Are you open for Pull Requests that do that? What would be the (UI) feature that you'd wish for but don't want to/can't implement yourself?

patience4711 commented 1 year ago

Oke i close this now. No whishes as to new features. Thanks for the offer though. The thing is that a lot of the users aren't interested in the ui at all. They only want to integrate in their home automation where the data is kept in a database and where they have nice charts. I know there is a lot we can do to improve the webinterface but it all costs program space which there isn't much available.