Uno to Wemos D1 mini serial RX TX

Hello all,
I have a Uno and a Wemos D1 mini. I want to send data serial from the Uno to the D1 mini. I can not get this to work.

I have this test sketch on the Uno - Transmitter(TX).

void setup() {
    Serial.begin(9600);
    Serial.println("Hello World!");
}
void loop() {
  }

and the D1 Mini -Receiver(RX)


#include <SoftwareSerial.h>
SoftwareSerial device(12,13);


void setup() {
    Serial.begin(9600);
  device.begin(9600);
}
void loop() {
   if (Serial.available() > 0) {
       device.println((char)Serial.read());
  }
}

I have also tried the RX(3) TX(1) pin directly. That did not work either. Where is my fault?
Cable UNO TX ---> D1 RX or 12 (with resistor 1K)
Cable UNO RX ---> D1 TX or 13 (with resistor 1K)

An Arduino Uno is a 5V device
An ESP8266 is a 3.3V device. It might be that your ESP8266 has been destroyed by the too high voltage.

Can you still upload new codeversions to the EPS8266?
A 1K-resistor is a rather poor solution to protect against to high voltages
You should use a voltage-level-shifter

if (Serial.available() > 0) {

there has to be at least a single byte inside the receive-buffer of the Wemos to make the if-condition true

If your Uno-code has nothing inside loop you just send one time "Hello World" and that's it.

You shouldn't use the RX/TX-pin on the uno for the serial monitor and for something else at the same time.

move in smaller steps.
write a program that uses software-serial on the arduino and let do this program send a short and fixed text over software-serial

Log what you send to software-serial to the serial-monitor (=hardware-serial too)

in the Wemos
Write a small testcode that does nothing more than listening to software-serial and prints the characters received over software-serial to the serial-monitor.

triple-check if you have connected Rx to Tx and Tx to Rx

best regards Stefan

You only send the serial message once, maybe it's gone before the D1 Mini has even started. If I were experimenting with something like this I'd have the message sent repeatedly, maybe once per second.

If you have a resistor between the 2 boards I don't think you will have damaged the D1 Mini, but a potential divider would be much better.

I see no suggestion that you have connected the grounds.

Good point. Forgot about that. best regards Stefan

1 Like

Thanks for the answers. I thought for trying one resistor is enough. I will still order a voltage-level shifter.
I had "Hello World" also in the loop with a delay(2000). Nothing arrives at the D1.
With Ground without Ground. I have been trying for a few hours.
The UNO only gets power via USB cable from a power supply. The Wemos I have in the IDE on the serial monitor.
Do I have to define RX and TX on the Wemos? SoftwareSerial device(XX,XX)? Or do I just take the RX and TX pin directly?
schematic:
https://www.programmersought.com/article/76066329655/

What do you mean by that?

Have I understood correctly? You are trying to receive the data into the D1 Mini on software serial? Your code is reading the hardware serial port and printing it to software serial, which I think is the opposite of what you are trying to do.

At least that's what I plan to do :wink:

Then you it backwards. Read software serial and send to the serial monitor.

ok, I don't understand that right now.
Like in this example?
https://iot-guider.com/arduino/serial-communication-between-two-arduino-boards/

would that be correct for the sender? Otherwise, I still do not think I have understood.

Uno - Transmitter(TX).

void setup() {
    Serial.begin(9600);
    
}
void loop() {
//Serial.println("Hello World!"); 
Serial.write("Hello World!");  //Write to Serial
delay(2000)
  }

wemos RX:


int data; //Initialized variable to store recieved data

void setup() {
  //Serial Begin at 9600 Baud 
  Serial.begin(9600);

}

void loop() {
  data = Serial.read(); //Read the serial data and store it
Serial.print((char)data);
  delay(1000);
}

Typo not EPs826 but ESP8266. A Wemos D1 mini board is based on the microcontroller type ESP8266
And I was naming it with this name.
best regards Stefan

This is apparently due to the resistor. Without it the sketch from the first post works as I want it to. Then I will order a logic level converter.