Yes it does. Thank you.
But isn’t my idea of how I thought it worked a really cool idea? ![]()
![]()
![]()
Todd
Yes it does. Thank you.
But isn’t my idea of how I thought it worked a really cool idea? ![]()
![]()
![]()
Todd
Todd,
We send commands from the ST Cloud to the Arduino all the time already… In every one of the ST_Anything device classes, there is a function called “beSmart()” which receives these commands in order to turn on or off a switch, for example. We also use the “beSmart()” function to handle the polling rate interval changes that can be set from within the DeviceType for any of the classes derived from the PollingSensor class, such as the MotionDetector, TemperatureHumidity, WaterDetector, etc…
So, I believe the capability to send commands from the ST Cloud to the ST_Anything architecture is already fully implemented. If you have a specific use case, all you have to do is create your own device class, derived from one of the existing parent classes (i.e. Device ->Sensor->PollingSensor OR Device ->Sensor->InterruptSensor OR Device->Exectuor).
For example, let say you’d like to create a class which could periodically update an LCD screen. Most likely you want to refresh the display at some defined interval. In tis case, I would create a new class derived from the existing PollingSensor class. This parent class will take care of all of the timing work, so your new code can focus on just updating the LCD screen. If you’d like to receive ST Cloud data, simply implement the beSmart() function in your new class to handle any string messages sent from the ST Cloud to your LCD device. This is done by the string name parameter passed into the device constructor within the Arduino sketch’s setup() routine.
The ST_Anything architecture is really quite flexible, once you understand all of the C++ classes and how they are intended to be used. I am sure we could do a better job at documentation, but my feeling was that the code was very well commented already, and should be fairly self-explanatory for C/C++ programmers. Adding a new “Arduino Device” should be quite simple, once you understand that all of the ST ThingShield communcations, routine polling, and other base capabilities are already handled by the library. All you need to focus on is integrating the new Arduino device, and the corresponding Groovy code to run in the cloud, if needed.
Our focus was on implementing the existing SmartThings Device Capabilities on the Arduino platform, such that it would be simple to map Arduino sensors and actuators directly back to their corresponding SmartThings counterparts found at http://docs.smartthings.com/en/latest/capabilities-reference.html.
Dan
Dan,
First, I want to THANK you for all your hard work you are doing here! Awesome!
I’m just trying to get started getting the shield up and running. I have the Mega2560, Arduino 1.6.7, & V2 Hub.
I have followed your Readme file to the point where you create a new device.
ST_Anything SmartThings Device Type Installation Instructions
•Join your Arduino/ThingShield to your hub using your phone’s SmartThings App. It will show up as a generic “Arduino ThingShield”
•Create an account and/or log into the SmartThings Developers Web IDE.
•Click on My Device Types from the navigation menu.
•Click on + New SmartDevice button.
•Fill in the Name field as ST_Anything and click on the Create button. Don’t worry about filling out everything else.
It will not allow me to create a new device without filling in everything else.
I have also tried following the “SmartThings Shield for Arduino” Instruction Manual found in the SmartThings App. Everything appears to be working on the app, but the led in not coming on. I loaded the Blink sketch to insure the led worked and it does.
What am I missing?
Looks like the ST IDE has changed a little over the past year. I have updated the ReadMe in the GitHub Repository to reflect these changes. Please use these new instructions and let me know if that resolves the issue…
https://github.com/DanielOgorchock/ST_Anything/blob/master/README.md
That resolved it! I’m up and running now.
Thanks!
I am embarking upon a new project to hack into my existing alarm system which has built in sensors to talk to my ST ecosystem. I have measured voltages so I know when doors are opened how the voltages change. It is trivial to then measure them on Arduino pins. In my project I want to make virtual door sensors for each physical door and update the status based on the voltages read on the Arduino. Your project is exactly what I needed to figure out how to go about doing this. I have a thingshield so I am ready to jump in. My only hesitation is I want to read multiple doors on the same Arduino. I assume that can be done. I am also considering using a Raspberry Pi instead. I have a generic web service talking to my ST account so it would be easy to update sensors using Python. I am not sure which path is easier - Arduino or Python+RPi. The latter will give me more flexibility since I will be able to also query my home from a private web page. Any other insights from anyone else who has done anything like this would be appreciated.
Ken,
If you check on the numerous example sketches in my GitHub repository, you will find a few excellent examples of how to do exactly what you’re wanting. My ST_Anyth,hing library can be configured within the Arduino sketch to handle sourcing/sinking signals as well as whether to use the internal_pullup resistor feature. Check out the comments at the top of IS_Contact.h for the various options for the constructor of the class (called from within the sketch’s setup() function.)
Here are three examples. You have to use my virtual contact sensors and corresponding multiplexer app to link the virtual devices to the Arduino to support more than one of each device type per Arduino. If all you have are doors and windows, the first example should be a great starting point. Be sure to use the corresponding groovy device type-handler for the Arduino and the corresponding groovy multiplexer smartapp. You can then very quickly customize the number of windows and doors from there.
The next example was to help someone who was trying to replace their entire alarm panel, but still use their existing alarm systems wiring.
I personally use the following example with my pre-wired alarm sensors for my house doors. I also added a cheap PIR motion detector, a DHT22 Temperature/Humidity sensor, and two garage door controls (each has an integrated contact sensor/relay to monitor/operate the garage door.)
I’m doing everything you are taking about (and more) with an Arduino Mega and a thing shield.
The work @ogiewon and his son have done makes this project dead simple and it is rock solid on the ST side. (Well, as solid as ST gets…)
Take the wires that go to all of your sensors, pull them out of your alarm enclosure, tie all of the common wires together and attach them to a ground pin and then hook each of the other wires to a digital pin, load up the sample Arduino code, customize it for your pins, customize and load the device type for your thing shield, create virtual contact sensors (using the example device type) customize and load the smart app, run the app and link the Arduino to the virtual sensors and you got contact sensors that the ST system thinks are standard sensors.
It works GREAT!!!
Todd
Sounds great and exactly what I needed.
You have convinced me to use an Arduino instead of a R-Pi so thanks. My alarm panel is still operational and I want to keep using the main functionality since I need a monitored service to get my insurance discount. So I think the second example is what I need. I will dig in and write again if I run into problems. One complication is my alarm documentation says that an open circuit or a short circuit will set off the alarm so I can’t remove the lines coming from the sensors. My tap has to run in parallel with high ohmage resistors to avoid altering the primary voltage path. I think I have that right.
I only have doors and windows plus a bunch of other z-wave devices that I bought for lights and motion sensing. My alarm system uses window break sound sensors for windows that don’t open, not motion, so I will just ignore those. I will use the door sensors and the window sensors for the windows that open.
Thanks again - this is going to be very helpful.
It was mentioned earlier in this thread that it might be possible to get the ST_Anything library to work without the requirement for a SmartShield.
Is this still the case?
If so, would it be possible to get a pointer as to which files would need to be changed?
I have an XBee shield and have been experimenting with getting it communicating with the SmartHub and have had some success, however being able to use the ST_Anything library would make things a lot easier!
Matthew,
Within the ST_Anything library, you will find a file named Constants.h. This file is designed to be modified by the end user as needed to adjust various settings with the overall library. In particular, based on your request, you can simply uncomment the following line of code, which will prevent the library from needing the ThingShield.
//#define DISABLE_SMARTTHINGS //If uncommented, will disable all ST Shield Library calls (e.g. you want to use this library without SmartThings...)
This will let you run the ST_Anything library, but you’re going to have to get into some of the more hidden features of ST_Anything to replace the ThingShield calls with your XBee shield calls. I believe most of the ThingShield calls are contained with the Everything class (Everything.h and Everything.cpp). So if you can modify these two files, and possibly Constants.h, you should be able to reuse the rest of the library.
Dan
Awesome, thanks for the pointers!
Hopefully I’ll be able to get something up and running without too many headaches.
Thanks once again.
Wauw, absolute amazing work you did here guys, I’m really impressed
I’m a civil engineer masterstudent from Belgium and I always found the google nest, smartthings,… systems way too expensive for what they only can do. One sensor for $40, seriously who buys that? That’s good to automate 1 light at your frontdoor that lights on when it’s dark, but if you want to do more then that it becomes insanely expensive.
I already played a bit with my arduino before stumbling on this post, I’m building my own automation, starting from my room, but i want to integrate it for my whole house
I will simply explain my idea:
Input:
1 box with: Temp + humidity + illuminance + motion sensor
Every room should eventually have 1 box, and 1 on the outside of the house (arduino material doesn’t suit for outside sensors i guess…)
This “input-boxes” can be connected to a central system that calculates all the input (at first wired: easier, later wireless)
Other inputs (not in box) are contact sensors on doors/windows,…
These inputs can trigger a lot of outputs and in this way we can create automated scenes for example:
Servo motor that can open/close 1 window per room
When does it need to open?
When the temperature is too high or the humidity is too high, and there is no one in the room.
If someone enters the room and the temperature/humidity is already better, it can close again so there’s no wind
The outside humidity sensor makes sure that the window doesn’t open when it rains
PS: automated opened window only a small gap and on 1st floor, so burglaring isn’t an issue
To open this window manually there needs to be a second button to override this scene and open/close manually
I’d like to set the hour of leaving my bed on the central system, for example: 07:45 am in the morning
The systems knows i’m not a morning person so at 07:30 the curtain slowly starts to open
This is done by a servo motor that pulls a double wire connected to the curtain top, to close it the servo turns the other way around and the curtains close
The music starts slowly on 7:30 too and by 7:45 the music is loud and the curtains are open
7:45 a buzzer start, that will only stop when my feet hit the pressure sensor on the floor next to my bed
Is it possible to do with ST_anything or am I dreaming?
I’ve read a lot about your input sensors that can communicate with smartthings, hey that’s amazing so my input side could really work in this system
But is it possible to steer my output servo’s,… too with ST? In this way ST needs to recognize my window servo/alarm clock/curtain servo/… as an output, like for example a philips hue bulb
I’m really exited about getting my project from the ground
I will exchange my arduino uno for the arduino mega and buy me the shield
Can someone tell me if I can try it with ST, or better just go dreaming along and buy me all the expensive inputs and outputs?
Thanks a lot
Jonas
Jonas,
Yes, you can most likely accomplish everything you’ve mentioned using SmartThings and the ThingShield with an Arduino Mega 2560. You’ll need to extend the ST_Anything library by adding your own classes to support things like servo motors. Let me know if you need any help understanding the design on the library and supporting sensor/device classes.
If you want to try an even less expensive solution, check out one of my other projects below that shows you how to hack a Cree LED lightbulb for use with an Arduino. Note - this is a one-way communications solution - ST to the Arduino. This would be good for devices that just need to be told what to do, like a motor.
Have fun with your project!
I built a bypass damper for my HVAC system using an Arduino Mega, ThingShield, and a Motor Shield (Adafruit). The shield can drive steppers or servos. It works great.
Got mine working today…
Ken,
Nice work. Thanks for sharing. I am sure others may find your integration method useful.
Dan
I’m taking the leap into Arduino land. I’m moving into a a home with a preexisting security system consisting of contact sensors and motion sensors. Here is what i hope to accomplish.
Phase 1
I hope to piggyback on the existing contact sensors in doors/windows adding them as (virtual) 'Things" into my SmartThings environment while also leaving them intact with the current system.
THE PLAN
After reading a ton of forums I believe that I can accomplish this with a Arduino Mega and a SmartThings Shield with this Sketch and following all of this fun ReadMe supplemented by this post on Virtual devices
The part I’m not totally sure on is splicing the wires from the existing security system into the Arduino. I haven’t gotten my filthy hands on the existing system but a cursory glance looks that each contact sensor has two wires and is the normal magnetic kind. I’m hoping the voltage drop is enough so I wont have to do any fancy breadbox work. From what I have read it sounds like I should splice a wire off the existing system’s contacts onto one of the boards pins and repeat for all the sensors.
Now the questions.
Do I need to splice the second wire from the existing sensors? I get the feeling from this post that I need to hook something to the ground on the Arduino board but I’m unsure if I need to do this for multiple sensors, just one, or at all.
I’m assuming that I only need the ST_Anything_Doors_Windows Sketch with the corresponding libraries to accomplish this task. Is that correct?
I’m going to screw up the coding part of the project as my coding knowledge is only slightly better than the average person. Not really a question just a forewarning of the impending broken code i may post.
Phase 2
If I somehow accomplish Phase one and the stability/Maintenance/Kludge of phase one doesn’t drive me insane I’ll process to complicate everything by adding the preexisting motion detectors to the mix.
I think the biggest concern is how much voltage does the existing system generate. The mega wants to work at around 5 volts. If you get above that, it might work, but it might fry the mega (either right away or over time).
I’m not sure what the upper limit is (Anyone?), but you may need to deal with that first.
If the voltage isn’t an issue, then I would think you would just need to tie ground on the mega into ground on the alarm and then tie all the non-grounds into pins on the mega.
You’ll also want to read this post about the settings you want to use if the alarm is generatIng the current.
This is why I used a transistor as a switch. That way the Arduino always gets 5volts and the alarm voltage is used only to drive the transistor via the base pin to switch the Arduino provided 5 Volts on and off by means of the cutoff voltage behavior of all transistors at 0.7 volts.
I will draw out my circuit when I have some time.