Today we teach you how to connect an Arduino to a Raspberry Pi via a serial communication
We Want To connect an Arduino board to a Raspberry Pi via a serial communication, to be able to use the advantages of both at the same time.
But first, let’s look at the advantages and disadvantages of Arduino and Raspberry Pi
Arduino advantages are that it has a low current consumption; it is also very easy to connect digital sensors and analog sensors without the need for additional hardware and is excellent for IOT
The Arduinoson defects that presents that most need additional cards and extensions to connect to the internet, USB, Wfi, bluetooth, etc.
The strong points of the Raspberry Pi are that works with a raspbian operating system: Linux derivation”, has a lot of extension (USB slot, Wifi, slot HDMI port, RJ45, etc) can
also be used to IOT “Internet of Things”, can make a calculation higher than most
Raspberry Pi Arduino boards also has defects and some are that presents the need to add additional hardware to connect analog sensors, consumes more energy than an Arduino
as well as for connecting the two plates and exploit their strengths for future projects, must be made to communicate and share data, for example data from the sensors, pressure, Internet, etc.
To demonstrate how it works this type of communication we will do a couple of small projects, one for the data to the Arduino Raspberry Pi, the other to the contrary. First, make sure that you have installed pySerial, which allows to read and write to the serial port with the Python programming language.
To begin with, we are going to need:
A Raspberry pi 3 2 B or an Arduino Uno, Mega or other, Get a male male usb cable to
connect them with the USB cable and test the serial communication on the Raspberry by using the following command in the terminal: