Announcing the "ST_Anything" Arduino/ThingShield Project

Since I already have the system running and it has been running great under the old board does anyone know if you can set this up to openand close a damper and turn off and on a fan on a fresh air duct that I am going to through into my HVAC system. I would like to be able to open and close at a percentage based on voltage.

I have the same problem. After about a week it freezes but the networking is still responsive. I originally had the ESP-01 then tried it with the w5100 shield and same issue on both the new and old st_anything code versions. Sucks cause I really love this setup. In order to get it working I have to power cycle the board and then it repeats

I will try to look at this issue in more depth once I finish getting the ThingShield v2.5 code released.

If you leave a Serial Monitor window up and running, do you ever see the “Free Ram” get consumed? There is always a possibility that I have a memory leak in the v2.x LAN based connectivity software. Personally, I am still using a ThingShield on my primary deployment, running very old code.

It may be possible, but we’ll need a little more information…

Turning the fan on/off is easy. Just use one of my EX_Switch devices. Connect a relay to the digital output and then connect the fan to the relay dry contacts to turn power on/off. Obviously, the Arduino cannot supply enough power to run the fan at the correct voltage/current. That is what the relay is for.

As for adjusting the dampers, that depends greatly on what type of signal the damper expects? The Arduino does not have a true Analog Output which would vary voltage from say, 0 to 5 volts. The Arduino’s “AnalogOuput” routine is used to generate a PWM output signal. I am sure you could add a true analog output chip to the Arduino, but then you’re going to need to write some code to integrate it.

Sounds like an interesting project.

1 Like

All, I have just released v2.6 of ST_Anything with support for the new Parent / Child Device Handlers for the old ThingShield. Check it out at

Arduino Pin Out is 5 Volts and you have it going directly going into the ESP8266 that is 3.3 Volts. ESP8266 may have some protection to 5V, but I conjecture that it eventually overheats/overloads with continued 5V input.

See: Arduino to ESP Connection

You need a FTDI serial adaptor or some resistors like:

http://www.martyncurrey.com/wp-content/uploads/2015/01/Arduino-to-ESP8266.jpg

On a side note, the ESP8266 should NOT be powered off the Arduino. (This makes me sad too.)
Arduino DC Current for 3.3V Pin 50 mA (Maximum current draw is 50 mA) -> ESP8266 can draw 200mA+ “Maximum current draw is 300 mA, so use a supply that can supply 500 mA to be safe. More is better. A weak or poor quality supply will cause the board to reset unexpectedly and make debugging difficult.”

Something else to consider: Power Supply. Make sure your power supply is adequate for Maximum draw (Amps) as it could run days on normal draw. Most times inadequate (low) power causes bugs and not a complete shutdown.

1 Like

It has free ram of 6558 and it still reads the sensors correctly on the serial monitor and responding to networking. The issue seems to be sending to smartthings hub for update. I didn’t get to check the logs on the hub yet. What do you think?

Just a list of brainstorming/troubleshooting ideas/questions…

How often does the issue occur? x hours? x days?

Do you have numerous LAN based devices connected through the HUB to ST? I saw in another thread that there may be a limit to how many LAN connected devices the hub can support.

How frequently are you sending updates from the Arduino to ST for your Polling Sensors?

How reliable is your internet connection?

Can you still ping the Arduino and the Hub from a computer on your LAN when the problem occurs?

What version of the Arduino IDE are your using?

So, I found something very interesting this morning on my Arduino MEGA+ESP01 bench system. The MAC Address reported in the Arduino IDE’s Serial Monitor window was different that what I saw in the ST IDE Live Logging (All) for updates coming in from the MEGA+ESP01. Not sure how that happens… The first 10 digits were the same, just the last two were different. When I used the MAC address from the ST IDE Live Log, and typed it into the MAC address configuration field in the phone app for the parent device, all communications started working.

Note: I had to change my ESP-01 to a new one due to careless wiring on my part where I fried the original ESP-01. The original one’s MAC address matched in the Arduino IDE and the ST IDE. Just this new one has the issue of Arduino IDE reporting one value and ST IDE reporting another.

I will debug this more to see what is going on. I wonder if my ESP-01’s need newer firmware to fix a bug? Just a guess. My router shows the same MAC address as SmartThings, so it must be on the Arduino side…

@Garnet, @Rostik_Borenko, @Raymond_Lopez

I was able to fix the strange issue of displaying the incorrect MAC address for the ESP-01 when attached to the MEGA. I also updated the WiFiEsp library.

Please update both the SmartThings and WiFiEsp libraries. Not sure if this is going to help with the uptime issues some of your have seen or not. I think a quality 3.3V power supply for the ESP-01 is critical to performance and reliability.

I am wondering if th official Arduino WiFi shield would be a much more robust solution? Unfortunately I don’t have one and they seem to be very scarce. My W5100 shield has been very reliable.

This is awesome, thanks so much. I don’t 100% understand what you changed but mine Mega + ESP01 system has started to work reliably so far. Will post more updates soon.

1 Like

I’m currently using w5100 and its the same outcome as the esp-01. Did you change anything for the w5100 networking ?

No changes to the W5100 library. My W5100 is pretty solid, whereas my MEGA+ESP01 just locked up after running for about 7 hours. May have been due to Microsoft automatically rebooting my Windows 10 PC to install security patches though… I have a standalone ESP-01 that’s been running all day without any issues, although it has dedicated 3.3v power so it wasn’t impacted by the PC reboot.

Can you send me a copy of your sketch via private message? I’d like to look at it to see if anything jumps out that could cause the W5100 communication issues.

SENT, thanks again

1 Like

I am working on adding support for the Arduino Ethernet2 (W5500) shield, as well as the Adafruit ATWINC1500 WiFi Breakout module. This will provide 2 additional LAN connection options for the Arduino MEGA/UNO.

I am also working on trying to figure out why the MEGA+ESP01 sometime locks up.

Stay tuned… :slight_smile:

1 Like

Hey Dan,
I started using your first version by following a guide someone had created long time ago. But upon reading a few weeks I was able to figure how to use arduino and set up a contact sensor to work properly with my alarm system. My question is I am unable to figure out how to use a beep siren with this setup. For ex: With the traditional system if I opened any door when system was unarmed I would hear a beep letting me know a door was opened. How am I able to do that with this software.

one way you can do it, is if you have sonos. You can have it say any phrase or sound when a sensor opens and closes.

1 Like

@heyitzjesse

Can you explain how you have things wired up a little? Are you using two different sirens, one for an Alarm and another for the door “beeps”? Or just one siren?

By far, the simplest thing to do is simply have ST send a Push notification to your phone(s) every time a door is opened. Thus, you’d get a quick audible notification.

If you have two sirens, the below suggestion works very easily. (Even if you have just one siren, you could use 2 different relays, either one of which could turn on the siren, as long as you wire them in parallel.)

You could pretty easily add some simple code to the “callback()” function in the Arduino sketch which would “see” any door being opened, and then it would trigger a Timed Relay device. The Timed Relay device is nice because you can determine how long the relay is left on before it automatically turns off. You could even make it do a short sequence of beeps if desired. (Read the comments at the top of the EX_TimedRelay.h or .cpp file to see what each argument of the constructor is used for.)

Using the local “callback()” routine to do this has the advantage of 100% local control within the Arduino code. Even though it runs locally, it also properly updates the ST cloud.

Here is an UNTESTED example, which assumes your contact sensors and timed relays are named per my new naming convention required for use with the Composite (Parent/Child) Device Handlers.

//******************************************************************************************
//st::Everything::callOnMsgSend() optional callback routine.  This is a sniffer to monitor
//    data being sent to ST.  This allows a user to act on data changes locally within the
//    Arduino sketch.
//******************************************************************************************

void callback(const String &msg)
{

  Serial.print(F("ST_Anything Callback: Sniffed data = "));
  Serial.println(msg);

  //TODO:  Add local logic here to take action when a device's value/state is changed


  //NOTE:  you may need to play with the logic below to get the behavior you desire!!!
  if (msg == "contact1 open") {st::receiveSmartString("relaySwitch1 on");}
  if (msg == "contact2 open") {st::receiveSmartString("relaySwitch1 on");}
  
}

Heads-up ST_Anything v2.x users…

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.