Maybe some of you thought about how to let some RaspberryPi’s communicate with each other wirelessly. For this purpose small 433MHz modules are ideal, which are already available for a few bucks.
Therefore in this tutorial I want to show how two (or more) RaspberryPi’s can “talk” with each other. But do not worry, if you have only one Raspberry Pi, you can do it also.
- 2 Raspberry Pi’s (at a pinch only one will do)
- 433 MHz Transmitter-Receiver Set (US / UK), if both Pi’s should send and receive you need 2 sets
- Female – Female jumper wires (US / UK)
- Breadboard (US / UK)
|Pin 2 (5V)||VCC||VCC|
|Pin 6 (GND)||GND||GND|
|Pin 11 (GPIO17) – RPi Nr.1||ATAD||—-|
|Pin 13 (GPIO27) – RPi Nr.2||—-||DATA (to the left of GND)|
Before we can test the actual software, we need a few libraries. Theses must be installed on all Pi’s that are communicating.
First of all wiringPi is required. If yave you already installed this previously, you can jump to the next installation (if the command
gpio -v returns a result, it is installed).
First, we update the packages. This may take several minutes.
sudo apt-get install git-core sudo apt-get update sudo apt-get upgrade
Then we clone wiringPi (git must be installed) and install it.
git clone git://git.drogon.net/wiringPi && cd wiringPi &&./build
gpio readall should show the pin allocation.
We need a library that simply allows us to send our data via the transmitter and receive it through the receiver module.
git clone https://github.com/ninjablocks/433Utils.git
This library contains corresponding scripts for both Arduino and Raspberry Pi. Now we go to the folder containing the scripts for the Raspberry Pi and compile them.
cd 433Utils/RPi_utils make all
As soon as a code is received, it will appear here.
Next, we want to send. For this we go to the other Raspberry and run the following command (if you have only one Pi, just open a second shell window, eg by using putty).
sudo ./codesend 1234
The sent number you can enter by yourself. E.g. by using ASCII numbers, a text can be send.
Have fun trying!