txt3rob
Posts: 365
Joined: Sat Aug 11, 2012 3:45 pm
Contact: Website

Re: Home automation with RPI for control wired "things"

Tue Oct 01, 2013 9:41 am

have you seen my set up with 433mhz remote plugs?
The Raspberry Pi Hell Guy - Random Ramblings to assist me and others.
http://raspberrypihell.blogspot.com
My Github - http:/www.github.com/random-robbie/
http://www.smspi.co.uk - send free uk sms via your raspberry pi from here

crystal13
Posts: 67
Joined: Tue Jan 22, 2013 2:13 pm

Re: Home automation with RPI for control wired "things"

Tue Oct 01, 2013 12:12 pm

txt3rob wrote:have you seen my set up with 433mhz remote plugs?
Hello, I don't want use so low frequency devices because are not legal in my country. I'm seeing the system with NRF24L01+ because works at 2.4GHz.

Thanks!

txt3rob
Posts: 365
Joined: Sat Aug 11, 2012 3:45 pm
Contact: Website

Re: Home automation with RPI for control wired "things"

Tue Oct 01, 2013 12:54 pm

thats fine if you check my github you could alter mystuff to your needs :)
The Raspberry Pi Hell Guy - Random Ramblings to assist me and others.
http://raspberrypihell.blogspot.com
My Github - http:/www.github.com/random-robbie/
http://www.smspi.co.uk - send free uk sms via your raspberry pi from here

halhertani
Posts: 40
Joined: Sun Aug 19, 2012 5:02 am
Location: Ottawa, ON Canada
Contact: Website

Re: Home automation with RPI for control wired "things"

Tue Oct 01, 2013 8:05 pm

crystal 13, the socket programming approach I mentioned can work over WiFi or wired Ethernet...basically so long as you have a local area network (LAN) connection of some sort....just as required for internet/web access.

If Each Raspberry Pi / Arduino is connected to the same LAN through either a wireless WiFi USB device (wlan0) or a wired Ethernet device (eth0) and have an IP address on the LAN, socket programming can enable UDP or TCP/IP communication amongst them.

The Nordic device is a Wireless transceiver that does not use the TCP/IP & Ethernet networking model. It relies on its own minimal communication stack and it really does not qualify as a WiFi device that can be attached to a home local area network. To interface with the Nordic device you need interface to it over the SPI peripheral.....quite possibly with the spidev driver or a custom linux device driver.

jsobota
Posts: 42
Joined: Tue Jul 10, 2012 3:24 pm
Location: Plzen, Czech Republic

Re: Home automation with RPI for control wired "things"

Tue Oct 01, 2013 9:40 pm

@crystal13: both of your plans seem reasonable, my only advice is to use a proper USB wifi device as @halhertani mentioned. I am using Edimax EW-7811Un if I need wifi on RasPi.

I have prepared a silly example showing 2 RasPis exchanging data via ethernet. Prior to reading further please see the wiring diagram and this video: http://youtu.be/oSc-dBaL5xQ (hope you will be able to see it in HD)
It would be quite easy to lighten up these LEDs on an Arduino itself, but we're interested in transmitting data via ethernet, right? So here is what's happening in the background: The RPi2 is reading a potentiometer connected to analog input 0 of the Arduino. The Arduino is running the REXduino slave sketch and RPi2 is the REXduino master. The RPi2 is running the RexCore, the runtime core of the REX Control System. The value read from the potentiometer is fed to the u12 input of the RDC_slave block. From there, it travels via ethernet to RPi1 (which is running RexCore too) where it appears at the y12 output of the RDC_master function block. From there, it passes through the LIN and CNDR function blocks which determine the intensities of individual yellow LEDs. The middle one is controlled by PWM output of RPi1 (GPIO18), while the others are controlled by PWM outputs of the Arduino. For this purpose, the signals are fed to the u0, u1, u5 and u6 inputs of the RDC_master block from where they travel to RPi2 and appear at the y0, y1, y5 and y6 outputs of the RDC_slave block. Before sending these values to the PWM outputs 5, 6, 9 and 10 of Arduino, the numbers are converted from real to integer ones.
The same approach is used for the red, yellow and green LEDs on the right side of the breadboard. They just switch their state each 3 seconds. The red and yellow LEDs are controlled by RPi1 while the green one is controlled by the Arduino connected to RPi2.

By this we have connected 2 RPis together, all data is available in RPi1 and thus we can display them using the webserver running on RPi1. And we can also watch the potentiometer value in the real-time graph.
Attachments
Example_RPi_RDC.jpg
Physical connections for demonstration of 2 RasPis talking via ethernet
Example_RPi_RDC.jpg (63.02 KiB) Viewed 6392 times

