Arduino Uno to wifi using ESP8266 12F

Hi!

I'm trying to connect my Arduino Uno to wifi using my ESP8266 12F. I found and tried 2 tutorials and instructables that use other ESP8266 boards, but none of them worked, and haven't found any example of how to do it with the 12F.

Thanks in advance

PS: I am aware that I could just use directly the ESP8266 but it can only output 3V while the sensor relay I'm trying to control takes 5V.

the sensor I'm trying to control takes 5V.

You usually read a sensor output and control an actuator. What is that sensor?

If it is a sensor that you read, you can reduce the 5V output to 3.3V (digital) or 1.0V (analog) with a resistor voltage divider.

groundFungus:
You usually read a sensor output and control an actuator. What is that sensor?

If it is a sensor that you read, you can reduce the 5V output to 3.3V (digital) or 1.0V (analog) with a resistor voltage divider.

I wrote that too quickly, it is not a sensor, it is a 5v relay like this

When you say it does not work does that mean not at all or some problem connecting?
initially try a WiFi scanner which is usually an example which comes with the library
how have you connected the ESP-12F ESP8266?
can you download your code?

to drive a 5V relay from 3.3V use a level converter
https://learn.sparkfun.com/tutorials/bi-directional-logic-level-converter-hookup-guide/all

if the relay is driving high voltages may sure it is opto isolated

horace:
When you say it does not work does that mean not at all or some problem connecting?

horace:
how have you connected the ESP-12F ESP8266?

I have tried both techniques described in the tutorial I linked in my first post.

horace:
can you download your code?

What I meant by not working is that uploading the code to the arduino works fine, but I don't get any answer to my AT commands.

Thanks for the tips on the relay!

which ESP8266 12F board are you using ?
this may be useful to check out the board

horace:
which ESP8266 12F board are you using ?
this may be useful to check out the board
https://www.instructables.com/id/ESP-12F-ESP8266-Module-Connection-Test/

This is the board's datasheet.

This is where I got the board. There are many choices on this product's page but mine is the second to last option.

I used it before on its own, and it worked fine, I could program it and connect to it with my phone and send command to it and get responses. Now the tutorials that I tried, since they say that "you don't need to flash the ESP8266, just the stock firmware", I used a brand new one.

looking at the specification of the ESP8266 12F in the datasheet it appears to be a 3.3V device (page 9) - have you used a level shifter between it and the UNO?
what baudrate did you use ? the default is 115200 (page 6)
the datasheet states on page 5 "General AT commands can be used quickly" but gives no details

have a look at
https://robertoostenveld.nl/esp-12-bootloader-modes/

this shows using AT commands

Thanks for your continuing effort to help, I am super new to all this and appreciate it.

horace:
looking at the specification of the ESP8266 12F in the datasheet it appears to be a 3.3V device (page 9) - have you used a level shifter between it and the UNO?

I did not, however do I really need to? I'm not using the 5V pin of the Arduino Uno, I'm using the 3.3V pin of the Arduino Uno, as stated in both the tutorials that I linked in my original question.

horace:
what baudrate did you use ? the default is 115200 (page 6)

I used 115200, as instructed in this tutorial that use this code and this tutorial that use this code.

horace:
have a look at
ESP-12 bootloader modes and GPIO state at startup | Robert Oostenveld’s blog

Thank you, but this is not what I'm trying to accomplish. This is useful information for programming the ESP8266 itself, but I am not trying to program the ESP8266:

From my first post:

knotanumber:
I'm trying to connect my Arduino Uno to wifi using my ESP8266 12F.

horace:
this shows using AT commands
https://www.instructables.com/id/ESP-12F-ESP8266-Module-Connection-Test/

This is the same link that you sent in your last answer, and while informative, it uses the ESP8266 12F on its own, to program it on its own, but I am trying to use it to talk to wifi from the Uno.

knotanumber:
Thanks for your continuing effort to help, I am super new to all this and appreciate it.

I did not, however do I really need to? I'm not using the 5V pin of the Arduino Uno, I'm using the 3.3V pin of the Arduino Uno, as stated in both the tutorials that I linked in my original question.

if you connect the serial lines of a 5v device such as the Mega to a 3.3V device such as the ESP8266 12F a level converter should be used otherwise the 3.3V device may be damaged.
Some 3.3V devices, e.g. some PIC24s, have some input pins that are 5V toterant

What does "the serial lines" mean in this case? Is that another name for the RX and TX pins?

In one of the tutorial, the wiring is setup with resistors:

Is that related?

the serial lines are the Tx and Rx signals
the resistors on the arduino Tx line are a potential divider which act as a level converter
converting the Arduino Tx 5V output to 2.5V for the ESP8266 Rx input
the ESP8266 Rx 3.3V output is connected directly to the Arduino Rx input

a level converter such as
https://learn.sparkfun.com/tutorials/bi-directional-logic-level-converter-hookup-guide/all
is bidirectional for interfacing to devices such as I2C where the SDA line acts both as an input and output

connected a ESP8266 12F to an arduino due (a 3.3V device therefore no requirement for a level shifter)

ran a simple serial program

//  Arduino Due communicating with a ESP8266 12F

// Arduino Due 3.3V and GND to ESP8266 12F Vcc and GND
// Arduino Due Tx pin 18 to ESP8266 12F RxD0
// Arduino Due Rx pin 19 to ESP8266 12F TxD0

// AT commands https://room-15.github.io/blog/2015/03/26/esp8266-at-command-reference/

unsigned long time1;

void setup() {
  while (!Serial) ;
  delay(500);
  // initialize both serial ports:
  Serial.begin(115200);
  Serial1.begin(115200);
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
  time1 = millis();
  // while(1) Serial1.print("hello");
  Serial.write("ESP8266 12F Serial test\n");
}

void loop() {
  // blink LED once a second
  if (millis() - time1 > 1000)
  {
    time1 = millis();
    if (digitalRead(LED_BUILTIN) == LOW)
      digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
    else                      // wait for a second
      digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
    //Serial.write('*');
  }
  // read from port 1, send to port 0:
  if (Serial1.available()) {
    int inByte = Serial1.read();
    Serial.write(inByte);
  }

  // read from port 0, send to port 1:
  if (Serial.available()) {
    int inByte = Serial.read();
    //Serial.write(inByte);
    Serial1.write(inByte);
  }
}

and AT commands worked OK

Serial test
at
OK

AT+RST
OK

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 27728, room 16
tail 0
chksum 0x2a
load 0x3ffe8000, len 2124, room 8
tail 4
chksum 0x07
load 0x3ffe8850, len 9276, room 4
tail 8
chksum 0xba
csum 0xba


AT+CIPSTATUS
STATUS:5
OK

AT+CWMODE=?
+CWMODE:(1-3)
OK

AT+CWJAP="xxxxxxx","yyyyyyyy"
WIFI CONNECTED
WIFI GOT IP