Problem with serial connection using raspberry pie and arduino uno

Hallo everybody!

I’m from sweden, so I want to in advance apologize for my bad english!

So Im having a bit difficulties with communication between the arduino uno and raspberry pie, when they talk over Serial. The code I use is shown below and I’ve commented the section which doesn’t print out.

The arduino is connected to the raspberry pie by a USB-cable. It furhter has a reciving RF module attatached to it. So the code should basically print out everything it recieves.

So the problem is that when I use the Arduino IDE Serial monitor on my PC the commented section within the if part is printed out. Now the strange part is that this part is not printed out when I use the serial monitor from the Aduino IDE on the raspberry pie. I’ve also tried printing out the message from the arduino by using Python on the raspberry pie. I still have the same problem! Am I missing something? Why is the serial communication not working on the raspberry pie?

So if anybody can help, that would be very helful!

Thanks in advance!

This sketch displays text strings received using VirtualWire
Connect the Receiver data pin to Arduino pin 11
#include <VirtualWire.h>
byte message[VW_MAX_MESSAGE_LEN]; // a buffer to store the incoming messages
byte messageLength = VW_MAX_MESSAGE_LEN; // the size of the message
void setup()
Serial.println("Device is ready");
// Initialize the IO and ISR
vw_setup(2000); // Bits per sec
vw_rx_start(); // Start the receiver
Serial.println("Connection to rf ready");

void loop()
if (vw_get_message(message, &messageLength)) // Non-blocking

//This part is printed when the arduino gets a message by the RF module

// It's printed out in serial on my pc but not on the raspberry pie!!

  Serial.println("I got a message! ");
  Serial.print("Received: ");
  for (int i = 0; i < messageLength; i++)
  Serial.println(" ");


How is the Pi connected to the Arduino ?

Hallo UKHeliBob!

It's connected by the usb port!

This Python - Arduino demo may help to get you started.

Please modify your post and use the code button </> so your code looks like this and is easy to copy to a text editor. See How to use the Forum


Hallo Robin2!

I've modified my orginal post now, so it should be easier to read now! Thanks for pointing out!

I will look into your post and try it out, thanks!

I’ve used Python serial for my Mega 2560 and Due, and it worked ok. I have been testing both with minicom for the last week, and it did fine. I use 115200 baud. The mega ran 3 days without a glitch, so I changed to the Due, and it has ran for 3 days also. The Due is still running and the RPi is still showing the time and location.

Both had a GPS unit connected to Serial1, and was relaying that data to the RPi.