[DEPRECATED] ST_Anything - Arduino/ESP8266/ESP32

Your code seems fine from a quick look. I am on the road, so no way to test anything. Since you’re monitoring pool water, I would think an update interval of every 5 minutes would be plenty fast. That much water doesn’t change temperature very quickly. :wink:

Hi Dan,

It is actually a room I am monitoring which is to a nursery! haha Plan is that the temperature reading will decide which colour the LED will glow and in turn mean which tog blanket the baby currently requires for that temperature :slight_smile:

Might try backing off the polling frequency tonight and seeing if thats helps.

Thanks
Gary

Sorry about the confusion. Must have mixed up your use case with someone else.

Hi Dan, Another random question if I may and I understand that it may need a bit of debugging as Im not using ST_Anything quite as designed. However I am learning a lot! I got the ‘button and relay’ code working for my use which is great.

However I have found that while there is any RX/TX happening on the Ethernet side of things of the W5100 shield (Which when it is connected to the network it is almost continuously) it isn’t reading any of my Serials, doesn’t matter if it is 0-3, it writes ok, but doesn’t want to read. Would you have any hints on where to look at to start debugging that?

Thanks!

I would really need to understand exactly what you are trying to do. These little microcontrollers are not running any operating system. As such, they can only do one thing at a time. This is why I stress to users to never add any ‘delay()’ statements within their sketch. The ‘loop()’ routine must run continuously to ensure that the networking has a chance to send and receive data continuously.

If you want, you can post your sketch here so I can take a look.

1 Like

Thanks for the reply. I think basically what you are saying is correct, I don’t have any delays as per your instructions in the ReadMe but I think I am literally running it to hard. My code really isn’t efficient either, if I take it back to just a couple of executors and sensors its ok. I did have about 20 executors with the pin ‘button’ monitoring on them and a few sensors :stuck_out_tongue:

I will look at possibly splitting it across a couple of units or something for this project and keep working on it over time :slight_smile:

One more thing to be aware of when running ST_Anything… By default, every 5 minutes all sensors and executors send to ST a current status update. This is to make sure ST is kept up to date in case an event is somehow missed (like your internet is down, your router is rebooted, ST cloud is acting bad, etc…) During these periodic refreshes, the system is busy sending a lot of data (based on the number of devices you declared in the sketch’s setup() routine.) The system will seem unresponsive during this time, but will then catch back up.

You can change the frequency of these periodic refreshes, or disable them, by editing ‘constants.h’ in the ST_Anything library folder.

1 Like

Yes thank you, I had noticed that and was planing on adjusting them a little to just give everything a little more breathing room.

1 Like

Hi Dan,

I’m still unfortunately seeing issues with my nodemcu where it will randomly reboot midway through reporting values etc, I am only running the device from my MacBook USB port and have read loads online that these ESP devices can easily have spikes that causes reboots so I just wanted to ask how you generally power you chips for ST ANYTHING based programs? Are you using an external source as opposed to just USB?

Thanks in advance!

I have only used the NodeMCU ESP8266 boards on the workbench, powered via an ‘externally powered USB 3.0 hub’. I have not experienced any random resets of the NodeMCU 1.0 ESP8266 boards. I did have problems with inadequate power for the tiny ESP-01 boards, but those require a lot more circuitry to work reliably. That why I like the NodeMCU form factor.

My main deployed board is an Arduino MEGA with a W5500 Ethernet shield, powered via a 9v 2.0amp wall wart, connected via the barrel connector on the MEGA.

What devices do you have wired to the ESP8266? Can you share a wiring diagram? Or does the problem occur even without anything wired to the board?

It’s very strange! So I have two NodeMCUs at the moment:

First project is the board with a photoresistor, DHT22, and RGB LED attached, this project is fairly stable but it will never last a day without restarting or crashing, I only notice as I see in SmartThings that values haven’t updated for a few hours so I manually have to reset the board.

Second project I only started yesterday and for now there is no hardware connected, just ST AnyThing multiples default uploaded which I would say is restarting every 20 seconds, serial monitor shows the updated values for all the default devices like motion and contact etc (obviously wrong as no hardware is connected yet) but it runs anyway and then all of a sudden it has to try and connect to the WiFi again with a stack restart error and that continues.

Have tried the ESP8266 Blink and WiFi scan sketch on both with no issues and they are both on version 2.3 of the board with 4 different usb cables?

To follow up from my other reply, I have just uploaded the clean ESP8266 Multiple ST Anything library to the nodemcu where I have only changed the SSID details and the IP address and all looks great at first but then you will spot the crash in the middle before it returns back to normal again which happens very frequently:

Everything: init ended
Everything: Free RAM = 43744
Everything: adding sensor named water1
Everything: Free RAM = 43744
Everything: adding sensor named temperature1
Everything: Free RAM = 43744
Everything: adding sensor named contact1
Everything: Free RAM = 43744
Everything: adding sensor named button1
Everything: Free RAM = 43744
Everything: adding sensor named button2
Everything: Free RAM = 43744
Everything: adding sensor named motion1
Everything: Free RAM = 43744
Everything: adding sensor named smoke1
Everything: Free RAM = 43744
Everything: adding sensor named relaySwitch1
Everything: Free RAM = 43744
Everything: adding executor named alarm1
Everything: Free RAM = 43744
Everything: adding executor named switch1
Everything: Free RAM = 43744
Everything: initDevices started
Everything: Free RAM = 43744
PS_Water::Analog Pin value is 14 vs limit of 200
Everything: Sending: water1 dry
PS_DS18B20_Temperature::Requesting temperatures...DONE
PS_DS18B20_Temperature:: Temperature for the device # 1 is: -196.60
Everything: Sending: temperature1 -196.60
Everything: Sending: contact1 open
IS_Motion: 30 second Motion Sensor Calibration Started...
Everything: Sending: relaySwitch1 off
Everything: Sending: alarm1 off

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

