Announcing the "ST_Anything" Arduino/ThingShield Project

Todd,

I have updated the ReadMe at the GitHub to include the DHT library instructions, as well as the first post in this topic. Thank you for the feedback and for giving ST_Anything a test run!

As for the Contact Sensor question, I think you already figured out how to get one to work, but just in case…

Per the sketch…

#define PIN_SWITCH 8”
"#define PIN_ALARM 9 "
#define PIN_CONTACT 11”

Pin 8 is a digital output for a relay, which is essential what a SmartThings Switch device is, like a SmartPower Outlet or a GE Z-Wave wall switch. Pin 9 is another digital output for another relay to turn on a siren. Of course, feel free to tweak the pins however you want…that’s the purpose of the library! Just don’t inadvertently assign the same pin to two different devices. I lost about 30 minutes trying to figure out that silly mistake during my copy and pasting of new sensors… :slight_smile:

Pin 11 in the sketch is a digital input, which is set to use “INPUT_PULLUP” per the constructor (see IS_Contact.h and IS_Contact.cpp for details of the C++ constructor arguments.) By connecting Pin 11 to ground, you should see the Contact Sensor change from Closed to Open in the Arduino IDE Serial Monitor window, as well as in the SmartThings App on your phone.

On the MEGA, make sure you follow the detailed directions in the full ReadMe from the ST_Anything GitHub. By default, I have configured the MEGA to use Hardware Serial communications on pins 14 and 15. Pin 14 needs to be jumpered to pin 2 while pin 15 needs to be jumpered to pin 3. Using the hardware UART on the MEGA really improves the performance and reliability based on our testing.

As for your question about multiple Contact Sensors, or actually multiples of any device type… Yes, this is possible, but requires some custom Attributes in the Groovy Device Type code, along with a SmartApp to link these custom attributes to a set of Virtual Contact Sensor Devices. I have successfully done this as part of my original GarageDoor Arduino application which can be found below.

I am planning on converting my GarageDoor controller over to the ST_Anything library shortly and will happily share that example with the community as well. It implements 4 x Contact Sensors (1 digital input each), 2 x GarageDoors (1 digital input & 1 digital ouput each), and 1 x Temperature sensor. All of these devices show up in the SmartThings App’s “Things” section as individual tiles, which can then be used within any existing SmartApps as if they were independent devices. I just need to find some time to work on it…

Continuing the discussion from Arduino SmartShield Garage Controller:

1 Like