[RELEASE] ST_Anything - Arduino/ESP8266/ESP32

Yes, all device state changes are automatically updated to the ST Cloud, assuming you don’t change things manually in the Arduino code without having ST_Anything do it for you.

Please post your code and I’ll take a look. Make sure you highlight it and click the “pre-formatted text” button in the menu bar. This prevents the code from getting screeed up.

hrmm the code still went full screen

well i tried in the forum but it still went 4 pages, i’ll just send you the
.ino here.

Thanks

Adam

@hwac I have sent you a Private Message…

Wow - firstly, Dan, what a spectacular job you’ve done here.

I have an old Alarm system. 5 Doors, 3 PIR, 2 Panic buttons and 2 sirens - one indoor, and an old bell outdoor.

Here is a picture of the alarm control board.

I have a sneaky feeling that your ST_Anything might well be the right platform for me to convert this old system into a SmartThings Home Monitor Alarm. I could technically do cool things like “when armed, on door open, take CCTV recording” etc.

My first (1) question is, am I at the right place? Can ST_Anything work for this use-case?

If yes. I assume I’ll need lots of inputs, possibly two pins for each alarm device, so my second question (2) is the Mega with a WiFi board is my only option here? [as it has 50 or so pins?]

I’m building a shopping list of things I’d need to buy - bearing in mind I’ve never done this before and own nothing relating to Arduino - (3) If it’s no trouble, can you confirm or add/remove items from my list please?

Then I’ll need some software, Arduino IDE, your libraries, and then the ST_Anything_WiFiEsp.ino sketch. I’ll follow your readme for installation instructions. Hopefully it’s noob proof :grin:

I suppose, once all that is bought and installed, (4) I just pull off the wires from the Alarm PCB and pop them into the Mega [they are labelled]? Surely there is more to it?

I’m also worried about power, reading this thread shows things like 3.3v and 12v etc. Here is a picture of the battery and the mains power incoming -

(4a) Would you be able to expand more on how to bring the two together, old Alarm PCB and Mega?

Let me know if I’ve taken this too far down into noob basics, or if this has already been discussed over and over before [though I couldn’t find anything - wrong search terms?]

Cheers.

1 Like

You might want to take a look at this.

I used it to replace my DSC alarm system. I’ve got 3 doors, 3 window zones, and a siren hooked up to it. I hope to eventually tie in my smoke detectors. You can use additional ESP8266s if you need more I/O pins. (I think 6 to 7 is the most you can connect to a single board.)

1 Like

@Vyker

Yes, you can very easily use the ST_Anything library to integrate an old alarm panel with SmartThings. Are you planning on continuing to use the old alarm panel, or just replace it it completely and use SmartThings instead? Your wiring plans will depend greatly on which approach you are planning to use. It is much simpler if you simply disconnect the sensors from the old panel and just connect them to the Arduino MEGA or NodeMCU ESP8266 board.

I am actually working on a new and improved version of ST_Anything which greatly simplifies the installation and setup of the system. I will be posting more information here in this thread very soon.

