Raspberry Pi - WiringPi with RF 433mHz transmitter
WiringPi GPIO pins
Pin 2 - Vcc (5V)
Pin 6 - GND
Pin 11 - GPIO 17 - (WiringPi Pin 0): Linked to Emitter
Pin 13 - GPIO 27 - (WiringPi Pin 2): Linked to Receiver (RF433MHz – XY-MK-5V)
FROM: http://i-build-stuff.blogspot.com.es/2015/01/wireless-room-temperature-monitoring_27.html
With that simple setup on i can go ahead i can try and send data and see if it is being received.
Now on my computer i connect to my Raspberry Pi using ssh
Code 1 : ssh pi@yourlocalIPaddress
|
Then I have to go to the specific folder where the 433Utils programs are stored in order to start them.
Code 2 : cd 433Utils/RPi_utils
|
This bring you to the correct folder where the sending program and the sniffing program are stored.
Now i open another Terminal window and login via ssh (code 1) and i go to the 433Utils folder (code 2)
In the first terminal window start the Sniffer program.
Code 3 : sudo ./RFSniffer
|
Now in the second terminal window send a code
Code 4 : sudo ./codesend 121234 (any random integer)
|
If everything works fine, you should see your integer going through the Sniffer result window just like in the below screenshot :
pi@raspberrypi ~/wiringPi $ gpio readall
|
(*) Raspberry Pi RF remote (433MHz)
FROM: http://npham.dk/?p=34
Creating RF transmitter / receiver
Source: http://shop.ninjablocks.com/blogs/how-to/7506204-adding-433-to-your-raspberry-pi
I bought my RF transmitter and receiver from eBay a about 1$.
Connecting RF transmitter and receiver to the Raspberry Pi is pretty simple.
Both the reciver and transmitter has a VCC, GND and DATA pins.
And all you do is connect it to the Raspberry Pi GPIO pins.
Install RPi_utils
Source:
https://github.com/ninjablocks/433Utils/tree/master/RPi_utils
Start by installing RPI_utils
sudo apt-get update
|
#Installs GIT
sudo apt-get install git
|
#Installs 433utils
git clone git://github.com/ninjablocks/433Utils.git
|
#Installs wiringPI
git clone git://git.drogon.net/wiringPi
|
#Builds RPI_util
cd ..
|
Testing and decoding RF signal
To capture and decode the RF signal from the remote, I ran the program RFSniffer.
sudo ./RFSniffer
|
When I push the A (on) button on the remote, I get the following code on the screen.
Received 5260625
|
To test if the transmitter works you can send the received value with this command.
sudo ./codesend 5260625
|
If you convert 5260625 to binary, you get 10100000100010101010001.
And looking at the binary value of all the buttons, you start to see a pattern.
Button Decimal value Binary value
|
They all starts with 1010000010, and all the ON buttons ends with 0001 and all the OFF buttons ends with 0100.
The 1010000010 matches with the dip-switches; 10 = down and 01 = up.
The middle part, is a value that identifies A,B,C and D.
You can see the pattern here:
Dip switch Button Id On / Off
|
Script
I then created the following bash script.
#!/bin/bash
|
And to emulate a click, I just call
./RFISend.sh A ON
|
Control via web
Because the codesend uses wiringpi, it is required to call with sudo.
But if you need to call it from a webserver, it creates some problem, because sudo requires a password.
So we need to edit visudo, so it doesn’t require a password.
(it may not be a secure thing to do, but in my case the webserver is not exposed to the internet, and is only for “at home” use)
sudo visudo
|
Add the following line to the file.
#NOTE: use TAB and not space, except for the last one – after NOPASSWD:
www-data ALL=(root) NOPASSWD: /home/pi/433Utils/RPi_utils/codesend
|
Save the file and reboot the Raspberry Pi, and you’re good to go.
Now the local PHP webserver can call the script with:
< ? php
|
http://rsppi.blogspot.com.es/2013/08/comunicacion-por-rf-433mhz-desde.html
Home Control Dashboard
https://dendriticspine.github.io/projects/2014/10/10/homedashboard
REFERENCE:
http://www.touteladomotique.com/forum/viewtopic.php?f=118&t=15760
http://wiringpi.com/wp-content/uploads/2013/03/pins.pdf
WiringPi GPIO pins
http://www.14core.com/configure-clibrary-wiringpi/
http://blogwifi.fr/raspberry-pi-b-telecommande-433-mhz-universelle/
http://domotique-home.fr/domotique-diy-partie-2-protocole-433-mhz/
http://npham.dk/?p=34
http://www.princetronics.com/how-to-read-433-mhz-codes-w-raspberry-pi-433-mhz-receiver/
0 comentarios:
Post a Comment