Current News

Moderator: Mmiscool

User avatar
By matherp
#35089 Mike

Have a great thanksgiving!

There appears to be a memory leak in the thingspeak code.

The attached runs perfectly for about 20 cycles and then crashes; completely repeatably :
Code: Select alltimer 5000 [do.some.stuff]
button "Click me to exit" [Exit.ThisThing]
wait
[do.some.stuff]
temp 2 curr
print curr
sendts(VS24H7DE4NTNOEYZ,1,curr)
print readts(ZEGHJT85T002GMHL,68291,1)
wait
[Exit.ThisThing]
timer 0
end


Code: Select all7.75
api.thingspeak.com
/update?key=vs24h7de4ntnoeyz&field1=7.75
api.thingspeak.com
/channels/68291/field/1/last.xml?api_key=ZEGHJT85T002GMHL
7.75
7.44
api.thingspeak.com
/update?key=vs24h7de4ntnoeyz&field1=7.44
api.thingspeak.com
/channels/68291/field/1/last.xml?api_key=ZEGHJT85T002GMHL
7.75
6.75
api.thingspeak.com
/update?key=vs24h7de4ntnoeyz&field1=6.75
api.thingspeak.com
/channels/68291/field/1/last.xml?api_key=ZEGHJT85T002GMHL
7.75
7.50
api.thingspeak.com
/update?key=vs24h7de4ntnoeyz&field1=7.50
api.thingspeak.com
/channels/68291/field/1/last.xml?api_key=ZEGHJT85T002GMHL
7.50
7.37
api.thingspeak.com
/update?key=vs24h7de4ntnoeyz&field1=7.37
api.thingspeak.com
/channels/68291/field/1/last.xml?api_key=ZEGHJT85T002GMHL
7.50
7.56
api.thingspeak.com
/update?key=vs24h7de4ntnoeyz&field1=7.56
api.thingspeak.com
/channels/68291/field/1/last.xml?api_key=ZEGHJT85T002GMHL
7.50
7.00
api.thingspeak.com
/update?key=vs24h7de4ntnoeyz&field1=7.00
api.thingspeak.com
/channels/68291/field/1/last.xml?api_key=ZEGHJT85T002GMHL
7.00
8.94
api.thingspeak.com
/update?key=vs24h7de4ntnoeyz&field1=8.94
api.thingspeak.com
/channels/68291/field/1/last.xml?api_key=ZEGHJT85T002GMHL
7.00
7.44
api.thingspeak.com
/update?key=vs24h7de4ntnoeyz&field1=7.44
api.thingspeak.com
/channels/68291/field/1/last.xml?api_key=ZEGHJT85T002GMHL
7.00
7.50
api.thingspeak.com
/update?key=vs24h7de4ntnoeyz&field1=7.50
api.thingspeak.com
/channels/68291/field/1/last.xml?api_key=ZEGHJT85T002GMHL

Exception (28):
epc1=0x4000e1e0 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: cont
sp: 3fff51c0 end: 3fff5690 offset: 01a0

