yashsingh1/xdaforums huggingface dataset:
[EVO 4G General] JsChiSurf:
[App][Project][Cool] JsChiSurf's "OpenSezMe" Android Garage Door Opener Application

I wanted to create this post to show fellow XDA members a cool project I've been working on, and figured that like-minded XDA members (techno-geeks) would think it was pretty sweet as well, so this post is nothing more than to "show off" what I've done and perhaps inspire others to do something similar once they see how I accomplished this :D.

I set out to develop a simple android application to turn my phone into a "virtual" garage door remote, with the requirements that the application only successfully function when / if I am within a 1 block quadrant of my home, and be protected by a pin code. Both of these requirements help to prevent accidental opening / closing of my garage both at home, or in some remote location half-way around the world. You will see the end product from the application side in the youtube demo video at the end of this post.

I happen to have an old linux box running as a mail / web server in my garage that also has a serial port. So I said to myself, "self", wouldn't it be cool if I could interface the serial port on the linux box to a relay switch that would enable me to send commands out, via the serial port, to toggle the relay switch on/off, with the goal of mimicking the button press of a garage door pad on your garage wall, and control all of this via my phone?

So, I picked up a cheap serial port relay controller and connected it to my linux box's rs232 port. The controllers are available in a variety of interfaces, such as USB, ethernet, etc, but for me, serial was the way to go due to my existing setup, and ease of programming to the port, etc.

I then wrote a set of serial port communication classes in PHP for sending the necessary commands out the serial port, as outlined in the relay controller's specs, for toggling the relay on/off.

I tie it together by having the android application I wrote first look for the correct PIN code and geolocation, and when correct / within range, present a "virtual remote" on screen. When the remote is pressed, it makes an HTTP call to the webserver in my garage, that when called successfully issues the necessary serial port commands to toggle the relay switch.

The end result? A pretty bad ass virtual garage door opener app I call "OpenSezMe" that allows my phone to double as my opener. When I go on walks, jogs, etc, upon return, I can simply open my garage via my phone for entry back into the house. I know I could install a keypad, but what's the fun it that?

This application is very specific to my needs / setup, so doesn't really have any value for anyone else. I just thought it was pretty cool and figured you guys would too, and, at a minimum, could spur you to come up with something similar, unique to your environment.

[YOUTUBE]zHDoeaImPiQ[/YOUTUBE]
[EVO 4G General] Mast3rpyr0:
Very cool! I would love something like this, you know, if I actually had a garage. :P But maybe something for my lights in my room, I hate getting up to turn them off :P
[EVO 4G General] JsChiSurf:
That's the cool thing about it, and the world of possibilities it opens.

You can get these cool controllers that have multiple (dozens) of relays to control different things. I just got a cheap single relay controller to start, but with a multiple relay controller, you can start building an app to control lights, the garage, or anything else you want.
[EVO 4G General] Rydah:
Awesome but don't think my patents would let me wire **** up and I don't have a lenix box.

Sent From My HTC Evo 4G Using Tapa Talk Pro!
[EVO 4G General] JsChiSurf:
This is just my specific setup, but you could have any type of environment, just depends on what you have / know how to use, etc.

At any rate, thought it was a fun project that, for no other reason, would hopefully inspire others to try it out, or do something similar, if they have the wherewithal.
[EVO 4G General] fachadick:
This...is AWESOME! I don't blame you for wanting to show off - this what android and open source is all about!

Sent from my blah blah blah blah
[EVO 4G General] JsChiSurf:
Ha, thanks! It was fun to do, and very rewarding when it all came together, seeing the door open/close on the inaugural button press :D.
[EVO 4G General] jagox5:
wow

wow nice job!
[EVO 4G General] Sporkman:
that was pure win !!! nice work !
[EVO 4G General] JsChiSurf:
Thanks. The discerning eye will notice that it's speaker cable wire that I used to hook up the relay to the opener. Didn't have any "standard" low voltage wire lying around, so I made due with the speaker cable :p.
[EVO 4G General] teomorell:
Really nice work. As said by others, there seems to be no limit to what we can do with this devices.
[EVO 4G General] nebenezer:
Brilliant! You're like a musician with this stuff.. a very talented musician :D

