Pages

2017/06/06

Working with ESP-12F

This is a quick summary of how to work with ESP-12F.


Arduino IDE: 1.8.4
ESP8266 Arduino Version: 2.4.1


Configuration



-------------------------------------------------------------------------------------------------------------------------

Environment:

Arduino IDE: 1.8.4
ESP8266 Arduino Version: 2.3.0


Select: NodeMCU 1.0 (ESP-12E Module).


Configuration:


--------------------------------------------------------------------------------------------------------------------------

Schematics

Note, the locations of GPIO4 and GPIO5 need to be swapped. GPIO5 should be next to RXD, GPIO4 should be next to GPIO0. The silkscreen printed on ESP-12F is wrong!!



The schematic below shows the correct location of GPIO 4 and GPIO 5.
Arduino IDE


Be sure to do the following before uploading the sketch to ESP-12F.

- Provide external +3.3V to ESP-12F (make sure the +3.3V is connected to VCC, and the GND is connected to GND). Or, power ESP-12F with the 3V3 power output from CP-2102.

- Plug the CP-2102 module to the USB port of the computer used for firmware upload;

- First close the flash switch then the reset switch so that both GPIO0 and RST of ESP-12F are connected to GND;

- First open the reset switch then the flash switch so that both GPIO0 and RST are floating;

- Click on the upload icon to compile and upload the sketch.

Result (running the example code Check FlashConfig)


Code for blinking LED attached to GPIO2

Below is the code for blinking LED attached to GPIO2. Note that "WiFi.mode(WIFI_STA);" is added to stop ESP-12F from acting as an AP in this test.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#include <ESP8266WiFi.h>

// the setup function runs once when you press reset or power the board
int LED_PIN = 2;

void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_PIN, OUTPUT);
  WiFi.mode(WIFI_STA);      //We don't want the ESP to act as an AP
  
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_PIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_PIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}

References:

ESP-12F
http://tech.scargill.net/esp-12f/

No comments:

Post a Comment