Announcing the "ST_Anything" Arduino/ThingShield Project

You all should seriously look at ESP8266/NodeMCU :slight_smile:

wired alarm alarm retrofit

contact sensor

What would be cool, if I ever can find time, would be to make a generic arduino firmware that sent all the ESP8266 pin and analog status to SmartThings. Then have a configurable SmartThings DH that let you configure what each pin on ESP is doing:
ADC0=light sensor
GPIO1=DHT22 temperature/humidity
GPIO2=contact sensor
GPIO3=motion sensor
etc…

The DH selectable options could be numerous for each GPIO…
-ANALOGIN-Gas Sensor
-ANALOGIN-Light Sensor
-IN-DHT-22 Temperature/Humidity
-IN-Contact
-IN-Motion
-IN-Leak
-OUT-LED-Red PWM
-OUT-LED-Green PWM
-OUT-LED-Blue PWM
-OUT-Buzzer
-OUT-Relay

Hi Dan,

does your work with the Ethernet shield and the ESP8266 still use the Samsung Hub? or are we bypassing the hub and going directly to the Cloud?

Thanks

Ben

My plan is to still use the ST Hub. This prevents the need for an OAUTH SmartApp and provides seemless bidirectional communications. Again, my goal is to replicate the ThingShield functionality, passing strings between the systems.

2 Likes

Hi Dan,

with the Ethernet shield, do you envision a hard line connection to a Router/switch that the Hub is connected to?

With the ESP8266 Wifi connection to the Hub or to a Wireless router?

Thanks

Ben

The device just needs to be connected to the same home network as the hub. It doesn’t matter how you connect, cat5 or wifi.

The hub only communicates via a hard wired cat5 connection to your home router. Your router will provide the wifi capability, not the hub.

Hi Dan, please see

Your comments are appreciated

Ben

1 Like

I know this is an old post but I am getting confused reading through all the threads and I am wondering if anyone has a detailed write up on how they successfully used “ST anything” with wired sensors from their alarm panel. If anyone has a step by step that would be awesome.

this was an awesome write up until, smartthings decided not to produce the thingshield anymore. looking for another way.

All - I have some good news! I have successfully added Ethernet support to the ST_Anything/SmartThings libraries. I have it working properly on my desk. Happy to report that Ethernet appears to be quicker than the ThingShield as well. I need to do some more testing and write up some new documentation to explain the changes needed within your Arduino sketches. I hope to have everything uploaded to Github this weekend.

To give you a feel for the changes…

Since, ST is no longer supporting the ThingShield and its Arduino library, my son and I decided it was alright to break backwards compatibility in the name of progress. There is now a class hierarchy which you should be aware of, however it really is pretty simple to use still. The same basic functions are all still there. Just the name of the class for the old ThinShield has changed from “SmartThings” to “SmartThingsThingShield” to make it clear which device you are using. And, I’ve added support for the W5100 Ethernet shield as well as the NodeMCU ESP8266 Wifi board to provide a couple methods of using Ethernet.

SmartThings
----SmartThingsThingShield
----SmartThingsEthernet
--------SmartThingsEthernetW5100
--------SmartThingsESP8266WiFi

The classes in BOLD above are the ones you would use depending on how you’re connecting to SmartThings. Additional classes could easily be added for other methods of connecting to the ST Cloud. Currently, all three methods above send and receive all of their traffic via the ST Hub (v2 hub tested, not sure about v1.)

I know that wired Ethernet or WiFi may not be ideal for every application, but at least these will provide options for users who can no longer purchase ThingShields. There are some other efforts underway within the community to see if Xbee shields could be used to continue using Zigbee. I have chosen to focus on Ethernet and WiFi for now. If there is a need for another method/shield, we can easily add another subclass to the new SmartThings library as shown above.

Each class simply needs to support:

  1. the Callback Function to handle data from ST
  2. the run() command
  3. the send() command
  4. and a new init() command

I hope to have everything ready for a release sometime this weekend, schedule permitting. Please let me know if you have any questions.

12 Likes

To use “ethernet shields w5100” with your program should I also buy “Arduino UNO R3”. And if I have 8 contact sensor , I need add “Mega 2560”.??

To use “NodeMCU esp8266” do I have to buy another module to run your system. I would like to buy the hardware to try your system when it’s ready. Maybe put the amazon links of material necessary. I want to try both wifi and ethernet.

