Help connecting esp-01 and nano

![esquema com mq5_bb|690x457](upload://1HzKaNWIj8rAVYJ11sKwC1DMFDd.png)

I need help to connect the esp-01 wifi in this scheme, can anyone help me?

My actual code:

int led_pin=13;
int Buzzer=4;
int analog_pin=A0;

void setup() {
Serial.begin(9600);
pinMode(led_pin, OUTPUT);
pinMode(Buzzer, OUTPUT);

}

void loop() {
int temp;
temp=analogRead(analog_pin);

if(temp>300)
{

Serial.print("[alarmegas]");  
Serial.println("[alarmegas]"); 
delay(30000);

}
}

While I know nothing about ESP-01 other than I have been asked for a part before, this web site

after translating the pins from a Uno to a nano indicates this should work.

the breadboard isn’t really needed, if you can connect the 3.3V nano pin to 2 pins on the ESP-01.

the sketch the above screen shot came from

ESP8266 ESP01.fzpz (17.5 KB)

Peter

This schematic has some problems:

  • You shouldn’t power an ESP-01 from the 3.3V output of an Arduino Nano: it consumes up to 200mA while that pin produces 40mA maximum.
  • The ESP-01 pins brought HIGH should be done with a 10K pull-up resistor instead of directly.
  • ESP-01 RX/TX pins work at 3.3V and it’s not clear (depends on where you read it) if they are 5V tolerant so, to be on the safe side, I will use a voltage divider (18K+10K) for the RX pin on the ESP-01 (TX is fine as the Nano will “understand” 3.3V logic).

Here you have a lot of details (in Spanish): Guía para configurar un ESP-01, el módulo WiFi basado en ESP8266

Best regards!

@roboteach thanks for the update! I also see I screwed up and uploaded the esp01 part rather than the sketch, so here is the updated sketch:

There are two level translation options here (a third, easier than either of these, would be to use a 3.3V nano as it won’t need level translation!) The resistor method is shown, a faster alternative is the 74ahc125. Its inputs (only the ahc version though!) are 5V tolerant) and will thus level translate at full speed (the resistor network is slow!) There is an external power supply supplying 3.3V to avoid the current limitation on the Nano (which I should have remembered!) And finally here is the sketch this time.

edit: missed the ground on the ESP01, corrected here!

edit2: removed the 74ahc125 and corrected the wiring as rx did not connect to the resistor.

esp01-nano-2.fzz (28.4 KB)

Peter

Sorry but this schematic confuses me? is it correct? (R3 is disconnected, purple wire also…). Unless both options are there so “you have to choose one before”… I’ll suggest separated schematics to be simpler/clearer :sweat_smile:

Voltage dividers work fine for these “slow” speeds and require less components and wiring. You have actually the option to use a proper “lever shifter” like this one in critical scenarios, but I never needed one myself in any practical case…

Good to know about the 74AHC125 though :blush:

No it isn’t correct. R3 should have been connected. I replaced both the image and .fzz with one that should be correct and removed the 74ahc125 entirely.

Peter

esquema com mq5.fzz (88.2 KB)

In this schema, how can I include esp-01 (wifi) ?

Load the sketch then right click on the part in the temp parts bin and select Export part. Fritzing will prompt you for a file name and directory and then write the .fzpz file for the part there.

Peter

ESP8266 ESP-01 Upgraded WiFi Module.fzpz (51.3 KB)