Howto: Raspberry Pi GPIO 433MHz Remote Sockets

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

fitzy89
Posts: 1
Joined: Friday 03 July 2015 21:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Surrey, UK
Contact:

Howto: Raspberry Pi GPIO 433MHz Remote Sockets

Post by fitzy89 »

Hello all

I'm a new user of Domoticz but it's a great project and nice to see how many different systems it can integrate with, well done to all those involved in creating it.

After the best part of 3 days trying to use a cheap £2 433MHz transmitter and receiver with Domoticz I must say it has been more difficult than I'd expected but I've finally figured it and and it's working like a charm so I thought I would write a little guide to help anyone else who may be having difficulty with it as I haven't seen any other guides anywhere detailing the whole process. This may not be the best or easiest way to do it but it worked for me so may help others too. If this is the wrong part of the forum to post it in I apologise, please could a mod move it to somewhere more appropriate?

Hardware
So, I started out by getting a cheap 433MHz transmitter and receiver from ebay, there are hundreds of sellers and brands of the same device, they are incredibly cheap so well worth giving it a try instead of buying an expensive £83 RFXCom device as I've seen suggested multiple times in various forums. This is the one I purchased for £1.68 including free UK postage: http://cgi.ebay.co.uk/221786845451
Image

As I'm fairly inexperienced with all things GPIO this was new territory for me. After about half an hour of hunting I found a decent picture and guide for which pins to hook the transmitter/receiver up to on the NinjaBlocks website. Follow the guide on that website and you can't go far wrong, although it's worth checking the voltage of your transmitter and receiver before hooking up the VCC leads to the Pi, I'm sure many of you on here know the various Pi pinouts, I'm using a Model B Rev2 Pi and I used the 5V headers (pins 1 and 3) for VCC and pin 6 and 14 for the grounds, Pin 11 for the data line of the transmitter, and pin 13 for the data line of the receiver (the receiver has 4 pins, the middle two are both data and it doesn't matter which one you use).

That's it for the hardware side of things, sit down and have a cup of coffee for a few minutes (if your brain is hurting as much as mine was by this point).

Software
At this stage you will need to install WiringPi, this guide was perfect and describes the process if you're not familiar with it.

So, still following the NinjaBlocks site I mentioned above, you'll get to Phase 2 which details downloading the programs for testing the hardware via SSH. I downloaded the utils mentioned there and ran the RFSniffer program and made a note of the RF codes for all buttons on my remote control, in my case this was for a 'Watts Clever ES-UK1203' remote socket. The original remote can support up to 6 sockets, sadly for me I've only got one to play with at the moment but I made a note of all the codes for future use. It's also worth noting that these sockets can learn new codes, so if you want more than 6 sockets you can just hold the button on the front of it until the light flashes, send a new code and it will learn that, you could also get two sockets to learn the same code to have them both turn on/off together.

So far, you should have downloaded the utils and made a note of all your remote codes. Now go back to your SSH connection and browse to the folder named RPi_utils from the guide above. You'll now need to change ownership of the codesend program so that Domoticz can execute it. The command I used for this was "sudo chown -v pi codesend" (without quotes).

Still remaining in your SSH session, and following the Domoticz Wiki guide on GPIO, you need to export the pins you are using to allow Domoticz access to them. start by typing "sudo nano /etc/init.d/domoticz.sh" (without quotes) into your SSH window, go to the bottom of the file and add the following below the colon:

Code: Select all

/usr/local/bin/gpio export 17 out
/usr/local/bin/gpio export 18 in
Reboot your Pi using the command "sudo shutdown -r now".

Once you're up and running again, move over to the web interface of Domoticz to continue. Go to Setup > Hardware and add a new device. Give it a nice name, I chose "433MHz", for the type select "Raspberry's GPIO Port and leave the data timeout to Disabled. You're done with this part.
Image

Then go to the Switches page and click Manual Light/Switch. Here you'll want to use the hardware you just added in the top box, give it a descriptive name in the second box, set the switch type to On/Off and the Type to GPIO. In the GPIO box, select "gpio17 (GPIO. 0) on pin 11 (OUTPUT)" if it says NOT EXPORTED instead of OUTPUT at the end of this line, go back to the paragraph about about exporting the GPIO pins and make sure you reboot afterwards (which is required). Don't worry about the Test button, it won't help us here. You've now added your 'Device'.
Image

