Particle to Raspberry with UART


I’m trying to send data between a Particle Photon and a Rapsberry Pi 3 B+ with UART.
I’ve enabled GPIO and changed the UART linked to the GPIO pins on the Raspberry in order to have a regulare baud rate (9600 with Serial0 -> ttyAMA0).
On the Photon I’m using Serial1.
I’ve tested to loopback Rx and Tx on each device (sending and receiving on the same device) to test my code and configuration and it worked for both.
But when I connect the Particle-Rx to the Rasperry-Tx i can’t receive the sended data. Instead I receive some empty or random char:

For the other direction (Particle to Raspberry), I receive nothing.

Can someone help me please ? I’m probably missing something obvious :confused:

Here is my code:

  • Particle Photon
int counter = 0;

void setup() {

void loop() {
  Serial1.println("Particle "+String(counter));
    String tmp = "";
    for(int i = 0; !tmp.endsWith("\n") && Serial1.available(); i++)
      tmp += (char);
    if (Particle.connected() == false) {

    Particle.publish("Testing UART", "{\"Value readed\":\""+tmp+"\"}");
  • Raspberry Pi
import serial

serialPort = serial.Serial("/dev/ttyAMA0", 9600, timeout = 3)

def main():
    counter = 0
        while 1:
            serialPort.write(("Raspberry %d\n" % counter).encode())
            messageReaded = serialPort.readline()
            counter = counter + 1
    except KeyboardInterrupt:

if __name__ == '__main__':

I’ve made other tests and by connecting Particle-Rx to Raspberry-Tx and Particle-Tx to Raspberry-Rx, i’ve got noting on the Raspberry side, but for the Particle side i’ve got the following :

Receiving Particle and Raspberry messages makes me wonder … is it possible, that the Photon uses a too high tension for the Raspberry ? :thinking:

I’ve made it work!
I was powering the Particle form a battery (3.7V). Now it’s powered by the 3.3V pin of the Raspberry.
At first I was surprised because the Raspberry rebooted after that I pluged the last cable (3.3V).
I double checked that my wiring was good and now it still reboot if I unplug and replug the Particle.
Does someone know why ? :thinking:

This suggest you didn’t have a common ground for both devices before. If so, having a common GND level is paramount for that kind of communication.