In my quest to create standalone WiFi enabled Servo Stepper motor actuators, I stumbled across the ESP8266 WiFi family.
They are basically mcu's with WiFi communications.
- 11 GPIO's and 1 ADC analog pin
- 802.11 b/g/n protocol
- Wi-Fi Direct (P2P), soft-AP
- Integrated TCP/IP protocol stack
- Integrated TR switch, balun, LNA, power amplifier and matching network
- Integrated PLL, regulators, and power management units
- +19.5dBm output power in 802.11b mode
- Integrated temperature sensor
- Power down leakage current of < 10uA
- Integrated low power 32-bit CPU could be used as application processor
- SDIO 2.0, SPI, UART
- STBC, 1×1 MIMO, 2×1 MIMO
- Wake up and transmit packets in < 2ms
- Standby power consumption of < 1.0mW (DTIM3)
Out of the box I reprogrammed the firmware with NODEMCU (WIKI) which provides a Lua programming environment , which makes it easier to set things up (I also tested some AT command firmware and it also worked well too).
Note the Programming configuration GPIO-00 and GPIO-15 must be tied to ground for Firmware update, afterwards these can be removed, for programming I am using a basic FTDI module with the TX>RX & RX>TX crossed over.
To test the system through I used this code code here:-
Test Lua Code uploaded via a Esplorer Lua Gui |
wifi.setmode(wifi.STATION) wifi.sta.config("James","11xxxx11") print(wifi.sta.getip()) led1 = 3 led2 = 4 gpio.mode(led1, gpio.OUTPUT) gpio.mode(led2, gpio.OUTPUT) srv=net.createServer(net.TCP) srv:listen(80,function(conn) conn:on("receive", function(client,request) local buf = ""; local _, _, method, path, vars = string.find(request, "([A-Z]+) (.+)?(.+) HTTP"); if(method == nil)then _, _, method, path = string.find(request, "([A-Z]+) (.+) HTTP"); end local _GET = {} if (vars ~= nil)then for k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do _GET[k] = v end end buf = buf.."<h1> ESP8266 Web Server</h1>"; buf = buf.."<p>GPIO0 <a href=\"?pin=ON1\"><button>ON</button></a> <a href=\"?pin=OFF1\"><button>OFF</button></a></p>"; buf = buf.."<p>GPIO2 <a href=\"?pin=ON2\"><button>ON</button></a> <a href=\"?pin=OFF2\"><button>OFF</button></a></p>"; local _on,_off = "","" if(_GET.pin == "ON1")then gpio.write(led1, gpio.HIGH); elseif(_GET.pin == "OFF1")then gpio.write(led1, gpio.LOW); elseif(_GET.pin == "ON2")then gpio.write(led2, gpio.HIGH); elseif(_GET.pin == "OFF2")then gpio.write(led2, gpio.LOW); end client:send(buf); client:close(); collectgarbage(); end) end) |
8266 Series 12 GPIO Table | |||
IO index | ESP8266 pin | IO index | ESP8266 pin |
0 | GPIO_16 | 7 | GPIO_13 |
1 | GPIO_05 | 8 | GPIO_15 |
2 | GPIO_04 | 9 | GPIO_03 |
3 | GPIO_00 | 10 | GPIO_01 |
4 | GPIO_02 | 11 | GPIO_09 |
5 | GPIO_14 | 12 | GPIO_10 |
6 | GPIO_12 |
Above Table is a cross table for programming ... i.e. toggle_ing IO index 3 in code will toggle the actual output pin GPIO_00.
The code can be run from the Lua Gui.
The ESP8266 (IP 192.168.178.28:80) does its interrogation and makes the WIFI TCP connection with "James"
and using a web browser window the WiFi module can be accessed.
Now I have the basic "Round Robin" working I will be checking out the PWM outputs and analog input.
It can be (and i have) programmed using the Arduino IDE using an ESP8266 addon, more on that will follow (I guess a simplified MRLCOMM could be placed inside the ESP chip too)
UPDATE 20150810 :-
WIred a stepper motor onto 4 of the ESP8266 GPIO pins
(its just a small one for testing, bigger and better to follow :-)
Proof of concept Web Browser GUI ----- just Forward and Backwards
Update 20150815 (basic working reference) :- Web button auto repeat.
Buttons on web pages seem to be only submit once type things.
My project requires continuous pulses on press button....
after a bit of digging (tnx for the tip kwatters)
Here is some HTML5 Code below allows for auto-repete onmousedown
<!DOCTYPE html> <html> <body>
<input type="button" onmousedown="mousedownfunc('counter')" value="Click-me" onmouseup="mouseupfunc('counter')" /><br/> <script> function mouseupfunc() { function runme(divid) { </script> </body> |
Update 20150816 :-
After using the Arduino IDE over the weekend I am happy to say that it is pretty stable.
I bumped into a sketch from sparkfun enabling the ESP8266 to act as a Server "ESP8266 Thing"
With a bit of tweaking I am able to extract the ESP8288's input pins / analog Pin and also flip Output pins too. (buttons for outputs are missing at momo - work in progress).
BTW .... just found out with this metal cased version of the ESP8266 its not possible to use all the I/O's as they have not brought out all of the pins onto the PCB ,they are mysteriously caged in (Duhhhh%&%ç&ç)
>>>>HTML5 ESP8266 Arduino IDE Button code (just the juicy bits)
String req = client.readStringUntil('\r'); // read in webpage details // Stock buttons ///////////// e.g. detection of button press's if (req.indexOf("4") >0 ) |
Wireless Elves ! Looks great
Wireless Elves !
Looks great Gareth .. 11 GPIOs & a ADC ! looks like a lot of remote potential.
With the WebGUI we have refined the protocol over HTTP, one thing which we have not explored is the idea of how minimal a "Service" could be.. the idea intrigues me..
We could try to make an Angular Service for the ESP8266 - which utilizes MRL communication and its GUI but talks directly to your chip...
Hmmmmm....
ESP8266
I have been working on these tiny and versatile modules for a while... have at least 10 different versions and all are awesome... easy to work with... with or without arduino.... a mrl service will be wonderful....
I've jumped into
I've jumped into experimentation of one of my ESP8266 finally ! Yay \o/ .
This is my plan
1. Get it worky - with some default code / library
2. Write a module for it
3. Write a service for it
4. BORG IT IN !
Alright .. step 1 ... looking for wiring diagrams and documentation :
Starting with http://www.instructables.com/id/Using-the-ESP8266-module/
Since my module seems to most closely resemble the picture
One thing I find unusual about the instructable is how the author talks about a 7.5v power supply although its a 3V module yes ?
ok ... looks like he just mentioning the 7.5 as an input to some regulator he did not mention...
esp8266 wifi
Greg,
here is some link which I found best for esp8266:
http://www.electrodragon.com/w/ESP8266
http://nodemcu.com/index_en.html
https://github.com/nodemcu/nodemcu-firmware
you will find all u want in these documentation...
cheers ...
Dincer
Thanks Dincer ! I found this
Thanks Dincer !
I found this too - had some problems trying to figure out what are ESP8266 module had vs Gareths.
Gareth seems to have a fancy version :)
esp8266 wifi
Greg,
The version Gareth has is esp12 which has more GPIOs and more flash... in your version u have only 2 GPIOs.. u will talk to the module via rx and tx... only thing to remember: CH_PD pin must be always HIGH....
I always solder it together with VCC... The other thing is, if u want to upload new firmware then u have to set GPIO_0 to LOW while programming... for the time being just simply send AT commands to the module via any terminal prg at 115200 baud... then u can try to do the same via sketches from arduino...
good luck and pls don't hesitate to ask for help when needed... I have many working scripts for esp8266...
cheers...
Dincer