Arduino and Raspberry Pi, working together over a serial communication. Step-by-step tutorial (UART)

Описание к видео Arduino and Raspberry Pi, working together over a serial communication. Step-by-step tutorial (UART)

The Raspberry Pi and Arduino are both excellent platforms in their own right, but they both have their pros and cons. As I discovered in my earlier video why accept compromise when you can have the best of both:    • Arduino Vs Raspberry Pi - Which shoul...  


This video shows you how you can connect a Raspberry Pi to an Arduino, both to program the Arduino and then to communicate with the Arduino. In this case the Raspberry Pi takes on the role of a primary controller with the Arduino acting as a secondary device responding to the instructions of the Raspberry Pi.
#raspberrypi #arduino


This is achieved using serial communications over USB, although could also be applied to direct serial from the Raspberry Pi GPIO to the Arduino Serial pins (with appropriate voltage level-shifting).



This example uses the USB port which uses UART serial communications. These are generally asynchronous communications sent half-duplex with one side sending at a time. This is similar to RS-232 serial communications that you may have used on older computers, but this uses different voltages and doesn't meet the full RS-232 specification.

#uart


The video explains the circumstances this can be useful, before working step-by-step through a practical exercise with the Arduino measuring an analog input voltage and reporting that to the Raspberry Pi, and the Raspberry Pi telling the Arduino when to turn an LED on and off.

The communication between the Raspberry Pi and the Arduino is over a custom text based protocol, making it easy for humans to understand the communication. First the code is created on the Arduino using C++ which can be tested using the Arduino IDC serial monitor. Then the serial code for the Raspberry Pi is added in Python which sends instructions to the Arduino.

This is going to form the basis of more advanced projects that I'm hoping to work on in future. So if you want to see more please subscribe to my channel and click on the notification icon to be notified of my future videos.

More details are available on my website at: http://www.penguintutor.com/electroni...

The 3d print design plans breadboard mount that the Arduino and breadboard is on are available from http://www.penguintutor.com/projects/...


Chapters:
00:00 Introduction
00:34 Advantages of Raspberry Pi
01:53 Advantages of the Arduino
03:36 Taking the best of each platform
04:28 Using GPIO serial pins
06:05 Creating the circuit
06:46 Installing the Arduino on the Raspberry Pi
07:19 Launching the IDE and programming the Arduino
08:35 Basic electronics code
10:05 Adding serial code to the Arduino
33:27 Adding Python serial code to the Raspberry Pi
37:43 Running the Raspberry Pi and Arduino code together

Raspberry Pi UART Information
https://www.raspberrypi.org/documenta...

Arduino Serial Information
https://www.arduino.cc/reference/en/l...

Комментарии

Информация по комментариям в разработке