Difference between revisions of "ESP8266"

From Fixme.ch
Jump to: navigation, search
(Created page with "[http://rancidbacon.com/files/kiwicon8/ESP8266_WiFi_Module_Quick_Start_Guide_v_1.0.4.pdf Quick getting started guide] === Flashing with RPi === You need get [https://github.com/...")
 
(Added links and cleaned up page)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
[http://rancidbacon.com/files/kiwicon8/ESP8266_WiFi_Module_Quick_Start_Guide_v_1.0.4.pdf Quick getting started guide]
+
The ESP8266 WiFi Module is a self contained SOC with integrated TCP/IP protocol stack that can give any microcontroller access to your WiFi network. The ESP8266 is capable of either hosting an application or offloading all Wi-Fi networking functions from another application processor.
 +
 
 +
[http://hammerproject.com/post/130804023369/iot-intro-sms-me-when-i-leave-my-garage-door-open Example project from a-z for beginners],  [http://rancidbacon.com/files/kiwicon8/ESP8266_WiFi_Module_Quick_Start_Guide_v_1.0.4.pdf getting started guide]
 +
 
 +
[https://github.com/nodemcu/nodemcu-firmware NodeMcu] is a great higher level interface and easier to use than the default one. You can also do this through [https://github.com/micropython/micropython/tree/master/esp8266 Python] and [http://www.esp8266.com/wiki/doku.php?id=loading_firmware other means].
 +
 
 +
[http://www.ebay.com/itm/ESP8266-Serial-WIFI-Wireless-Transceiver-Module-Send-Receive-LWIP-Support-AP-STA-/171653455849 Currently cheapest eBay listing (2.40 CHF)]. Available under $2 in bulk.
 +
 
 +
=== Flashing ===
 +
How to talk to your RPi (and wiring) [http://www.extragsm.com/blog/2014/12/03/connect-esp8266-to-raspberry-pi/]
  
=== Flashing with RPi ===
 
 
You need get [https://github.com/themadinventor/esptool/ esptool] and wire your Pi like so (if it doesn't work, connect ESP's GPIO2 to it's VCC as well):  
 
You need get [https://github.com/themadinventor/esptool/ esptool] and wire your Pi like so (if it doesn't work, connect ESP's GPIO2 to it's VCC as well):  
  
Line 12: Line 20:
 
      
 
      
 
   Leaving...
 
   Leaving...
 +
 +
=== Uploading code via CLI ===
 +
Although there are tools like ESPlorer and others that require running a GUI on a local (windows) machine, using the CLI is easier. [https://github.com/ArchimedesPi/esp8266-luaupload Luaupload] is a CLI tool that uploads code without having to copy it over line by line via serial. If you want your code to run when booting the ESP8266, it must be called init.lua
 +
 +
  sudo pip install click pyserial
 +
  git clone https://github.com/ArchimedesPi/esp8266-luaupload.git
 +
  cd esp8266-luaupload/
 +
  python luaupload.py upload -p /dev/ttyAMA0 -b 9600 ~/path_to_your_init.lua_file
 +
 +
=== Using the GPIOs ===
 +
On the ESP-01 there are only 2 usable GPIOs. Other ESP's have more (ESP-12 has 10 GPIOs for example). You can use them for pwm, i2c, spi, 1-wire, gpio, adc, and uart with nodemcu. Please note that nodemcu maps the GPIO pins differently, refer to this [https://github.com/nodemcu/nodemcu-firmware#gpio-new-table--build-20141219-and-later index].
 +
 +
[[File:ESP8266_led_wiring.png|500px]]
 +
 +
There are quite a few examples of how to use the ESP on the [https://github.com/nodemcu/nodemcu-firmware#start-play nodemcu] page, to be able to control LEDs or relays over wifi, you'll need to [https://github.com/nodemcu/nodemcu-firmware#connect-to-your-ap connect it to wifi], set up a [https://github.com/nodemcu/nodemcu-firmware#with-below-code-you-can-telnet-to-your-esp8266-now telnet server] (hint: load it as a init.lua script), and then [https://github.com/nodemcu/nodemcu-firmware#manipulate-hardware-like-a-arduino manipulate the GPIOs].
 +
 +
=== Resources ===
 +
* [https://hackaday.io/project/5673-esp8266-dash-button ESP8266 Amazon Dash button]
 +
* [http://hackaday.com/2015/03/18/how-to-directly-program-an-inexpensive-esp8266-wifi-module/ How to directly program an inexpensive ESP8266 wifi module]
 +
* [https://www.youtube.com/watch?v=7BYdZ_24yg0 ESP8266 outdoor range test (hint: very far)]

Latest revision as of 06:23, 26 October 2015

The ESP8266 WiFi Module is a self contained SOC with integrated TCP/IP protocol stack that can give any microcontroller access to your WiFi network. The ESP8266 is capable of either hosting an application or offloading all Wi-Fi networking functions from another application processor.

Example project from a-z for beginners, getting started guide

NodeMcu is a great higher level interface and easier to use than the default one. You can also do this through Python and other means.

Currently cheapest eBay listing (2.40 CHF). Available under $2 in bulk.

Flashing

How to talk to your RPi (and wiring) [1]

You need get esptool and wire your Pi like so (if it doesn't work, connect ESP's GPIO2 to it's VCC as well):

Esp8266-flashing-wiring.png Flashing-esp8266.jpg

 pi@raspberrypi ~ $ sudo python esptool/esptool.py --port /dev/ttyAMA0 write_flash 0x000000 nodemcu_latest.bin 
 Connecting...
 Erasing flash...
 Writing at 0x00062000... (100 %)
   
 Leaving...

Uploading code via CLI

Although there are tools like ESPlorer and others that require running a GUI on a local (windows) machine, using the CLI is easier. Luaupload is a CLI tool that uploads code without having to copy it over line by line via serial. If you want your code to run when booting the ESP8266, it must be called init.lua

 sudo pip install click pyserial
 git clone https://github.com/ArchimedesPi/esp8266-luaupload.git
 cd esp8266-luaupload/
 python luaupload.py upload -p /dev/ttyAMA0 -b 9600 ~/path_to_your_init.lua_file

Using the GPIOs

On the ESP-01 there are only 2 usable GPIOs. Other ESP's have more (ESP-12 has 10 GPIOs for example). You can use them for pwm, i2c, spi, 1-wire, gpio, adc, and uart with nodemcu. Please note that nodemcu maps the GPIO pins differently, refer to this index.

ESP8266 led wiring.png

There are quite a few examples of how to use the ESP on the nodemcu page, to be able to control LEDs or relays over wifi, you'll need to connect it to wifi, set up a telnet server (hint: load it as a init.lua script), and then manipulate the GPIOs.

Resources