★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
WiFi SoC ESP8266
1. Adding Wi-Fi to our
Embedded Systems
By
Devesh Samaiya
devesh.samaiya@pilani.bits-pilani.ac.in
2. Why Add Wi-Fi?
● Having network connectivity is good for any
computing system. It opens plenty of new
possibilities and adds to a systems utility.
● Can fetch data from anywhere in the WWW.
● Can push data to cloud or any specific server for
storage, computation or monitoring.
3. How?
● We need a piece of external hardware that can
convert the Wi-Fi data into a data format
understood by common micro-controller, example
UART, SPI, I2C etc.
● The external hardware must have all the network
protocol stack, RF front ends, Encryption-
Decryption algorithm built into it.
4. Options!
● Plenty are there.
● Almost every SoC manufacturer have their own
Wi-Fi SoC.
● We will talk about the one which is easily
available, lowest cost, easy to use, supported by
community of users.
5. ESP8266
● $5 Micro-controller with Wi-Fi capability.
● Can be programmed just like any other MCU, it has GPIO,
SPI, I2C, UART, I2S.
● It has 802.11 b/g/n.
● Integrated TCP/IP Protocol stack. MAC/ Baseband Processor.
● Integrated TR Switch, Balun, LNA, Power Amplifier,
matching network.
● Integrated PLL, regulator, DCXO, PMU.
DCXO – digitally controlled Oscillator, PMU – Power management unit
6. ESP8266 Continued.
● Designed and distributed by a fab-less Chinese
company named Espressif Systems.
● Comes in a QFN-32 package, smaller than a
fingernail.
● Supported by a large user community online.
● Various breakout modules are available in market
at a cost as low as Rs. 300.
7. ESP8266 Interfacing
● We will be using ESP-01 Module.
RXD Receive Data
Vcc 3V3, DO NOT Connect 5V
GPIO0 Also, used to enter into Flash Mode, Active Low
RST Reset
GPIO 2 General Purpose I/O
CH_PD Chip Enable, Active High
GND Ground
TXD Transmit Data
9. AT Commands
There are many other commands for every other task ESP8266 can perform.
Remembering so many AT commands with all the correct parameter is hardly possible,
we need a more familiar system like C Language, Arduino Sketch or Any other easy to
write and read script.
10. NodeMCU and LUA Script
● ESP8266 is made to understand its AT Commands.
● For larger programs AT commands based program
becomes complex to read and write.
● NodeMCU is a very useful ESP8266 firmware.
● Allows writing of easy to understand LUA scripts
for ESP8266 applications.
11. Which is easy to remember?
wifi.sta.getip() AT+CIFSR
wifi.setmode(wifi.STATION) AT+CWMODE = 1 [1 Indicates STATION]
LUA Script Style AT Commands
Using LUA is easy for application programmer for larger more complex programs.
12. How to flash Node MCU firmware to
ESP8266?
● Use this sofware utility -“ESP8266 Flasher”
13. LUA Script for Web Client
1 wifi.setmode(wifi.STATION)
2 wifi.sta.config("AndroidAP","esp8266")
3 wifi.sta.connect()
4 tmr.delay(100000000) -- wait 1,000,000 us = 1 second
5 print(wifi.sta.status())
6 print(wifi.sta.getip())
7 conn=net.createConnection(net.TCP, false)
8 conn:on("receive", function(conn, pl) print(pl) end)
9 conn:connect(80,"121.41.33.127")
10 conn:send("GET / HTTP/1.1rnHost: www.nodemcu.comrn"
.."Connection: keep-alivernAccept:*/*rnrn")
Once written, this script can be permanently stored in ESP8266 flash memory and
can be called to run any time using any external serial interface.
Let's say the file name is client.lua, you can call this script by sending
=dofile('client.lua') over serial interface.
14. Programming the Flash
● Use ESPlorer sofware. Tie GPIO0 to Ground.
● Write your LUA script and press SEND to ESP to
run the script.
● Use SAVE to ESP to permanently flash the script
onto memory.
● NodeMCU firmware always executes init.lua upon
reset/ power on. In'init.lua' write everything you
need to run upon start-up.
15. Things to learn yourself
● Blynk (blynk.cc)
● ESP8266 using Arduino IDE
● LUA script in detail.