You should repost HERE, imo
[EVO 4G General] chas123:
This is actually part of what I do. There are multiple home automation apps out there that interface with - say Z wave controllers to name one - that can open/unlock doors, turn on lights, adjust your thermostat, access alarm/fire panels, control hot water heaters, view surveillance cameras...etc.

Do a search for 'xanboo'. They interface with DSC panels that , in turn can interface with multiple zwave devices, i.e. many of the new door openers/locks made by Schlage.
[EVO 4G General] Saltwater Hero:
This is great! I live in a condo and never use my front door to enter my place I always use the garage! This is great.
[EVO 4G General] JsChiSurf:
Thanks Nebs. Good to hear from you!

Cool. When I first started with the idea (centered around creating an android app to drive the whole thing), I came across the ZigBee controllers, which looked pretty slick. These and others, though, were way more than what I needed for my simple application.

What's cool about the ZigBee, and i'm sure others, is that you can get ones that have an apache server built right in, eliminating the needs for a computer to be in the mix all together. Though, as mentioned, based on price, they were way beyond what was necessary for what I was looking to do.

Precisely. You can probably tell from the video that I live in a townhome, where the garage is attached to the house, so I typically just leave the door into the house unlocked and access through the garage, rather than the front door, which was the main reason why I wanted to do this.
[EVO 4G General] nebenezer:
:eek:

Haven't you seen that Brinks commercial with the guy driving around with a backpack full of garage door openers? :D
[EVO 4G General] JsChiSurf:
Ahh, he'd have to get into my gated complex first :p. Point taken though! Let me re-phrase. I "could" leave the door inside the garage unlocked, and then just use my phone to gain access via the garage ;).
[EVO 4G General] sling:
Very cool

........
[EVO 4G General] jaypeezee:
I love the concept/idea....

I'm one of many that is guilty of using my garage door as my main door to my residence.

An app like this has endless ideas to expand on. One that would personally benefit me would be the option to remote open the garage from anywhere barring a series of security measures to prevent a false opening.

I have family that routinely drop by and at times I'm not home. I hate having tons of keys distributed and it would be nice if they were to call or text saying they were out front. I then could go to an app like such input a series of security pins, or what have you, and then open remotely. A timer or LED indicator that stays lit while the door is opening/closing would be great also - this would tell me if an accidental key press weather the door was still opening or closing.

Gosh, i need to brush up on my programming skills !
[EVO 4G General] JsChiSurf:
That's the beauty of the setup, as you can put whatever restrictions you want in place to determine when/if the door, for example, should open.

I mapped out a 1 block quadrant that, if I am within, the proper command / call will be issued to toggle the door open/close, otherwise, the commands won't get sent, but this restriction could be set to whatever level desired.

I was actually thinking about have a "super user" pin code, that I can use, instead of my default code, that when entered, causes the app to ignore the geolocation attributes, allowing me to open from China if I wanted to.

The wife was apprehensive when I decided to do this, worrying about false openings, etc, so that's why I put in both pin code and geolocation measures. Problem is, there's no way for me to remotely tell if the door is actually in an open or closed state, just that I successfully toggled the relay. So, I slapped a cheap webcam in my garage, so that if I want, I can login remotely to verify the door is open or closed.
[EVO 4G General] fastfed:
Tell ya what . If you start selling the relays or some up with a system like ehome or whatever its called

... it controls all the lights from your computer. Basically transmits to timers that are plugged into the wall outlet and then you plug your device into that..

Sell it as a package. Like the app plus 2 systems for 69.99 or 4 controllable systems plus apparently for 99.99

. Make one for the iPhone too. You would have fun doing it, creating a service for people and make a ton of.money.. I'll help ya :)
[EVO 4G General] mkhopper:
Great idea!

