Git Product home page Git Product logo

esp8266_simple's Introduction

ESP8266_Simple

Simple to use Arduino library to interface to ESP8266 Wifi (802.11 b/g/n) Module

Firmware Version

This library was written when 0.9.2.4 was the common firmware on ESP8266 devices (roughly late 2014 through to somewhere around march-april 2015).

Subsequently I have updated it to work with 0.9.5.2, you can get this firmware here

Later versions (1.0 and greater) may or may not work, I have not tested.

Download, Install and Example

  • Download: https://sparks.gogo.co.nz/ESP8266_Simple.zip
  • Open the Arduino IDE (1.0.5)
  • Select the menu item Sketch > Import Library > Add Library
  • Choose to install the ESP8266_Simple.zip file you downloaded
  • Now you can choose File > Examples > ESP8266_Simple > HelloWorld
  • Edit the SSID and PASSWORD where indicated, upload, and open the serial terminal

Note the standard Serial baud rate is set to 115k so be sure to select that in your terminal, we want our debugging terminal as fast as possible so that we can keep up with the ESP8266 on the SoftwareSerial connection and avoid buffer overflows.

However, if your particular Arduino has trouble communicating on it's serial port at 115k (you get continual garbage in the serial terminal), you can drop it down, just change the value in the sketch. Usually it's fine, but technically speaking it's pushing limits a bit with 16MHz crystals.

Connecting To Your Arduino

The ESP8266 is a 3.3 Volt Module, both power and signalling is 3.3v, so you can not connect it directly to a 5v Arduino, you will need to level-shift, an example diagram given below.

This library uses SoftSerial, so that your normal hardware serial can still be used for your debugging.

The 3.3v supply must be quite "strong", the on-board 3.3v (if any) that your Arduino supplies may not be sufficient, you will most likely have to give it a 3.3v supply (of course, you must share a ground between your arduino and the ESP8266 for them to talk!)

Example Wiring Diagram for ESP8266 Level Shifted with Zeners to Arduino

There are a few different modules of ESP8266, this is the most common.

Pinout Of Common (V091) ESP8266 Module

Usage

Open the HelloWorld example, it really is as simple as can be. Also provided is an HTTP Server example.

Caveats

Not multi-threaded, you can request or serve one thing at a time.

Only SoftwareSerial is supported currently, although I will eventually make it work with HardwareSerial as well probably.

This is all very experimental.

Patches Welcome

By all means!

esp8266_simple's People

Contributors

marabesi avatar sleemanj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esp8266_simple's Issues

Doesn't show ESP8266's own IP address

First, let me say this looks like a great library for newbies like me.

So real quick here's my specs:
Arduino Duemilanove, Sparkfun Bi-Directional Logic Level Converter, ESP-01
Arduino software v1.6.5

When I try to run the 'GetIPAddress' sketch, this is what I get in the serial monitor:


ESP8266 Demo Sketch
Reset: OK
Connect: OK
IP Address: 0.0.0.0

The string IP is: 0.0.0.0
The unsigned long IP is: 0
The IP address 127.0.0.1 has integer value 2130706433
The integer value 921773419 has IP address 54.241.37.107
End of Demo

The string IP is: 0.0.0.0
The unsigned long IP is: 0
The IP address 127.0.0.1 has integer value 2130706433
The integer value 921773419 has IP address 54.241.37.107
End of Demo


(minus the asterisks of course)
And I just get that same 2nd paragraph on and on

However, I know the ESP-01 is getting an IP address because I can see it in my WiFi controller's software 'Client' list and I can ping it.

Firmware AI-v0.9.5.0 AT

Loaded the http_server sketch and get the following response

ESP8266 Demo Server Sketch
Reset: OK
Connect: Device issued "ready" unexpectedly (rebooted)
Connect: OK
IP Address: 0.0.0.0
Starting HTTP Server: OK
( Now you can use your web browser to hit the IP address above. )

uncommenting the delay in your code seems to fix that.

(code that I uncommented)
// delay(4000);
// Once the reset is issued OK, try to issue an AT command
// and wait until that works

However, it does not seem to work. It comes up and I locate the IP on my DHCP server be cause the code does not return an IP. When I connect to it, the port is open and available but I never get a response.

Trouble with reset: General Error

At first I was using the 3.3v power supply from the arduino, but the ESP8266 was constantly blinking red and giving me "reset: General Error". I ordered a part to step down the voltage from the arduino 5v to 3.3v, so i could supply enough current. The ESP built in LED is now a steady red, not blinking. I have updated the firmware to the current version, but I am still getting "reset: General Error". Any ideas? Thanks

Trouble with webserver requests freezing

I would like to first thank you for this excellent and well-written library!
I am having a bit of trouble with the HTTP_Server example. When I connect to the Arduino via Chrome or Firefox, it will display the page contents, however it continues to load and never completes. Even after well over 30 seconds, the page continues loading, yet never finishing.
In spite of being a web developer, I cannot seem to figure out what's lacking nor why the request is being held open. I cannot see the response data either, because any HTTP Request viewers I try never report since the request will not finish.
Your code is cryptic enough to where I can't quite determine the process, so I was hoping you might be able to offer some insight into this. I really like the fact your code is very lightweight, yet robust. Thank you.

Hardware Names

In the schematic, it shows that you need two diodes and one 100nF capacitor. What are the part numbers for these? Without knowing the part numbers, I don't know the type of each to order. Thanks

Open SSID not working

Hello,
when I try to connect to my Open Wi-Fi SSID the library returns an error message:
Missing SSID/Password, see sketch #defines.

How can I connect on a wifi with no password?
thanks

GET to return the webpage body

Hi!

How could I get the page body content (without the headers?) I am requesting a php page, which I want to read back some text data. The httpResponseCode, returns a number only.. or not?

unsigned int httpResponseCode =
wifi.GET
(
F(reqIP), // The IP address of the server you want to contact
80, // The Port to Connect to (80 is the usual "http" port)
buffer, // Your buffer which currently contains the path to request
sizeof(buffer), // The size of the buffer
F(reqPage), // Optional hostname you are connecting to(* see below)
0 // Get from line 2 of the body, no headers (use 0 to get headers)
// responses often have a leading newline, hence starting
// from line 2 here, adjust as necessary
);
if(httpResponseCode == 200 || httpResponseCode == ESP8266_OK) {
// Our request was successfull and the response can be found in the buffer
Serial.println(F("OK"));
Serial.println(buffer);
}

Also, could I have 2-3 different wifi credentials, and when the server cannnot connect, it would switch to the next combination, and rotate until it is connected? example:
String wifiCodes[][3] = {
{ "ssid1","pwd1"},
{"ssid2","pwd2" },
{"ssid3","pwd3" }
};

Thanks a lot for the code, and all the effort :-)

Panos

Problem with Reset

I uploaded the HelloWorld sketch and when I open the serial monitor here is what does it return to me:


ESP8266 Demo Sketch

Reset: General Error

What am I doing wrong?
Thanks.

Timeout Waiting For Response

Hi!

Your library is very simple and easy to use, I have been searching to find a simple on like that!
I have a problem that the AT+CWJAP=.. command (wifi.setupAsWifiStation(ESP8266_SSID, ESP8266_PASS, &Serial);) shows me "Timeout Waiting For Response" error before actual connecting nu merous times. Is there a way to increase the timeout milliseconds?

Thanks,
Panos

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.