Aliende

Background data:My idea of this thread is to share my project and maybe get your opinion or experiences and also to help you out if anyone wants the code I am working on, etc.

As my house is under construction, I got really excited of being able to apply some domotics on it, after being a Java programmer for 3 years, I finally got the chance to play with hardware. The first version I am working on consists on Lighting + Security handling.

I have planned to install an arduino + eth. shield per one or two rooms (when possible).All this black boxes (uno + eth. shield) will be connected to a router or switch (I like the idea of the switch because I find better to separate the domotic´s net from my actual wifi + internet net), but this can also be done via software so I still don´t know if it is necessary. Below I will add a question about power sourcing this "boxes".I expect that I´ll be installing 3 to 5 of this "boxes" in total.

The server machine role will be hosting a web page to manage the house remotely, also bring access to the ip cameras (I took a look at zone minder and found it very powerfull, zone handling, alerts, etc). One idea I like is having zoneminder watching the cameras and being able to talk to the arduino boards through ethernet (for example: turn on a light for a while) if something strange has been detected, "House alone" style haha. Server machine will be storing camera´s images and maybe media center (future plan).

Technical stuff:From the beggining of this project I had in mind that the system I used had to be able to work (normal use + soft configuration) regardless of the server availability.What I have done to achieve this is storing an array of structs on Arduino´s eproom wich (each struct) consists of an input pin, output pin, a name and a type. This config can be read through ethernet by accessing http://arduinoip/CONFIG, the response is JSON formatted (did it without a parser because of its simplicity). This config purpose is to map inputs to outputs for the lighting adjustment, acting like a flip flop with multiple inputs for each light.

The next thing after being able to read this configuration is how to write it remotely, I am actually working on this having in mind what I said before, that It must be done regardless of the server availability. To achieve this I am planning to host a web page on the arduino displaying this configuration in a form, being able to modify it and saving it (the form will be submitted to the arduino). IP + MAC address will also be displayed for modifications if needed.If needed, this same web page will be hosted on the server, maybe with extended functionality, or at least nicer .

Finally, the server communicates to the boards using RESTduino library. As the server is able to read each "box" configuration, it can handle events that affect more than one board (for example turn all the lights off), just by accessing http://arduinoip/8/LOW will turn the 8 pin output off.

Hardware:The lighting on/off control will be done using the 5v Relay available on dx.com

Doubts:1. What do you recommend, having a power source for each arduino or having only one (more powerfull) all of them (with the advantage of having 9v through all he house for future)?2. Relays, I don´t know where to install them, near the arduino or near the controlled object. I like that having it near the object (for example a lamp) will separate my arduino from 220v being safer to do maintenance on the board.

Feel free to leave any comment of opinion about any of the ideas I have.Sory for my english and the extension of this thread, it got large.

Thanks,Federico

danhux

I am curious to see your code for the computer side. I'm not a programmer at all, I'm looking for a way to control the outputs of the arduino from windows using C#. I have the serial port figured out. I am looking a C# code I can copy and paste, then change the pin numbers to the correct pin I want to control. I want to build/compile the code to be exe files for each pin I want to control. I don't want a form application, I'd rather work with console apps. Thanks,Dan

RobV15

since low voltage wire (smaller gauge) is less expensive than higher voltage wire, I would suggest putting the relays next to the component being controlled. That way you dont have to run expensive wire across your home to the relay board.

Aliende

I am curious to see your code for the computer side. I'm not a programmer at all, I'm looking for a way to control the outputs of the arduino from windows using C#. I have the serial port figured out. I am looking a C# code I can copy and paste, then change the pin numbers to the correct pin I want to control. I want to build/compile the code to be exe files for each pin I want to control. I don't want a form application, I'd rather work with console apps. Thanks,Dan

Dan, I haven´t got any computer side code yet. You could, as I did, use RESTduino (https://github.com/jjg/RESTduino), that way you can control output pins using only urls, for example, running "curl http://arduinoip/8/LOW" from console you would set pin 8 to low. I am not sure if this would be the best way given your requirements, but it can be done and works.If doing it from C#, I supose that creating an http request should not be so hard.But first, are you going to do this by the serial port or through ethernet shield?

since low voltage wire (smaller gauge) is less expensive than higher voltage wire, I would suggest putting the relays next to the component being controlled. That way you dont have to run expensive wire across your home to the relay board.

Rob, thanks for your reply. What do you think about wich cable type to use? In this case a relay uses 3 wires, what about connection port?

danhux

Thanks for the tip, I'm going to use serial port communications. I'm working on a "Jarvis" from ironman hobby project. For now I only need console apps in the form of exe files. For example, using windows 7 voice recognition and windows speech recognition macros I can get the pc to launch a specific file. I can make windows forms apps work, but it wouldn't make since to shout "light B on" then run across the room to click the mouse to send the command to turn on pin35 of the Arduino Mega2560. I could just make a lightBon.exe that turns pin35 on/high and lightBoff.exe that turns pin35 off/low. I have a relay module to drive the high voltage for the lights/lamps.

kyngston

You should check out this video. They're using MQTT for their communication protocol, and POE (power-over-ethernet) modules on all their remote arduino light switches.http://www.youtube.com/watch?v=ZUEKr_48EfQ

If you have long runs, trying to distribute 9v will run into problems. Depending on your current draw, you will suffer voltage I-R drop down the wire which if it gets bad enough will cause brownouts and flaky behavior. That's why POE uses 48v for it's distribution, with stepdown transformers at each node. With a high voltage the current is low, which results in small I-R drops in your power distribution line. Same reason power companies run high voltage lines to your local transformer, and step it down for the final leg into your house.

Aliende

Just to keep this updated: I ended up using openHab as the main software controller (running on xubuntu), I really recommend it to all trying to do stuff like this. There is an event bus and where you can bind lots of types of connectos, in my case, mainly http ones. I was able to parse arduino output (json) from openHab easily.Also added a little RFC controller interface (look up on dx.com), wich has 4 buttons wich turn on off 4 different lights. For the record, this is a big improvement because opening chrome and navigating to openHab interface took long enough from my cellphone/pc. It is now my preffered method, cost is low and works perfect with arduino.