ctx: sys 
sp: 3ffffd50 end: 3fffffb0 offset: 01a0

>>>stack>>>
3ffffef0:  3ffea724 3ffea708 3ffea710 40107244  
3fffff00:  40221c59 00000000 3ffea736 40229c95  
3fffff10:  40229b0a 3ffea76e 00000000 00000000  
3fffff20:  3fff1584 ffffffff ea80ffff 3ffedd30  
3fffff30:  000005e0 00000000 40103fe1 3fff0c1c  
3fffff40:  3ffeb9ca 00000000 3fff1584 4022cce2  
3fffff50:  0000001c 00000001 4010510a 3ffed300  
3fffff60:  3ffeca30 40101a76 00000000 3ffecf24  
3fffff70:  3ffeca30 40101843 00000000 00000000  
3fffff80:  4020d54e 3fffdab0 00000002 3fff0cac  
3fffff90:  3fffdc80 00000000 3fff1584 4022161f  
3fffffa0:  40000f49 3fffdab0 3fffdab0 40000f49  
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
v3de0c112
~ld
Everything: init started
Everything: Free RAM = 44864

Initializing ESP8266 WiFi network.  Please be patient...
Attempting to connect to WPA SSID: MYWIFI

SmartThingsESP8266WiFI: Intialized

Disabling ESP8266 WiFi Access Point

ArduinoOTA Ready
IP address: 10.0.1.28

Everything: init ended
Everything: Free RAM = 43744
Everything: adding sensor named water1
Everything: Free RAM = 43744
Everything: adding sensor named temperature1
Everything: Free RAM = 43744
Everything: adding sensor named contact1
Everything: Free RAM = 43744
Everything: adding sensor named button1
Everything: Free RAM = 43744
Everything: adding sensor named button2
Everything: Free RAM = 43744
Everything: adding sensor named motion1
Everything: Free RAM = 43744
Everything: adding sensor named smoke1
Everything: Free RAM = 43744
Everything: adding sensor named relaySwitch1
Everything: Free RAM = 43744
Everything: adding executor named alarm1
Everything: Free RAM = 43744
Everything: adding executor named switch1
Everything: Free RAM = 43744
Everything: initDevices started
Everything: Free RAM = 43744
PS_Water::Analog Pin value is 12 vs limit of 200
Everything: Sending: water1 dry

I have removed some of the Wifi/Mac details from the log but you should see that it is logged exactly as expected then the exception / stack error.

The above is with nothing wired to the board except USB from my Macbook pro directly. static IP has been set for the device on my Airport Extreme router so I am struggling to see what could be causing it.

Appreciate the help, I have so many use cases for this project but just cant seem to get it working in a stable way at the moment.

Interesting development… I had my nodemcu attached to a blank breadboard, ive since removed it and it now seems stable when running the default script!? Perhaps something within the breadboard were causing bad connections?

Ill continue testing and get back to you!

1 Like

Left it for an hour on a new breadboard and it seems much more stable but still occasionally seeing this:

ets Jan  8 2013,rst cause:4, boot mode:(3,6)

wdt reset
load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
v3de0c112
~ld 

Then it connects again and back to normal, anything to be concerned about?

1 Like

I have never seen this issue previously. Can you post a link to the exact ESP8266 board you are using? I have two different models that I have used, and I would like to make sure I am testing with the same model as you, if possible.

1 Like

I have been doing a little more research, and it appears that the ESP8266’s Watchdog Timer is somehow detecting that your board has locked up and has automatically reset it. Can you please run a test where you comment out all of the ST_Anything devices in the setup() routine except 1 contact sensor?

I loaded up another NodeMCU ESP8266 this morning with the standard ‘multiples’ example sketch and it has been running without any issues.

I am wondering if you somehow have a different version of a supporting library (like the DS18B20 temp sensor) that is somehow causing issues. Using just a single contact sensor will ensure that no additional 3rd party libraries are being used.

The only other differences I see is that you’re using a Macintosh and an Apple Airport Extreme Router. Not sure why that would matter, but it is different from what most people use. I use a Windows 10 PC and an Asus router.

Thanks ill do some investigating on that as well, I really think it is breadboard related for me at the moment but not sure. Now trying my RC Switch project with the transmitter connected directly to the board and it seems stable, only issue is that the switch is not showing in SmartThings, I presume that executer switches should be displayed?

static st::EX_RCSwitch executor1(F("switch2"), PIN_RCSWITCH, 1381719, 24, 1381716, 24, 174, 1, 15, LOW);

Thats my line and look at the serial monitor I can see that is reporting as switch 2 off as expected but i refresh the parent device I created in smartthings and cant see the button to switch it show up?

does a L9110S work whit st_anything?

ST_Anything does not have support for the L9110.

Yes, the RCSwitch executor should appear as a child of your parent device in ST. I have not tested that device for a very long time. If I find some time, I’ll give it a quick test to see if it still works as designed.