SlideShare ist ein Scribd-Unternehmen logo
1 von 35
Downloaden Sie, um offline zu lesen
ESP8266 Workshop 1
Andy Gelme (@geekscape)
http://geekscape.org

Wednesday 2015-03-11
Copyright (c) 2015 by Geekscape Pty. Ltd. License CC-BY-NC-4.0
Workshop overview
• ESP8266 introduction: hardware and software
• ESP-01 and ESP-12 set-up for development
• Flashing firmware using esptool
• NodeMCU and Lua introduction
• ESPlorer IDE
• Using a button and LED(s)
• Setting up as a Wi-Fi client
• Using UDP to send and receive messages
• Creating an MQTT client
ESP8266 Hardware
• 3.3V device, operating current ~ 215 mA
• CPU: Tensilca Xtensa LX3: 32-bit, 80 MHz
• ESP8266 SOC: Expressif
• RAM 32Kb, DRAM 80Kb, Flash 200Kb (for SDK)
• Wi-Fi 802.11 b/g/n 2.4 GHz radio (station or AP)
• Timers, deep sleep mode, JTAG debugging
• Peripherals …
• GPIO (upto 16), PWM (3), ADC (one)
• UART, I2C, SPI
ESP8266 Memory Map
• More complicated than your AVR ATMega / Arduino
• SRAM 32Kb
• NodeMCU heap memory available: print(node.heap())
• SPI Flash ROM layout: Since SDK 0.8 …
• 00000h 248k app.v6.flash.bin User application

3E000h 8k master_device_key.bin OTA device key

40000h 240k app.v6.irom0text.bin SDK libraries

7C000h 8k esp_init_data_default.bin Default configuration

7E000h 8k blank.bin Filled with FFh. May be WiFi configuration
• Source: https://github.com/esp8266/esp8266-wiki/wiki/Memory-Map
ESP8266 Software stack
• Can build using FreeRTOS: http://www.freertos.org
• https://github.com/espressif/esp_iot_rtos_sdk
• ESP8266 SDK: hardware access and C library
• Application layer, either …
• AT commands (standard on ESP-01)
• IoT demo (standard on yellow ESP-12 dev board)
• NodeMCU Lua interpreter
• Your own application written in C
ESP-xx modules
• Variety of form factors, ESP-01 through ESP-12 …
• Antenna: None, Chip, PCB or U-FL connector
• Which pins broken out and layout (2 mm pitch)
• Power: 3.3V typical, 3.0V min, 3.6V max
• Chip enable pin (CH_PD): Hold high
• ESP-12 dev board does this for you
• GPIO0: Hold low on power-up to enter boot loader
• Flash firmware
• After power-up, can use GPIO0 as button input
ESP-xx modules
ESP-01
ESP-05
ESP-02
ESP-12
ESP-07 ESP-08 ESP-06
ESP-09ESP-03
ESP-10 ESP-11
ESP-04
ESP-01 set-up
• PCB antenna
• 8 pins including UART Rx/Tx, GPIO (2), Reset
• No power regulator, use only 3.0V to 3.6V
• Need a means of holding GPIO0 low for firmware flash
• Standard firmware: AT commands
• Cable or use JohnS ESPkit-01 …
• ESP-01 USB serial adaptor

1 RXD <—— TXD

2 VCC —— VCC 3.3V

3 GPIO0 —— Connect to ground during power-up to flash firmware

4 RESET —— VCC 3.3V

5 GPIO2

6 CH_PD —— VCC 3.3V

7 GND —— GND

8 TXD ——> RXD
ESP-12 dev board set-up
• PCB antenna
• 16 pins inc. UART Rx/Tx, GPIO (9), ADC, Reset
• RGB LED GPIOs: Red = 8, Green = 6, Blue = 7
• Uses 3x AA batteries with on-board 3.3v regulator
• Provides GPIO0 header for bootloader / firmware flash
• Standard firmware: IoT demo
• Cable: Note ESP-12 dev board labels are confusing !
• ESP-12 USB serial adaptor

RXD <—— RXD

GND —— GND

TXD ——> TXD
esptool overview
• Cross-platform Python, requires pySerial
• https://github.com/themadinventor/esptool
• Various functions …
• Flash firmware
• Create bootable image from binary blobs
• Read MAC address
• Read chip identification
• Read / write memory
• Hold GPIO0 low and power cycle ESP8266
esptool flash firmware
• Flash standard NodeMCU pre-built image …
• Download image …
• https://github.com/nodemcu/nodemcu-firmware
• esptool -p SERIAL_PORT write_flash 0x00000 nodemcu_20150212.bin
• Flash NodeMCU image with WS2812B support
• https://github.com/geekscape/esp8266_nodemcu_examples/firmware
• esptool -p SERIAL_PORT write_flash 0x00000
nodemcu_dev_0x00000.bin 0x10000 nodemcu_dev_0x10000.bin
NodeMCU firmware
• eLua interpreter including ESP8266 SDK API
• NodeMCU API documentation …
• https://github.com/nodemcu/nodemcu-firmware/wiki/nodemcu_api_en
• Serial terminal connection at 9,600 baud
• Command line prompt is “> “
• Enter valid Lua statements
• Starts with around 23Kb heap available
• Need to take care with your memory consumption
• Further reading: nodemcu.com/index_en.html
NodeMCU API
• node.restart(), heap(), compile()
• file.format(), list(), remove(), open(), read(), write()
• wifi.sta, wifi.ap sub-modules
• net module: TCP and UDP client and server
• mqtt module: Message Queue Telemetry Transport
• timer module, tmr.alarm(), tmr.stop(), tmr.time()
• gpio.mode(), read(), write(), trig()
• pwm, adc, i2c, spi, one-wire modules
• bit module: bit-wise logical operations
Lua introduction - I
• http://www.lua.org/start.html
• print(1 + 2); print(“hello”); print(node.heap())
• Variables: boolean, numbers, strings, tables
• Global by default, but can use “local” keyword
• Variable type declarations are not required
• colour = {}; colour[“red”] = 1; colour[“blue”] = 2
• Functions are first-class values
• function name(parameters)

return value - - Can return multiple values

end
Lua introduction - 2
• Control-flow …
• if condition then

print(true)

else

print(false)

end
• for variable = first, last, delta do

end
• while condition do

end
Lua introduction - 3
• NodeMCU after boot will try to run “init.lua”
• Compile using node.compile(“file.lua”)
• Byte-code written to “file.lc”
• Saves some memory
• Modules …
• moduleA = require(“module.lua”)
• local module = {}

