Introduction: Getting Started With ESP8266

About: Computer Science and Engineering Design Teacher Hobbyist and General Tinkerer

ESP WHA..?

(From Wikipedia, the free encyclopedia)
The ESP8266 is a low-cost Wi-Fi microchip with full TCP/IP stack and microcontroller capability produced by manufacturer Espressif Systems[1]in Shanghai, China.

Huh?

The ESP8266 is like a little Arduino with wifi capabilities. Smaller and a little lighter than your Sparkfun or other Arduino Compatible board this nodeMcu board contains a small 32bit controller, USB micro port, reset and flash push buttons, a wifi module capable of acting like a web server (full TCP/IP stack) and GPIO pins for control. This is not unlike the brains/guts of most home Smart (or IoT - Internet of Things) devices that you can connect to to remotely use for sensing and/or control)

For this project - we'll install software on your computer to allow easy USB interfacing from your computer and program with the Arduino software.

Supplies

  • ESP8266 NodeMCU module
  • USB Micro cable *be sure this is a data - not just charge only cable*
  • Solderless Breadboard
  • LED
  • 330 Ohm resistor

Step 1: Find an ESP8266

Easily found on Amazon, AdaFruit, Newark or electronics Hobby stores - ie MicroCenter,

Step 2: Get Parts: Breadboard, MicroUSB, LED And...?

Gather (or purchase) materials to connect and prototype the ESP8266.

  • Solderless Breadboard - recommend 400pt, however the mini board will fit in a pinch
  • USB to MicroUSB cable
  • 5mm LED
  • 330 Ohm resistor (optional)

Step 3: Fires Up the Engines! Let's Connect

Place your ESP8266 controller on a bread board.

Be sure the parallel row of pins straddle the 'trough' of the breadboard - separating the two sides of GPIO pins on either side of the breadboard. **Be sure you place the USB end of the ESP8266 near the end of the bread board, to allow easy connection (and disconnection).

If you are using the smaller boards, without the power rails - be sure the board is centered to allow a row of spare pins in the board on either side (for LED testing, etc.)

NEXT - Lights!

  1. To test power to the board, we'll connect a 5mm LED to the 3.3V port of the GPIO pins
  2. Remember, the long leg of an LED is Positive, short leg and flat side of lens is Negative, to GND
  3. If you search 'pinout diagram, ESP8266' online, you'll find a similar diagram.
  4. With the silver box (wifi module) oriented to the top of the board, locate '3.3V' pin in the lower right corner
  5. Plug the long leg of the LED in the 3.3V pin, and short, negative leg to ground, GNC
  6. Finally, plug the micro end of your USB cable into the ESP8266, and the other end into your computer.

And voila!

Bask in the brilliant light of the little LED.

Step 4:

  • Launch Arduino
  • Open Preferences window
  • Copy the following URL:
    •   https://arduino.esp8266.com/stable/package_esp8266com_index.json  
  • Paste into Additional Board Manager URLs field.
    • It is titled: Additional Boards Manager URLs
      • If there is already something in the box, click on the icon to the right
      • This will show items already in the list
      • Place your cursor at the end of the last line, hit on the keyboard
      • Paste the URL above into the next line
      • See the example in the picture
      • Click OK or save to apply changes

Next:

  • Open Boards Manager ( from Tools > Board >Board Manager ) menu
    • Search for esp8266
    • Choose the most recent version and select 'Install' (see picture 3)
  • Once the install is complete, click Save/Close/Apply
  • Go back to the Tools menu and select your ESP8266 board from Tools > Board menu after installation.

Step 5: Let's Write Some Code!

Let's create a new sketch in Arduino ( File > New ) and write a little program to blink the LED on and off, rather than just on all the time. (You can also use one of the 'BLINK' examples from your Arduino)

 void setup() {
	// the setup part of your code establishes needed elements,
	// such as creating a placeholder for a GPIO pin 
	// in this case #13, as an output
	pinMode(13, OUTPUT); 
}
void loop() {
		// next two lines turns ON the LED 
		// (HIGH is the voltage level)
		// then waits and leaves LED on for 1000ms (1 sec)
	digitalWrite(13, HIGH);
	delay(1000);
		// these next two lines switch voltage to LOW, 
		//essentially turning LED OFF
		// delay leaves bulb off for 1000ms (1 sec)
	digitalWrite(13, LOW);	
	delay(1000);
		//void loop repeats continuously 
		//until power is disconnected
}

Step 6: Wait.... What Ever Happened to Plug and Play?

If you are ready to write code to test your Arduino skills out on you ESP8266 Board, you do not need any libraries or includes (yet) besides the steps we've completed.

So just plug in the board and go, right?

But wait.... the port is not showing up?

You will find that even if You have used Arduino platform before, and have folllowed prior instructions for importing libraries using board manager, your ESP8266 will still not show up on the port listing for USB/Serial.

The ESP8266 uses UART ports over pins, but does not communicate directly over USB (Like your Arduino UNO or Sparkfun SIK's)

We can use software from Silicon Labs that will allow you to communicate (upload sketches) to your board over the USB micro port)

Download the software for YOUR operating system (scroll down) from the page below:

https://www.silabs.com/products/development-tools/...

SHS students, for ur devices: https://www.silabs.com/documents/public/software/M...

Step 7: Final Test!

Once the UART software is installed, a virtual port is created between the ESP8266 and the USB cable - so the board will show up on Tools > Port...

Now, send the Arduino Blink Sketch to the Board and enjoy the ooohs... and aaahs of admiration from peers