I've been trying to make a project that connects to the internet by means of the ESP8266 wifi board. However, my board won't respond. The setup is quite simple it's shown in the attachements.
To check whether it is working or not i just upload a blank and i send 'AT' by means of the serial monitor. Normally the response should be OK but i just get nothing. I tried 9600 baud rate and 115200 baud rate. Neither of them works.
What is the diode in the ESP TX to Mega RX doing? How have you wired the rest of the ESP pins (RST, CH_PD, GPIO0, GPIO15)? Which variant of the ESP do you have (-01, -07, -12, Huzzah)?
Apologies, apparently i do not get an email alert if someone replies. The diode prevents current flowing from the Mega RX to the ESP TX, because of the voltage difference. only CH_PD is wired to VCC. As for the ESP version, i actually don't know. How can i see it? On the chip stands: ESP8266EX 512014 P1WX71
In the mean time I tried adding a linear voltage regulator and i'm supplying from the socket with a 12V adapter. Also doesn't help. I just get no response when I send 'AT' in the monitor. I already tried two modules. Neither works.
The ESP TX outputs a 3.3V signal. 3.3V into the Mega RX will not cause damage. The diode is unnecessary and very likely detrimental. Did you read the tutorial that I linked? On page 2 is a link to a page that will help you to identify your module. The tutorial shows how the ESP must be wired.
Edit: To be clear, the Mega TX must go through a level shifter (your voltage divider) to the ESP RX. The Mega 5V TX will damage the ESP RX if directly connected. And I notice that you are using RX0 and TX0, you should use a different serial port (Serial1 or 2) for the ESP as RX0 and TX0 are used for USB upload.
To tell the truth, I quit using the AT commands about 30 minutes after I got my first ESP working. I do all of my ESP programming using the Arduino IDE. The tutorial explains how to set up the IDE to do so. Most of my ESP projects use the ESP stand alone (my weather station uses only an ESP to read the sensors and serve a web page). The ESP is a powerful processor as well as a WiFi module. The AT command method is cumbersome an of limited utility.
I missed your link the first time i read your post :). I've looked into it but to be honest it is a level too high for a simple guy like me. If i get it correctly than they're actually programming the ESP8266. However i'm one of those guys that just want to use it for its wifi capabilities. So the only thing i wanne do is establish the wifi-serial communication.
If this is the link of page 2 that you meant: esp8266-module-family [ESP8266 Support WIKI] than i guess that I have the esp-01 (by looking at the pictures). I have removed the diode and tried it without the AT module by using the following sketch:
#include <ESP8266.h>
#include <SoftwareSerial.h>
#define SSID "ITEAD"
#define PASSWORD "12345678"
int RxPin=10;
int TxPin=11;
SoftwareSerial mySerial(RxPin, TxPin); // RX, TX
ESP8266 wifi(mySerial);
void setup(void)
{
delay(500);
Serial.begin(9600); // Start Serial with PC
Serial.print("setup begin\r\n");
Serial.print("FW Version: ");
Serial.print(wifi.kick());
Serial.println(wifi.getVersion().c_str());
if (wifi.setOprToStation()) {
Serial.print("to station ok\r\n");
} else {
Serial.print("to station err\r\n");
}
if (wifi.joinAP(SSID, PASSWORD)) {
Serial.print("Join AP success\r\n");
Serial.print("IP: ");
Serial.println(wifi.getLocalIP().c_str());
} else {
Serial.print("Join AP failure\r\n");
}
Serial.print("setup end\r\n");
}
void loop(void)
{
}
Some extra info: I can see the wifi with my cellphone, and my voltage regulator heats up very quickly (right now i'm using a 12V adaptor that i plug in and connect to a linear voltage regulator at 3.3V with max current of 1 amp).
I tried using the Hardware serial using the following code:
/**
* @example ConnectWiFi.ino
* @brief The ConnectWiFi demo of library WeeESP8266.
* @author Wu Pengfei<pengfei.wu@itead.cc>
* @date 2015.03
*
* @par Copyright:
* Copyright (c) 2015 ITEAD Intelligent Systems Co., Ltd. \n\n
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version. \n\n
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "ESP8266.h"
#define SSID "ITEAD"
#define PASSWORD "12345678"
ESP8266 wifi(Serial1);
void setup(void)
{
Serial.begin(9600);
Serial.print("setup begin\r\n");
Serial.print("FW Version: ");
Serial.println(wifi.getVersion().c_str());
if (wifi.setOprToStation()) {
Serial.print("to station ok\r\n");
} else {
Serial.print("to station err\r\n");
}
if (wifi.joinAP(SSID, PASSWORD)) {
Serial.print("Join AP success\r\n");
Serial.print("IP: ");
Serial.println(wifi.getLocalIP().c_str());
} else {
Serial.print("Join AP failure\r\n");
}
Serial.print("setup end\r\n");
}
void loop(void)
{
}
Have you flashed any firmware or burned any bootloader?
I think you're skipping many steps in working with the ESP-01.
You either use AT commands or you use the Arduino IDE. Not both.
There are plenty of great guides out there that you should follow thoroughly from the very beginning instead of jumping in blind and trying to make sense of where you are.
Just to see if the ESP and Mega can communicate try the following code. I burned the AI-v0.9.5.0 AT.bin firmware to one of my ESP8266 modules. I connected the serial as shown. The other pins should be connected as shown in the beginner's guide tutorial that I linked before.
Upload that code and when it is uploaded, open the serial monitor and push the Mega reset button. You should see something like below in serial monitor if the firmware is loaded and the Mega and ESP are talking over Serial1.
If it doesn't seem to work, try different baud rates for the Serial1.begin. Some ESP module firmware is set to 115200.
If you can get no response or not something like the above we need to find out why.
As INTP implied , if you have uploaded a program to the 8266, then the AT commands will no longer work , as you have now overwritten the program with which the 8266 is supplied.