esp8266 Things You Should Know Before Using ESP8266 WiFi Module - JohnHau/mis GitHub Wiki

Things you should know using ESP8266 WiFi module for its safety and easiness as it's very delicate module to use.

https://www.hackster.io/PatelDarshil/things-you-should-know-before-using-esp8266-wifi-module-784001

image

Things used in this project Hardware components Arduino UNO Arduino UNO × 1 ESP8266 ESP-01 Espressif ESP8266 ESP-01 × 1 SparkFun Logic Level Converter - Bi-Directional SparkFun Logic Level Converter - Bi-Directional × 1 Software apps and online services circuito.io circuito.io Arduino IDE Arduino IDE Hand tools and fabrication machines Soldering iron (generic) Soldering iron (generic)

Story ESP8266 is a 3V WiFi module very popular for its Internet of Things applications. ESP 8266 maximum working Voltage is 3.6V and its very important to note. You must know how to power it, how to serial-connect it with Arduino safely, how to ping and many other things. You should use software like Circuito.io, Tinkercad, Fritzing to simulate and work with the board safely. You should also use Logic Level Controller to use with ESP8266 module.

image

VCC and GND are powering pins. RX and TX are used to communicate. You should also look at ESP8266 datasheet at https://cdn.sparkfun.com/datasheets/Wireless/WiFi/ESP8266ModuleV1.pdf

Powering ESP 8266 There are many ways to power ESP8266 WiFi module: you can use 2 AA sized batteries for powering, PC port if you have a TTL-Serial-to-USB adapter (Don't try to connect the module to a PC serial port directly, you could cause damage to the module or to your computer!). You can use LIPO batteries to power the ESP Dev Thing board. You can use LM117 3.3V voltage regulator.

image

The ESP8266’s maximum voltage is 3.6V, so the thing has an onboard 3.3V regulator to deliver a safe, consistent voltage to the IC. That means the ESP8266’s I/O pins also run at 3.3V, you’ll need to Logic Level Controller any 5V signals running into the IC.

Alternatively, if you have an external, regulated supply you’d like to deliver directly to the ESP8266, you can supply that voltage through the 3V3 pin (on the I2C header). While this voltage doesn’t have to be 3.3V, it must be within the range of 1.7-3.6V.

image

image

I have used Tinkercad to show how the board can't handle even 0.1 extra. The maximum voltage you can give is 3.5V. You should use such simulation software to look that the power you are delivering to ESP is safe or not.

Using Logic Level Controller

image

The level converter is very easy to use. The board needs to be powered from the two voltages sources (high voltage and low voltage) that your system is using. High voltage (5V for example) to the ‘HV’ pin, low voltage (3.3V for example) to ‘LV’, and ground from the system to the ‘GND’ pin.

image

image

image

image

image

image

Code test code

// Include Libraries #include "Arduino.h" #include "ESP8266.h" #include "dweet.h"

// Pin Definitions #define ESP8266_PIN_RX 10 #define ESP8266_PIN_TX 11

// Global variables and defines

// ==================================================================== // vvvvvvvvvvvvvvvvvvvv ENTER YOUR WI-FI SETTINGS vvvvvvvvvvvvvvvvvvvv // const char *SSID = "WIFI-SSID"; // Enter your Wi-Fi name const char *PASSWORD = "PASSWORD" ; // Enter your Wi-Fi password // // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // ====================================================================

// These Dweet tokens have been auto generated for you. char* const inputToken = "59a7c547b7e19d001f7002d0_input"; char* const outputToken = "59a7c547b7e19d001f7002d0_output";

// object initialization ESP8266 wifi(ESP8266_PIN_RX,ESP8266_PIN_TX); Dweet dweet( &wifi, inputToken, outputToken);

// define vars for testing menu const int timeout = 10000; //define timeout of 10 sec char menuOption = 0; long time0;

// Setup the essentials for your circuit to work. It runs first every time your circuit is powered with electricity. void setup() { // Setup Serial which is useful for debugging // Use the Serial Monitor to view printed messages Serial.begin(9600); while (!Serial) ; // wait for serial port to connect. Needed for native USB Serial.println("start");

wifi.init(SSID, PASSWORD);
menuOption = menu();

}

// Main logic of your circuit. It defines the interaction between the components you selected. After setup, it runs over and over again, in an eternal loop. void loop() {

else if (menuOption == '1') {

//SET DWEETS

dweet.setDweet("DemoKey", "DemoValue"); // replace with your own (key, value) pairs to dweet your data
dweet.sendDweetKeys();


//GET DWEETS  
dweet.receiveDweetEvents();

if(!strcmp(dweet.getValue() , "DemoEventName"))
{
    Serial.println("DemoEventName received!");
    // Do something
}
}

if (millis() - time0 > timeout)
{
    menuOption = menu();
}

}

// Menu function for selecting the components to be tested // Follow serial monitor for instrcutions char menu() {

Serial.println(F("\nWhich component would you like to test?"));
Serial.println(F("(1) IOT"));
Serial.println(F("(menu) send anything else or press on board reset button\n"));
while (!Serial.available());

// Read data from serial monitor if received
while (Serial.available()) 
{
    char c = Serial.read();
    if (isAlphaNumeric(c)) 
    {
        
		else if(c == '1') 
			Serial.println(F("Now Testing IOT"));
        else
        {
            Serial.println(F("illegal input!"));
            return 0;
        }
        time0 = millis();
        return c;
        }
    }
}