Tuesday, April 28, 2015
Connect ESP8266 (WiFi module) to Arduino Due
Just to prove the connection between Arduino Due (TX3/RX3) and ESP8266 WiFi module, electrically and logically. Because both Arduino Due and ESP8266 work on 3.3V, so no voltage converter is needed.
Next:
- Arduino Due + ESP8266 - to Join AP
ESP8266 GND - Due GND
ESP8266 VCC - Due 3.3V
ESP8266 TX - Due RX3
ESP8266 RX - Due TX3
ESP8266 CH_PD - Due pin 53 (always HIGH)
The test program on Arduino Due simple redirect the received data from RX to TX3, and from RX3 to TX. Such that we can use Serial Monitor of Arduino IDE (TX/RX) to send command to ESP8266 (TX3/RX3). It act as a USB-Serial cable functionally. Pin 53 always High, such that the ESP8266 always NOT Power Down.
int LED = 13;
boolean LEDst = false;
//always high
int CH_PD_8266 = 53;
void setup() {
Serial.begin(9600);
Serial3.begin(9600);
pinMode(LED, OUTPUT);
digitalWrite(LED, LEDst);
pinMode(CH_PD_8266, OUTPUT);
digitalWrite(CH_PD_8266, HIGH);
}
void loop() {
while (Serial.available() > 0) {
char a = Serial.read();
Serial3.write(a);
}
}
void serialEvent3() {
while (Serial3.available() > 0) {
char a = Serial3.read();
Serial.write(a);
ToggleLED();
}
}
void ToggleLED(){
digitalWrite(LED, LEDst = !LEDst);
}
[フレーム]
Next:
- Arduino Due + ESP8266 - to Join AP
Subscribe to:
Post Comments (Atom)
22 comments:
Hello, this is great information, however I am stuck trying to get a response back from AT commands, I am also unsure how the function serialEvent3 is ever to run, is this correct that the function sits there with no calls to it in the example code?
Reply DeleteHello friend, You must change in serial monitor options to "NEW LINE" for sending command to ESP.
Reply Delete(help!) in my case apper this message:
Reply Delete]p
D! +ÿ &hœL C R hz
�’KÒ
€a
Hello, I can't to sent AT or AT+RST. I open serial monitor before run code to auduino Mega 2560 it show "0 ]
Reply Delete; �D,ร… �I�B�� |zpมย &�’K๒*��". Help me please, I need to know IP esp8266.
or: Open Serial Monitor - press on-board RESET button of Arduino.
DeleteMake sure both Serial Monitor and Arduino set in same baud rate.
Some of the ESP8266 come set to 115200 baud rate as default. I got the same thing you did and changing serial monitor to 115200 and code to 115200 fixed it. Also had to set serial monitor option to " Both NL&CR"
Deletethanks a ton!
Reply Deletewhy do I send AT commands + RST appear \: cc ¥ ÿ and not send AT commands to get more please help me
Reply Deletetry other baud rate. May be firmware of other version have different baudrate.
Deletejust found this Fritzing parts of ESP8266-based WiFi module.
Reply DeleteHi,
Reply DeleteI am getting "exit status 1
'Serial3' was not declared in this scope" while trying to Verify the code snippet.
Can you please help?
What Arduino Board are you using?
DeleteGreat Information. But In my case appear no response.
Reply DeleteTHE ARDUINO IS UNABLE TO SEND THE OMMANDS EVEN IF HANGED THE BAUD RATES
Reply DeleteNOTHING IS HAPPENING BAUD ARE IS OK CONNECTIONS AE OK BUT NOTHING WORK PLEASE HELP ME
Reply DeleteThank you
Reply DeleteHi,
Reply DeleteCan you please help me,
i want connect multiple sensor output to arduino duo and transmit all sensor data to wifi using ESP8266 generic module,
How can i do that,
Thanks for advance
i get an error when input " AT+CWMODE". what happen?
Reply DeleteThanks a lot
Ready
AT+GMR
AT version:1.1.0.0(May 11 2016 18:09:56)
SDK version:1.5.4(baaeaebb)
Ai-Thinker Technology Co. Ltd.
Jun 13 2016 11:29:20
OK
AT+CWMODE
ERROR
AT+CWMODE?+CWMODE
ERROR
AT+CIPSR
ERROR
can you tell me ardiuno mega and Esp-12 which library is used for communication between them?
Reply DeleteIn this post, the test program on Arduino Due simple redirect the received data from RX to TX3, and from RX3 to TX. Such that we can use Serial Monitor of Arduino IDE (TX/RX) to send command to ESP8266 (TX3/RX3). No any library needed.
Deletei have been wasting my time for 2 fucking days and today i came to know that 74880 baud rate is the rate for ESP8266 and no other baud rate will work.
Reply DeleteHello! Thanks a lot for this post! It worked for me when I put serialEvent3(); inside loop instead of the while in there. But I'm still having trouble with connecting the module over the WiFi. I'm not sure if I need to do anything else. When I type the command AT+RST it shows all that stuff until "jump to run user1". After that the module starts printing unreadable stuff for every new command I type. Do you have any idea about what this could be?
Reply DeleteThanks a lot for the post again!