Categories
ESP8266 (ESP-01/01S) Microcontrollers

Blinking LED (external)

Components

  • 1 x A-i Thinker Technology ESP-01 microcontroller based on ESP8266EX
    • 4Mbit (512 Kb) external flash memory
    • Espressif firmware
  • 1 x Red LED
  • 1 x 10K resistor
  • Jumper wires
    • Male to Female
    • Female to Female
  • 1 x Breadboard (830 or 400 holes)
  • 1 x Breadboard Power Module MB102 (USB Input: 5V and Output: 3.3V)
    • AMS1117 LDO circuit included
  • 1 x ESP01/01S USB Programmer Adapter (CP2104 USB-UART Chip)
    • Programming Mode (Enable)
    • Reset button

Programming Utility, ESP8266 Library and USB-UART driver (MacOS Catalina)

Circuit

EasyEda

Power Up the Circuit and Enable the ESP8266 chip

MB102 Breadboard Power Module provides 3.3V for the circuit. CH_PD pin connected to the 3.3v source to enable the ESP8266EX chip

Code (Output to GPIO 2)

On the Arduino IDE’s Tool Menu, setup the Builtin Led = 2 and the sketch will take the value 2 for LED_BUILTIN

/*
  ESP8266 Blink by Simon Peter
  Blink the blue LED on the ESP-01 module
  This example code is in the public domain

  The blue LED on the ESP-01 module is connected to GPIO1
  (which is also the TXD pin; so we cannot use Serial.print() at the same time)

  Note that this sketch uses LED_BUILTIN to find the pin with the internal LED
*/

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);     // Initialize the LED_BUILTIN pin as an output
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, LOW);   // Turn the LED on (Note that LOW is the voltage level
  // but actually the LED is on; this is because
  // it is active low on the ESP-01)
  delay(1000);                      // Wait for a second
  digitalWrite(LED_BUILTIN, HIGH);  // Turn the LED off by making the voltage HIGH
  delay(2000);                      // Wait for two seconds (to demonstrate the active low LED)
}

Upload (binary code) to external flash memory (512 kb) via ESP01 USB Programmer Adapter

Resources

Arduino IDE software

https://www.arduino.cc/en/software

A-i Thinker

https://docs.ai-thinker.com/en/esp8266

ESP8266EX Datasheet

https://www.espressif.com/sites/default/files/documentation/0a-esp8266ex_datasheet_en.pdf

ESP8266 Library (Arduino IDE)

https://github.com/esp8266/Arduino

USB-UART CP2401 Drivers

https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers

Espressif firmware

https://www.espressif.com/en/support/download/at

8266 Community

https://www.esp8266.com/