The hacker spirit will never die so long as people continue to ask "I wonder if I can do.... ?"
[EVO 4G General] uniquenameevo:
I like it a lot. After reading it, my first thought was setting up the christmas lights (PC controlled) to something similar.
[EVO 4G General] JsChiSurf:
Oooh, I like that idea!
[EVO 4G General] birdFEEDER:
Tight. Well done mate... :D
[EVO 4G General] JsChiSurf:
Thanks birdFEEDER and welcome to XDA. I see you're in Chicago too. Hope you're a Cubs fan.
[EVO 4G General] scottndville:
Geeks rule. That's awesome man. Truly awesome...
[EVO 4G General] JsChiSurf:
Who you calling a geek? I "represent" that statement :D.
[EVO 4G General] evohack99:
Wow, you helped me out with the hexediting my keyguard lock, thanks again for your patience, I'm 20 years old and going too school for CIS and going to get some server certifications also, and I really envy a knowledgeable guy in this field . I live technology and love computers and anything to do with them, I just wish I had a guy like you to teach me on the side. I find myself reading late into the night. Keep up the hard work. Ic also seen something like this in popular science mag, where a guy had his twitter accout set up to turn on his camera on his front porch, when he was in his basement.

Sent from my netarchy_toast, froyo beast of a machine evo!
[EVO 4G General] JsChiSurf:
The key to any of this stuff is simply persistence. There is such a wealth of information out there, that if you are persistent enough, you'll figure out a solution to your problem, or how to so something you've been wanting to do. You might drive yourself crazy in the process, as you struggle to get it right, but it's incredibly rewarding when it ends up working as intended.
[EVO 4G General] hibby50:
bump... sounds awesome
[EVO 4G General] grkfire:
This is so awesome!!! I submitted this link to both Engadget & Gizmodo....it's just too good & needs to be seen by others!
[EVO 4G General] JsChiSurf:
Ha! Well, that would be cool. Thanks!
[EVO 4G General] JaydenR:
Off topic Q. What wallpaper is that?
[EVO 4G General] brockster:
Nice!

Nice Job. I've setup X10 and a webpage on a home server to turn my perimeter lights on at the house. I have a bookmark on my EVO that brings up the secure page with the on/off buttons for the lights.
[EVO 4G General] srkmagnus:
Nice work JS. Truely inspiring and if I knew anything about about programming I'd be inspired to try something :)
[EVO 4G General] chibucks:
awesome job JSChiSurf - been following your work since the Hero. love the idea of this and the precautions you took as well. :)
[EVO 4G General] belogical:
Love it, great work!
[EVO 4G General] Dishe:
LOL- I actually designed a strikingly similar solution for someone about 3 or 4 years ago... only back then, it was a Windows Mobile handset.

I told someone that I take every "a mobile phone can't do that" as a personal challenge.

So a client once half-jokingly asked "oh yeah? bet you can't open a garage door with your phone!".

So I made it happen. It required a gutted-out old pc which we had installed in their garage running linux off a flash drive, connected to the internet via wiFi.

Only instead of your nifty relay switch, we sold out and with the turn-key solution of an X-10 controller for the garage door. Then it was a matter of getting the box to send a signal to the x10 when the user pressed a button on their home screen (custom app plugin).

I think eventually the idea was he would be able to open the garage for UPS from his office, then close it remotely.

I was going to follow up with a modification to the home plugin that would indicate if the door was currently open or closed (that way he would be able to see if it was left open or accidentally pressed), but we never followed up after that.

Cool project, interesting to see it get picked up again in another variation.

Great minds...
[EVO 4G General] Chainfire:
I've had a similar idea for about two years, but never gotten around investigating how to implement it.

You see, I have a door with special security keys. It takes a whole lot of hassle and a whole lot of money to get a new key made. I don't however live alone. One of the other inhabitants of my house has been blessed with the uncanny ability to lose keys whenever and wherever we are. On one occasion, a set of keys was lost between the front door and the living room couch, and though we've searched for hours, it was never recovered.

The sheer amount of lost keys has raked up a very unhappy landlord (who is the only one who has the needed certificates and such and has to do the work to get a new key) and a few thousand dollars in total charges over the past two years.

I wanted a system that could open the front door through cell, but, I can't actually drill into or otherwise modify the door internals. Neither do I want to be running a PC to do it.

Over time we've made some elaborate plans, but nothing that works.

