Arduino SmartShield Garage Controller

Did you uncomment the debug #define statement to enable the debug messages? Otherwise I have no idea… should work as far as I know… unless it’s a Mega-specific problem…

@ogiewon Thanks. I’m also an old-school C/C++ programmer. Dabbled in some PIC programming as well. I considered myself quite a C++ expert. :stuck_out_tongue: But I could be a bit rusty, and have zero Zigbee or Arduino experience before the week-end I started (and finished) this.

I did consider creating a bitmask to report an entire array of inputs and outputs, but I thought to keep this type of operation on the Arduino to keep the pressure off the Smartthings device. (It would help in future as well if I had to move to another platform which may not have the flexibility of this groovy scripting)

But yes, it does seem to put some pressure on the comms… but I think my addition to throttle the updates to one per hearbeat seems to fix the congestion issue that I think some people might have (with dropped events). So this should not be too big an issue…

You only have about 4 or 5 inputs… and the hearbeat is relatively fast… so I don’t think the delays should be significant.

A bit off-topic:

I wrote a building management system way back in 1997 … client/server type system with linux servers and windows Gui front-ends. Used PIC PCI cards on servers communicating with RS485 to multiplexors controlling video feeds.

Did all sorta stuff like access control, card reading, video motion detection, jpeging, OCR, fingerprint etc. etc… It was long ago before I even started writing real compilers and my code was relatively simple.

Was way fun writing this, at some clients we had over 200 cameras and 50 card readers… was a load-balancing nightmare at the time of pentiums.

So I think 5 inputs should be fine… :wink:

1 Like

@ogiewon I finally got around to implementing this. I really like the ability to have each door on the Arduino exposed as virtual devices so I can add them to the dashboard and for use with regular apps. I did run into some challenges though, when I add both garage doors to the dashboard I can’t open or close them from there, I can however from their device tiles directly. Also, I’m not sure what smartapp you’re using with your doors, but I’m not having any luck using the “ridiculously automated” app with your code which might be a deal breaker for me unless I can get that sorted out.

Sorry folks! I have been away for a while. Looks like you guys have really gone to town on the original code! For what it’s worth, I bought a small temp/humidity sensor and added that to the arduino… so now I have temp and humidity of the garage.

Here’s the device I bought: http://amzn.com/B00CDHH3WQ

If we ever get iBeacon integration, I’m definitely going to have the door just open when I drive up and close when I leave!

lailoken, I mainly brought a arduino board and smart things shield to reuse existing wiring in the house for doors. I was happy to see your project which is exactly what I was looking for. Thank you saved me a ton of time !

I installed the device types 3 of them and 1 smart app and the arduino code. when I loaded the arduino code it goes into unknown state which I am still trying to figure out. on the smart app simulator I am trying to set my hub and then using the virtual contact sensor and virtual ardiono I tried to install. I am getting an exception saying simulator is not currently running. What am I doing wrong? I am also getting this error message."grails.validation.ValidationException: Validation Error(s) occurred during save():

  • Field error in object ‘physicalgraph.device.Device’ on field ‘name’: rejected value [null]; codes [physicalgraph.device.Device.name.nullable.error.physicalgraph.device.Device.name,physicalgraph.device.Device.name.nullable.error.name,physicalgraph.device.Device.name.nullable.error.java.lang.String,physicalgraph.device.Device.name.nullable.error,device.name.nullable.error.physicalgraph.device.Device.name,device.name.nullable.error.name,device.name.nullable.error.java.lang.String,device.name.nullable.error,physicalgraph.device.Device.name.nullable.physicalgraph.device.Device.name,physicalgraph.device.Device.name.nullable.name,physicalgraph.device.Device.name.nullable.java.lang.String,physicalgraph.device.Device.name.nullable,device.name.nullable.physicalgraph.device.Device.name,device.name.nullable.name,device.name.nullable.java.lang.String,device.name.nullable,nullable.physicalgraph.device.Device.name,nullable.name,nullable.java.lang.String,nullable]; arguments [name,class physicalgraph.device.Device]; default message [{0} cannot be null]"

I am assuming I should be able to test it with smart app simulator but not sure though. Do I need a breadboard and some resistor etc,… to test the code or can it be done through the smart app simulator?

Thank you much!

I’m glad I could help… I had similar help from other people to build upon.

Also I’m sorry I only saw this now, for some reason I did not get notified of the response… Just saw it per chance. (I think you need to address someone like this: @fortune to get their attention… not sure.)

