Paulware8

I'd like to start a forum Discussion on using the ESP8266. I was able to create a simple http server with it using the Mega (for extra serial ports), and I had to make sure it had its own 3.3V power supply. I created a github repo that has the source code, and will follow with some diagrams to show how it was connected.: https://github.com/Paulware/ESP8266

Datasheets for the ESP8266 are quite poor, but basically it's a microcontroller with WiFi with default firmware that will respond to "AT" style commands over serial. Modules are cheap ($5) and the range is fantastic -- hundreds of meters -- and of course that can be improved with better antennas.

Basic theory of UDP operation: ESP8266 logs onto your local network (it will need SSID and password) Android device also logs on to local network and sends out a UDP broadcast (to 192.168.0.255 for example). The message is "findkey" where key is a unique name of the device (i.e. garageDoor).

All other ESP8266 on the local network will receive this message but only the unit with the matching key will respond. This matching unit will respond: "CTS" (clear to send) to the android device.

When the android device receives this message it now also has the ip address of the device. All further commands will be point to point from the android device to the specific ip address of the specific ESP8266 unit with the matching key.

The unit can now process and respond to commands, like "open" or "readTemp".

In the ESP8266UDP directory is also a udpServer.py file which can be used to simulate and android device (if you don't yet have one - The Kyocera Event can be purchased at Best Buy for $40) to command the ESP8266.

Also, in this directory is an Android project written in .java/Eclipse which demonstrates basic connectivity. You can use this project as a skeleton to create your own Android App.

Paulware8

I just found out there is an AT+CIOBAUD command which allows you to change the baud rate.This will change the pcb design because previous posts I had read on this subject assumed a baud rate of 115200. This forced me to connect D0 (Arduino RX) to ESP8266 TX (using a transistor) and D1 (Arduino Tx) to ESP8266 Rx (using a transistor).

But now with the reduced baud rate we can use softserial to connect to ESP8266 rx/tx and save standard serial (D0,D1) for debugging. I think this will make the final solution much more user friendly.

I have tried to use the LUA webserver with an ATtiny85.The t85 does all the sensor reading and sends it to the esp8266 via seriel.It works very well and very covenient because the t85 can run on the same 3.3V as the esp8266.

There is still a problem with the RAM usage but working on it@PaulwareWhich firmware do you use on the esp8266 ?

Paulware8

I don't modify the firmware on the esp8266, I just use them as I get them from the vendor. I believe that vendors ship them with firmware that allows them to respond to AT commands.

I created an Arduino program to store the SSID/Password in EEPROM on the atmega. That way other users can use it without needing to change the source code. My Arduino program allows me to set the SSID and password for my home network. by typing in the Serial monitor: ssid mySSID, where mySSID is the ssid of my home router. My Arduino program also allows me to set the password by typing in the Serial monitor: password myPassword, where myPassword is the password on your home router.

The first step when I get an ESP8266 is to determine what baud rate the device is set to. I do this by sending "AT" commands at various baud rates until it responds with "OK". Once it responds with "OK", I know I have the correct baud rate, and I will be able to set its parameters. First I set the baud rate to 19200. Then I set the other parameters to configure it as a UDP server. At that point I will be able to use it to fulfill a variety of functions such as a motor controller or a sensor. After setting the baud rate, I also set:

AT+CWMODE=3 AT+CIPMUX=1 AT+CIPSERVER=1,3333 AT+CIPSTO=120

once this is done, the esp8266 will get an ip address assigned by my home router and listen to port 3333 for a command. In this manner it can be used as a sensor or a device controller.