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

Penguin Tutor
Penguin Tutor
86.1 هزار بار بازدید - 4 سال پیش - The Raspberry Pi and Arduino
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: https://www.seevid.ir/fa/w/cQ_VQ4F5NOQ 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/electronics/rpi-arduino The 3d print design plans breadboard mount that the Arduino and breadboard is on are available from http://www.penguintutor.com/projects/freecad Chapters: https://www.seevid.ir/fa/w/nh5geiIDqjA Introduction https://www.seevid.ir/fa/w/nh5geiIDqjA Advantages of Raspberry Pi https://www.seevid.ir/fa/w/nh5geiIDqjA Advantages of the Arduino https://www.seevid.ir/fa/w/nh5geiIDqjA Taking the best of each platform https://www.seevid.ir/fa/w/nh5geiIDqjA Using GPIO serial pins https://www.seevid.ir/fa/w/nh5geiIDqjA Creating the circuit https://www.seevid.ir/fa/w/nh5geiIDqjA Installing the Arduino on the Raspberry Pi https://www.seevid.ir/fa/w/nh5geiIDqjA Launching the IDE and programming the Arduino https://www.seevid.ir/fa/w/nh5geiIDqjA Basic electronics code https://www.seevid.ir/fa/w/nh5geiIDqjA Adding serial code to the Arduino https://www.seevid.ir/fa/w/nh5geiIDqjA Adding Python serial code to the Raspberry Pi https://www.seevid.ir/fa/w/nh5geiIDqjA Running the Raspberry Pi and Arduino code together Raspberry Pi UART Information https://www.raspberrypi.org/documentation/configuration/uart.md Arduino Serial Information https://www.arduino.cc/reference/en/language/functions/communication/serial/
4 سال پیش در تاریخ 1399/08/05 منتشر شده است.
86,116 بـار بازدید شده
... بیشتر