Then go back to your switches page and click Edit under the one you have just added. The fields we are interested in here are 'On Action' and 'Off Action'. For these, we will tell it to run the codesend script from the NinjaBlocks tutorial we did earlier so you need to type in the path to that script, followed by one of your remote codes that we noted earlier. For me, the 'On Action' line reads "script://home/pi/433/433Utils-master/RPi_utils/codesend 2505742" where 2505742 is the code to switch on my socket, the path to your script will likely vary, you should know where you downloaded it to so you may need to change the path and your remote code accordingly. My 'Off Action' line reads "script://home/pi/433/433Utils-master/RPi_utils/codesend 2505734" where the code 2505734 is the code to turn my socket off. Click Save, and you're done here! If you find that it is not working, make sure you run the 'chown' command as described earlier, that's one problem I ran into when it wouldn't work for me.
Image

Complete!
You should now have a fully functioning remote control plug socket controlled by Domoticz. As I'm very new to it, and don't have the greatest linux skills myself there may be errors in the above guide but I've tried as best as possible to describe it clearly and correctly, I'll try and update it later on with some pictures and screenshots for clarity when I get more time. This guide was somewhat rushed as I wanted to detail it before I forgot what I did :) As I've only got the one remote socket at the moment, I don't know if the settings I have put in will allow to have more than one socket controlled by the same transmitter/hardware but hopefully it can. If anyone knows of any improvements or if I've made any errors in this guide please feel free to mention it and I'll update the guide accordingly.
roymoesker
Posts: 1
Joined: Friday 07 August 2015 17:16
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Howto: Raspberry Pi GPIO 433MHz Remote Sockets

Post by roymoesker »

Looks great. components bought and on their way.

I'm having trouble with connecting the right pins. You refer to the ground headers as pin 6 and 14.
Not having any experience myself, I had to read this page to learn about the pinnumbers: https://www.raspberrypi.org/documentation/usage/gpio/
And it seems correct physical numbering. But then it would not be pin 1 and 3 for the V5 headers. So now I'm confused.

I hope someone can help me out.
ngauruhoe
Posts: 7
Joined: Sunday 26 July 2015 19:35
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Howto: Raspberry Pi GPIO 433MHz Remote Sockets

Post by ngauruhoe »

Hi fitzy89, I'm also confused about pin usage. The data pins for receive/xmit you are using do not match the pins in the Ninja article you refer to. So, which ones should I use?

Thx
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Howto: Raspberry Pi GPIO 433MHz Remote Sockets

Post by ThinkPad »

Why not go the RFLink route? Cheaper than RFXCOM and easier to use than this GPIO solution i think.
See http://www.nodo-shop.nl/nl/21-rflink-gateway for kits/ready2use items.

No spam, i am not linked to the RFLink product, just think it is a good competitive product :)
I am not active on this forum anymore.
User avatar
remb0
Posts: 499
Joined: Thursday 11 July 2013 22:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: Howto: Raspberry Pi GPIO 433MHz Remote Sockets

Post by remb0 »

Nice tutorial fitzy89. can you add it into the wiki?
Fot the users who like to experiment and be busy.

but for the most users rfxcom is the best option but a cheaper option is indead the rflink way...

every option has cons and pros.
rvvliet78
Posts: 3
Joined: Thursday 30 July 2015 22:19
Target OS: -
Domoticz version:
Contact:

Re: Howto: Raspberry Pi GPIO 433MHz Remote Sockets

Post by rvvliet78 »

Why do you create a gpio switch? I use a normal dummy switch and call the script. Using a gpio switch I clould only add one. Also this way you dont need to define the gpio ports at domoticz startup
koosman35
Posts: 1
Joined: Thursday 10 September 2015 15:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Howto: Raspberry Pi GPIO 433MHz Remote Sockets

Post by koosman35 »

Hi rvvliet78

Can you maybe also do a nice step by step tutorial the way you set yours up using a dummy switch.
The current way works, but I'm stuck with 1 switch only. It sounds like your way is a better option.
I'm also a noob with Domotics
User avatar
sincze
Posts: 1299
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Howto: Raspberry Pi GPIO 433MHz Remote Sockets

