Announcing the "ST_Anything" Arduino/ThingShield Project

You’re doing it wrong! :wink: (just kidding, sort of…)

I don’t think I ever said I added support for using an Arduino with an ESP8266 chip to add WiFi capability.

I added support for an Arduino with a W5100 shield
OR
a NodeMCU V1.0 ESP8266-12E board

The NodeMCU v1.0 ESP8266-12E board is a standalone solution.

If someone wants to send me a ESP8266-01 WiFi module, I could look at including support for it as a WiFi shield for an Arduino. I just don’t have one to test with. I also do not have the USB to Serial adapter necessary to program the ESP-01 WiFi module, if that’s necessary.

Or, if you want to add support for the configuration shown above, you need to add a new Sub-Class under the st::Ethernet class within the SmartThings Library. You can’t really reuse the st::ESP8266WiFi class since that is designed specifically for running on the ESP8266 board. You’re trying to run on an Arduino, with an ESP-01 as a WiFi shield.

great! lol ok, so let me purchase w5100 shield and start all over. so
other than the wifi module. I should be on the right path?

Yes, but please realize that a W5100 shield is a hard wired Cat5 Ethernet shield. No WiFi.

SOLD! I will gladly send you a ESP8266-01 WiFi module as I’m about to place an order for more toy’s from AliExpress anyway. This looks like a really good option for larger projects. I had been investigating the Arduino WiFi shield, but they are twice the price of the ESP-01. (The Arduino WiFi shields are ESP8266 based anyway.)

Garnet,

Thanks for the offer. I actually just placed an order on Amazon for some ESP-01 modules. They should be here on Sunday. Looks like they should be fairly easy to integrate with an Arduino UNO or MEGA as a WiFi shield device.

Dan

@Garnet, @Raymond_Lopez

I have added support for the Arduino MEGA/ESP-01 hardware combination. See below:

you the man!

Is it possible to have this trip the following siren (see attached image of security panel). the siren uses 2 wires ground and positive.

You should be able to do this with a Relay Sample Relay on Amazon. It looks like it’s only 12 Volts, so you may be able to use an Arduino directly, but I wouldn’t take the chance as the relays are cheap. I believe that Arduino would use 5V relay and ESP8266 would need 3.3 volt ones, but the one I linked handles both. I would personally recommend using an ESP-01, Relay, and Ogiewon new ESP code which would make this a $10 project at most.
Good Luck

thanks sounds good, how would the wiring look like on this particular setup. the siren gets wired to the relay and then the arduino gets wired to pin 9 and ground from the relay ? im confused sorry.

You can decide which arduino pin you’d like to use by setting it in the sketch.

Here is a pretty close example of how you can wire a relay into an Arduino. The relay’s “dry contacts” would then act as a switch for your existing siren, regardless of the voltage (0v to 240v) without damaging the arduino’s digital output pin. As @Garnet mentioned, make sure you choose your relay depending on whether you use a 5v or 3.3v microcontroller.

thanks will follow this once the relay gets delivered. in the mean time i am uploading the esp01wifi sketch and still getting the following:

ip address does not name a type

any clue?

Are you trying to do the whole alarm panel? Or just the siren? Getting an ESP-01 running all by itself takes a bit of work and familiarity with circuits. The NodeMCU v1.0 ESP8266 board is MUCH simpler use and has more digital I/O pins (9 vs 2). If you need even more I/O, an Arduino MEGA is the way to go.

To get either ESP based board to compile, you must add the board support package to the Arduino IDE and select the correct board type. Google it as there are a ton of guides out there. Also, make sure you install all of the libraries from my repository. You should also be running Arduino IDE v1.8.1 or newer.

i have a ESP board already monitoring hard wired contact sensors, im just using this for the siren portion of it. Im just confused with understanding the sketches to use and implementing this. Ill give it another go but at this point just looking to buy a zwave fortrezz mimolite relay to activate my siren. even though its super expensive but probably would save me the headache.

Help :slight_smile:
I seem to have a small disconnect here’s what I have:

NodeMCU programed with
D1 Switch
D2 Contact

Thing
"Node_Device" IP xxx.xxx.xxx.xxx /MAC/Port 8090
with
"ST_Anything_Ethernet" Handler

Using Simulator I get these results:
Send Commands ON/Off I can see the NODE receives ON/OFF in Serial Monitor but no action taken

Physical NODE:
Change the Contact state “serial out sniffed data on/off” seen in serial monitor
the Device Handler logs remain unaware of any changes.

any suggestions? I don’t think I am at the stage for the ST_Anything application yet, but when I do try and set it up and save it never retains my settings.

I am a little confused with what exactly you have set up currently. My advice is to simply start with the ST_Anything_ESP8266WiFi.ino sketch on your NodeMCU ESP8266-12e based board.

Inside that sketch, edit the lines that are labeled “You must change this line!” to match your home network configuration. Using the Arduino IDE v1.8.1, compile and load the sketch on your NodeMCU ESP8266 board. Use the IDE’s Serial Monitor window to watch the NodeMCU boot up, and take note of the MAC address that is printed out.

Load the “ST_Anything_Ethernet.device.groovy” Device Handler into the ST Web Based IDE as new Device Handler. Manually add a device using this Device Handler, and give it a name. Then use the ST App on your phone to edit the config for this new device, typing in the NodeMCU ESP8266’s IP Address, Port, and MAC Address (no delimiters.) Save the changes and then click the “Configure” tile for this device (on your phone’s ST app.)

At this point, you should have 2-way communications established. Reboot the NodeMCU ESP8266 board for good measure to make sure it updates all of the tiles in the device.

