Reflect

To content | To menu | To search

Tag - ESP8266

Entries feed - Comments feed

Saturday 21 May 2016

Watchdog Resets

There are two commands which can help prevent a watchdog reset.

  1. delay()
  2. yield()

These commands allow the ESP8266 to perform internal routines while the user commands are waiting for some action. If the internal routines are not executed on time the watchdog is triggered.

Simple Ping Example

There are instances where you want to check if the ESP8266 is connected to a Wifi AP and if the AP does have internet connectivity or not. In those situations try the code below

#include <ESP8266WiFi.h>
#include <ESP8266Ping.h>

const char* ssid     = "ssid";
const char* password = "password";

void setup() {
  Serial.begin(115200);
  delay(10);

  // We start by connecting to a WiFi network

  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);
  
  WiFi.begin(ssid, password);
  
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  } 
/* If you are here you successfully connected to your access point */

  Serial.println("");
  Serial.println("WiFi connected");  
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
}

void loop() {
  delay(5000);
  Serial.print("Pinging ip ");
  Serial.println("www.google.com");

  if(Ping.ping("www.google.com")) {
    Serial.println("Success!!"); /* if the code reaches here you are good to go */
  } else {
    Serial.println("Error :(");
  }
}

Stable ESP8266 experiences

After struggling to get the ESP8266 ESP-012 to work without reboots, watchdog resets and lots of unknown problems I finally seem to have successfully managed to get the ESP8266 work without reboots. The circuit uses 10K ohm resistors from VCC to Rst, En, GPIO0 and from GND to GPIO15. Also, if you plan on using the deepSleep option its best to short Rst to GPIO16 for the ESP8266 to wake up successfully. Also I used a massive 4700uF 25V capacitor as that's what I had lying around across VCC and Gnd but there have been multiple documented instances where 2200uF works fine.

I have been using a linear LM1117 3.3V regulator but plan on trying out TC1262-3.3VAB, or LF33ABV some day.

I blew a lot of these ESP8266 because I was using a 12V battery charger which was giving some fancy waveforms in the output. I opted out of this and botched a usb charger cable to hook to the LM1117's input. The power source was a 5V battery backup pack rated at 4000 mah.