cribskip / esp8266_spa

Control for a Balboa BP2100G0 spa controller using the esp8266
46 stars 20 forks source link

Wemos keeps resetting #11

Closed micv83 closed 2 years ago

micv83 commented 3 years ago

I’ve tried with 2 different wemos d1 mini, but after it connects to WiFi it disconnects again crashes with wdt reset.

what Couple be wrong ?

cribskip commented 3 years ago

Power Supply ok? Please post a photo of your setup

micv83 commented 3 years ago

The resets occurs even when hooked up to the laptop via usb, with only the Wemos - no regulator or rs485 attached. I have also tried standalone setup with 12v psu through regulator with rs485 attached. I do get connection attempts in mosquito in home assistant, so it does something before it crashes...

Like this: 1617639019: New connection from 192.168.1.78 on port 1883. 1617639019: New client connected from 192.168.1.78 as Spa1 (p2, c1, k10, u'mqtt'). 1617639034: Client Spa1 has exceeded timeout, disconnecting.

EmmanuelLM commented 3 years ago

Hi, in my experience the device resets when it doesn't receive messages from the hot tub (see: https://github.com/cribskip/esp8266_spa/issues/7#issuecomment-772675742).

I am afraid you're going to have to hook it up to resolve that one :)

srasmond commented 3 years ago

It's because of the "hardreset()" function inside esp8266_spa.ino. If you want to test it without hooking it up, you can disable the content of that function.

I disabled it permanently for the "WiFi check" --> especially the first time the esp module try to connect to my network, it did not get enough time (because of several security checks in my system), it restarts every 30 seconds. Once I disabled that (and in my case, I keep it disabled), everything works as expected. The same routine happens by default when there is no incoming messages from the hot tub. You would definitely want to keep this enabled when it's permanently connected.