Post by sincze »

Seems like a nice cheap project. :D
Currently I am one RFXCom short but I think this solution is able to help me capture the ID''s of the devices currently out of reach of my rfxcom.
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
User avatar
sincze
Posts: 1299
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Howto: Raspberry Pi GPIO 433MHz Remote Sockets

Post by sincze »

fitzy89 wrote:.....

Hardware
So, I started out by getting a cheap 433MHz transmitter and receiver from ebay, there are hundreds of sellers and brands of the same device, they are incredibly cheap so well worth giving it a try instead of buying an expensive £83 RFXCom device as I've seen suggested multiple times in various forums. This is the one I purchased for £1.68 including free UK postage: http://cgi.ebay.co.uk/221786845451
Image

As I'm fairly inexperienced with all things GPIO this was new territory for me. After about half an hour of hunting I found a decent picture and guide for which pins to hook the transmitter/receiver up to on the NinjaBlocks website. Follow the guide on that website and you can't go far wrong, although it's worth checking the voltage of your transmitter and receiver before hooking up the VCC leads to the Pi, I'm sure many of you on here know the various Pi pinouts, I'm using a Model B Rev2 Pi and I used the 5V headers (pins 1 and 3) for VCC and pin 6 and 14 for the grounds, Pin 11 for the data line of the transmitter, and pin 13 for the data line of the receiver (the receiver has 4 pins, the middle two are both data and it doesn't matter which one you use).
Great manual. Inspired me to buy at least the hardware and start experimenting. :D

As the NinjaBlocks website. link is not working for me just a quick question.

Should I be worried about damaging my GPIO board as the sensors need 5V and return some sort of data to the GPIO port that will only allow 3,3v ?

Also did you mount an additional antenna to increase range / reception ??
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
Koensk
Posts: 33
Joined: Friday 25 September 2015 9:23
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Howto: Raspberry Pi GPIO 433MHz Remote Sockets

Post by Koensk »

The Ninja website is offline indeed. Is there another guide to be found or fitzy89 can you guide us through a bit more maybe?

I would be very gratefull

Regards
Purejet
Posts: 12
Joined: Wednesday 07 October 2015 14:07
Target OS: -
Domoticz version:
Contact:

Re: Howto: Raspberry Pi GPIO 433MHz Remote Sockets

Post by Purejet »

What is the difference between RFLink and cheap 433 mhz on GPIO?
I mean in functionality?

Because i have some cheap transceiver and now use it with Pimatic. But want to have an easier manner to work with.
Does also anyone if it's possible to make an RFLink with an Arduino nano?
Woeka
Posts: 6
Joined: Thursday 12 November 2015 13:28
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.4834
Location: Olst, The Netherlands
Contact:

Re: Howto: Raspberry Pi GPIO 433MHz Remote Sockets

Post by Woeka »

Ninjablocks site can be found here:
https://web.archive.org/web/20150415084 ... spberry-pi
User avatar
sincze
Posts: 1299
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Howto: Raspberry Pi GPIO 433MHz Remote Sockets

Post by sincze »

Woeka wrote:Ninjablocks site can be found here:
https://web.archive.org/web/20150415084 ... spberry-pi
tnx. now I can complete my testing :D without breaking somethng
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
MaartenTMM
Posts: 2
Joined: Monday 23 November 2015 16:13
Target OS: -
Domoticz version:
Contact:

Re: Howto: Raspberry Pi GPIO 433MHz Remote Sockets

Post by MaartenTMM »

how to get this done with a raspberry pi 2?

including a scheme how to attach the reciever and transmitter to the board
rolfo
Posts: 11
Joined: Monday 23 November 2015 20:35
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Howto: Raspberry Pi GPIO 433MHz Remote Sockets

Post by rolfo »

MaartenTMM - try "gpio readall" command - it prints gpio diagram.

And I have a question. I installed both transmitter and receiver. It works great but only for my 230v sockets. I managed to control it with Siri - https://www.youtube.com/watch?v=kSSMpJr5ehg . But I have blinds with 433 remote and receiver doesn't seem to receive any code from the controller. I guess that code is 9 digits or more (tried to ./codesend 12345678 and it worked, but ./codesend 123456789 not). Do you guys now how can I "read" the code form the remote (here - it is RR-5 remote http://www.portos.company/automation/portos ).
FraMi
Posts: 2
Joined: Tuesday 08 December 2015 18:00
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Howto: Raspberry Pi GPIO 433MHz Remote Sockets