function module.name()

end

return module
NodeMCU example
• You can’t just type … print(file.list()) !

• You need to type …
• for n,s in pairs(file.list()) do print(n.." size: "..s) end
• file.list() … returns a table
• pairs() … returns an iterator
• for n,s in … loops through each iterator pair
• n = file name, s = file size
ESPlorer IDE
• Simplify process of managing files and running
scripts on NodeMCU or MicroPython
• Also short-cuts for AT commands firmware
• http://esp8266.ru/esplorer
• Open source …
• https://github.com/4refr0nt/ESPlorer
• Start via command line … java -jar ESPlorer.jar
• Scans for available serial ports
• Provides Graphical User Interface for development
ESPlorer IDE
Button input
• Connect button between GPIO0 and Ground
• Example code …
• https://github.com/geekscape/esp8266_nodemcu_examples/blob/master/
examples/button.lua
• Load into ESPlorer IDE: File -> Open
• Save to ESP8266: [Save to ESP]
• Run script: [Do File]
• ESP-12 bonus: Try to use LDR and adc.read()
Button input - FAIL
• Our first attempt is likely to look like this …
PIN_BUTTON = 3 -- GPIO0

gpio.mode(PIN_BUTTON, gpio.INPUT, gpio.PULLUP)



while true do

if gpio.read(PIN_BUTTON) == 0 then

print("BUTTON PRESSED")

tmr.delay(20000) - - microseconds

end

