Esp8266 WiFi Server
This project uses a stock ESP8266 module plus a PIC. It provides 6 digital outputs and a serial in/out funtion.
(Note: the ESP module is assumed to run at 115k baud, communications with the serial port are at 9600 baud)
The PIC16F1615 was chosen for its 1k linear ram and high speed serial interface. It provides a complete plug-n-play unit for acting as an 'internet of things' server.
You can choose to build the entire unit as shown, or just the interface from the PIC to the ESP8266. If you do not need RS-232 levels, you can communicate directly with the unit using TTL (5 volt) serial.
Once the PIC is programmed, it sends out the following commands to the ESP on power up:
AT+RST (reset device)
AT+CIPMUX=1 (enable multiple users for server mode)
AT+CWMODE=3 (enable server mode)
AT+CIPSERVER=1,80 (set standard server port)
After that, here is what you need to do.
Connect a serial terminal program at 9600 baud to either the RS-232 (db9) connedctor or to J3 pins 1,2,3 using a TTL interface. Hit ESC key to get the command prompt, then...
AT+CWJAP="<your ssid>","<your password>"
AT+CIFSR ---- to see your assigned address
After that, you can either power down and back up (it remembers your password) or enter *1<enter> from the command prompt to return to normal operation.
Now, open a browser and enter the address (something like 192.168.0.nn) and you should see the webpage load.
All outputs default to 0 when powered up. To set an output high, click the associated HIGH button. The state of the device is read back after each change and you should see a '1' for that output. The LOW button sets the corresponing output low.
Any text you enter in the Serial Data box will be sent out the serial port. Any data comming back in (multiple lines if needed) will be shown under the box. There is a limit of about 800 characters returning data.
("But Wait --- There's More!!!")
After the unit powers up (about 5 seconds), you can hit ESC key to get the command prompt. It looks something like...
From here you can enter any AT command directlly to the ESP. All commands must be in upper case, and backspacing is supported.
One very useful command is to set your own fixed IP address. This overrides the DHCP function that assigns one automatically. The format is:
Will set your local IP address to a fixed value. This value is saved on power down.
Another useful command is:
This will list all wifi access points within range of your unit. There is about a 2 second delay to get a response from this command.
There is also a debug fuction in normal operation. Hit ESC to get the command prompt and then enter *2 <enter> to go to run in debug mode. You will now see all of the internet communications echo out the serial port. Watching the interaction between the browser and the server in this mode gives a lot of insight into just how the whole internet (IP) connection works.
In any case, you will see LED-1 light whenever the board is accessed.
Here are the files you will need.
Source - in Text Tools format
Hex - works in any programmer as is
Layout - print at 36% to create a board image
Part Placement - for board build.