crystal13
Posts: 67
Joined: Tue Jan 22, 2013 2:13 pm

Re: Home automation with RPI for control wired "things"

Thu Oct 03, 2013 2:42 pm

Dear friend, last night :D I turned on a led using my Raspberry Pi from my PC that is in same LAN of the RPi, using the line command:
gpio -g mode 4 out
gpio -g write 4 1

with the led connected on pin #4 of the Raspberry. First step is ok, next step is create the webserver for command the led from my smartphone.

Meanwhile, reading your answer:
@jsobota: I will study your answer and I downloaded your document that I will read:
http://control.zcu.cz/~jsobota/REXduino.pdf

@halhertani: I downloaded the document "Beej's Guide to Network Programming Using Internet Sockets" and I will read it.
http://beej.us/guide/bgnet/output/print/bgnet_A4_2.pdf
In few words, what are the advantages to use "Internet Sockets"?

So, you are saying that because the NFR24L01+ of Nordic doesn't use TCP/IP is NOT possible to view the datas trasmitted and received on a webserver? Did I understand right?
Vice versa, using an usb wifi dongle (e.g. Edimax), is it possible?

Thank you very much to all!!

halhertani
Posts: 40
Joined: Sun Aug 19, 2012 5:02 am
Location: Ottawa, ON Canada
Contact: Website

Re: Home automation with RPI for control wired "things"

Thu Oct 03, 2013 5:18 pm

crystal13 wrote:Dear friend, last night :D I turned on a led using my Raspberry Pi from my PC that is in same LAN of the RPi, using the line command:
gpio -g mode 4 out
gpio -g write 4 1

with the led connected on pin #4 of the Raspberry. First step is ok, next step is create the webserver for command the led from my smartphone.

Meanwhile, reading your answer:
@jsobota: I will study your answer and I downloaded your document that I will read:
http://control.zcu.cz/~jsobota/REXduino.pdf

@halhertani: I downloaded the document "Beej's Guide to Network Programming Using Internet Sockets" and I will read it.
http://beej.us/guide/bgnet/output/print/bgnet_A4_2.pdf
In few words, what are the advantages to use "Internet Sockets"?

So, you are saying that because the NFR24L01+ of Nordic doesn't use TCP/IP is NOT possible to view the datas trasmitted and received on a webserver? Did I understand right?
Vice versa, using an usb wifi dongle (e.g. Edimax), is it possible?

Thank you very much to all!!

The NFR24L01+ is a wireless radio transceiver that uses its own protocol. It cannot talk to other devices on an Ethernet based local network. In order to use the NFR24L01+ device, you'll need to attach one NFR24L01+ radio transceiver to each RPi to allow them to communicate using the NFR24L01+'s protocol / stack. The NFR24L01+ is SPI bus based so you'll need to interface it with the RPi over the SPI bus.

The advantage of socket programming, you can enable two RPi devices to communicate over preexisting infrastructure...the home network LAN on which your website/webserver will also be hosted on. Take a look at socket/network programming to understand it better. Beej's tutorial is good for C programmers. If you are new to programming or prefer python I suggest looking for python based socket programming tutorials. This might be a good start http://www.binarytides.com/python-socke ... -tutorial/

kapiteined
Posts: 1
Joined: Sat Oct 05, 2013 7:45 pm

Re: Home automation with RPI for control wired "things"

Sat Oct 05, 2013 7:53 pm

DrFatalis wrote:One solution for home automation is using X10 protocol to send information through electrical wire in your house.
You can place some X10 module in switch light hole and use a CM15 pro to send X10 order in your house electric wires.
Security system and others functionnalities exist on this protocol.

You connect your raspberry pi to CM15 Pro thanks to an USB cable and send order. I've got a tutorial on a french blog that explain how to proceed but it's in french. This will send information to the desired module like dimmer, touch screen, or others devices and will control all your house.

gl & hf
Hi, shameless plug: i wrote a small program to control your lights with a pi and a 434 MHz transmitter.
I is available at http://x10.kapitein.org

crystal13
Posts: 67
Joined: Tue Jan 22, 2013 2:13 pm

Re: Home automation with RPI for control wired "things"

Tue Oct 08, 2013 9:49 pm

Hi to all,

I have good news for me. ;)

I turned on and turned off a simple led from a webserver that runs on RPi. As you suggest I did this both through LAN cable that through usb wi-fi adapter (Netgear WG111). In this video you can see how I turn on/off via wi-fi adapter:
http://www.youtube.com/watch?v=gQFQ2tp- ... e=youtu.be