end
Button input
• … but previous example, after a short while it fails :(
• More reliable to use timers, rather than delays
• Also, code is much more modular and re-usable
• Try … tmr.alarm(id, interval, repeat_flag, function)
• id: timer number 0 to 6
• interval: alarm time in milliseconds
• repeat_flag: 0 = once, 1 = repeat until tmr.stop()
• function: Lua function to invoke
• The following code is more reliable …
PIN_BUTTON = 3 -- GPIO0

TIME_ALARM = 25 -- 0.025 second, 40 Hz

gpio.mode(PIN_BUTTON, gpio.INPUT, gpio.PULLUP) 

button_state = 1

button_time = 0



function buttonHandler()

button_state_new = gpio.read(PIN_BUTTON)

if button_state == 1 and button_state_new == 0 then

button_time = tmr.time()

print("BUTTON PRESSED")

elseif button_state == 0 and button_state_new == 1 then

button_time_new = tmr.time()

if tmr.time() > (button_time + 2) then

tmr.stop(1)

print("BUTTON DISABLED")

end

end

button_state = button_state_new

end



tmr.alarm(1, TIME_ALARM, 1, buttonHandler)
Regular LED output
• Connect LED and current limiting resistor between
GPIO2 and Ground
• Example code …
• https://github.com/geekscape/esp8266_nodemcu_examples/blob/master/
examples/led.lua
• Load into ESPlorer IDE: File -> Open
• Save to ESP8266: [Save to ESP]
• Run script: [Do File]
• Try … init.lua: dofile('led.lua')
Regular LED output
LED_PIN = 4 -- GPIO2

TIME_ALARM = 500 -- 0.5 second

gpio.mode(LED_PIN, gpio.OUTPUT)

led_state = gpio.LOW

function ledHandler()

if led_state == gpio.LOW then

led_state = gpio.HIGH

else

led_state = gpio.LOW

end

gpio.write(LED_PIN, led_state)

end
tmr.alarm(1, TIME_ALARM, 1, ledHandler)
WS2812B LED output
• Original development by Markus Gritsch
• http://www.esp8266.com/viewtopic.php?f=21&t=1143
• Isn’t yet part of the NodeMCU master branch
• BRIGHT = 0.1; ON = BRIGHT * 255

LED_PIN = 4 -- GPIO2

PIXELS = 8

RED = string.char( 0, ON, 0)

GREEN = string.char(ON, 0, 0)

BLUE = string.char( 0, 0, ON)

ws2812.write(LED_PIN, RED:rep(PIXELS))

ws2812.write(LED_PIN, GREEN:rep(PIXELS))

ws2812.write(LED_PIN, BLUE:rep(PIXELS))
WS2812B LED example
• Connect WS2812B to GPIO2
• Example code …
• https://github.com/geekscape/esp8266_nodemcu_examples/blob/master/
examples/ws2812.lua
• Load into ESPlorer IDE: File -> Open
• Save to ESP8266: [Save to ESP]
• Run script: [Do File]
• Try … init.lua: dofile('ws2812.lua')
• Scan to get available Wi-Fi Access Points …
• wifi.sta.getap(function)
• Calls function when list of Access Points is ready
• Start Wi-Fi station (client) …
• wifi.setmode(wifi.STATION);
• wifi.sta.config(“ssid”, “passphrase”)
• wifi.sta.connect()
• Returns your IP address when ready …
• wifi.sta.getip()
Setting up Wi-Fi client
• wifi.sta.getap(wifi_start)
• module.SSID = {}

module.SSID["SSID1"] = "passphrase1"

module.SSID["SSID2"] = "passphrase2"
• local function wifi_start(aps)

for key,value in pairs(aps) do

if config.SSID and config.SSID[key] then

wifi.setmode(wifi.STATION);

wifi.sta.config(key, config.SSID[key])

wifi.sta.connect()

tmr.alarm(1, 2500, 1, wifi_wait_ip)

end

end

end
• local function wifi_wait_ip()

if wifi.sta.getip() then 

tmr.stop(1)

end

end
• Modular, flexible, timer-based application skeleton
• Example code …
• https://github.com/geekscape/esp8266_nodemcu_examples/tree/master/
skeleton
• Load into ESPlorer IDE: File -> Open
• Save to ESP8266: [Save to ESP]
• Reset ESP8266
• print(wifi.sta.getip())
Wi-Fi client example - 1
• init.lua
• Called on boot
• Minimal, can’t be compiled :(
• config.lua
• Application configuration, e.g SSID and passphrases
• setup.lua
• Sets up Wi-Fi depending upon your location
• application.lua
• Your code, change filename as appropriate
• Use node.compile() on everything except init.lua
Wi-Fi client example - 2
UDP message transmit
• socket = net.createConnection(net.UDP, 0)

socket:connect(PORT_NUMBER, HOST_STRING)

socket:send(MESSAGE)

socket:close()
• Example code …
• https://github.com/geekscape/esp8266_nodemcu_examples/blob/master/
applications/button_udp.lua
• Test on laptop with command line UDP server …
• nc -l -u IP_ADDRESS 4000
UDP message receive
• udp_server = net.createServer(net.UDP)

udp_server:on("receive", function(srv, data)

print("udp: " .. data)

end)

udp_server.listen(PORT)
• udp_server:close()
• Example code …
• https://github.com/geekscape/esp8266_nodemcu_examples/blob/master/
applications/ws2812_udp.lua
• Test on laptop with command line UDP client …
• nc -u IP_ADDRESS 4000
MQTT client
• MQTT server address “192.168.0.32”
• m:on("message", function(conn, topic, data) 

print(topic .. ":" ) 

if data ~= nil then print(data) end

end)



m:connect(“192.168.0.32", 1883, 0, function(conn)

print("connected")

end)

m:subscribe("/topic",0, function(conn)

print("subscribe success”)

end)

m:publish("/topic","hello",0,0, function(conn)

print("sent")

end)

m:close();
ESP8266 / NodeMCU resources
• ESP8266 general information
• https://nurdspace.nl/ESP8266
• https://nurdspace.nl/images/e/e0/ESP8266_Specifications_English.pdf
• NodeMCU API documentation
• https://github.com/nodemcu/nodemcu-firmware/wiki/nodemcu_api_en
• Lua programming language: http://www.lua.org
• ESPlorer IDE
• http://esp8266.ru/esplorer
• esptool (cross-platform) for flashing firmware
• https://github.com/themadinventor/esptool

Weitere ähnliche Inhalte

Was ist angesagt?

Iot based digital notice board with arduino
Iot based digital notice board with arduinoIot based digital notice board with arduino
Iot based digital notice board with arduinoNani Vasireddy
 
Esp32 cam arduino-123
Esp32 cam arduino-123Esp32 cam arduino-123
Esp32 cam arduino-123Victor Sue
 
Iot architecture
Iot architectureIot architecture
Iot architectureAnam Iqbal
 
Introduction to embedded systems
Introduction to embedded systemsIntroduction to embedded systems
Introduction to embedded systemsApurva Zope
 
Voice Control Home Automation
Voice Control Home AutomationVoice Control Home Automation
Voice Control Home AutomationAbhishek Neb
 
Introduction to arduino ppt main
Introduction to  arduino ppt mainIntroduction to  arduino ppt main
Introduction to arduino ppt maineddy royappa
 
Introduction to Arduino & Raspberry Pi
Introduction to Arduino & Raspberry PiIntroduction to Arduino & Raspberry Pi
Introduction to Arduino & Raspberry PiAhmad Hafeezi
 
Using arduino and raspberry pi for internet of things
Using arduino and raspberry pi for internet of thingsUsing arduino and raspberry pi for internet of things
Using arduino and raspberry pi for internet of thingsSudar Muthu
 
ESP32 WiFi & Bluetooth Module - Getting Started Guide
ESP32 WiFi & Bluetooth Module - Getting Started GuideESP32 WiFi & Bluetooth Module - Getting Started Guide
ESP32 WiFi & Bluetooth Module - Getting Started Guidehandson28
 
Training Report on Embedded System
Training Report on Embedded SystemTraining Report on Embedded System
Training Report on Embedded SystemRoshan Mani
 
Humidity and Temperature Measurement Using Arduino
Humidity and Temperature Measurement Using ArduinoHumidity and Temperature Measurement Using Arduino
Humidity and Temperature Measurement Using Arduinodollonhaider
 
LAS16-112: mbed OS Technical Overview
LAS16-112: mbed OS Technical OverviewLAS16-112: mbed OS Technical Overview
LAS16-112: mbed OS Technical OverviewLinaro
 
Introduction to ESP32 Programming [Road to RIoT 2017]
Introduction to ESP32 Programming [Road to RIoT 2017]Introduction to ESP32 Programming [Road to RIoT 2017]
Introduction to ESP32 Programming [Road to RIoT 2017]Alwin Arrasyid
 
RFID BASED ATTENDANCE SYSTEM PPT
RFID BASED ATTENDANCE SYSTEM PPTRFID BASED ATTENDANCE SYSTEM PPT
RFID BASED ATTENDANCE SYSTEM PPTnikhilpatewar
 

Was ist angesagt? (20)

Iot based digital notice board with arduino
Iot based digital notice board with arduinoIot based digital notice board with arduino
Iot based digital notice board with arduino
 
Esp8266 basics
Esp8266 basicsEsp8266 basics
Esp8266 basics
 
Embedded Systems and IoT
Embedded Systems and IoTEmbedded Systems and IoT
Embedded Systems and IoT
 
Esp32 cam arduino-123
Esp32 cam arduino-123Esp32 cam arduino-123
Esp32 cam arduino-123
 
Iot architecture
Iot architectureIot architecture
Iot architecture
 
Ardui no
Ardui no Ardui no
Ardui no
 
Introduction to embedded systems
Introduction to embedded systemsIntroduction to embedded systems
Introduction to embedded systems
 
Voice Control Home Automation
Voice Control Home AutomationVoice Control Home Automation
Voice Control Home Automation
 
Arduino & NodeMcu
Arduino & NodeMcuArduino & NodeMcu
Arduino & NodeMcu
 
Introduction to arduino ppt main
Introduction to  arduino ppt mainIntroduction to  arduino ppt main
Introduction to arduino ppt main
 
Embedded systems ppt
Embedded systems pptEmbedded systems ppt
Embedded systems ppt
 
Introduction to Arduino & Raspberry Pi
Introduction to Arduino & Raspberry PiIntroduction to Arduino & Raspberry Pi
Introduction to Arduino & Raspberry Pi
 
Raspberry pi
Raspberry pi Raspberry pi
Raspberry pi
 
Using arduino and raspberry pi for internet of things
Using arduino and raspberry pi for internet of thingsUsing arduino and raspberry pi for internet of things
Using arduino and raspberry pi for internet of things
 
ESP32 WiFi & Bluetooth Module - Getting Started Guide
ESP32 WiFi & Bluetooth Module - Getting Started GuideESP32 WiFi & Bluetooth Module - Getting Started Guide
ESP32 WiFi & Bluetooth Module - Getting Started Guide
 
Training Report on Embedded System
Training Report on Embedded SystemTraining Report on Embedded System
Training Report on Embedded System
 
Humidity and Temperature Measurement Using Arduino
Humidity and Temperature Measurement Using ArduinoHumidity and Temperature Measurement Using Arduino
Humidity and Temperature Measurement Using Arduino
 
LAS16-112: mbed OS Technical Overview
LAS16-112: mbed OS Technical OverviewLAS16-112: mbed OS Technical Overview
LAS16-112: mbed OS Technical Overview
 
Introduction to ESP32 Programming [Road to RIoT 2017]
Introduction to ESP32 Programming [Road to RIoT 2017]Introduction to ESP32 Programming [Road to RIoT 2017]
Introduction to ESP32 Programming [Road to RIoT 2017]
 
RFID BASED ATTENDANCE SYSTEM PPT
RFID BASED ATTENDANCE SYSTEM PPTRFID BASED ATTENDANCE SYSTEM PPT
RFID BASED ATTENDANCE SYSTEM PPT
 

Andere mochten auch

Implementation of the ZigBee ZCL Reporting Configuration Features
Implementation of the ZigBee ZCL Reporting Configuration FeaturesImplementation of the ZigBee ZCL Reporting Configuration Features
Implementation of the ZigBee ZCL Reporting Configuration FeaturesSimen Li
 
電路學 - [第一章] 電路元件與基本定律
電路學 - [第一章] 電路元件與基本定律電路學 - [第一章] 電路元件與基本定律
電路學 - [第一章] 電路元件與基本定律Simen Li
 
電路學 - [第二章] 電路分析方法
電路學 - [第二章] 電路分析方法電路學 - [第二章] 電路分析方法
電路學 - [第二章] 電路分析方法Simen Li
 
射頻電子實驗手冊 - [實驗8] 低雜訊放大器模擬
射頻電子實驗手冊 - [實驗8] 低雜訊放大器模擬射頻電子實驗手冊 - [實驗8] 低雜訊放大器模擬
射頻電子實驗手冊 - [實驗8] 低雜訊放大器模擬Simen Li
 
射頻電子實驗手冊 - [實驗7] 射頻放大器模擬
射頻電子實驗手冊 - [實驗7] 射頻放大器模擬射頻電子實驗手冊 - [實驗7] 射頻放大器模擬
射頻電子實驗手冊 - [實驗7] 射頻放大器模擬Simen Li
 
Agilent ADS 模擬手冊 [實習1] 基本操作與射頻放大器設計
Agilent ADS 模擬手冊 [實習1] 基本操作與射頻放大器設計Agilent ADS 模擬手冊 [實習1] 基本操作與射頻放大器設計
Agilent ADS 模擬手冊 [實習1] 基本操作與射頻放大器設計Simen Li
 
射頻電子實驗手冊 [實驗6] 阻抗匹配模擬
射頻電子實驗手冊 [實驗6] 阻抗匹配模擬射頻電子實驗手冊 [實驗6] 阻抗匹配模擬
射頻電子實驗手冊 [實驗6] 阻抗匹配模擬Simen Li
 
Agilent ADS 模擬手冊 [實習3] 壓控振盪器模擬
Agilent ADS 模擬手冊 [實習3] 壓控振盪器模擬Agilent ADS 模擬手冊 [實習3] 壓控振盪器模擬
Agilent ADS 模擬手冊 [實習3] 壓控振盪器模擬Simen Li
 
Agilent ADS 模擬手冊 [實習2] 放大器設計
Agilent ADS 模擬手冊 [實習2]  放大器設計Agilent ADS 模擬手冊 [實習2]  放大器設計
Agilent ADS 模擬手冊 [實習2] 放大器設計Simen Li
 
射頻電子實驗手冊 [實驗1 ~ 5] ADS入門, 傳輸線模擬, 直流模擬, 暫態模擬, 交流模擬
射頻電子實驗手冊 [實驗1 ~ 5] ADS入門, 傳輸線模擬, 直流模擬, 暫態模擬, 交流模擬射頻電子實驗手冊 [實驗1 ~ 5] ADS入門, 傳輸線模擬, 直流模擬, 暫態模擬, 交流模擬
射頻電子實驗手冊 [實驗1 ~ 5] ADS入門, 傳輸線模擬, 直流模擬, 暫態模擬, 交流模擬Simen Li
 

Andere mochten auch (10)

Implementation of the ZigBee ZCL Reporting Configuration Features
Implementation of the ZigBee ZCL Reporting Configuration FeaturesImplementation of the ZigBee ZCL Reporting Configuration Features
Implementation of the ZigBee ZCL Reporting Configuration Features
 
電路學 - [第一章] 電路元件與基本定律
電路學 - [第一章] 電路元件與基本定律電路學 - [第一章] 電路元件與基本定律
電路學 - [第一章] 電路元件與基本定律
 
電路學 - [第二章] 電路分析方法
電路學 - [第二章] 電路分析方法電路學 - [第二章] 電路分析方法
電路學 - [第二章] 電路分析方法
 
射頻電子實驗手冊 - [實驗8] 低雜訊放大器模擬
射頻電子實驗手冊 - [實驗8] 低雜訊放大器模擬射頻電子實驗手冊 - [實驗8] 低雜訊放大器模擬
射頻電子實驗手冊 - [實驗8] 低雜訊放大器模擬
 
射頻電子實驗手冊 - [實驗7] 射頻放大器模擬
射頻電子實驗手冊 - [實驗7] 射頻放大器模擬射頻電子實驗手冊 - [實驗7] 射頻放大器模擬
射頻電子實驗手冊 - [實驗7] 射頻放大器模擬
 
Agilent ADS 模擬手冊 [實習1] 基本操作與射頻放大器設計
Agilent ADS 模擬手冊 [實習1] 基本操作與射頻放大器設計Agilent ADS 模擬手冊 [實習1] 基本操作與射頻放大器設計
Agilent ADS 模擬手冊 [實習1] 基本操作與射頻放大器設計
 
射頻電子實驗手冊 [實驗6] 阻抗匹配模擬
射頻電子實驗手冊 [實驗6] 阻抗匹配模擬射頻電子實驗手冊 [實驗6] 阻抗匹配模擬
射頻電子實驗手冊 [實驗6] 阻抗匹配模擬
 
Agilent ADS 模擬手冊 [實習3] 壓控振盪器模擬
Agilent ADS 模擬手冊 [實習3] 壓控振盪器模擬Agilent ADS 模擬手冊 [實習3] 壓控振盪器模擬
Agilent ADS 模擬手冊 [實習3] 壓控振盪器模擬
 
Agilent ADS 模擬手冊 [實習2] 放大器設計
Agilent ADS 模擬手冊 [實習2]  放大器設計Agilent ADS 模擬手冊 [實習2]  放大器設計
Agilent ADS 模擬手冊 [實習2] 放大器設計
 
射頻電子實驗手冊 [實驗1 ~ 5] ADS入門, 傳輸線模擬, 直流模擬, 暫態模擬, 交流模擬
射頻電子實驗手冊 [實驗1 ~ 5] ADS入門, 傳輸線模擬, 直流模擬, 暫態模擬, 交流模擬射頻電子實驗手冊 [實驗1 ~ 5] ADS入門, 傳輸線模擬, 直流模擬, 暫態模擬, 交流模擬
射頻電子實驗手冊 [實驗1 ~ 5] ADS入門, 傳輸線模擬, 直流模擬, 暫態模擬, 交流模擬
 

Ähnlich wie NodeMCU ESP8266 workshop 1

Getting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer KitGetting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer KitSulamita Garcia
 
Adafruit Huzzah Esp8266 WiFi Board
Adafruit Huzzah Esp8266 WiFi BoardAdafruit Huzzah Esp8266 WiFi Board
Adafruit Huzzah Esp8266 WiFi BoardBiagio Botticelli
 
Qiscus bot esp8266
Qiscus bot esp8266Qiscus bot esp8266
Qiscus bot esp8266Ashari Juang
 
Introduction to FreeRTOS
Introduction to FreeRTOSIntroduction to FreeRTOS
Introduction to FreeRTOSICS
 
IoT Hands-On-Lab, KINGS, 2019
IoT Hands-On-Lab, KINGS, 2019IoT Hands-On-Lab, KINGS, 2019
IoT Hands-On-Lab, KINGS, 2019Jong-Hyun Kim
 
Remote temperature monitor (DHT11)
Remote temperature monitor (DHT11)Remote temperature monitor (DHT11)
Remote temperature monitor (DHT11)Parshwadeep Lahane
 
[5]投影片 futurewad樹莓派研習會 141218
[5]投影片 futurewad樹莓派研習會 141218[5]投影片 futurewad樹莓派研習會 141218
[5]投影片 futurewad樹莓派研習會 141218CAVEDU Education
 
Arduino by yogesh t s'
Arduino by yogesh t s'Arduino by yogesh t s'
Arduino by yogesh t s'tsyogesh46
 
Arduino delphi 2014_7_bonn
Arduino delphi 2014_7_bonnArduino delphi 2014_7_bonn
Arduino delphi 2014_7_bonnMax Kleiner
 
Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013Tom Paulus
 
Athens IoT Meetup #3 - Introduction to ESP8266 (Pavlos Isaris)
Athens IoT Meetup #3 - Introduction to ESP8266 (Pavlos Isaris)Athens IoT Meetup #3 - Introduction to ESP8266 (Pavlos Isaris)
Athens IoT Meetup #3 - Introduction to ESP8266 (Pavlos Isaris)Athens IoT Meetup
 
Rdl esp32 development board trainer kit
Rdl esp32 development board trainer kitRdl esp32 development board trainer kit
Rdl esp32 development board trainer kitResearch Design Lab
 
JS Fest 2018. Володимир Шиманський. Запуск двіжка JS на мікроконтролері
JS Fest 2018. Володимир Шиманський. Запуск двіжка JS на мікроконтролеріJS Fest 2018. Володимир Шиманський. Запуск двіжка JS на мікроконтролері
JS Fest 2018. Володимир Шиманський. Запуск двіжка JS на мікроконтролеріJSFestUA
 
Micropython on MicroControllers
Micropython on MicroControllersMicropython on MicroControllers
Micropython on MicroControllersAkshai M
 
[OpenStack Day in Korea 2015] Track 1-6 - 갈라파고스의 이구아나, 인프라에 오픈소스를 올리다. 그래서 보이...
[OpenStack Day in Korea 2015] Track 1-6 - 갈라파고스의 이구아나, 인프라에 오픈소스를 올리다. 그래서 보이...[OpenStack Day in Korea 2015] Track 1-6 - 갈라파고스의 이구아나, 인프라에 오픈소스를 올리다. 그래서 보이...
[OpenStack Day in Korea 2015] Track 1-6 - 갈라파고스의 이구아나, 인프라에 오픈소스를 올리다. 그래서 보이...OpenStack Korea Community
 

Ähnlich wie NodeMCU ESP8266 workshop 1 (20)

Remote tanklevelmonitor
Remote tanklevelmonitorRemote tanklevelmonitor
Remote tanklevelmonitor
 
Getting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer KitGetting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer Kit
 
Adafruit Huzzah Esp8266 WiFi Board
Adafruit Huzzah Esp8266 WiFi BoardAdafruit Huzzah Esp8266 WiFi Board
Adafruit Huzzah Esp8266 WiFi Board
 
Qiscus bot esp8266
Qiscus bot esp8266Qiscus bot esp8266
Qiscus bot esp8266
 
Introduction to FreeRTOS
Introduction to FreeRTOSIntroduction to FreeRTOS
Introduction to FreeRTOS
 
IoT Hands-On-Lab, KINGS, 2019
IoT Hands-On-Lab, KINGS, 2019IoT Hands-On-Lab, KINGS, 2019
IoT Hands-On-Lab, KINGS, 2019
 
Remote temperature monitor (DHT11)
Remote temperature monitor (DHT11)Remote temperature monitor (DHT11)
Remote temperature monitor (DHT11)
 
[5]投影片 futurewad樹莓派研習會 141218
[5]投影片 futurewad樹莓派研習會 141218[5]投影片 futurewad樹莓派研習會 141218
[5]投影片 futurewad樹莓派研習會 141218
 
Esp8266 Workshop
Esp8266 WorkshopEsp8266 Workshop
Esp8266 Workshop
 
arduino.pdf
arduino.pdfarduino.pdf
arduino.pdf
 
Arduino by yogesh t s'
Arduino by yogesh t s'Arduino by yogesh t s'
Arduino by yogesh t s'
 
arduinoedit.pptx
arduinoedit.pptxarduinoedit.pptx
arduinoedit.pptx
 
Arduino delphi 2014_7_bonn
Arduino delphi 2014_7_bonnArduino delphi 2014_7_bonn
Arduino delphi 2014_7_bonn
 
Начало работы с Intel IoT Dev Kit
Начало работы с Intel IoT Dev KitНачало работы с Intel IoT Dev Kit
Начало работы с Intel IoT Dev Kit
 
Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013
 
Athens IoT Meetup #3 - Introduction to ESP8266 (Pavlos Isaris)
Athens IoT Meetup #3 - Introduction to ESP8266 (Pavlos Isaris)Athens IoT Meetup #3 - Introduction to ESP8266 (Pavlos Isaris)
Athens IoT Meetup #3 - Introduction to ESP8266 (Pavlos Isaris)
 
Rdl esp32 development board trainer kit
Rdl esp32 development board trainer kitRdl esp32 development board trainer kit
Rdl esp32 development board trainer kit
 
JS Fest 2018. Володимир Шиманський. Запуск двіжка JS на мікроконтролері
JS Fest 2018. Володимир Шиманський. Запуск двіжка JS на мікроконтролеріJS Fest 2018. Володимир Шиманський. Запуск двіжка JS на мікроконтролері
JS Fest 2018. Володимир Шиманський. Запуск двіжка JS на мікроконтролері
 
Micropython on MicroControllers
Micropython on MicroControllersMicropython on MicroControllers
Micropython on MicroControllers
 
[OpenStack Day in Korea 2015] Track 1-6 - 갈라파고스의 이구아나, 인프라에 오픈소스를 올리다. 그래서 보이...
[OpenStack Day in Korea 2015] Track 1-6 - 갈라파고스의 이구아나, 인프라에 오픈소스를 올리다. 그래서 보이...[OpenStack Day in Korea 2015] Track 1-6 - 갈라파고스의 이구아나, 인프라에 오픈소스를 올리다. 그래서 보이...
[OpenStack Day in Korea 2015] Track 1-6 - 갈라파고스의 이구아나, 인프라에 오픈소스를 올리다. 그래서 보이...
 

Mehr von Andy Gelme

LCA2018 Open Hardware MiniConference: LoliBot Software
LCA2018 Open Hardware MiniConference: LoliBot SoftwareLCA2018 Open Hardware MiniConference: LoliBot Software
LCA2018 Open Hardware MiniConference: LoliBot SoftwareAndy Gelme
 
Connected Community Hackerspace (Melbourne, Australia) 2014 03-11
Connected Community Hackerspace (Melbourne, Australia) 2014 03-11Connected Community Hackerspace (Melbourne, Australia) 2014 03-11
Connected Community Hackerspace (Melbourne, Australia) 2014 03-11Andy Gelme
 
Internet Of Things: Hands on: YOW! night
Internet Of Things: Hands on: YOW! nightInternet Of Things: Hands on: YOW! night
Internet Of Things: Hands on: YOW! nightAndy Gelme
 
BarCamp Melbourne 2012: Internet of Things
BarCamp Melbourne 2012: Internet of ThingsBarCamp Melbourne 2012: Internet of Things
BarCamp Melbourne 2012: Internet of ThingsAndy Gelme
 
Internet Of Things, Smart Energy Groups
Internet Of Things, Smart Energy GroupsInternet Of Things, Smart Energy Groups
Internet Of Things, Smart Energy GroupsAndy Gelme
 
2011 01-24 dragino
2011 01-24 dragino2011 01-24 dragino
2011 01-24 draginoAndy Gelme
 
TinyMCE: WYSIWYG editor 2010-12-08
TinyMCE: WYSIWYG editor 2010-12-08TinyMCE: WYSIWYG editor 2010-12-08
TinyMCE: WYSIWYG editor 2010-12-08Andy Gelme
 
Internet of Things
Internet of ThingsInternet of Things
Internet of ThingsAndy Gelme
 

Mehr von Andy Gelme (8)

LCA2018 Open Hardware MiniConference: LoliBot Software
LCA2018 Open Hardware MiniConference: LoliBot SoftwareLCA2018 Open Hardware MiniConference: LoliBot Software
LCA2018 Open Hardware MiniConference: LoliBot Software
 
Connected Community Hackerspace (Melbourne, Australia) 2014 03-11
Connected Community Hackerspace (Melbourne, Australia) 2014 03-11Connected Community Hackerspace (Melbourne, Australia) 2014 03-11
Connected Community Hackerspace (Melbourne, Australia) 2014 03-11
 
Internet Of Things: Hands on: YOW! night
Internet Of Things: Hands on: YOW! nightInternet Of Things: Hands on: YOW! night
Internet Of Things: Hands on: YOW! night
 
BarCamp Melbourne 2012: Internet of Things
BarCamp Melbourne 2012: Internet of ThingsBarCamp Melbourne 2012: Internet of Things
BarCamp Melbourne 2012: Internet of Things
 
Internet Of Things, Smart Energy Groups
Internet Of Things, Smart Energy GroupsInternet Of Things, Smart Energy Groups
Internet Of Things, Smart Energy Groups
 
2011 01-24 dragino
2011 01-24 dragino2011 01-24 dragino
2011 01-24 dragino
 
TinyMCE: WYSIWYG editor 2010-12-08
TinyMCE: WYSIWYG editor 2010-12-08TinyMCE: WYSIWYG editor 2010-12-08
TinyMCE: WYSIWYG editor 2010-12-08
 
Internet of Things
Internet of ThingsInternet of Things
Internet of Things
 

Kürzlich hochgeladen

Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 

Kürzlich hochgeladen (20)

Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 

NodeMCU ESP8266 workshop 1

  • 1. ESP8266 Workshop 1 Andy Gelme (@geekscape) http://geekscape.org
 Wednesday 2015-03-11 Copyright (c) 2015 by Geekscape Pty. Ltd. License CC-BY-NC-4.0
  • 2. Workshop overview • ESP8266 introduction: hardware and software • ESP-01 and ESP-12 set-up for development • Flashing firmware using esptool • NodeMCU and Lua introduction • ESPlorer IDE • Using a button and LED(s) • Setting up as a Wi-Fi client • Using UDP to send and receive messages • Creating an MQTT client
  • 3. ESP8266 Hardware • 3.3V device, operating current ~ 215 mA • CPU: Tensilca Xtensa LX3: 32-bit, 80 MHz • ESP8266 SOC: Expressif • RAM 32Kb, DRAM 80Kb, Flash 200Kb (for SDK) • Wi-Fi 802.11 b/g/n 2.4 GHz radio (station or AP) • Timers, deep sleep mode, JTAG debugging • Peripherals … • GPIO (upto 16), PWM (3), ADC (one) • UART, I2C, SPI
  • 4. ESP8266 Memory Map • More complicated than your AVR ATMega / Arduino • SRAM 32Kb • NodeMCU heap memory available: print(node.heap()) • SPI Flash ROM layout: Since SDK 0.8 … • 00000h 248k app.v6.flash.bin User application
 3E000h 8k master_device_key.bin OTA device key
 40000h 240k app.v6.irom0text.bin SDK libraries
 7C000h 8k esp_init_data_default.bin Default configuration
 7E000h 8k blank.bin Filled with FFh. May be WiFi configuration • Source: https://github.com/esp8266/esp8266-wiki/wiki/Memory-Map
  • 5. ESP8266 Software stack • Can build using FreeRTOS: http://www.freertos.org • https://github.com/espressif/esp_iot_rtos_sdk • ESP8266 SDK: hardware access and C library • Application layer, either … • AT commands (standard on ESP-01) • IoT demo (standard on yellow ESP-12 dev board) • NodeMCU Lua interpreter • Your own application written in C
  • 6. ESP-xx modules • Variety of form factors, ESP-01 through ESP-12 … • Antenna: None, Chip, PCB or U-FL connector • Which pins broken out and layout (2 mm pitch) • Power: 3.3V typical, 3.0V min, 3.6V max • Chip enable pin (CH_PD): Hold high • ESP-12 dev board does this for you • GPIO0: Hold low on power-up to enter boot loader • Flash firmware • After power-up, can use GPIO0 as button input
  • 7. ESP-xx modules ESP-01 ESP-05 ESP-02 ESP-12 ESP-07 ESP-08 ESP-06 ESP-09ESP-03 ESP-10 ESP-11 ESP-04
  • 8. ESP-01 set-up • PCB antenna • 8 pins including UART Rx/Tx, GPIO (2), Reset • No power regulator, use only 3.0V to 3.6V • Need a means of holding GPIO0 low for firmware flash • Standard firmware: AT commands • Cable or use JohnS ESPkit-01 … • ESP-01 USB serial adaptor
 1 RXD <—— TXD
 2 VCC —— VCC 3.3V
 3 GPIO0 —— Connect to ground during power-up to flash firmware
 4 RESET —— VCC 3.3V
 5 GPIO2
 6 CH_PD —— VCC 3.3V
 7 GND —— GND
 8 TXD ——> RXD
  • 9. ESP-12 dev board set-up • PCB antenna • 16 pins inc. UART Rx/Tx, GPIO (9), ADC, Reset • RGB LED GPIOs: Red = 8, Green = 6, Blue = 7 • Uses 3x AA batteries with on-board 3.3v regulator • Provides GPIO0 header for bootloader / firmware flash • Standard firmware: IoT demo • Cable: Note ESP-12 dev board labels are confusing ! • ESP-12 USB serial adaptor
 RXD <—— RXD
 GND —— GND
 TXD ——> TXD
  • 10. esptool overview • Cross-platform Python, requires pySerial • https://github.com/themadinventor/esptool • Various functions … • Flash firmware • Create bootable image from binary blobs • Read MAC address • Read chip identification • Read / write memory • Hold GPIO0 low and power cycle ESP8266
  • 11. esptool flash firmware • Flash standard NodeMCU pre-built image … • Download image … • https://github.com/nodemcu/nodemcu-firmware • esptool -p SERIAL_PORT write_flash 0x00000 nodemcu_20150212.bin • Flash NodeMCU image with WS2812B support • https://github.com/geekscape/esp8266_nodemcu_examples/firmware • esptool -p SERIAL_PORT write_flash 0x00000 nodemcu_dev_0x00000.bin 0x10000 nodemcu_dev_0x10000.bin
  • 12. NodeMCU firmware • eLua interpreter including ESP8266 SDK API • NodeMCU API documentation … • https://github.com/nodemcu/nodemcu-firmware/wiki/nodemcu_api_en • Serial terminal connection at 9,600 baud • Command line prompt is “> “ • Enter valid Lua statements • Starts with around 23Kb heap available • Need to take care with your memory consumption • Further reading: nodemcu.com/index_en.html
  • 13. NodeMCU API • node.restart(), heap(), compile() • file.format(), list(), remove(), open(), read(), write() • wifi.sta, wifi.ap sub-modules • net module: TCP and UDP client and server • mqtt module: Message Queue Telemetry Transport • timer module, tmr.alarm(), tmr.stop(), tmr.time() • gpio.mode(), read(), write(), trig() • pwm, adc, i2c, spi, one-wire modules • bit module: bit-wise logical operations
  • 14. Lua introduction - I • http://www.lua.org/start.html • print(1 + 2); print(“hello”); print(node.heap()) • Variables: boolean, numbers, strings, tables • Global by default, but can use “local” keyword • Variable type declarations are not required • colour = {}; colour[“red”] = 1; colour[“blue”] = 2 • Functions are first-class values • function name(parameters)
 return value - - Can return multiple values
 end
  • 15. Lua introduction - 2 • Control-flow … • if condition then
 print(true)
 else
 print(false)
 end • for variable = first, last, delta do
 end • while condition do
 end
  • 16. Lua introduction - 3 • NodeMCU after boot will try to run “init.lua” • Compile using node.compile(“file.lua”) • Byte-code written to “file.lc” • Saves some memory • Modules … • moduleA = require(“module.lua”) • local module = {}
 function module.name()
 end
 return module
  • 17. NodeMCU example • You can’t just type … print(file.list()) !
 • You need to type … • for n,s in pairs(file.list()) do print(n.." size: "..s) end • file.list() … returns a table • pairs() … returns an iterator • for n,s in … loops through each iterator pair • n = file name, s = file size
  • 18. ESPlorer IDE • Simplify process of managing files and running scripts on NodeMCU or MicroPython • Also short-cuts for AT commands firmware • http://esp8266.ru/esplorer • Open source … • https://github.com/4refr0nt/ESPlorer • Start via command line … java -jar ESPlorer.jar • Scans for available serial ports • Provides Graphical User Interface for development
  • 20. Button input • Connect button between GPIO0 and Ground • Example code … • https://github.com/geekscape/esp8266_nodemcu_examples/blob/master/ examples/button.lua • Load into ESPlorer IDE: File -> Open • Save to ESP8266: [Save to ESP] • Run script: [Do File] • ESP-12 bonus: Try to use LDR and adc.read()
  • 21. Button input - FAIL • Our first attempt is likely to look like this … PIN_BUTTON = 3 -- GPIO0
 gpio.mode(PIN_BUTTON, gpio.INPUT, gpio.PULLUP)
 
 while true do
 if gpio.read(PIN_BUTTON) == 0 then
 print("BUTTON PRESSED")
 tmr.delay(20000) - - microseconds
 end
 end
  • 22. Button input • … but previous example, after a short while it fails :( • More reliable to use timers, rather than delays • Also, code is much more modular and re-usable • Try … tmr.alarm(id, interval, repeat_flag, function) • id: timer number 0 to 6 • interval: alarm time in milliseconds • repeat_flag: 0 = once, 1 = repeat until tmr.stop() • function: Lua function to invoke • The following code is more reliable …
  • 23. PIN_BUTTON = 3 -- GPIO0
 TIME_ALARM = 25 -- 0.025 second, 40 Hz
 gpio.mode(PIN_BUTTON, gpio.INPUT, gpio.PULLUP) 
 button_state = 1
 button_time = 0
 
 function buttonHandler()
 button_state_new = gpio.read(PIN_BUTTON)
 if button_state == 1 and button_state_new == 0 then
 button_time = tmr.time()
 print("BUTTON PRESSED")
 elseif button_state == 0 and button_state_new == 1 then
 button_time_new = tmr.time()
 if tmr.time() > (button_time + 2) then
 tmr.stop(1)
 print("BUTTON DISABLED")
 end
 end
 button_state = button_state_new
 end
 
 tmr.alarm(1, TIME_ALARM, 1, buttonHandler)
  • 24. Regular LED output • Connect LED and current limiting resistor between GPIO2 and Ground • Example code … • https://github.com/geekscape/esp8266_nodemcu_examples/blob/master/ examples/led.lua • Load into ESPlorer IDE: File -> Open • Save to ESP8266: [Save to ESP] • Run script: [Do File] • Try … init.lua: dofile('led.lua')
  • 25. Regular LED output LED_PIN = 4 -- GPIO2
 TIME_ALARM = 500 -- 0.5 second
 gpio.mode(LED_PIN, gpio.OUTPUT)
 led_state = gpio.LOW
 function ledHandler()
 if led_state == gpio.LOW then
 led_state = gpio.HIGH
 else
 led_state = gpio.LOW
 end
 gpio.write(LED_PIN, led_state)
 end tmr.alarm(1, TIME_ALARM, 1, ledHandler)
  • 26. WS2812B LED output • Original development by Markus Gritsch • http://www.esp8266.com/viewtopic.php?f=21&t=1143 • Isn’t yet part of the NodeMCU master branch • BRIGHT = 0.1; ON = BRIGHT * 255
 LED_PIN = 4 -- GPIO2
 PIXELS = 8
 RED = string.char( 0, ON, 0)
 GREEN = string.char(ON, 0, 0)
 BLUE = string.char( 0, 0, ON)
 ws2812.write(LED_PIN, RED:rep(PIXELS))
 ws2812.write(LED_PIN, GREEN:rep(PIXELS))
 ws2812.write(LED_PIN, BLUE:rep(PIXELS))
  • 27. WS2812B LED example • Connect WS2812B to GPIO2 • Example code … • https://github.com/geekscape/esp8266_nodemcu_examples/blob/master/ examples/ws2812.lua • Load into ESPlorer IDE: File -> Open • Save to ESP8266: [Save to ESP] • Run script: [Do File] • Try … init.lua: dofile('ws2812.lua')
  • 28. • Scan to get available Wi-Fi Access Points … • wifi.sta.getap(function) • Calls function when list of Access Points is ready • Start Wi-Fi station (client) … • wifi.setmode(wifi.STATION); • wifi.sta.config(“ssid”, “passphrase”) • wifi.sta.connect() • Returns your IP address when ready … • wifi.sta.getip() Setting up Wi-Fi client
  • 29. • wifi.sta.getap(wifi_start) • module.SSID = {}
 module.SSID["SSID1"] = "passphrase1"
 module.SSID["SSID2"] = "passphrase2" • local function wifi_start(aps)
 for key,value in pairs(aps) do
 if config.SSID and config.SSID[key] then
 wifi.setmode(wifi.STATION);
 wifi.sta.config(key, config.SSID[key])
 wifi.sta.connect()
 tmr.alarm(1, 2500, 1, wifi_wait_ip)
 end
 end
 end • local function wifi_wait_ip()
 if wifi.sta.getip() then 
 tmr.stop(1)
 end
 end
  • 30. • Modular, flexible, timer-based application skeleton • Example code … • https://github.com/geekscape/esp8266_nodemcu_examples/tree/master/ skeleton • Load into ESPlorer IDE: File -> Open • Save to ESP8266: [Save to ESP] • Reset ESP8266 • print(wifi.sta.getip()) Wi-Fi client example - 1
  • 31. • init.lua • Called on boot • Minimal, can’t be compiled :( • config.lua • Application configuration, e.g SSID and passphrases • setup.lua • Sets up Wi-Fi depending upon your location • application.lua • Your code, change filename as appropriate • Use node.compile() on everything except init.lua Wi-Fi client example - 2
  • 32. UDP message transmit • socket = net.createConnection(net.UDP, 0)
 socket:connect(PORT_NUMBER, HOST_STRING)
 socket:send(MESSAGE)
 socket:close() • Example code … • https://github.com/geekscape/esp8266_nodemcu_examples/blob/master/ applications/button_udp.lua • Test on laptop with command line UDP server … • nc -l -u IP_ADDRESS 4000
  • 33. UDP message receive • udp_server = net.createServer(net.UDP)
 udp_server:on("receive", function(srv, data)
 print("udp: " .. data)
 end)
 udp_server.listen(PORT) • udp_server:close() • Example code … • https://github.com/geekscape/esp8266_nodemcu_examples/blob/master/ applications/ws2812_udp.lua • Test on laptop with command line UDP client … • nc -u IP_ADDRESS 4000
  • 34. MQTT client • MQTT server address “192.168.0.32” • m:on("message", function(conn, topic, data) 
 print(topic .. ":" ) 
 if data ~= nil then print(data) end
 end)
 
 m:connect(“192.168.0.32", 1883, 0, function(conn)
 print("connected")
 end)
 m:subscribe("/topic",0, function(conn)
 print("subscribe success”)
 end)
 m:publish("/topic","hello",0,0, function(conn)
 print("sent")
 end)
 m:close();
  • 35. ESP8266 / NodeMCU resources • ESP8266 general information • https://nurdspace.nl/ESP8266 • https://nurdspace.nl/images/e/e0/ESP8266_Specifications_English.pdf • NodeMCU API documentation • https://github.com/nodemcu/nodemcu-firmware/wiki/nodemcu_api_en • Lua programming language: http://www.lua.org • ESPlorer IDE • http://esp8266.ru/esplorer • esptool (cross-platform) for flashing firmware • https://github.com/themadinventor/esptool