Raspberry Pi - Arduino - Link the two serial / UART
To receive data in 433Mz on the Raspberry Pi, you can use different libraries but all use almost 100% of the CPU 100% (If you know one that does not I'm interested in !). Then a solution is through an Arduino which will send us the valid data on serial port.
I continue to progress slowly on my project PI Home Connect, and therefore continued to my article on the creation of a node, It is necessary to receive data. Using for the moment a 433Mz transmission should therefore be able to receive messages from my probe. The reception directly on the Raspberry using the CPU has (almost) its maximum, I chose to use an Arduino.
As I didn't have multiple power sources, I found the excellent article from Jared Wolff on a quick and easy connection between the two :
This is how with 4 wires connect the two. Thanks Jared !!
To exploit the communication between the two you need to disable the extra console on the Raspberry Pi :
- Updating your system
apt-get update && apt-get upgrade
- Install if necessary raspi-config
apt-get install raspi-config
- Run raspi-config and select the following steps :
- Restart Raspberry Pi
Now you can communicate with your Arduino on the serial port. For the Raspberry you can use a program in Python for example :
import serial
import sys
import string
ser = serial.Serial('/dev/ttyAMA0', 115200)
while True :
try:
# Read data incoming on the serial line
data=ser.readline()
print data
except:
print "Unexpected error:", sys.exc_info()
sys.exit()
And on the Arduino :
void setup() {
Serial.begin(115200);
}
void loop() {
Serial.println("Hello");
delay(1000);
}








