Академический Документы
Профессиональный Документы
Культура Документы
COM
Projects MariaMole Blog About
personal projects
Note that I'm using the CD4050 only to adapt the Arduino-Tx to
ESP-Rx. There's no need to adjust the ESP-Tx to Arduino-Rx,
since the Arduino port can handle 3.3V.
Also note that the Arduino 3.3V regulated output (50 mA max)
can't drive the current requested by the ESP (Up to 200 mA).
Some tutorials on the Internet use the Arduino 3.3V to power
the ESP, but it didn't worked for me. I'm using an external power
supply (An old 5V Android charger).
I'm using a diode and resistor (17 kOhms, but any large value
will work) to decrease my 5V power supply (Here depicted as a
battery pack). Depending on the quality of your power supply,
you can use one or two diodes. As mine wasn't a good one, a
single diode was enough to get 3.7V when the circuit was
powered on.
I made a PCB with this circuit. You'll find the link at the end of
this post
Important:
Never power your ESP with 5V. You'll destroy it. The same
goes for any logic input (In this case, the Rx pin)
If your ESP receives less than 3.3V, you'll end up with a lot
of transmission errors (You'll see a lot of garbage on your
serial communication)
When using an external power, do not forget of
interconnecting both Arduino-GND and power supply GND,
to keep the voltage reference. If you don't do that, you'll
end up with a lot of transmission errors, again.
ESP-8266-01 terminals
The terminals for this ESP models are depicted here:
Test code
In order to test your ESP, you'll need two serial ports:
One dedicated serial port, connected between Arduino and
ESP, where Arduino will send AT commands to ESP.
A second serial port, connected between Arduino and the
computer, where you can type your AT commands.
So, the best Arduino model for this task is Mega, since it
provides up to 4 serial ports. You can still try other models,
using the SoftSerial lib, but this library has some speed
limitations, and it may not work with some ESP models.
You can test your ESP connection with the following simple
code:
void setup()
{
Serial.begin(9600);
Serial1.begin(9600);
}
void loop()
{
while (Serial1.available()) {
Serial.write(Serial1.read());
}
while (Serial.available()) {
Serial1.write(Serial.read());
}
}
This code simply relays data from both Arduino serial. It gets
the AT commands you type at your computer and sends them
directly to your ESP. It also gets ESP return data and sends to
your computer.
Once you upload this code to your Arduino, you'll see this on
your terminal:
Links
My projects with ESP826 at github (Includes all circuits
shown at this page)
List of ESP AT commands
ESP-8266 Library for Arduino
A great tutorial, in Portuguese
CD45050 Datasheet
A very good reference doc for ESP8266 (PDF)
alexporto.com 2017 |
Arclite theme by digitalnature | powered by WordPress
TOP