1
votes

I'm new to arduino stuff and i'm currently trying to connect an ESP8266-01 (https://www.reichelt.de/entwicklerboards-esp8266-wifi-modul-debo-esp8266-p192142.html) with my arduino nano. I'm using this (https://www.youtube.com/watch?v=ji71cHaGW8w) as tutorial and my wiring is almost the same. ESP8266-01 upload wiring

I can upload without any problems. The only difference is, that using the 3V3 directly without any extra components. I measured 120mA (stable) and they should be enough. This is my ESP8266-01 code:

void setup() {
 Serial.begin(9600);
}

void loop() {
    Serial.write("Hello from ESP");
    delay(2000);
}

After uploading to the ESP8266-01 i'm changing the wiring to this (except that i'm connecting Vcc directly to 3V3). This is my Arduino code:

 #include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX
 
void setup()
{
 Serial.begin(9600);
 mySerial.begin(9600);
 delay(5000);
 }
 
void loop(){
  
 String IncomingString="";
 boolean StringReady = false;
 
 while (mySerial.available()){
   IncomingString=mySerial.readString();
   StringReady= true;
  }
 
  if (StringReady){
    Serial.println("Received String: " + IncomingString);
  
  }
 }

Once again, uploading is no Problem, but i'm not getting any signs of life. The ESP8266-01 LED is not blinking (only when uploading) and there's no output in the serial monitor. I already switched the ESP8266-01 with another, but nothing changed.

EDIT: I tested the ESP8266-01 with blink and an accesspoint example and it worked without any problems.

2
Hello again! Something I would try is to use another program. You should try to remove as many variables as possible. Then run the SoftwareSerialExample (in the examples / softwareserial) after adjusting the RX and TX pins, the baud rates and removing mySerial.println("Hello, world?"); and then try again. Maybe also try to just swap RX and TX until it works (although it seems fine to me but it won't hurt to try). And keep in mind that the Uno uses 5v and the ESP 3v3, so you might have a problem when the Uno sends a 5v signal via serial to the 3v3 ESP.user14699696
is it a problem, that i'm using a nano?twcrnr
It shouldn't. The nano is pretty much just a tiny uno (and sometimes underclocked I think and with some missing pins), but you should set it in Tools / Board. What happened?user14699696
I changed the baud rate of "mySerial" to 9600 and the other one was by default 57600. Everytime i switch between these two in the serial monitor it either prints "Goodnight moon!" (57600) or some weird chars like "⸮]⸮" or just a "k".twcrnr
Uh ... sorry for disappointing you, but "goodnight moon" is just the default message the code sends so you know that the Uno is doint its thing. Whenever you change the baud rate, the uno gets reset, so you either get that starting message or a corrupt version of it since you use the wrong rate.user14699696

2 Answers

0
votes

ok your code is perfect but only try to make changes between RX and tx wire and the most important thing is that voltage I know it can work on 3.3v but in my case on 3.3volt it is not working properly so is give it 5.0v 100ma and it is working so much perfectly

-1
votes

Make sure your RX pin is going to the TX on the other side, and TX is going to RX on the other side. So pin 2(RX) on the receiver should go to the transmit pin on the esp8266.

Software Serial is okay for low baud rate stuff, but in general it's slow and unpredictable, and just a pain in general. If you have the Serial Lines available for the Arduino, just use that instead. It's a lot more predictable, and besides, it doesn't hurt to try. Just remove all the Software Serial stuff, and replace mySerial with the regular Serial command which are just pins 0 and 1.

If none of these do it, try changing to baud rate to 115200. I know a lot of ESP's are more accustomed to this, as well are other communication devices. Although that high of a baud rate doesn't work with Software Serial so you just have to change it to the regular Serial lines again.