Sending string from ESP8266 to Arduino Leonardo via Serial1

My goal is to send a string "Hello World" from the ESP8266 to the Arduino Leonardo. What would the code look like on both the receiver and sender sides? I know that the Leonardo has two Serial ports Serial and Serial1. Also, because I only want to send data one way (esp tx to leonardo rx) do I still need a voltage divider? I believe my ESP is on 3.3v while the Leonardo is 5.5v.

Heres a diagram. Pretend the arduino on the bottom is an ESP8266.

Pretend there are about 4 more connections that we can’t see.

Remembering the ESP is a 3,3V device vs the 5V UNO.

what? could you please elaborate.

Hi @serenity091

Yes, it's possible to connect the 3.3V ESP8266 output to the 5V arduino input on the Arduino Leonardo without damaging either board, but not the other way around (5V->3.3V).

Personally however, I'd still use a level shifter, just in case I got the boards' Tx and Rx accidentally mixed up. I use an I2C level-shifter like this:

Ok thank you. I will remember to wire TX to arduino RX correctly.

I only need to wire both GND ports and the TX on the ESP to the RX on the arduino right?

Yes, that's right.

Thanks. For the code on the ESP which is the sender of the data how would I send a string? Does Serial.println() work?

@serenity091 It's also posible to use Serial.read() and Serial.write() functions, or in the case of the Arduino Leonardo Serial1.read().

My goal is to send a string "Hello World" from the ESP8266 to the Arduino Leonardo. What would the code look like on both the receiver and sender sides? I know that the Leonardo has two Serial ports Serial and Serial1. Also, because I only want to send data one way (esp tx to leonardo rx) do I still need a voltage divider? I believe my ESP is on 3.3v while the Leonardo is 5.5v.

You don’t want a voltage divider from a Tx at 3.3V sending data to an Rx expecting a HIGH at 5V… ideally you would need to boost the signal but usually 3.3V is seen as HIGH on the UART. Don’t forget to join the GNDs.

If you don’t use Rx, just don’t connect it

@serenity091, do not cross-post. Threads merged.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.