By far, the easiest hardware to integrate is a NodeMCU ESP8266 board ( http://amzn.eu/4iF1bCy). This is an all-in-one solution that includes a microprocessor, WiFi, and general purpose I/O pins. Using an Arduino MEGA is a bit more complicated, unless you can use hard-wired Ethernet via a W5100 shield (http://amzn.eu/ifDnNI3.) You can also use an Arduino MEGA with an ESP-01 WiFi board (like the parts you have linked in your message), but it takes a lot more wiring (not the best first choice for a noob, but it can be done.)

As for power, you’re going to have to decide which pieces of the old system are staying and what is leaving. Personally, I would probably start simple with a “mains-powered” USB power supply. This can be used to power either an Arduino MEGA or a NodeMCU ESP8266 board. Best to get everything up and running on the work-bench and then figure out exactly how to integrate with the old sensor wiring.

You do not need two pins per sensor. You really only need one pin per sensor, with the other wire from each sensor all attached to a common ground pin. The door/windows sensors are pretty trivial. The PIR sensors from the old panel will probably need to be powered independently, as the new microcontroller will most likely not be able to power them. You’ll also need to figure out the power requirements for the sirens, which will most likely need relays to activate them. None of this is too difficult, but it does take some basic electrical skills with a voltmeter to figure out it all out.

Hope this helps get you started. I am happy to help out where possible. Again, stay tuned for my upcoming release which makes most of the setup semi-automagic/plug-n-play.

Dan

3 Likes

Hi ogiewon,

It would be great to see basic on/off/dim levels/RGB setting, as well as some simple “scenes” for neopixels. I’ve seen some apps that have a color selecting wheel where you can scroll through any possible color. Not sure how do-able it is, but I think having a memory functionality to the color setting would be helpful between power on/off of the ESP8266 board, or at least on/off of the LEDs themselves. Perhaps a fade between selections as well, rather than stark, immediate color or dim level changes? Just some thoughts!

It would also be great to have a setting that will slowly fade each LED randomly through several color options. For example, you could select a few different shades of blue and the strip would randomly fade each LED through the different blues for a bit of a random wave effect? Not linear down the strip, but random fades… I’ve seen some examples and it looks pretty relaxing.

The Adafruit neopixel library and FastLED library also have some interesting effects. I think all of these could be as simple as writing the effect code and storing it on the ESP8266, and then use Smartthings to trigger a call to the ESP8266 and run the effect with the chosen colors.

I would be happy to find some of these code sections if it would help! I would really love to see neopixel support on ESP8266 get implemented to Smartthings, even on/off/dim/RGB color for now. The possibilities are endless for home lighting accents.

Thanks for all of your work on this!

Apologies if this is a dumb question, but when creating a virtual device, what is entered into “device network id”?

Any unique string is fine.

I have a new version coming out very soon that eliminates the need for virtual devices and the multiplexer application!

1 Like

Dan, That’s awesome. You’ve really done some amazing work to get this out. Thank you so much!

1 Like

Thanks very much for your reply.

Looking forward to this now.

Dan, this work you have done is exactly what I’ve been looking for; so thank you!!!

I have an Arduino Mega 2560 and an Ethernet Shield W5100 (purchased these 2 after reading your thread and seemed like the best fit – I like staying wired whenever possible)… my alarm panel has door/window contact sensors (maybe 8-10), 1 motion sensor, and 2 smoke detectors (have to check if the smoke detectors are battery powered or not, but I do NOT think so)… I’ve successfully compiled and uploaded your “ST_Anything_Doors_Windows_EthernetW5100.ino” sketch (editing all mandatory lines you commented on) and the IP I set to my Arduino Mega 2560 instantly starting to ping once uploaded!!! So that was a great feeling!!!
So a few basic questions…I’m sure you already went over these… and I apologize if I’ve missed the answer to my questions somewhere along this thread or in your readmes…
Here are my nooby questions (hopefully attached images will help shed some light on my setup)…

  1. Are the wires in my panel, with resistors attached, my contact sensors? What are the wires without resistors, typically?
  2. How do I get your smoke detector code into the “ST_Anything_Doors_Windows_EthernetW5100.ino” sketch for upload?
    a. Or is this not the way of going about integrating smoke detector alerts?
  3. I created device handlers and devices in Samsung API for Ethernet On/OFF, Virtual Contact Sensor, and also ST_Anything_W5100… what does Ethernet on/off do? When I attempt to toggle Ethernet OFF, from SmartThings app, my W5100 ethernet shield network lights stay on, and I can still ping it… toggling it on/and off seems to do nothing?? Is this not relevant to my endgame of monitoring my home security system through SmartThings with the help of your code and Arduino board? I’m pretty sure I got all the IP / MAC / network config settings right, in your code, because I got constant annoying motion detection alerts when I plugged in, what I thought was my motion sensor wire, into the corresponding pin 35.

I think I may be missing something fundamental…

I need a better understanding of the wiring in these panels and a better way to test each sensor for functionality and labeling purposes

If you have time to write back, hopefully you could point me in the right direction…
Thank you again for all of this work!!! It’s sick!!!

@CRedsand2 - I do not have an old Alarm Panel in my house. I simply have a home that was pre-wired for an alarm system like yours. So, I simply added the magnetic reed switches to my doors, hooked them up to the wiring, and then connected the wires to my Arduino.

Is your goal to replace the old Alarm Panel? Or are you trying to create a parallel system using ST in addition to the old Alarm Panel? This is an important first step in deciding how to proceed.

Second, I am in the process of releasing new Arduino sketches and SmartThings Device Handlers that will greatly simplify this process. Hang tight while I get the code uploaded to my Github repository and find time to update the ReadMe file to help make everything a little more clear.

1 Like

For the Advanced users who prefer to not wait for better documentation and who are willing to provide me with some feedback…

I have uploaded 12 new device handlers and 2 new Arduino sketches to my GitHub repository, along with some revisions to the ST_Anything Arduino library. These changes implement SmartThings new Composite Device Handler feature (i.e. Parent/Child Device Handlers) which allow more than one of each ST Capability in a single DH without requiring a Miltiplexer SmartApp to translate between the Arduino DH and the Virtual DH’s. In fact, no virtual devices are needed any longer with ST_Anything!

SmartThings IDE
I have adopted the ST Github IDE integration for the 12 new Device Handlers to make it much simpler to add them to your ST Account. Add my Github to your IDE using these settings:

Owner = DanielOgorchock
Name = ST_Anything
Branch = master

Or you can still manually copy and paste the new DH’s from (https://github.com/DanielOgorchock/ST_Anything/tree/master/devicetypes/ogiewon)

Please be sure to get all eleven “Child …” and one “Parent …” Device Handlers. Note: At this time I only have support for Ethernet/Wifi based Arduino and ESP8266 based boards. I have not yet implemented a “Parent DH” for the old ThingShield.

Arduino IDE
Be sure to grab the latest copy of the ST_Anything Arduino library and copy it to your …\Arduino\libraries\ folder. I needed to make a few minor changes to support the new DH’s. All of the Arduino code is still 100% backwards compatible with the old DH’s.

Additionally, please download and copy the two new example “ST_Anything_Multiples…” sketches to your local …\Arduino\Sketches\ folder.

ST_Anything_Multiples_ESP8266WiFi.ino is for use on a NodeMCU ESP8266 board (standalone, no Arduino)
ST_Anything_Multiples_EthernetW5100.ino is for use on an Arduino MEGA 2560 with a W5100 shield.

(Note: remember to update the network settings within each of these sketches to allow them to attach to your home network. Do NOT change the name of each of the defined devices. You must follow the standardized naming convention for everything to work correctly. After you get things working as-is, you can start experimenting with how many of each device type you want, what pins to use, etc… For now, just try getting the new example to work.)

Once you have everything installed in the ST IDE, manually add a new device, using the new Parent_ST_Anything_Ethernet DH. Configure it in your phone just like you did previously, setting the MAC Address, IP Address, and Port of your Arduino or NodeMCU board.

Once configured, and the Arduino or NodeMCU board is online, all of the child devices will be automagically created for you within SmartThings. From the THINGS view, you can rename each of the Child Devices as you see fit. From within the Parent, you can see all of the children, but cannot rename them. Just think of the parent as a generic container. Each of the children is what you will have normal SmartApps interact with anyway.

Something to be aware of… sometimes an extra child device will be created. This appears to be caused by a race condition in the ST Cloud. Just delete any duplicate child devices using the ST Phone App. You can even delete all of your child devices and the parent will automagically recreate any missing ones whenever new data is received from the Arduino/NodeMCU board. Pressing the new “Refresh” tile (in the parent DH) will force the Arduino to send the latest data for each of its defined devices. Deleting the parent will delete all of its children as well.

Getting late… more to come later. As always, feedback is welcome!

5 Likes

Dan - Thanks for the reply!

Since I originally started this project to replace alarm system (to avoid paying monthly rates to alarm company) what’s the best way to use this system in parallel using ST? Is this possible? I would LIKE to use in parallel, if feasible…however, if it would be much easier to simply replace alarm panel, that would be fine too (it was my original method of intent anyways). I think the only benefit of using ST, in parallel, to my old system, would be to utilize the already in place keypad panels somehow? What is your advice here?

Really looking forward to your new sketches and device handlers.

Thanks for getting back to me!!

Thanks again,

The new sketches and device handlers are already uploaded to my Github, although the ReadMe file has not been updated yet. See my post just above your latest one here for the details that should get you going.

As for the replace vs parallel, you may be looking at a hybrid if you really want to continue using the old system’s motion and smoke detectors (if even possible at all!) Motion detectors and smoke detectors need power to function properly. This power is probably supplied by your alarm panel. If your smoke detctors are more than 10 years old, they should probably be replaced anyway. Why not look at buying new ones that are z-wave capable which will work with ST and almost every other home automation systems on the market? Z-Wave and Zigbee motion detectors are readily available too.

That then leaves the contact sensors (Door/Windows magnetic reed switches) which are very easy to integrate to ST using my ST_Anything library, associated example Arduino sketches, along with my latest Device Handlers. I would suggest removing the contact sensor wiring from the alarm panel altogether, and then connecting each sensor to Arduino GPIO pins of your choice (1 wire per pin, per sensor.) The other wire from the sensors are then tied together and connected to an Arduino GND pin. These sensors are simply tiny electrical switches which are “open” when the magnet is removed, and “closed” when the magnet is in place. Thus, for testing you can simply attach a jumper wire from the Arduino GND ping to any of the digital input pins you choice in the sketch for your contact sensor devices. Just make sure you follow the naming convention I have defined in the ST_Anything_Multiples_EthernetW5100.ino sketch (i.e. “contact1”, “contact2”, “contact3”, etc…) as these specific names are required for the automatic creation of the child devices by the new Parent device handler.

Dan, I was already a fan of ST_Anything, and believe your new parent/child version will make it a lot easier for users to implement. I will work on migrating to the new version this weekend. If you are open to creating additional child device handlers, my suggestions would be CO detector and voltage measurement. Smoke detector and illuminance measurement are useable for these devices, but integration would be cleaner if the correct capabilities were built in from the start. Do you have plans to implement strobe capability on the alarm child DH?