>>>stack>>>
3fff5360:  3fff5440 3fff53cc 3fff53a8 4021d990
3fff5370:  3fff5440 3fff53cc 00000000 4021e306
3fff5380:  3fff5440 3fff56e4 00000000 4020cec3
3fff5390:  3ffeb080 00000000 000003e8 3fffa488
3fff53a0:  3fff3948 3fff9e70 3fffa668 0000000f
3fff53b0:  00000004 3fffa4b8 0000000f 00000001
3fff53c0:  3fff9f38 0000000f 00000001 3fff9d40
3fff53d0:  0000000f 00000004 3fff9db0 0000000f
3fff53e0:  00000001 3fff9c00 0000000f 00000001
3fff53f0:  3fffa828 0000003f 00000039 3fffa488
3fff5400:  0000001f 00000012 00000000 0000033f
3fff5410:  0000033f 00000000 3fff544c 4021d990
3fff5420:  3ffe96f0 00000000 3fff5520 00000000
3fff5430:  3ffe96f0 00000000 3fff5520 4020e3d1
3fff5440:  00000000 00000000 00000000 3fff9e10
3fff5450:  0000004f 0000004b 3fffa428 0000004f
3fff5460:  0000004b 3fff9db0 0000001f 00000019
3fff5470:  3ffe96f0 00000000 3fff54cc 3fff9d90
3fff5480:  0000000f 00000000 3fff9d70 0000000f
3fff5490:  00000000 3fff9ca0 0000000f 00000000
3fff54a0:  3fff9c80 0000000f 00000000 3fff9c60
3fff54b0:  0000000f 00000000 3fff9c40 0000000f
3fff54c0:  00000001 3fff9c20 0000000f 00000005
3fff54d0:  3fffa938 0000001f 00000010 3fff7de8
3fff54e0:  0000000f 00000006 3fff5538 4021d88e
3fff54f0:  00000001 0000001f 3fff5538 4021d990
3fff5500:  3ffe96f0 3fff3750 3ffe89cc 3fff5520
3fff5510:  00046bca 3ffe8344 3ffe89cc 4020fabf
3fff5520:  3fff9de0 0000001f 00000018 00000005
3fff5530:  00000001 3fff54a1 3fff9bc0 0000002f
3fff5540:  00000018 3fff9c50 3fff9c00 4021721c
3fff5550:  3ffeba78 00000001 3fff9c00 40216e93
3fff5560:  3fff9464 ffffffff 3fff9c50 40218124
3fff5570:  40106d98 3fff5620 3fff55a0 40216636
3fff5580:  3fff9c00 3fff9c50 3fff5620 4020b350
3fff5590:  3fff55e0 3ffe96f0 3fff5620 4020b58e
3fff55a0:  3ffeb918 3fff9ba0 0000000f 00000000
3fff55b0:  3fff9b80 0000000f 00000000 3fff9b60
3fff55c0:  0000000f 00000000 3fff96b0 0000000f
3fff55d0:  00000000 3fff9ce0 0000002f 00000020
3fff55e0:  3fff7c68 0000000f 00000005 3fff7de8
3fff55f0:  40106d98 3fff3298 3fff7c68 0000000f
3fff5600:  0000000a 3fff3750 3fff3750 3fff4664
3fff5610:  00046bca 3fff3750 3fff3298 402111f4
3fff5620:  3fff9c78 0000002f 00000000 3fff4664
3fff5630:  00046bca 3fff3190 3fff3194 4021132c
3fff5640:  3fff96b0 0000001f 00000016 3fff9b60
3fff5650:  0000001f 00000000 00000016 40101f01
3fff5660:  3fffdc20 00000000 3fff465c 40211345
3fff5670:  3fffdc20 00000000 3fff465c 40216045
3fff5680:  00000000 00000000 3fff4670 40100114
<<<stack<<<
User avatar
By forlotto
#35839 You need to delay longer than this ...

According to what I have read there is a 15 second interval for thingspeak...

So at minimum your delay should be 15000 personally I would suggest 20000 or a per minute update or 60000 delay...

Give that a try and see what comes of it.
User avatar
By heckler
#35844 matherp,

the memory leak may actually be due to your repeated use of the print statement.
if you include these somewhere in your code...
Code: Select allprint ramfree()
print flashfree() 'how much mem left

and then watch the numbers as the code runs.

If you see one or the other ram/flash numbers going down then eventually your code will crash.
It may be due to your repeated writing to the web interface (print) as there is a finite amount of memory for the web page.

One way to correct this is to include a "cls" statement just before you write new info to the web page.

This will clear the web page and keep the buffer from depleating.

I did not study or try your code but that is what I suspect.

dwight
User avatar
By viscomjim
#37892 Mike, this has to be by far the easiest way to control something from anywhere else without the need for the usual hassles that typically come with this type of project. The fact that you can send a text string to TS from one esp and read it back from another esp and do something is AWESOME and easy as pie (not pi).

You can simply have one esp, for instance, read a switch and send TS a string like "switchon" and then have another esp poll TS every 2 seconds or so for "switchon" (since the read results in the last sent update) and turn on a relay (or whatever you want to do). Just a few lines of code and your up and running. Talk about EASY IOT!!! No other micros needed!

I have one esp at home just sending data to TS every 20 seconds and another one at work polling the channel every 5 seconds for the past 2 days and all is well. You can even have 2 way comms using two different fields. Not the fastest thing in the world, but certainly the easiest and no hassles with ips, etc.

I have looked around a lot for this type of project and espbasic makes it super easy!!!! I may have to do an instructable now...

Thanks again Mike. Keep up the GREAT work. Another beer donation on its way...