Thank you for your efforts for integrated this.

Good questions…

I bought my W5100 Ethernet Shield a few years ago on eBay. Here is an Amazon link to one that looks identical to mine. You need to be a little cautious and read the reviews on these shields as quality of the cheap clones can be an issue.

Currently, I only have an Arduino MEGA 2560 available for my testing. I strongly recommend getting a MEGA 2560 due to the increased RAM size versus an UNO R3. I have not tested Ethernet with an UNO R3 since my spare UNO R3 was put into service to replace one that was destroyed by lightning.

As for the NodeMCU ESP8266 board, here is the one that I am using currently. It’s the only one I have, so not sure if there are better alternatives or not.

1 Like

My Ethernet shield was missing connectors… just FYI if you can’t get Ethernet to work, there are an extra set of at the end that need to connect to the Arduino board. It’s been a while so I forget the details now.

This is really awesome! Thank you for all your efforts - I can’t wait to dig into this and see if I can’t get my old home security system wired into a shield that can integrate with SmartThings!

1 Like

Dan, you are awesome. I can’t wait to buy all the components and try. I’m very new to this. Thanks for your contribution.

This. Is. Awesome.

Thanks!

Just to be sure it is clear…

if you use a NodeMCU ESP8266, that is all you’ll need to buy. It can be programmed via the Arduino IDE and uses built in WiFi.

If you want to use an Arduino MEGA or UNO, you’ll need either a ThingShield or a W5100 Ethernet shield. I don’t have a Wifi solution for an Arduino as I don’t have a Wifi shield.

This evening I was successful in getting the ST_Anything library running on the NodeMCU ESP8266.

1 Like

I’m glad you mention this. Which solution is better and easier? Thanks.

It really depends on what your project is and how you want to connect it.

The Arduino MEGA + W5100 Ethernet Shield requires a hardwired Cat5 Ethernet connection to your home network. It has the advantage of using one of the most ubiquitous platforms on the market (Arduino) and runs at 5V TTL logic levels, allowing it to be used with a plethora of devices on the market. There is a huge community that has developed code for this platform, so finding help is quite easy. Also, the Arduino MEGA has 54 Digital I/O and 16 Analog I/O pins. The total cost for this solution is somewhere around $30 to $50 USD. This is a somewhat large solution compared to the NodeMCU solution.

The NodeMCU ESP8266 board is a much newer, smaller, less expensive product. It runs all of its I/O at 3.3V logic levels. It has 1 Analog and 11 Digital I/O pins, along with built-in WiFi for network connectivity. It is a very small package as well, and only cost ~$8 to $12 USD. Because of these features at such a low price point, it is fast becoming the go-to board for many small DIY electronics projects. It can also be programmed via the Arduino IDE, making it very easy for Arduino developers to use it without having to learn a new platform.

If you’re just getting started, just grab a NodeMCU ESP8266 board. It takes a little work to set up the Arduino IDE to work with this board, but that’s a one-time configuration/download. There are tons of guides online to show you exactly how to get started.

Hope this helps!

So to confirm the Ethernet Shield option would work just the same as the Thingshield in the project below that calls for Thingshield + Arduino Mega + AD2Pi .

So, there are a few things to be aware of if you want to try to use my new “SmartThings” library with that particular project, along with a W5100 Ethernet Shield.

  1. Of course, you’ll need a hard-wired Cat5 Ethernet connection for the W5100 shield.
  2. The Arduino sketch will need to include the new “SmartThingsEthernetW5100.h” header file instead of the old “SmartThings.h” header file.
  3. The Arduino sketch will need to create a “st::SmartThingsEthernetW5100” object instead of the old “SmartThings” object. This also requires you to define numerous TCP/IP network objects to be passed into the new constructor. Also, the new “init()” routine will need to be called in the Arduino setup() function to establish the network communications.
  4. The ST IDE Groovy based Device Handler will need some tweaks make to its “parse()” routine to handle Ethernet packets, instead of Zigbee. Also, every call to send data to the Arduino will need to be tweaked to send an Ethernet packet, instead of Zigbee.

I will release examples showing exactly what I am describing above to make it easier for you to modify your old Arduino and ST Device Handler source code.

In the case of the project you referenced above, I believe you should work with the original developers to see if they are willing to incorporate these changes for you and the rest of the community.

2 Likes