I thought of using Bluetooth, because it is short-range, and perhaps connect it as a Bluetooth keyboard to enter the correct PIN code. No idea what sort of electronics I would have to build to accept that connect, but that is not the biggest problem. As I can't modify the door, there would have to be a little electromotor that turns an actual key in the lock. But, if the key is in on one side (the inside), you can't use the key from the outside.

If I can't trust people to not lose their keys, I can't trust them to not lose their phones either, so there would have to be a mechanism to actually insert the key, turn it, open the door, and extract the key again.

Needlessly to say, the system never got built - but I'm open to ideas!

RESPECT to you for building this. It is awesome :)
[EVO 4G General] piyushnp:
Very nice Work ! very usefull .. Droid Works !
[EVO 4G General] bl4d3_:
Hi guys, I read about your work, really nice! If you are interested I made the same things using android and arduino but I tried to create a reusable atchitecture, you can find all the information on arduino blog on my site...I'd like to post the link but I have this message

[To prevent spam to the forums, new users are not permitted to post outside links in their messages. All new user accounts will be verified by moderators before this restriction is removed.]

the code is available on github too.

greetings from italy!
[EVO 4G General] T3hPWN:
Very nice i might just have to fool around with this to add my ac so it can be off until maybe im in a certain GPS location and it turns on cooling or heating the house, maybe adjust the temp as well incase the weather changed and u need to make it colder or hotter your right possibilities are endless you could possibly have your own "Jarvis" on your phone.
[EVO 4G General] Kellic:
That is slick as heck. However why enter a pin? Wouldn't it be faster to use the pattern method instead?
[EVO 4G General] JsChiSurf:
Perhaps. But it's a whole lot easier to code for a pin input than trying to figure out pattern input.
[EVO 4G General] verbuyst:
Really great app, that would really come in handy when it starts raining again.

What about those automated garage doors? When you have a buton to press from in your car, that sends a radio signal. Could an app be writen to emulate that frequency? So I don't have to do some crazy things in my garage ;-)
[EVO 4G General] belogical:
Would you be willing to share your APK and code so we can customize for our home setup? Would love to try this out.
[EVO 4G General] tejasrichard:
Did you ever know that you're my hero?
[EVO 4G General] bradfox2:
HI Jai

I sent you a pm. Please give it a read and let me know if you are interested.

Thanks.
[EVO 4G General] tommy320:
nice

Nice, but why the app? As I understand your just fireing a request to your webserver, so why not just use the browser? That way you can control it from any device which has a browser on it.
[EVO 4G General] imdickie:
This is most excellent and opens a ton of possibilities. While I don't have much programming experience, I do have a ton of program management experience.

You mentioned not having a way to know if your door is open or closed in OpenSezMe, what if you were to use a wireless IP camera like this...

www(dot)geeks(dot)com/details.asp?invtid=APM-J011-WS&cpc=SCH

and use the linux box in your garage to validate movement? If you point the camera right at your door and set the motion sensor trigger you could easily validate that your door is opening or closing.

Plus, if you get IP Cam Viewer Lite...

www(dot)androlib(dot)com/android.application.com-rcreations-ipcamviewer-zmC.aspx[/url]

You can personally have a visual reference from your phone.

Just a thought.

Sorry for the cut and paste links. I am new and haven't posted the prerequisite 8 times yet.
[EVO 4G General] schwin97:
Think about the integrations between home automation and Tasker? The ability to turn on lights, modify thermostat, etc. based on location or any other triggers that you may desire...
[EVO 4G General] tunneling:
How about the ability of the home automation system to push notifications to android based on event triggers... door opening, motion detector triggered, light turned on, temperature changed, etc... the app i'm working on will do all those things
[EVO 4G General] PlutoISaPlanet:
Hey, I'm late to this party but this is amazing. I was just looking for a way to open my garage door through my phone last month b/c we only had one controller and ended up buying one of those splice-in systems from HomeDepot. I wish I had the know-how to do what you did. Amazing.

Ran across this from this blog post... not sure if you're aware of it:

http://www.pcpro.co.uk/blogs/2011/01/02/the-10-best-android-hacks/
[EVO 4G General] belogical:
any chance?
[EVO 4G General] sandpa:
Very nice! I have a question : How is the web service on your server secured from anyone else calling it ?
[EVO 4G General] jvrobert:
I did something like this, kind of a fun project.