Post by FraMi »

Hello,

i am new here and i am a absolutely noob.

I have the problem that domoticz does not turn on my socket. when i run the script in ssh with sudo in front of it, it works. without sudo i get this error: wiringPiSetup: Must be root. (Did you forget sudo?)

In the log i see the following:
2015-12-08 17:46:09.895 Domoticz V2.3530 (c)2012-2015 GizMoCuz
2015-12-08 17:46:09.895 Build Hash: 9eef872, Date: 2015-11-01 11:41:18
2015-12-08 17:46:09.895 System: Raspberry Pi
2015-12-08 17:46:09.896 Startup Path: /home/pi/domoticz/
2015-12-08 17:46:10.361 Sunrise: 08:25:00 SunSet:16:29:00
2015-12-08 17:46:10.361 EventSystem: reset all events...
2015-12-08 17:46:10.404 Active notification subsystems: (0/10)
2015-12-08 17:46:10.539 Webserver started on port: 8080
2015-12-08 17:46:10.589 Webserver started on port: 443
2015-12-08 17:46:10.611 Started shared server on: 0.0.0.0
2015-12-08 17:46:14.487 Incoming connection from: 192.168.2.116
2015-12-08 17:46:58.810 1-Wire support available (By Kernel)...
2015-12-08 17:47:10.856 GPIO: WiringPi is now initialized
2015-12-08 17:47:10.856 GPIO: Worker started...
2015-12-08 17:51:03.556 GPIO: WriteToHardware housecode 0, packetlength 7
2015-12-08 17:51:03.556 GPIO: pin #17 state was 0
2015-12-08 17:51:03.556 GPIO: WriteToHardware housecode 0, GPIO 17, previously 0, set 1
2015-12-08 17:51:03.557 (433Mhz) Lighting 1 (Radio)
2015-12-08 17:51:06.167 GPIO: WriteToHardware housecode 0, packetlength 7
2015-12-08 17:51:06.167 GPIO: pin #17 state was 1
2015-12-08 17:51:06.167 GPIO: WriteToHardware housecode 0, GPIO 17, previously 1, set 0
2015-12-08 17:51:06.167 (433Mhz) Lighting 1 (Radio)

But nothing happens.
I hope anybody can help me.

Kind regards
Michael
alfred_j_kwak
Posts: 110
Joined: Friday 20 September 2013 18:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.3530
Location: Finland
Contact:

Re: Howto: Raspberry Pi GPIO 433MHz Remote Sockets

Post by alfred_j_kwak »

FraMi
Posts: 2
Joined: Tuesday 08 December 2015 18:00
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Howto: Raspberry Pi GPIO 433MHz Remote Sockets

Post by FraMi »

Hello,

it works but i combined this http://mathias-biedert.de/2014/08/25/ra ... -schalten/ with the hints from above.

But now there is the problem that i can use the gpio 17 only once. I have 5 sockets, so i need "5x a switch with gpio17".
Maybe somebody knows what is to do that the dummy solution works, steb by step?

I tried it and following happend:

1. new Hardware with the type: dummy
2. Switches -> manual Light/Switch
3. Hardware: dummy
device name: Sofalampe
Switch type: on/off
Type: GPIO
GPIO: gpio17 (GPIO.0) on pin 11 (OUTPUT)
4. klick on "add device" -> undefind

I hope somebody can help me with this.

greatings
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Howto: Raspberry Pi GPIO 433MHz Remote Sockets

Post by Derik »

Great Thanks!!!!
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
PiFan
Posts: 1
Joined: Saturday 20 February 2016 15:14
Target OS: -
Domoticz version:
Contact:

Re: Howto: Raspberry Pi GPIO 433MHz Remote Sockets

Post by PiFan »

Hi folks,

just found a new 433MHz module on Kickstarter:

https://www.kickstarter.com/projects/12 ... spberry-pi

Like written in the campagne, it's a nice opportunity to the solutions with two seperate modules and the wires.
I think, I'll go for two modules :mrgreen: . What do you think?

Cheers,

PiFan
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest