Arduino hardware serial not sending data

Hi I tried the following with the arduino mega:

void setup() {
  Serial1.begin(9600);  // Hardware Serial on pins 18 (RX1) and 19 (TX1)
}

void loop() {
  Serial1.println("1");
  delay(1000);
  Serial1.println("2");
  delay(1000);
}

It doesnt show anything on the serial monitor. If i use serial not serial1, it works. But i want to use serial1 for the hardware serial to send data to a raspberrypi.

Yes i tried using a level converter from 5v to 3.3v but that's aside from the point, the arduino just wouldnt send anything on the hardware serial1.

Serial1.begin(9600);  // Hardware Serial on pins 18 (RX1) and 19 (TX1)

If you have connected it as described in the comment the Rx and Tx are reversed

How did you wire everything up?

Thats normal.

The IDE Serial Monitor will only show the Serial output, it cannot display the Serial1 output unless you add additional wiring.

1 Like

Great, which additional wiring can i add pls?

arduino RX to Pi TX and vice versa, GRD to GRD....using a level converter and tried without.

Yes i tried the correct way.

Where is the serial data coming from and where are you expecting to see it ?

the data is coming from the code i provided, it just repeats sending 1 or 2. I am expecting the pi to be able to read the data on the other side. But all i see from the raspberry side is the letter K over and over again.

To summarise :

  • if you send data from pins 0 and 1 using Serial you can read the data on the Pi
  • if you send data using Serial1 using pins 18 and 19 connected correctly the Pi does not receive any data

Is that correct ?

If so, then why did you mention that you could not see anything on the Serial monitor ?

As you are sending to a Pi you will need to reduce the output voltage to 3.3V and it is not

The 2 systems will also need a common GND connection

How is the Mega connected to the Pi?

The pi is receiving the data but no matter what data i sent, it only shows the letter K. I did decode it properly in python, ive done this without pi before but for some reason its only showing k in this case.

I could only see if serial is used but cannot see if serial1 is used. Can see both on the terminal receiving using pi but can only see the letter k is serial1 is used.

Yes i tried with both a level converter with a common GRD and tried without, same problem.

The more you explain, the less clear.

Are you connected Serial and Serial1 pins to the Rasp Pi pins (which pins?) or just connect your Mega's USB to the Raspbery's USB ?

connecting serial1 pins 19 and 18 from arduino to the gpio14 and 15 or raspberry pi. Not connecting serial only serial 1. The Ground is also connected. I tried the connections i mentioned using a level converter and tried without. Same results, all i see from the pi side is the letter k.

Is it a RPi or a Pi-Pico ?

image

It is a raspberry pi 3

Nonetheless, all the more.
Examine your premises.
Which was is it then?

Do i try this new diagram you made? what about the voltage converter?

The resistor network in @runaway_pancake's diagram is a voltage divider that takes care of that. It's only important for the Tx from the Mega to the Rx of the Pi.

↑ What he said. And are you squared away on that 18 vs 19 deal @nice_servo ?