Wanted: ST Arduino Shield

I have found same thing, multiple sensors of same type are not easy to handle. However you can easily add many different sensors (contact,temp, humidity, motion,etc) so long as just one of each (with Arduino/esp8266 at least, don’t know about ZigBee shield)

To have multiple sensors of the same type requires you to use a different endpoint for each within zigbee home automation profile. I am not sure how this can be done on the arduino things shield. Hopefully when I get my finger out and sort this replacement solution for the thing shield I will be able to help further.

Well, I had planned to use this excellent tutorial: http://kendrickcoleman.com/index.php/Tech-Blog/total-noob-guide-to-move-your-old-wired-security-system-to-smartthings.html

He is splitting the zigbee response and breaking it down into parts thus creating the multiple endpoints. He is able to register as many devices as you have inputs on one ThingShield.

This is why I am dying to get my hands on a ThingShield. I am willing to pay double or even triple the original cost for one.

Edit: Heck, at this point, name your price and I will listen.

That definitely looks like a promising solution. Bookmarking for future reference…

I know, right?! So if anyone wants to get rid of their ThingShield, hit me up. I have cash in hand. :smile:

Here is my new version of the ST_Anything and SmartThings Arduino libraries, with added support for Ethernet/WiFi connectivity - no ThingShield required! Hope this helps!

1 Like

This might be a viable solution to my expensive contact sensor problem :wink: Time to dig out the ESP-01s again…

1 Like

FYI - All of my testing was done with a NodeMCU ESP8266-12E board. Not sure about the ESP-01…???

The ESP-01 is one of the original variations of the ESP platform. The 12E is a custom board with some additional helper parts and an ESP soldered on board (I can’t remember which one… 06/07 or 08). Any of the ESPs will work as long as they have at least 1Mbit or more flash… some may be more challenging to program than others. The 12E comes in 512Kbit, 1Mbit and 4Mbit flavors depending on where you buy it from.

esp8266.com has a comparison chart with the different versions.

2 Likes

Kelly,

Question for you… Were you hoping to use the ESP-01 as a WiFi board attached to an Arduino? Or as a completely standalone controller?

I am using a NodeMCU v1.0 board which has an ESP8266-12E on it. This has significantly more I/O that an ESP-01.

Just curious… :slight_smile:

Dan

Dan,

For the 12e, am I correct that it can only monitor up to 6 sensors then you add another board? Would I be able to use 8 boards to monitor everything with ST_Anything?

No problem… let me go back a little bit and explain how I’ve integrated them with ST before. I had two devices that I wanted to integrate into ST – a water sensor in my water closet (I have a pressure tank, water heater, etc in a closet) and my existing hard-wired alarm system. Not so much the alarm, just the contact sensors.

To preface, I do realize there are sensors for the water closet but I was cheap at the time and it worked for the time I needed it. I later switched it out to a Z-wave sensor. Initially I was going to modify contact sensors for the alarm system but realized quickly to get 14 zones was going to be very expensive. At the present, I only have one Z-wave contact sensor in place.

So to make all of this work I had to setup an MQTT broker on a linux box that served as the communication bridge between my devices and ST. This broker would accept messages from the ESP devices and then relay it to ST and vice-versa. ST would have the broker registered as a device and communicate with it locally on the network.

I started out with the water closet sensor. This was intended to be a simple, single I/O headless device. To accomplish this I used an ESP-01 with 512Kbit of flash. I removed the NodeMCU firmware and flashed the Arduino firmware to it. It was fairly simple code that ran a simple web server (for debugging and stats) and an MQTT client that pointed to the broker over WiFi. When the sensor contact was closed, it would send a ‘1’ to the MQTT broker at a specific address, ‘0’ if it was open (default state). The sensor was connected to one of the I/O input pins across a modified soil moisture sensor. I ground down the bottom ‘points’ of the sensor so it met the concrete flat and would detect a small puddle about 3/4" in width. This was all put into a small project case and mounted on the wall with a power LED and a wall wart for power. Because of the small amount of flash on the ESP-01, OTA programming was not available so I had a few jumpers to put it into programming mode for reflashing.

The alarm system was originally a DSC 8-zone system that I completely tore out. I rewired the zones to create 14 zones for additional detail (splitting windows vs doors, for instance) in each room. Three ESP-12E boards with 4Mbit each were used with each having its own set of code based on the inputs/outputs of that particular board. The software was similar to the water sensor in that each was reflashed with Arduino and ran a web server, MQTT client and WiFi client. Because of the additional flash, these boards allowed OTA programming directly from the Arduino software which was great when updating code. One of the boards had an output programmed and would listen for MQTT messages for an external powered siren I have in the attic. When triggered, it would turn on the output which would trip a relay board and 12v would be applied to the siren. This was a bit finicky because of how the 12E handled its outputs during reboots and needed some massaging to work smoothly. The whole unit was powered by a 12V supply and then a 3.3v/5v regulator board was used to power the ESPs and relay board. Each alarm contact was tied to one of the I/O pins on one of the three boards and mapped to ST accordingly through MQTT.

