• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Esp8266 crashing after 30 mins

dr pepper

Well-Known Member
Most Helpful Member
I put together a data logger that serves a couple of guages and a google graph to a webpage, it works well, but packs up after an hour or so.
The page still part loads then hangs.
It runs on an esp8266-01, there is a 2200 cap across the power in.
So I programed a wemos d1 with the same code, all settings the same, except the board type.
Programming was done with arduino ide.
The wemos works fine for days, and I think it will probably carry on.
The 8266-01 is setup for 1m flash 64k spiffs, flash type Dio.
I ran the flash confog checker that comes with the ide so I know thats correct.
Bad board maybe?
 

Pommie

Well-Known Member
Most Helpful Member
Could it be a memory leak causing the heap size to drop. Try printing out the free memory as it's running - see ESP.getFreeHeap().

Mike.
 

dr pepper

Well-Known Member
Most Helpful Member
Well I did add that to the webpage, it tells you free memory.
Because its a datalogger it uses the flash (I think), on power up the code determines the free memory, leaves 35kb spare for the esp to run and allocates the rest to the logger.
This sounds like it would cause the problem, but it works fine on a wemos, and the code was adapted from another system that also runs fine.
The site says 29kb is still free, but I havent been able to check that up to the point where it crashes.
I dont use spiffs to create the memory array, I just create a large array, I'm not sure if it goes into ram or flash to be honest.
And if it did the system only takes readings every 10 mins, and it takes a couple of weeks to fill the memory assigned, so a full memory write would be 2 weeks x 10,000, I dont think I'd be around long enough to see it fail.
 

dr pepper

Well-Known Member
Most Helpful Member
5 mins 3 months, were you saving a lot of data so it was rolling over.
Mine takes 2 weeks to wrap around.
Making me wonder if its 10,000 write cycles per location, or its 10,000 write cycles to any location.
The wemos I'm using is my prototype goto and has been used a lot, it works fine, the esp 01 I used that doesnt work is new unwrapped from its packet 2 days ago.
 

dr pepper

Well-Known Member
Most Helpful Member
T'other thing to mention is that the esp is 'talking' to an arduino, the arduino sends serial sensor data to the esp, and the esp serves tha data as a chart on a webpage.
The arduino is 5v, and the esp obviously is 3.3, there is just the ground and data line connected, the latter has a 1k in series to shift the level from 5 to 3.3v, it just relies on the built in protection diode in the esp to conduct & drop the voltage.
I guess I could try running it for 24 hours without the datalines connected.
 

dr pepper

Well-Known Member
Most Helpful Member
Bodged it for now.
I used a esp12 based board, and used espsoftware serial to create a second com port and use it for receiving data from the arduino.
I would like to suss out the issue with the esp 01 though, must be a memory thing, thats the only difrence.
 

Pommie

Well-Known Member
Most Helpful Member
5 mins 3 months, were you saving a lot of data so it was rolling over.
I was appending a file on spiffs so I'm not sure how that works. Basically, 3 months at 5 mins is 288 writes per day or ~25,000 writes. The data was an ascii line of about 16 characters.

Mike.
 

dr pepper

Well-Known Member
Most Helpful Member
The original has been running since the end of septembe and still seems ok.
 

Latest threads

EE World Online Articles

Loading
Top