Once you reached this point, you can start making modifications specific to your application.

Note: I never use the simulator feature in the ST web-based IDE, so I can’t help you with that. I do use the “Live Log” feature extensively to see the flow of data.

These instructions are detailed in the two ReadMe files (one for the “SmartThings” library, and the other for the “ST_Anything” library. The latter uses the prior.)

Dan,

thanks for responding and the write up.
I had done all those steps except I had used the IDE to input the
IP/MAC/Port.
So I deleted that device and created a new one and then used the phone app
to input the variables. Now I get error in app, see attached.

info direct out of router:
ESP_122084
192.168.2.149 A020A6122084
http://standards.ieee.org/cgi-bin/ouisearch?A020A6
SmartThingsHub
192.168.2.44
any ideas?
Thanks!!! Kenneth

Not sure why the Device Handler is throwing that error. I can’t see the last few items on the page. Make sure you have data entered for all 6 fields. Did you modify the Device Handler in any way?

Also, you can’t name things “contact d2” and “switch d1” in your Arduino sketch. This will not work as my parse() uses a space as a delimiter. If you only have one contact sensor and one switch, simply leave them named “contact” and “switch” in the sketch as this will match the names in the Device Handler.

Please use the examples without modification, except for where it says “You must change this line”, as well as the pins you want to use on your device. This will get you started. Afterwards, comment out the extra devices in both the Arduino sketch and the Device Handler.

still getting ‘IPAddress’ does not name a type. after editing all lines that require editing. any ideas (see below output)

Arduino: 1.8.1 (Windows 10), Board: “Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)”

ST_Anything_ESP01WiFi:58: error: ‘IPAddress’ does not name a type

IPAddress ip(192, 168, 11, 209); //Device IP Address // <—You must edit this line!

^

ST_Anything_ESP01WiFi:59: error: ‘IPAddress’ does not name a type

IPAddress gateway(192, 168, 11, 1); //Router gateway // <—You must edit this line!

^

ST_Anything_ESP01WiFi:60: error: ‘IPAddress’ does not name a type

IPAddress subnet(255, 255, 255, 0); //LAN subnet mask // <—You must edit this line!

^

ST_Anything_ESP01WiFi:61: error: ‘IPAddress’ does not name a type

IPAddress dnsserver(192, 168, 11, 6); //DNS server // <—You must edit this line!

^

ST_Anything_ESP01WiFi:65: error: ‘IPAddress’ does not name a type

IPAddress hubIp(192, 168, 11, 153); // smartthings hub ip // <—You must edit this line!

^

C:\Users\raymond.lopez\Documents\Arduino\Sketches\ST_Anything_ESP01WiFi\ST_Anything_ESP01WiFi.ino: In function ‘void setup()’:

ST_Anything_ESP01WiFi:126: error: expected type-specifier

st::Everything::SmartThing = new st::SmartThingsESP8266WiFi(str_ssid, str_password, ip, gateway, subnet, dnsserver, serverPort, hubIp, hubPort, st::receiveSmartString);

                                ^

Multiple libraries were found for "PS_TemperatureHumidity.h"
Used: C:\Users\raymond.lopez\Documents\Arduino\libraries\ST_Anything_TemperatureHumidity
Not used: C:\Program Files (x86)\Arduino\libraries\ST_Anything_TemperatureHumidity
Not used: C:\Program Files (x86)\Arduino\libraries\ST_Anything_TemperatureHumidity
Not used: C:\Program Files (x86)\Arduino\libraries\ST_Anything_TemperatureHumidity
Not used: C:\Program Files (x86)\Arduino\libraries\ST_Anything_TemperatureHumidity
Multiple libraries were found for "dht.h"
Used: C:\Users\raymond.lopez\Documents\Arduino\libraries\DHT
Not used: C:\Program Files (x86)\Arduino\libraries\DHT
Not used: C:\Program Files (x86)\Arduino\libraries\DHT
Not used: C:\Program Files (x86)\Arduino\libraries\DHT
Not used: C:\Program Files (x86)\Arduino\libraries\DHT
Multiple libraries were found for "SmartThingsESP8266WiFi.h"
Used: C:\Users\raymond.lopez\Documents\Arduino\libraries\SmartThings
Not used: C:\Program Files (x86)\Arduino\libraries\SmartThings
Not used: C:\Program Files (x86)\Arduino\libraries\SmartThings
Not used: C:\Program Files (x86)\Arduino\libraries\SmartThings
Not used: C:\Program Files (x86)\Arduino\libraries\SmartThings
Multiple libraries were found for "Constants.h"
Used: C:\Users\raymond.lopez\Documents\Arduino\libraries\ST_Anything
Not used: C:\Program Files (x86)\Arduino\libraries\ST_Anything
Not used: C:\Program Files (x86)\Arduino\libraries\ST_Anything
Not used: C:\Program Files (x86)\Arduino\libraries\ST_Anything
Not used: C:\Program Files (x86)\Arduino\libraries\ST_Anything
exit status 1
’IPAddress’ does not name a type

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

My guess is that your Arduino libraries folder may be messed up somewhat, based on the later errors shown in your post above. Or, you may have copied the libraries to two locations? Can you try another computer that has never had the Arduino IDE installed yet? Install Arduino 1.8.1, then copy my github …Arduino\libraries folder to your c:\users\username\Documents\Arduino\libraries folder. Then do the same for the …Arduino\Sketches folder.

You should be able to then open one of the sketches and simply compile it, without even hooking up an Arduino.

© 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.