Link Search Menu Expand Document

Connect an Arduino to the Raspberry Pi

In some cases it may be very helpful to combine an Arduino with a Raspberry Pi. Luckily this is very straight-forward to do

Table of contents

  1. Install Arduino IDE
  2. Connect the Arduino
  3. Sending files to your Arduino

Install Arduino IDE

The Raspberry Pi makes a great host for the Arduino, which is a much simpler microcomputer but with some complementary capabilities, like converting analog-to-digital with its built-in ADC chip. To control the Arduino we will use the Arduino IDE like on any other computer. To install:

sudo apt-get update
sudo apt-get install arduino

Connect the Arduino

Now to connect, simply plug in the USB-cable into the Arduino and any of the USB ports on the Raspberry Pi. When you launch the Arduino IDE, it polls all the USB devices and builds a list that is shown in the Tools > Serial Port menu.

In order to access the serial port, you’ll need to make sure that the Raspberry Pi user has permission to do so. You can do that by adding the user (e.g. pi) to the so-called tty and dialout groups, which needs to be done before running the Arduino IDE:

sudo usermod -a -G tty pi; sudo usermod -a -G dialout pi

Sending files to your Arduino

Click Tools > Serial Port and select the serial port (most likely /dev/ttyACM0), then click Tools > Board, and select the type of Arduino Board you have (e.g., the Uno).

Now to start, click File > Examples > 01.Basics > Blink to load a basic example sketch. Click the Upload button in the toolbar or choose File > Upload to upload the sketch to your Raspberry Pi. If everything worked correctly, the LED on your Raspberry Pi should start blinking continuously.


Add a Comment

If you use find any of the information provided on this website useful it would be great to hear from you and please consider citing the paper! All rights reserved © 2021 Jolle Jolles. Website built using Jekyll and the Just the Docs theme.