All in all the system worked alright for the most part. Some logic was put in place to reboot the ESPs when WiFi was lost or the MQTT broker disconnected. Additional logic was put in place for debouncing, ST errors and stale sensors but ultimately it was never really a clean solution. One of the biggest problems is that the ESP is a single-threaded finicky beast. For instance, if you’re running a lightweight HTTP server on it and make a request, it will pause the entire CPU while it produces the output for the connection. Fine for monitoring a plant or watering your hermit crab tank but not good when you need near real-time sensor monitoring.

Now that I’ve mentioned where I’ve been… with your info, here is where I’d like to go…

Through the first setup I learned that combining all of the contact sensors on two or three boards was a bad idea. These little boards just work better when given a single task. The water closet sensor was this way and quite frankly, I never had to touch it. While it will take additional IPs on the network, I’m going to use ESP-01s because a) they’re cheap at $1-2 each and b) they work great for single sensor usage and put one on each contact sensor. This will result in 14 ESP-01s in the closet and that should cover all of the zone inputs. While this seems like a lot of sensors, it should get around ST’s lack of one-to-many sensor support as well. The siren output is being covered by existing Z-wave sirens that are now installed.

Some of this is still tumbling around in my head until I get things out and play around again… but hopefully it clears up some of my madness :slight_smile:

1 Like

Kelly,

Great information! Thank you for taking the time to share. I am very interested to hear if my new “SmartThings v2.x” library will run on the ESP-01 boards. Keep me up dated on your progress. I like the tiny form factor of the ESP-01s, and the “single purpose” idea as it definitely helps with the one-to-many ST limitation. My “Multiplexer” SmartApps and Virtual Devices also resolve the one-to-many issue.

I will say that I am very impressed with the ESP8266-12E as well. So far, so good. I am contemplating replacing my current UNO R3/ThingShield which monitors 6 doors reed switches, 1 DHT22 for Temp/Humid, and controls 2-relays (garage doors) with a single ESP8266-12E board. It appears to have enough I/O to handle everything. I may even add a photoresitor for luminence using the single Analog Input channel on it. For about $10, that’s quite a powerful little package!

My “ST_Anything v2.x” library (which uses my “SmartThings v2.x” library) handles all of the pin monitoring/updates and bi-directional communications for you. For some, this removes too much control, as they want to code their own solution. For others, it provides a robust and quick way to get started. Both libraries are written C++ with the goal of being added to to support additional sensors (ST_Anything) and communications methods (SmartThings). Again, the “SmartThings” can be used as a standalone package. I have included example sketches for this purpose (in the examples folder of the Arduino library) as well as the corresponding groovy Device Handler code in the extras folder. The ReadMe for “SmartThings v2.x” explains how to use this library independent of the ST_Anything library.

Have fun!

Dan

1 Like

@munsterlander

It is my understanding that the NodeMCU v1.0 ESP8266-12E boards have 11 usable Digital I/O pins, as well as 1 Analog Input pin (not sure if it can be used as a digital input pin or not.) I have not personally tried to use each of these pins as I just got this working over the past few days. I have used D0, D1, D3, D4 and A0 during my testing without any issues.

Here are the #define statements I include in my ESP8266 sketches to make it easy to refer to the pins on the NodeMCU board based on the printed text of the baord.

#define D0 16
#define D1  5
#define D2  4
#define D3  0
#define D4  2
#define D5 14
#define D6 12
#define D7 13
#define D8 15
#define D9  3
#define D10 1

And here is the image of the NodeMCU v1.0 ESP8266 board I am using (~$10 on Amazon.)

I have three thing shields I could part with.
Pm me if interested.

I have three available, pm if interested.

Mike,

I would like to purchase one of them from you and have it sent to zip code 30028. Can you give me a price?

@xcesmess

Kelly,

Inspired by your use of the ESP-01’s, I bought a few to play with. I have just released a new version of both of my “SmartThings” and “ST_Anything” libraries (v2.1) that support using the ESP-01 as a WiFi module for an Arduino MEGA. Next step will be to see if I can actually run my ST_Anything library directly on the ESP-01 the way I can with the NodeMCU v1.0 ESP-8266-12e boards.

Thanks again for sharing your work!

@xcesmess

Kelly,

Tonight I was able to load one of my ST_Anything example sketches directly on to a ESP-01 board successfully! I have 2 GPIO pins happily transferring data to the ST Cloud via WiFi. Talk about a very low-cost solution! This is great! Thank you so much for sharing your ESP-01 experiences.

It definitely takes more work to get the ESP-01 wired up to be programmed as compared to the NodeMCU v1.0 ESP-8266-12e boards. But once done, it runs exactly the same, albeit with much more limited I/O.

Thanks again!

Dan

Great! I’m glad you got it to work… I’ve been meaning to test things out here but life got in the way :slight_smile:

You are correct… the ESP-01 is a bit of a bear to wire up but once you get it, it works smooth. I ended up putting reset and program switches on my mainboard and then a 5-pin header for the FTDI board so it is a bit more manageable.

1 Like