I got 2 Xbee chips (like $20 each), and put one in a tiny enclosure with a relay switch. The relay switch is hooked up to the digital out of the Xbee and a wireless garage door opener. The Xbee also has a digital-in which I hooked up to a garage door magnetic switch. 4 AA batteries power the remote sensor/controller.

The other Xbee is hooked up to USB to my server, and I have a simple .NET service which handles using the Xbee wireless to query the current state of the garage door and to signal it to trip the relay (toggle the door open or closed).

I have a simple little ASP .NET page I use to control it over the web from my phone (too lazy to do Android app). It shows battery state, signal strength, and whether door is open or closed. To toggle state, it requires both password (HTTP/basic) and PIN.
[EVO 4G General] ncherry:
There are many ways to check for an open/close state. You could get your hands on this board:

ARGH, go to Amazon.com and search for Webcontrol-Universal-Temperature-Humidity-Controller

Sorry I can't post URLs yet.

This is a Ethernet Webcontrol board which (appears to have/) has 8 digital I/O plus a whole lot more. You can control it via it's web interface. At ~$40 it's a steal.

I intend to use one with MisterHouse (see misterhouse.wikispaces.com ), which I have running my home. I securely access it via a browser and SSH (via tunnels). I've got a lot more than just a garage door to monitor and control. :D

BTW, care to share your Android code?
[EVO 4G General] ppc_dan:
Did you guys know that both the Android and iPhone are popular in the home automation world? I am surprised not more people on this forum are doing this, it's fun! Check out ElkDroid, a home automation application for Android which lets you do anything you can think of (thermostat, lights, sprinklers, security), and you can even control it by Voice.

It can notify you via Text-To-Speech and system messages that an event has occured (such as a garage door opening). Plenty of other apps out there, but ElkDroid is one of my favorites (google: elkdroid preview if you want to see it in action).

I also compiled a complete list of home automation apps for Android (google: comprehensive list android home automation apps) which I keep up to date if you are interested in this sort of stuff.
[EVO 4G General] ncherry:
Ah, home automation (... see my sig :D , oops no sig: LinuxHA.com)

The reason I asked the OP about his app was that I wanted to see how he did a few things (just curious). My home automation can be accessed via a Browser and I've tested a few on Android. Many fail with my custom domain name (xyz.uucp) and also don't work with IP addresses (WTFrell)? The small size of a smart phone almost makes it a good idea to build a custom HA app. So far I'm not impresses with the menu/tree structure I've seen on some and my floor plan setup is difficult to see at normal screen size. Since the user can strectch the floor plan it works okay but for things more complex than on/off (e.g. weather conditions or complex controls) it's difficult to figure how to display/access the information.

I'd be interested in this!
[EVO 4G General] lubbad85@hotmail.com:
Nice work!
[EVO 4G General] painter13:
I'm a fan of that! Good work!!!
[EVO 4G General] vnonvmousx:
Brilliant :d

This app is awesome. I am also creating one similar, its also running from my linux box :) It will allow me to boot up my game servers remotely, using my phone, then I can connect to the using a vnc client on my phone. Seeing this app has made me want to finish it. Nice job.
[EVO 4G General] otroguero:
Inspiring! Extremely creative concept, it's this kind of non-linear thinking that is changing technology as we know it. Thank you for sharing! :)
[EVO 4G General] abbots:
this is super, BUT, I don't have a computer in the garage....

anyone has like a bluetooth/relay gadget to do similar task ?
[EVO 4G General] fstbusa:
Has anyone looked into this?

http://tuxgraphics.org/electronics/201104/smartphone-garage-door-opener.shtml#0lfindex5
[EVO 4G General] 2trickpony:
I have been using a GSM garage door switch for a while now

it is a little box that contains a Sim card and various relays.

It is programmed to only accept my mobile number and pin code

I can operate it from anywhere I get a phone signal.

cheers:cool:
[EVO 4G General] scottspa74:
I know this is wicked-old, but how lucky were we to have him here in the Evo forum? (Obviously rhetorical). You're a genius, man.

sent from AOKP heaven