enter image description hereI want to sent AT command into node mcu esp8266 module with arduino IDE through serial monitor. I connect the node mcu to arduino uno board in following sequence: RX to pin 2 of arduino TX to pin 3 of arduino Vin of node mcu to 3.3V of arduino GND to GND EN of node mcu to 3.3V of arduino I send at commands in serial monitor but dont get any response. I also checked different baud rates. what is the problem? what thing I'm doing wrong?
#include <SoftwareSerial.h>
SoftwareSerial esp8266(2,3); //2 -->rx ,3 -->tx
void setup() {
Serial.begin(115200);
esp8266.begin(115200);
}
void loop() {
if (esp8266.available()>0)
{
char c = esp8266.read();
Serial.write(c);
}
if (Serial.available()>0)
{
delay(1000);
String cmd = "";
while (Serial.available())
{
cmd += (char)Serial.read();
}
esp8266.println(cmd);
}
}
-
It is an actual NodeMCU as in a NodeMCU Version 1.0 or 0.9, etc? Not some random ESP8266 module that you're calling a NodeMCU?Majenko– Majenko2020年04月17日 18:00:43 +00:00Commented Apr 17, 2020 at 18:00
-
@Majenko as I'm reading the board information it's model nomber is: esp-12E. I will send the image.sepehr– sepehr2020年04月17日 18:23:28 +00:00Commented Apr 17, 2020 at 18:23
-
wire rx to tx, not rx to rx and tx to tx. do you have the AT firmware uploaded to NodeMcu? does it respond to AT commnds over USB on NodeMcu? change the baud rate to 9600 baud in firmware and sketch because SoftwareSerial doesn't work reliably at 115200 baud. why do you want to use NodeMcu this way.?Juraj– Juraj ♦2020年04月17日 18:43:55 +00:00Commented Apr 17, 2020 at 18:43
-
As Majenko already noted in his answer(s), the NodeMCU that you're using most probably does not come with the AT firmware installed and will not respond to AT commands out of the box. It's actually much more powerful than what you are trying to use it for.StarCat– StarCat2020年04月18日 06:33:51 +00:00Commented Apr 18, 2020 at 6:33
1 Answer 1
Some points to note:
- VIN should connect to 5V (it goes through the on-board 5V -> 3.3V regulator). If you connect VIN to 3.3V you will be starving the device of power.
- The NodeMCU doesn't come with AT firmware installed. You will have to install it first before it will respond.
- If you have a NodeMCU why are you bothering with an Arduino? The NodeMCU can do everything (and more) that the Arduino can do (except it lacks IO).
-
did OP do something right?2020年04月17日 19:52:49 +00:00Commented Apr 17, 2020 at 19:52