Serial Communication between the Arduino and the Raspberry Pi

From Sensors in Schools
Jump to navigation Jump to search

Introduction

  • The purpose of this tutorial is to teach the hardware and software requirements to establish two way communication between an Arduino and a Raspberry Pi.
  • In this case study, the Arduino Uno will be used to control and collect data from sensors (e.g. temperature sensor) and also to control electronic equipment (e.g. fan or servo motor).
  • The Raspberry Pi will be used to collect data from the Arduino, save the data in a text file, dweet the data and graph the data using plotly. The Raspberry pi can even host a web site to display the data.

Equipment

  • Arduino Uno (Sparkfun RedBoard) - any Arduino Uno is suitable
  • Raspberry Pi 3B+ or Raspberry Pi 4
  • USB cable that can connect the Raspberry Pi USB to the USB serial connection on the Arduino Uno.

Hardware and Software setup for Serial

  • Firstly connect the Arduino Uno to the Raspberry Pi using the serial cable.

Configuration of Serial software library on the Raspberry Pi