Announcing the "ST_Anything" Arduino/ThingShield Project

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, @anon69466676, @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.

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…

@Garnet @Raymond_Lopez

I have just released v2.71 of ST_Anything which includes the long awaited fix for the Arduino + ESP01 (for WiFi only) configuration. Note - the new version of ST_Anything now requires the Arduino IDE’s Serial Monitor window to use 115200 baud rate. This one change made the single biggest impact to resolving the issues I was able to reproduce with respect to reliability when using an Arduino + ESP01 combination. I have also added automatic reconnect logic in the event the WiFi signal is lost.

v2.71 also adds support for the Arduino MKR1000 board AND the WiFi101 shield (or Adafruit ATWINC1500 breakout board). Note: v2.7 added support for the Arduino + W5500 Ethernet Shield as well.

Adding all of these Ethernet/WiFi combinations required me to break apart the one single SmartThings communications library into multiple smaller libraries to avoid compiler/linker issues. Make sure you get all of the new “SmartThings…” and “ST_Anything…” Arduino libraries and replace (do not merge!) your old ones.

As usual, feedback is always welcome and appreciated!

Dan

This is great. I’ll be sure to check it out.
Thanks for all your work!

1 Like

New ST user here and I just want to give a big thanks to Dan. Following his detailed instructions, I was able to get the ESP8266 up and running in a couple of hours and that’s starting from zero. Now on to the project of connecting my alarm panel (GE Concord 4) to ST.

1 Like