A word on generic commercial usb wifi adapter. The most expansive usb wifi adapter (about 12/15€) use chipset Realtek 8188 (Netgear WG111 is 8187); the less expansive usb wifi adapter (about 3/6€) use chipset Ralink 5370. Both are supported by Raspbian, but seems that the chipset Realtek is more reliable.

For now, I set aside the idea of ​​using a NRF24L01+ because it seems that in order to use TCP / IP protocol, I should write from scratch the TCP/IP protocol and I don't know how to do it. For the wireless solution is much simpler the use of USB wifi adapter, and at the same time seems not more expansive of the NRF24L01+.

Anyway....the next step is understand how can control more RPi using only one webserver mounted on one of RPis; for do this, I will read your suggestions.

For now, thank you to all!

crystal13
Posts: 67
Joined: Tue Jan 22, 2013 2:13 pm

Re: Home automation with RPI for control wired "things"

Wed Oct 09, 2013 2:47 pm

Hello,

a question for who use the usb wifi adapter.

Are you using the adapter on external usb hub or are you using it on the RPi usb port?

I ask this because I read that some usb adapter can requires a lot of power and this cause the reboot of RPi.

Thank you.

User avatar
jbeale
Posts: 3491
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: Home automation with RPI for control wired "things"

Wed Oct 09, 2013 4:28 pm

Cancelor wrote:I understand the two I2C buses are the easiest and most expandable on the RPi and are capable of expanding to thousands of ports.
What does the Arduino bring to the party?
I don't think I2C on a single host is the best solution if you need thousands of ports, but with enough expander chips I guess it is possible.
The RPi is quite small, low power and low cost for being cable of desktop-computer functions. But an Arduino can be even smaller, lower power, and cheaper than R-Pi in addition to having analog in, more PWM out, and being a hard-real-time microcontroller. The basic Arduino is no good for graphics or hosting USB devices, but it's good for simple I/O control tasks.

Consider this "Arduino Pro Mini" clone on ebay. It is under $4 shipped (!), about the size of a postage stamp, and uses something like 20 to 30 mA of current running flat out, and down to microamps or less in sleep mode. Power is nominally 5V but can work down to 3.3 V. For these reasons it can go places the RPi is too large or too power-hungry or too expensive to go.

crystal13
Posts: 67
Joined: Tue Jan 22, 2013 2:13 pm

Re: Home automation with RPI for control wired "things"

Thu Oct 10, 2013 7:46 am

jbeale wrote:
Consider this "Arduino Pro Mini" clone on ebay. It is under $4 shipped (!),
Hello jbeale,

I already know this business, but how can you program the Arduino Pro mini without usb port?

I saw the arduino NANO that have the usb for to connect to a PC and can program it, but the price is about 10$.
http://www.ebay.com/itm/271251071444

Thanks

User avatar
jbeale
Posts: 3491
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: Home automation with RPI for control wired "things"

Thu Oct 10, 2013 2:06 pm

crystal13 wrote:I already know this business, but how can you program the Arduino Pro mini without usb port?
The idea with the "Arduino Pro Mini" is that you only need to use the FTDI USB-Serial adapter programmer sometimes, so you can save board space and cost by getting just one USB-serial adaptor, and it can program however many Arduinos you want. The adaptor costs under $5: http://www.ebay.com/itm/FT232RL-FTDI-US ... 1171616077

thienson30
Posts: 26
Joined: Mon Jul 08, 2013 7:53 am

Re: Home automation with RPI for control wired "things"

Sun Oct 27, 2013 8:04 pm

On Ebay, it shows a transmitter module that can control upto 1000 channels/devices. on the ebay search for rfCommandMe.

thienson30
Posts: 26
Joined: Mon Jul 08, 2013 7:53 am

Re: Home automation with RPI for control wired "things"

Sun Oct 27, 2013 8:11 pm

I just finish my project: one simple RF transmitter module (3 pins) add to Raspberry PI and control over 1000 channels/devices in your home. I just put it on ebay for sale. If you search for rfCommandMe, you will see my products. I'm going to make a youtube video to show user how to implement HVAC control, light, fan, garage, sprinkler, Power Strip, or anything to do with electric current . Hope this will help your HOME AUTOMATION PROJECT.

crystal13
Posts: 67
Joined: Tue Jan 22, 2013 2:13 pm

Re: Home automation with RPI for control wired "things"

Wed Oct 30, 2013 2:03 pm

Hello everyone,

after a week of studies, I'm analyzing the solution X10. I'm thinking if this is a convenient way of to do home automation instead that the wifi solution. The reasons are that I'm seeing the prices of the actuator that works on X10 protocol. If you see this, for example:

http://www.nicoshop.com/domotica-microm ... tek.html#3

