How to send data from Arduino Due to Raspberry Pi

By | March 30, 2017

This post here got me started on the right track. Here, I specifically focus on the Arduino Due.

Step 1: First connect your computer to the Arduino Due to the programming USB slot. The one closest to the power supply barrel. Connect the native USB to the raspberry pi.

Step 2: Double check that the pi can “see” the new connection. Run

>> ls /dev/tty*

and you should see something like


Step 3: Upload this code to the Arduino Due

void setup(){

void loop(){
  SerialUSB.println("Hello Pi");

What got me was the extra “USB” required for the Due. This took me hours to figure out.

Step 4: On the Raspberry Pi side run this python code.

import serial
ser = serial.Serial('/dev/ttyACM0', 9600)
while 1 :

There are 2 ways you can do this. Save the above code as and then execute it via

>> python

or you can type it directly into the python command line. This is what you should see.


  • Check you have python installed on your raspberry pi. It should be installed by default.
  • Check you are using the right kind of USB cable. It has to be the right one.
  • Serial.println(“hello world”) won’t work. It has to be SerialUSB.println(“hello world”)

Note that unlike the raspberry pi where you could damage it by powering it with an external supply as well as the GPIO pins, plugging in 2 USB cables is fine. The Due will figure out where to take the power source from.

2 thoughts on “How to send data from Arduino Due to Raspberry Pi

  1. Grant G

    Thank you for the very helpful tutorial. I am about to work on a project with a very similar connection. Do you have the Raspberry Pi connected to the same laptop or a separate device.

    Thank you


Leave a Reply

Your email address will not be published. Required fields are marked *