nayr's home automation build out...

Discussion in 'Home Automation' started by nayr, Sep 8, 2014.

Share This Page

  1. nayr

    nayr Known around here

    Joined:
    Jul 16, 2014
    Messages:
    9,376
    Likes Received:
    4,951
    Location:
    Denver, CO
    Figured I'd share some details on my setup since its pretty unique..

    I have a Cubox i4 Pro (Quad 1GHz ARM w/2GB RAM 64gb uSD) that runs ArchLinux and has an eSata 4TB WD Purple Disk
    [​IMG]

    This lil linux box runs a web server with a custom interface I whipped up, the interface controls all the home automation aspects and uses x509 TLS Authentication to access the webpage; without a certificate signed by me you just get an error message (check it out if you like, http://dispatch.nayr.net).. the interface looks great on phones/tablets and desktops, here are a few shots:
    Screenshot 2014-04-08 02.29.52.png Screenshot 2014-04-07 02.50.44.png Screenshot 2014-04-03 23.39.42.png
    Some of the home automation is done through ZWave; the rest is over IP through my control nodes I'll get to shortly... Ive got a ZWave thermostat with some custom circuitry I put together so it runs my swamp cooler like an airconditioner.

    Dispatch also runs an Asterisks VoIP Server for my Cisco VoIP Phones; handling all my phone calls, syncing address books with google, etc.. lots of hacks in here... But from the VoIP Phones I can also control the home automation & security through a touchscreen menu system hosted off the webserver.

    Cameras are on there own vlan with a firewall protecting them; they FTP video 24/7 to the dispatch server and then those files are shared back over the network to my apple computers for playback. I can remote view slow FPS jpeg captures of all my cams over HTTP or use SmartPSS either locally or remotely over VPN (I have 10Mbit uploads so it works well)

    There are several programs I wrote that interface with the Television and Audio/Video Receiver over serial connections, and throughout the house in strategic locations I have Sensor nodes hidden.

    Sensor nodes are BeagleBone Black's running ArchLinux and plugged into the same vlan as the security cameras.
    [​IMG]

    These run custom code to monitor security sensors, turn things on/off with relays, control sprinklers, basically be my IO ports of all sorts.. one in the garage, one in the attic, and one in the basement... they run really simple services that just push changes and sensor data to the dispatch server, where it gets proccessed, and recieves commands from the dispatch server to bang relays, report environmental conditions, etc.. These devices also authenticate with the dispatch server using strong crypto.

    osbo (1).jpg

    I am still debugging/programming/adding on to this and it will be a long term project I spend some considerable time on each year; the next big addon I am going to shoehorn into this is an OkIdoKeys smartlock to have it disarm security system when presented with an auth token, and begin work on an automated aquarium controller for my 55g cold water tank.

    there's a load more going on in the background but I'd just bore you with details... but I thought you guys would get a kick out of such a convoluted setup; I'll keep you guys appraised of any cool new happenings.
     
    Last edited by a moderator: Sep 8, 2014
  2. Shockwave199

    Shockwave199 Pulling my weight

    Joined:
    Mar 13, 2014
    Messages:
    678
    Likes Received:
    195
    Location:
    New York
    Wow, very sweet. Definitely keep up the progress reports.
     
  3. icerabbit

    icerabbit Getting the hang of it

    Joined:
    Apr 14, 2014
    Messages:
    581
    Likes Received:
    71
    Location:
    FL <~> ME
    Short on words ... waw! Way cool! :headphones:
     
  4. nayr

    nayr Known around here

    Joined:
    Jul 16, 2014
    Messages:
    9,376
    Likes Received:
    4,951
    Location:
    Denver, CO
    Thanks :D

    one thing I forgot to mention; the web interface provides toasts for the local device.. if you keep the page open event notifications popup in realtime through the OS's notification system.. when a call comes in the caller-id/address book info appears in the corner of the screen, or a door opens, alarm goes off, etc.. regardless what app you have open as long as the page is open in the background somewhere... It was a grand day when I finally got that working... it also works over IM so I can have it push notifications to my mobile devices.

    eventually the plan is to offload the NVR duties to a Dahua NVR hooked into my AVR and put a bunch of automation around it; ie if the doorbell/alarm goes off then turn on tv (if needed), switch HDMI to NVR.. then timeout and switch back/shutdown..

    Im thinking of new ways to hack more intelligence in all the damn time; for example on really nice days in spring/fall we just leave the back door open for the fresh air, but at night it gets really cold.. if I remembered to shutdown the heater I'd forget to turn it back on later, waking up to your house being 40 degrees sucks and takes a ton of energy to heat back up.. So now if the back door is left open for longer than 5mins it shuts off the heater until the door is closed for 20mins; then it resumes its normal programming.

    I made it really modular and flexible; so often I come up with an idea and a few hours later I have program written and tested that works beautifully.. perhaps one day if I get enough time to cleanup the code and restructure/document things better I may release it OpenSource; but its still going to take a bit of cleverness to even get it running well.
     
  5. Tiger_Claw

    Tiger_Claw Getting the hang of it

    Joined:
    Aug 23, 2014
    Messages:
    151
    Likes Received:
    20
    That is some serious talent brother and that isn't a joke. Have you ever considered designing, copyrighting and selling anything like this?e

    Seriously, I don't know what your day job is, but your hobby here is amazing. :disillusionment:

    Tiger
     
  6. Shockwave199

    Shockwave199 Pulling my weight

    Joined:
    Mar 13, 2014
    Messages:
    678
    Likes Received:
    195
    Location:
    New York
    Hold on, all this effort and cameras and the back door could be left OPEN! You might look into auto door closing!
     
  7. nayr

    nayr Known around here

    Joined:
    Jul 16, 2014
    Messages:
    9,376
    Likes Received:
    4,951
    Location:
    Denver, CO
    no the back door is purposely left open, while were sitting in living room and kids/pets run in and out... especially in the spring time; after breathing recycled air for months on end its nice to smell something other than eachother.. :)

    problem would be I'd open the door and temps would drop a degree or two and the heater would kick on; then I'd shut heater off then few hours later close the back door and go to bed and wake up cold as fuck... I already had the pieces in place for other reasons I just need to put them together.

    For my day job? Well lets just say a few million users is a walk in the park for the systems I design and maintain... My hobbies are vast and never ending, it gets tiring at times because it seems the project is never done and if it is there's several more projects that need attention... the accomplishment is fleeting; but then every once and while I stand back and look at this shit and the bigger picture comes into focus and its just friggin awesome and I have to at least tell someone whats going on.

    I could sell alot of things and make plenty of money; but I make good money and have the ability to do some epic projects as it is so why mess up a good thing? I live life in the pursuit of knowledge and ability; not money...

    ps: my garage doors auto close; both the big car door and the normal pedestrian door.. I am considering one on my office door.
     
    cornholio and Caveman81 like this.
  8. Tiger_Claw

    Tiger_Claw Getting the hang of it

    Joined:
    Aug 23, 2014
    Messages:
    151
    Likes Received:
    20
    That is awesome. You are one lucky MoFo. I tilt my hat in your presence. Keep up the good work

    Tiger
     
  9. catseyenu

    catseyenu Getting the hang of it

    Joined:
    Jun 13, 2014
    Messages:
    311
    Likes Received:
    38
  10. nayr

    nayr Known around here

    Joined:
    Jul 16, 2014
    Messages:
    9,376
    Likes Received:
    4,951
    Location:
    Denver, CO
    you hear any black helicopters yet? there on there way!
     
  11. Vin Tekiel

    Vin Tekiel Young grasshopper

    Joined:
    Jul 30, 2014
    Messages:
    59
    Likes Received:
    1
    Love it!!! It's awesome, it's part of what I want to do, and now I feel so far behind ;(
     
  12. Mike

    Mike Staff Member

    Joined:
    Mar 9, 2014
    Messages:
    1,450
    Likes Received:
    548
    Location:
    New York
    @nayr you never cease to amaze me! This is amazing and extremely cool, keep up the great work and thanks for sharing with the IPCT community.
     
    Last edited: Nov 5, 2016
  13. nayr

    nayr Known around here

    Joined:
    Jul 16, 2014
    Messages:
    9,376
    Likes Received:
    4,951
    Location:
    Denver, CO
    Thanks guys, recently added a Nexus 7 to the network, its freaking wonderful.. battery lasts all day, its fast, display is great, supports multiple users and the wireless charging is ideal.

    im putting together a mobile NAS to put in with my expedition kit, its going to be a WiFi access point coupled with a PogoPlug and 1-2tb of storage running Plex Media Server and Music Player Daemon w/usb sound.. I'll shove it all into a tiny indestructible enclosure with a 12v power plug and it'll provide endless hours of entertainment for passengers on my frequent road trips and give me access to my entire music collection where ever I may wander.

    I will manually re-encode (Handbrake FTW) my entire children's movie collection and favorite tv shows directly into a tablet appropriate resolution (dont really need 1080p) to put on the NAS so all it has to do is serve the files up over a local wireless network.
     

    Attached Files:

    Last edited by a moderator: Oct 2, 2014
  14. icerabbit

    icerabbit Getting the hang of it

    Joined:
    Apr 14, 2014
    Messages:
    581
    Likes Received:
    71
    Location:
    FL <~> ME
    Fantastic!

    You must be able to build and control just about anything with that much technical, hardware and software knowledge! :D

    Custom home automation to suit your needs! Love it!

    In car wifi, nas etc I can handle, though probably not as elegantly as you, and certainly not with custom server, authetication, interface etc. Would be off the shelf-ish.

    ... I really need to learn more stuff ...
     
  15. icerabbit

    icerabbit Getting the hang of it

    Joined:
    Apr 14, 2014
    Messages:
    581
    Likes Received:
    71
    Location:
    FL <~> ME
    PS: regarding the mobile nas.

    I have somewhat of a lite & portable version of what you're going for, in the form of a kingston mobilelite; which does wifi sharing of sd card and usb drives.

    I picked one up for easier mobile file access on the road with ios devices (no card slots :( tired of wasting time moving files around ... no file and folder access really sucks in ios). The kingston was better than the other ones I tried. Might be something under the hood that could be reflashed to be more useful.
     
  16. Jim W

    Jim W Young grasshopper

    Joined:
    Sep 19, 2014
    Messages:
    51
    Likes Received:
    0
  17. Vin Tekiel

    Vin Tekiel Young grasshopper

    Joined:
    Jul 30, 2014
    Messages:
    59
    Likes Received:
    1
    I almost went with the sainsmart relay card, but decided to have fun and bought the relays by themself for almost nothing :)
     
  18. Jim W

    Jim W Young grasshopper

    Joined:
    Sep 19, 2014
    Messages:
    51
    Likes Received:
    0
    I think the relay bit is quite cheap but I want the ethernet controller -I'm trying to figure out a way to rig up a lighting controller that works from an Android phone.
    These are another device wit I/O ports
    Here

    eth484-400.png
     
  19. nayr

    nayr Known around here

    Joined:
    Jul 16, 2014
    Messages:
    9,376
    Likes Received:
    4,951
    Location:
    Denver, CO
    I use beagle bone black for network access and hook the GPIO's to basic relay boards (w/no proccessors)
     
  20. Jim W

    Jim W Young grasshopper

    Joined:
    Sep 19, 2014
    Messages:
    51
    Likes Received:
    0
    I don't have the skills needed to do the programming so i need something ready to go
     
  21. networkcameracritic

    networkcameracritic Getting the hang of it

    Joined:
    Mar 10, 2014
    Messages:
    719
    Likes Received:
    200
    You can use a ZWave setup like a Vera Lite from MiCasaVerde. You can setup ZWave light switches that carry out scenes. For example, you can have a series of light switches that control lighting, maybe one for watching a movie where it dims lights to 20%, closes curtains, turns on TV and DVD player, maybe another one for dinner that turns lights to 60% and turns fireplace on, one for breakfast that opens the curtains and turns lights off. For example, when I unlock the front the door, it turns a lamp on. If I'm watching TV and don't hear someone opening the door, I can visually see the light come on, then shuts off when it's locked. All this can be controlled from a smartphone through their app for IOS and Android. '

    If you just want to control lighting from a phone, there's plenty of WiFi controllable light bulbs like the Philips Hue that even has an assortment of apps - http://www2.meethue.com/en-us/apps-more/apps-we-like/ I just prefer to go with something that's more comprehensive that works with lights, door locks, thermostats and such from one app.


     
  22. nayr

    nayr Known around here

    Joined:
    Jul 16, 2014
    Messages:
    9,376
    Likes Received:
    4,951
    Location:
    Denver, CO
    I did a bunch more work to my system this weekend, started moving logic and automation over to a software suite called Domoticz, its very much like the software you find in VeraLite and other automation controllers.. very clean, fast and well designed software thats exceptionally easy to integrate with, oah and its open source and all coded in C++ so its exactly what Ive been looking for, ive tried several other OSS Automation controllers and they did not compare in quality.

    I am able to create virtual switches and configure them to connect to a URL or run a script for the switch to go ON/OFF, and using json my remote beagles can update sensors and let the logic start to execute.

    For example, to change my thermostat to 75 degrees I would simply request this URL:http://localhost:8080/json.htm?type=command&param=udevice&idx=24&nvalue=0&svalue=75

    Screenshots:
     

    Attached Files:

    Last edited by a moderator: Nov 9, 2014
    Mike likes this.
  23. nayr

    nayr Known around here

    Joined:
    Jul 16, 2014
    Messages:
    9,376
    Likes Received:
    4,951
    Location:
    Denver, CO
    forgot to mention that Domo has rudimentary IPCamera support, I configure the snapshot JPG URL's and then i can associate the camera with certain sensors, and then when notifications go out from those sensors they include a snapshot from the camera.. I am using it with a service called Pushover which lets me send notifications instantly to all my devices..

    It also provides a Security Panel and security logic programing so it will become my security control system too, lots of work to do.
     
  24. Jim W

    Jim W Young grasshopper

    Joined:
    Sep 19, 2014
    Messages:
    51
    Likes Received:
    0
    Looks good
    How many beagles do you have in your place?

    I'm ust trying to figure out what devices I can get so I can have a doorbell chime in all my buildings running off the network.
     
  25. nayr

    nayr Known around here

    Joined:
    Jul 16, 2014
    Messages:
    9,376
    Likes Received:
    4,951
    Location:
    Denver, CO
    I got two right now, one in the Garage doing sprinklers, garage door, rain sensor, garage temp, front door light, and car heater and some security sensors.

    I am working on the one for the basement now, I'll post photos as I get further along.. Its going to monitor temp of 2 fish tanks, current sensors on washer/dryer/dish washer, bug zapper, server exhaust, and also have some more security (motion/door contacts) sensors.. I am waiting on a few parts to start bench testing it and finishing up code.

    A series of scripts monitors the sensors and when there is a change they do a https json request to Domocotz to update status, there is also an https server running that you can post json updates to and change switches.
     
    fenderman likes this.
  26. Jim W

    Jim W Young grasshopper

    Joined:
    Sep 19, 2014
    Messages:
    51
    Likes Received:
    0
    Sounds complex to me
    I like the Robot Electronics device as it has the inputs and outputs but it lacks internal processing power so to can't use it as a standalone device.
    You can view the status of the inputs ie voltage from the analogue input or on/off on the digitals but it can't even handle an external on/off switch to trigger the relays-only a command via the network will trigger the relays
     
  27. nayr

    nayr Known around here

    Joined:
    Jul 16, 2014
    Messages:
    9,376
    Likes Received:
    4,951
    Location:
    Denver, CO
    yeah it could be done simpler, but accessing gpio's in linux is pretty easy and having a full linux operating system and network connectivity on it lets me install apps and programing environments of my choice and then the sensors/io are very easy to wrap in a web server and then you get all the benefits of encryption tls authentication for security... It is then very easy to integrate whatever logic processing I want as all gpio's are now network controllable and readable.. Slap together some html with javascript and I can quickly make a web app where the browser queries various sensors and interacts with them directly, greatly reducing latency and increasing security. Integrating my existing controls with this automation logic control panel was a piece of cake because I am not locked into any vendors or technology.

    I also have a shit ton of GPIO's and I can easily expand to hundreds of sensors/devices if I needed to while having plenty of processing overhead.. in the end its cheaper and more flexible, but yes its more complicated.

    reasons why i choose beagle:

    • Great Ethernet Performance
    • Full Linux Environment of my Choice (ArchLinux Arm)
    • Hardware Watchdog (reboot automatically if bug hangs hardware)
    • Real Time Clock (can hardwire battery backup), keeps accurate timing.
    • Onboard Storage, no micro-sd card for operating system
    • Great Performance, well supported in linux.
    • USB Console and USB Host Port
    • Multitude of GPIO's for all sorts of use and microSD for extra storage if needed.

    using a linux os lets me control watchdog, set time, connect to network and internet, run a webserver, perform certificate authentication, schedule events, and run all sorts of other software without writing a single line of code... A few lines of PHP and perhaps C or something else and a GPIO is controlled via web with almost no noticeable latency.
     
    Last edited by a moderator: Nov 10, 2014
    Mike likes this.
  28. nayr

    nayr Known around here

    Joined:
    Jul 16, 2014
    Messages:
    9,376
    Likes Received:
    4,951
    Location:
    Denver, CO
    So I had to break down and design my own board for this project, the problem is multifactor:
    • Need to Protect the GPIO Pins on BeagleBone from all sorts of bad things.
    • BeagleBone only outputs 3.3v @ 6mA, not enough voltage to make it very far and not enough current to drive much.
    • Home Security systems work off 12v logic levels @ 50mA to drive relays and send signals over long twisted pairs.
    • Need to handle up to 12v signal inputs to handle switches/contacts/motion sensors at a distance.

    So I created a board that does all the above, it uses OptoIsolaters that can run off 3-15V provide 50mA current.. Whatever I power them with is what is outputted, so I can power the board with 5v and get 5v outputs at 50mA or 12v and get 12v outputs at 50mA. The board can be switched around to take 12v/5v signals/inputs and output them at a safe 3.3v

    Optoisolaters are basically LED's and a Light collector, you light up the LED and the collector completes the circuit.. since high and low levels are coupled with optics there safely isolated from eachother.. and the beaglebone only needs to output enough current to drive a LED to send a high level signal, so 6mA is more than enough.

    I went through all sorts of iterations, with Relays and Mosfets and Transistors and Diodes and decided to settle on the OptoIsolator because its the most robust.

    The board is basically an 8ch logic converter and IO isolator, nothing too fancy.. its got nice screw terminals to to wire into, I choose 8 channels because I am doing 24 inputs and 24 outputs in the main security panel and OSHPark who will fabricate my boards does them in batches of 3, so I will make 3 boards on the first run then if all goes well make 3 more on a 2nd run.. then maby 3 more in future for Garage BeagleBone to drive 16 outputs and 8 inputs or vice versa.

    here is the current drawing and schematics, it will cost about $10 a board to fabricate and less than $10 to populate.. not exactly cheap but not bad either.
    just a current revision, likely to change before I send them off to fab:

    [​IMG]

    cant wait to put my reflow soldering oven back to use, but I used large surface mount and through hole components so its easy to do by hand. :D
    dont let the image fool you tho, the board measures ~2x2.75in.

    once I test it all out and it works to my expectations I will release the board, schematics and a bill of materials CC-BY-NC, basically meaning anyone can use it free for non commercial uses.
     

    Attached Files:

    Last edited by a moderator: Nov 16, 2014
  29. nayr

    nayr Known around here

    Joined:
    Jul 16, 2014
    Messages:
    9,376
    Likes Received:
    4,951
    Location:
    Denver, CO
    Ive got a full size elk security cabinet in my server room, the plan is to take a big piece of acrylic.. mount the beagle kinda in the middle with 3 boards on each side stacked on top of each-other.. so 24in on the left and 24out on the right.. might be a small proto board under the beagle with a few more headers broken out for serial and dallas 1-wire sensors.

    I will stick the CuBox in the cabinet too, ive got a 5v 5A power supply that runs off 9-30v input that will be hooked to my big ass 60A 12v linear psu, eventually I will put couple golf cart batteries in my racks and a small solar panel on the roof and attempt to make my entire security system off the grid.. even the cameras
     
    Last edited by a moderator: Nov 16, 2014
  30. Jim W

    Jim W Young grasshopper

    Joined:
    Sep 19, 2014
    Messages:
    51
    Likes Received:
    0
    Nayr that's all over my head but it looks great !

    Can you knock up something similar to the Robot electronics device but slightly different and similar to the
    http://www.controlbyweb.com/webrelay/ but cheaper !