Alas, I’m not sure what your problem is, my debugging worked well enough… just make sure you enable the debugging options (#define) in the Arduino Code. I was using an Uno… not sure if that could be the cause.

My experience on the Arduino is pretty limited, this was a week-end project for me.

@lailoken, Thank you for responding.

I gave up trying to simulate. I hooked up some resistors and wired them and it does show open and close properly. Now I am trying to see if I can send a text to myself when a door opens when I am away. I tried to introduce some code in the smart app the other day but i was unsuccessful. Need to spend some more time to get that working. In the mean time I am waiting for the battery to power the arduino.

I must say for a weekend project, you did pretty good. This would have taken me weeks!

well will update where I am at in a few days…

I think it was a combination of years of programming, with some PIC programming experience, a smidgen of electronics knowledge and a whole lot of luck I guess.

Anyone figure out how to enable turning on and off the garage light or even enabling the “lock” for when in away mode? At least these are the feature on my lift master it would be great to incorporate.

@stevesell Can you share your code for the temp sensor and any hints on wiring? This is my first Arduino project. I am assuming that the pins referenced in the arduino code are the corresponding ones you wire to on the shield?

@afewremarks Hi Mark, I just finished my install of this project this weekend. I will take some pictures to help you once I get home this evening. I wasn’t able to figure out a way to get the light to turn on, but I do have a way to lock the system. Basically you would run the power for the garage door opener through the Arduino controlled relay. The interesting thing is that on my opener (Genie) when you return power to the opener, the light comes on.

@afewremarks Hi Mark, Here are some images from my install that will hopefully help you out. The pins referenced in the Arduino code are indeed the locations that you wire to on your Uno. Please note that my setup will likely be different from yours. I have only 1 garage door attached to my relay, but I installed a 4 relay module because I will be adding more items to control in the future.

Overall view

Relay closeup (please note that this is a test setup, in the live the wires are not exposed!) :slight_smile:

Garage Door Opener attachment. This is a Genie opener, and the wires coming from the bottom are where mine attach. (Same place as the wall control unit)

Arduino reed sensor module and magnet mounted to steel inner door.

Hopefully this helps, I found that it took a little experimentation to get the relay wired to the opener, so that it worked and kept the control panel active.

Cheers,
David

@DavidCreed awesome thanks for the pics. Got mine up and working as well. Always interesting to see how different people implement these things. Now i just need to figure out the temp/humidity sensor.

Since this is the thread where it all started for me, I thought I’d share…

I have just posted a new topic about a project, ST_Anything, my son and I have developed to make using an Arduino with SmatThings as simple as we believe possible.

Check it out at Announcing the "ST_Anything" Arduino/ThingShield Project

Hopefully the ST_Anything project will at least provide some examples of what is possible. It also includes an upgraded Arduino SmartThings library which you can about in the other post as well and on the GitHub repo at https://github.com/DanielOgorchock/ST_Anything

Dan

1 Like

Dan,

This project is amazing. How did I not find this before?

I do have a question.

I have created the device types for:
Arduino
Virtual Garage Door
Virtual Contact Sensor

I have created the smart app:
VirtualtoArduinoMultiplexer

I have installed the Arduino code in my mega.

I have configured my ST Shield to be of the Arduino Device Type.

I have configured the VtAM Smart App to point all things to my Arduino.

At this point, I have the Arduino in my “things” list and when I toggle pins 5, 7, 8, 9, 10 and 11 the corresponding icon on the sub screen of the thing changes color.

I now want to add Virtual sensors. What I don’t know is how to tell the virtual sensor which pin it is related to.

I tried setting the Name, Label, Zigbee ID and Device Network ID to frontDoor thinking one of those would be what tells the virtual contact which one to trigger from, but that did not work.

How do I make the logical connection from the Virtual Sensor to Arduino Pin?

Thank you!!!
-Todd

Looking at the SmarThings live logging, it looks like it doesn’t like openme in the virtual sensor:

6181b483-490c-4c8d-bd5f-0b1272de9a70 1:47:50 PM EST: error java.lang.IllegalArgumentException: Command ‘openme’ is not supported. Supported commands: [poll, refresh, pushLeft, pushRight] @ line 147
6181b483-490c-4c8d-bd5f-0b1272de9a70 1:47:50 PM EST: debug arduinoevent(frontDoor: open: 1892e981-dc27-429a-95f8-83730308bb7a)
1892e981-dc27-429a-95f8-83730308bb7a 1:47:50 PM EST: debug [value:open, name:frontDoor, handlerName:frontDoor open, linkText:AlarmThing, descriptionText:AlarmThing was frontDoor open, isStateChange:true, displayed:true]
1892e981-dc27-429a-95f8-83730308bb7a 1:47:50 PM EST: debug Value is frontDoor open

I figured it out.

I had the multiplexer assigned to the Arduino. I had to assign it to the virtual contacts!

Thanks!

-Todd

Todd,

Glad you managed to get it working and have your virtual devices linked to your arduino. It can be a little confusing trying to keep track of all of the events going back and forth…

Dan

Just in case any of my old Arduino Garage Door fellow coders are interested… I have ported my old Garage Door code to use my new ST_Anything library. See the post below for more information.

Hi Todd
I’m having the same issue could you pls explain me how to link the smart app to the virtual contacts I’ll like to use the sensors with the lighting apps and the security dashboard but don’t know how to do it. I just create a virtual contact from Daniel code.
I’d appreciate your help thanks a lot