The WiFi part I am talking about is: if (WiFi.status() != WL_CONNECTED) { //hardreset(); }

micv83 commented 3 years ago

Thank you srasmond - this was the issue, it stays connected now, and I am more confident trying to connect it to the spa now 😊👍🏼

cribskip commented 3 years ago

@micv83 Good luck then! What controller do you have?

micv83 commented 3 years ago

It’s a Balboa bp6013g1 hope it works 😊

srasmond commented 3 years ago

It’s a Balboa bp6013g1 hope it works 😊

I got the same. Works brilliant, I control it via OpenHAB (Mosquito as broker). Already quite some things you can monitor or change

EmmanuelLM commented 3 years ago

Hey @srasmond - what other features would you like to see implemented? I am currently working on an access point mode, so I can start releasing binaries, which would make the initial setup much easier, but wondering whether there are other things I could also knock off people's wish list?

cribskip commented 3 years ago

@EmmanuelLM setting filter cycles and wifi manager would be great.

I'm currently polishing my heat pump controller and write up of the setup and photovoltaik optimization 😉

micv83 commented 3 years ago

401471EA-75DA-4183-8C1B-74EC5C5CD35D

Managed to get it working, but it’s not all that stable at the moment, but I can see the WiFi signal is very poor, so I’ve ordered a wemos with external antenna connector hope that makes the switches work more reliable 😊

srasmond commented 3 years ago

@EmmanuelLM I am still playing around with some settings. Currently, my main goal was to set off the heating of the hottub during the night (with a minimum temperature of 21° C, but that is only a concerning during winter). At the moment I am realizing this by setting the "target_temp" lower each night (via openHAB rule). I tried to just turn off the heater and though it does seem to work, there seems to be 2 issues in this scenario:

--> Setting the target temperature provides a more ensuring way that the hottub will indeed not heat during that amount of time and as a plus, it seems like in this case you get continuously updated current temperature values.

Other things I am thinking about:

srasmond commented 3 years ago

@micv83 Getting an external antenna is a good idea. The default is indeed not strong enough: in my case for example, the signal needs to get from inside its case, which is inside the hottub (close to the balboa controller), which stands outside in the garden, to inside my house - to the closest receiver. Considering also the extra interference by all the wiring inside the balboa controller and perhaps even a bluetooth device next to it, getting a decent antenna is the minimum. After that, you should be all good.

cribskip commented 3 years ago

@srasmond I'll try to answer to your rather long text structured ;-)

Heater off during winter: You're right, when the temp is low AND "Balboa M7" "Artificial Intelligence Blockchain Crypto" is turned OFF, you're getting 0 as current temperature as the temperature is unknown to the controller. When M7 is on, the tub starts the circulation just before invalidating the temperature for a few minutes and knows the temperature again.

When you start the jets, the tub goes into ready-in-rest mode: Meaning it's heating to the Ready-Temperature.

My current setup (which needs to be described more in detail ;-) which circumvents all those problems:

Some benefits:

TL;DR: I need to get my documentation ready. But first: more photovoltaic :-D

srasmond commented 3 years ago

@cribskip The J2 connector would be my alternative to put a wifi switch relais on if I would not get the controller to work. Now that I can control the hot tub in many other ways, I don't see an immediate benefit from using the J2 connector, but I am curious on what you mean exactly with the "circulation only" mode?

At the moment I am using the "target_temp" since a couple of days, and I have to say it works really well this way. At 10 pm a script is setting the "target_temp" to 30°C and at 10 am a script is setting the "target_temp" to 38°C again. This also makes sure that the current temperature is always known (during heating up or cooling down moments), which is handy, because now I see how much the T is dropping during the night (at the moment it never drops below 34,5 °C).

When light control, time and power control (will most likely need to be done at input level, not via the controller) is added to my system, for me it will have everything I would ever need.

If I have some time this week I will try to put my system, configuration, use cases, etc. on paper. You can then use whatever you want from it in future documentation.

pengemetal commented 3 years ago

Hi! I use wemos D1 mini (not pro) how can I check the wifi connection? I can't see nothing in MQTT explorer, I think Wemos do not connect to wifi (SSID and password is correct is src/esp8266_spa.ino. Thx

srasmond commented 3 years ago

@pengemetal you could try to ping it. If it's connected you should also see it in your network list with all devices. Nornally, when using the code from this repo, the Wemos should broadcast its own SSID as well, so in the list of wifi network it should be visible as well. Other things you could check is the serial output when connected with the board via usb.

pengemetal commented 3 years ago

@pengemetal you could try to ping it. If it's connected you should also see it in your network list with all devices. Nornally, when using the code from this repo, the Wemos should broadcast its own SSID as well, so in the list of wifi network it should be visible as well. Other things you could check is the serial output when connected with the board via usb.

Ping do nothing. I can see an ESP-xxxxxx SSID, but I use many esp I don't know it's wemos. I tried Platformio serial monitor, but without any success:

Executing task in folder esp8266_spa-master: C:\Users\Admin.platformio\penv\Scripts\pio.exe device monitor <

--- Available filters and text transformations: colorize, debug, default, direct, esp8266_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time --- More details at http://bit.ly/pio-monitor-filters --- Miniterm on COM7 9600,8,N,1 --- --- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H --- ���␙ ��D�������␄!>�@���H!�4�L�����?

pengemetal commented 3 years ago

At baudrate 115200:

wdt reset load 0x4010f000, len 3584, room 16 tail 0 chksum 0xb0 csum 0xb0 v2843a5ac ~ld

pengemetal commented 3 years ago

I tried with a NodeMCU v3, problem the same:

wdt reset load 0x4010f000, len 3584, room 16 tail 0 chksum 0xb0 csum 0xb0 v2843a5ac ~ld

srasmond commented 3 years ago

@pengemetal and did you try the solution from higher in this post (disabling the reset function)?

pengemetal commented 3 years ago

@pengemetal and did you try the solution from higher in this post (disabling the reset function)?

I need to delete this row? if (WiFi.status() != WL_CONNECTED) { //hardreset(); }

Thx

srasmond commented 3 years ago

No, you just need to comment out the hardreset function where needed. The // in the example you showed is a way of commenting a line (so you don't need to delete it and easily can activate it again afterwards). For testing I suggest disabling the hardreset for the wifi connection, but also for the serial check (if the device is not hooked up correctly, it will keep resetting as well).

pengemetal commented 3 years ago

No, you just need to comment out the hardreset function where needed. The // in the example you showed is a way of commenting a line (so you don't need to delete it and easily can activate it again afterwards). For testing I suggest disabling the hardreset for the wifi connection, but also for the serial check (if the device is not hooked up correctly, it will keep resetting as well).

Notthing has changed :( messege still the same

EmmanuelLM commented 3 years ago

Are you connected to the hot tub yet, or is that solo?

pengemetal commented 3 years ago

Are you connected to the hot tub yet, or is that solo?

Both

EmmanuelLM commented 3 years ago

Looks like a potential compile/flash error as you shouldn't see any ESP-xxxxxx SSID

Questions to help debug:

srasmond commented 3 years ago

@EmmanuelLM , why shouldn't you see any SSID? There is nothing in the code that prevents the esp from broadcasting the SSID. I see it as well. It's a nice tip however: people should prevent this broadcasting or put a WPA key on the esp. Else you have a potential security issue at hand.

I do however also believe that there might be some flash error in this case like you explained. Nice suggestion concerning the lower flash size!

pengemetal commented 3 years ago

Looks like a potential compile/flash error as you shouldn't see any ESP-xxxxxx SSID

Questions to help debug:

  • are you using atom/platformio to compile?
  • do you know the memory size of your chip?
  • A guess is your chip has a lower flash size - have a look at "board_build.ldscript = eagle.flash.4m3m.ld" and change to "board_build.ldscript = eagle.flash.1m0.ld"

Thx for your effort!

pengemetal commented 3 years ago

I changed it in platformio.ini, but I get this:

Error: Could not find 'eagle.flash.1m0.ld' LD script in LDPATH 'C:\Users\Admin\Downloads\esp8266_spa\esp8266_spa-master.pio\build\d1_mini_pro C:\Users\Admin\Downloads\esp8266_spa\esp8266_spa-master.pio\build\d1_mini_pro\ld C:\Users\Admin.platformio\packages\framework-arduinoespressif8266\tools\sdk\lib C:\Users\Admin.platformio\packages\framework-arduinoespressif8266\tools\sdk\ld C:\Users\Admin.platformio\packages\framework-arduinoespressif8266\tools\sdk\libc\xtensa-lx106-elf\lib C:\Users\Admin.platformio\packages\framework-arduinoespressif8266\tools\sdk\lib\NONOSDK22x_190703' Error: Could not find 'eagle.flash.1m0.ld' LD script in LDPATH 'C:\Users\Admin\Downloads\esp8266_spa\esp8266_spa-master.pio\build\d1_mini_pro C:\Users\Admin\Downloads\esp8266_spa\esp8266_spa-master.pio\build\d1_mini_pro\ld C:\Users\Admin.platformio\packages\framework-arduinoespressif8266\tools\sdk\lib C:\Users\Admin.platformio\packages\framework-arduinoespressif8266\tools\sdk\ld C:\Users\Admin.platformio\packages\framework-arduinoespressif8266\tools\sdk\libc\xtensa-lx106-elf\lib C:\Users\Admin.platformio\packages\framework-arduinoespressif8266\tools\sdk\lib\NONOSDK22x_190703'

srasmond commented 3 years ago

Could you try with eagle.flash.1m.ld (so without the "0"). Also a link that could be of intrest in this case : https://docs.platformio.org/en/latest/platforms/espressif8266.html#flash-size

pengemetal commented 3 years ago

I tried, flash is perfect, but the wdt fault is still existing :(

srasmond commented 3 years ago

How is your esp currently powered for testing? I'm guessing you are just plugin it in via an usb adapter to the laptop, so you can check the messages in the serial monitor?

pengemetal commented 3 years ago

Yes, laptop via usb.

EmmanuelLM commented 3 years ago

This may not work as terminal is taken over to communicate with the hot tub. I find your issue very odd - can you try flashing something else on yoru chip?

On Wed, 21 Apr 2021 at 20:30, pengemetal @.***> wrote:

Yes, laptop via usb.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cribskip/esp8266_spa/issues/11#issuecomment-824303422, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHW4H36STJGPKSVEAVQN2XTTJ4RVDANCNFSM42NEV7EQ .

pengemetal commented 3 years ago

Yes, I flashed with esphome and worked perfect! I am thinking about using a D1 mini pro. I have one, but it is built for control sauna.

pengemetal commented 3 years ago

I try a D1 mini pro, almost the same result, but now I can see nothing in serial monitor. I think the main problem is connecting to wifi. I can't see Wemos fixed ip in the network. When I flash esphome, there is no problem.

cribskip commented 2 years ago

@pengemetal Can this be closed? Is your issue resolved and you can enjoy the sketch?

pengemetal commented 2 years ago

@pengemetal Can this be closed? Is your issue resolved and you can enjoy the sketch?

Yes, thank you! It solved, I dont know what was wrong, I think the wifi signal was the problem! Finally the sketch works great! :)