Go Down

Topic: Controlling Arduino Uno outputs with ESP8266 (Read 6478 times) previous topic - next topic

Khorne

Hello, Please I want to connect my Arduino Uno to my wifi using ESP8266, I used this wiring:


It's connected Okay I can use "AT" commands without a problem, now I want to add some LEDs or Relays on the Arduino Uno then control them Via Wifi from web or a phone app like this:



I found a lot of project about using the ESP8266 module alone, but I want to use it with the Arduino board if it's possible, Thank you

pert

I like to use the WiFiEsp library for this:
https://github.com/bportaluri/WiFiEsp
After installing the library you will find an example sketch at File > Examples > WiFiEsp > WebServerLed that demonstrates how you can control an LED over WiFi. Using that as a reference it should be quite easy for you to expand it to multiple LEDs, etc.

Whandall

You should use a level shift on the Arduino Tx -> ESP Rx connection, at least a voltage divider.

The ESP is a 3.3V device and could get damaged if supplied with 5V signals.
Ah, this is obviously some strange usage of the word 'safe' that I wasn't previously aware of. (D.Adams)

Khorne

I like to use the WiFiEsp library for this:
https://github.com/bportaluri/WiFiEsp
After installing the library you will find an example sketch at File > Examples > WiFiEsp > WebServerLed that demonstrates how you can control an LED over WiFi. Using that as a reference it should be quite easy for you to expand it to multiple LEDs, etc.
Thanks I will try.

Khorne

You should use a level shift on the Arduino Tx -> ESP Rx connection, at least a voltage divider.

The ESP is a 3.3V device and could get damaged if supplied with 5V signals.
I used the 3.3V output from the Arduino board, as you can see in the picture I didn't use the 5V output.

MartynC

I used the 3.3V output from the Arduino board, as you can see in the picture I didn't use the 5V output.
It is not just the power you need to care about but also the other pins.


As Whandall states above, the ESP8266 RX pin is 3.3v and the Arduinos TX pin (D11) is 5v. This needs bringing down to 3.3v. A simple voltage divider made from 2 resistors will do. I generally use a 1K and a 2K.

The Arduino will see 3.3v as HIGH, so you can connect the ESP8288 TX directly to the Arduino RX.


Khorne

It is not just the power you need to care about but also the other pins.


As Whandall states above, the ESP8266 RX pin is 3.3v and the Arduinos TX pin (D11) is 5v. This needs bringing down to 3.3v. A simple voltage divider made from 2 resistors will do. I generally use a 1K and a 2K.

The Arduino will see 3.3v as HIGH, so you can connect the ESP8288 TX directly to the Arduino RX.


Thanks, I forgot about that, because I just tried some other tutorials I've seen before, but I couldn't find what I'm looking for yet. I'll try using a voltage divider or level shifte.

papasmurph

The Arduino will see 3.3v as HIGH, so you can connect the ESP8288 TX directly to the Arduino RX.
I guess you mean TX to TX, RX to RX. The Arduino is marked opposite to what each pin means.

I tried with 10k+20k resistors instead according to an example, and without the 8266 connected there's a 3V3 signal from the MCU, but with 8266 connected, the port marked RX on the 8266 is steady 1V2. Weird indeed.

Whandall

I guess you mean TX to TX, RX to RX. The Arduino is marked opposite to what each pin means.
Nope.

You have to connect RX to TX and TX to RX if the Arduino should communicate with the ESP.
Ah, this is obviously some strange usage of the word 'safe' that I wasn't previously aware of. (D.Adams)

klaatu42

#9
Jul 20, 2019, 05:56 pm Last Edit: Jul 20, 2019, 06:01 pm by klaatu42
Since nobody has said it, and this is coming up high in Google results for powering ESP8266, I'm reviving this old thread to point out that you cannot connect the ESP8266 to the 3.3v output of the Arduino. It draws far too much current. This will cause damage. Power it separately. Also, it is perfectly fine to provide 5V signal to the RX on the 8266. This was confirmed by the Espressif CEO Teo Swee Ann.

raymw

For not much money, you can get a small adapter board which will power the esp8266 from a 5v supply, and it connects to the uno tx,rx, 5v, gnd lines. With a bit of fiddling with connecting leads, you can use it to flash the esp8266, too. Search for "Ils ESP8266 Serial WI-Fi Wireless ESP-01 Adapter Module 3.3V 5V Compatible for Arduino". Makes it safe and easy for prototyping.

Go Up