33€ for only 1 lamp. If you calculate for all the lamps of house.....the price goes up very much.

What do you think about this?

thienson30
Posts: 26
Joined: Mon Jul 08, 2013 7:53 am

Re: Home automation with RPI for control wired "things"

Tue Jan 21, 2014 12:57 am

Check out my youtube video at http://www.youtube.com/watch?v=5dmvT6vTV2w

Hardware (85volt to 260volt RF Relay Receiver) is available at http://www.ebay.com/itm/271337832780?ss ... 1555.l2649
crystal13 wrote:Hi to all,

I start to build my home next April and I'm very interested to plan the project of electric wires so that I can use Raspberry Pi to control things of my home (lights of rooms, windows, anti-theft, etc...).

My initial idea of the architecture of my Home automation is this:

- I imagine that there is one point in the home where will arrive all electrical wires of the things of home (e.g. electrical wires of lights).

- Here, every electrical wire (and so, every light of the rooms) is controlled (turned on and turned off) by a relay.

- Everey relay is connected to RPI via his GPIO pins; so every relay is controlled by GPIO pins.

- On RPI lives a webserver, where an user can be connected (via mobile device) and so he can control the GPIO (and so every relay) status.

- The RPI is connected to an WI-FI router via LAN cable. So, every mobile device can be connected via wireless.

- A single user can use his smartphone, tablet, iphone, PC for to connect to webserver and so for to control the GPIO (and so every relay).

This is my preliminary idea. I don't know if I forgot to consider something of important, software or hardware. Before to do a schema on paper, I want ask you some question if you can help me. I saw that some one have used also a microcontroller as Arduino with RPI for this scope. So, for clear my ideas I want ask you:

1) what are the advantage to use Arduino in combination with RPI?

2) I saw that there are a lot of open source project for to control home via webserver. Can you suggest me what are the most popular?

If I have not explained well, you can ask me where I can be more clear.

For now, thank you very much.
Gianfranco

johndough
Posts: 254
Joined: Sun Jan 13, 2013 2:00 pm

Re: Home automation with RPI for control wired "things"

Tue Jan 21, 2014 11:34 am

Hiya

Well there are a few possibilities.

SAFETY. Get it wrong and you can be .....

In hospitals, particularly the US, they use a relay. This relay latches on and is then silent in operation.

Now there are ways to control that relay to Switch ON and OFF using a single wire. It latches.

If you route the wiring of the light through a relay, making it "2 way" then the light can be switched as you walk past or by a remote thingy like a Pi.

With various types of relay and contact combination the system will work even if your digital system fails.

But this is all dependant on access to circuit wiring and fitting a small box with a relay in. The connections etc are something that can be explained later.
The cost seems prohibitive, but...

crystal13 wrote:Hi to all,

I start to build my home next April and I'm very interested to plan the project of electric wires so that I can use Raspberry Pi to control things of my home (lights of rooms, windows, anti-theft, etc...).

My initial idea of the architecture of my Home automation is this:

- I imagine that there is one point in the home where will arrive all electrical wires of the things of home (e.g. electrical wires of lights).

- Here, every electrical wire (and so, every light of the rooms) is controlled (turned on and turned off) by a relay.

- Everey relay is connected to RPI via his GPIO pins; so every relay is controlled by GPIO pins.

- On RPI lives a webserver, where an user can be connected (via mobile device) and so he can control the GPIO (and so every relay) status.

- The RPI is connected to an WI-FI router via LAN cable. So, every mobile device can be connected via wireless.

- A single user can use his smartphone, tablet, iphone, PC for to connect to webserver and so for to control the GPIO (and so every relay).

This is my preliminary idea. I don't know if I forgot to consider something of important, software or hardware. Before to do a schema on paper, I want ask you some question if you can help me. I saw that some one have used also a microcontroller as Arduino with RPI for this scope. So, for clear my ideas I want ask you:

1) what are the advantage to use Arduino in combination with RPI?

2) I saw that there are a lot of open source project for to control home via webserver. Can you suggest me what are the most popular?

If I have not explained well, you can ask me where I can be more clear.

For now, thank you very much.
Gianfranco

Tarcas
Posts: 740
Joined: Thu Jan 09, 2014 5:38 am
Location: USA

Re: Home automation with RPI for control wired "things"

Thu Jan 23, 2014 10:31 pm

If you haven't already, check out Jonathan Oxer's SuperHouse YouTube series. He has done a lot of what you're talking about doing, and more. You can get some ideas from how he's done it. I'm not saying his way is the best way, but you can use it as a template.
Episode #1: http://www.youtube.com/watch?v=ZUEKr_48EfQ

Return to “Automation, sensing and robotics”