ESP8266 reboot issue

Good Evening,

I have issue with rebooting ESP once or twice a day.

It is a large home project with 3000 code lines.

I think the issue is power supply and noises on minus line. Is capacitor could solve the problem? How can i calculate it?

We need a bit more than that !
Circuit diagram , how it’s powered , code ??
( long wires on inputs can be problematic for example ).

Choice of deoends on power supply etc

2 Likes

thanks for reply

I have two nodemcu connected to different power supply. Nodemcu's connected to each other via rx/tx and use it to sync data + watchdog function,

code is no problem, but sadly i think it's way to long for someone to review it.

I don't have circuit diagram. Cause it's nodemcu lua board.


Sorry, but your code not looks good for me. I think it is a most probable cause of ESP reboot.

Please clarify your suspects about noises in power supply line. Do you have a proof of them? Why didn't you test the project with another power supply if you not sure in actual one?

Do you have any explanation why it's bad though?

Yes. I think it is not power adapter itself. I think it's minus line. I think because of significant total length of all communication cables. I think it is 100+ meters total.

In my understanding it is basically antenna.

And also I do know that I have poor ground line in my apartment, it's couses issues with PC sounds card, I think.

When I use power supply from PC usb - it was rebooting more frequent.

As first aid try to add a ceramic "104" capacitors to power and any other inputs with long wires.

Your code is not structured, the repeating sets of variables with numbers in name ( like aaa1 aaa2 aaa3...) is a sign of bad programming. Once you create a such variables - it is a clear signal that you must convert them to array.

Thanks!

Okay. I think you are talking about clockarray1 and etc... actually I did change those to clockarray[][];

But even though it shorten the code for ~300 lines. And it looks better from far. Inside the functions - it looks pure unreadable evel.

I personally think that the code is very clean. It looks hard, because it does hell lot of things.

Watchdog
Log
Sync via rx/tx
3 addressable led control
7 temperature sensors
Humidity sensor
CO2 sensor
Nema17 (air flow control)
Full control via 4 different bots in telegram
Night time modes
Basically, climate control
Error notification
A lot of calculations with temperatures

This amount of commands... Some for debugging purposes, some useful.

I would say it hard for reading and understanding, and it is not a benefit.
But it is your project.

About the led display - don't you think the code will be more compact if you decided to use a p10 led panels instead of homemade matrix build on addressable strips?

1 Like

I do agree. I did my best to simplify everything I can. I just don't know how to simplify it more.

For sure, it would be more compact and easier to code too. But... I love how it looks)

Even now, at night.

1 Like

You must be able to produce a wiring diagram showing interconnections .

Your board layout doesn’t look promising with high and low current cables overlapping .
With long cables you need to have optio isolation in digitals at least and strong Pullup / pull-down resistors .
This picture is what you should aim for with high current and power supplies on one side and signals on the other Analogs should be in screened cable . Plugs and sockets can be very unreliable .
All “ field” wiring needs to enter via a terminal strip .

Your motor layout and display look very good and an interesting projects .
Wires need to be clipped !

Sorry if this is a but negative to you , but the benefits in terms of finding what is wrong will benefit

1 Like

I think i should start with answering "no" here. I did all that from zero experience in programming and arduino. In two month. So, i am happy with all constructive criticism like yours. Thanks for that.

thanks) i have much more experience in simple sketchup-like "engineering" than capacitors ard resistors)

What is "clipped" mean? Shorten? Total length is long because physical distance is long.

i'll try)

If understand correctly it allows light in one direction. I guess it won't work with DS18B20 sensors, that use OneWire. In my project longest cables are between nodemcu and ds18b20. From ~5 to ~8 meters each. 7 sensors total.

Yeap, i didn't know that either =0

For all data lines i used "Unshielded Twisted Pair" with ground/data and ground/+5v in pairs. It works well enough. I think i don't wont to rewire everything with shield wire))

i used either dupont connectors or soldering or terminal strip.


Update:

First - i did some minor refactoring.

Second - by the help of Paul in dm did understand that "data + ground" and "5v + data" should not be separated. And even 10cm could create problems. So i paired it back.

I couldn't say for sure that pairing is the solution for the problem (more time needed), but i think it is.
update - it's not...

Also i did order suggested capacitors.

For ones wandering "WHAAAT ARE THOOOOSE" =0

it's "plug and play" resistors =0

i will solder them one day... i hope...

I’ve never thought of doing the plug and play resistors. Nice.

1 Like

Thanks) they are perfectly fits in 4pin dupon connector))

And yeah, I'm slow, for sensors and led - I tried like 20 different resistors to define perfect resistance....

But, yeah, I agree that after prototyping is finished - soldering would be better...

The joys of prototyping.
G

1 Like

A little update:

spend few hours on cable management :

Did a lot code refactoring and upload to GitHub :

Probably found the solution. It seems like it :sweat_smile: :
There was a lot of long functions that took longer than 3,2sec.... So adding a lot of yeild(); seems to be the solution. i am 60% sure it doesn't reboot anymore... I will be sure about it after one-two weeks test stability...

So , the code isn't so bad after all... I did print heap memory for half a day - i don't have problem with it, free heap is stable, i don't have leak...

The problem was - i tried to create "perfect" asynchronous functional code with internal timers and i tried to avoid delay as much as possible... But i didn't know that when delay happen it interrupt main code for ESP to do it thing like WI-Fi and etc...

1 Like

I once found 70V of 13Mhz on an earth wire. I'd suggest you install an earth spike and screen all the signal wires.
Also I see you seem to be working with some electro-mechanical stuff that may be causing EMI so you will need to keep the control and signal wires well separated.

1 Like

I think it would be hard living in apartment on 8 floor :joy::joy:

It does make sense! Thank you!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.