IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware Sub-Group

24
1 - 03/09/2015 Austin IoT Hardware Sub- Group July 2015

Transcript of IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware Sub-Group

1 - 03/09/2015

Austin IoT Hardware Sub-GroupJuly 2015

About The Austin IoT Sub-GroupThe IoT Hardware Sub-Group offers a more hands-on approach than its broader based parent, the Austin IoT group.

Meetups will feature show-and-tell demonstrations, collaborative discussion, and educational presentations.

The focus is on learning how to create IoT devices, for fun or profit. Most of all, we will have fun! with IoT.

About Tech Shop

A Maker’s Dream!Support for EntrepreneursMembershipToursMeetings

Tonight’s Agenda● Introduction

○ Announcements○ Call for jobs○ Call for demos - project discussions

● ESP8266 Getting Started

Announcements

● Got a Job to announce?● Looking for a Job?● Any other announcement?

○ of interest to the group

Demo and Project Discussion

● Show and Tell time!○ Have something to show?○ Are you working on a project you can tell us about?○ How about for next month?

ESP8266 based ESP-01 Module

● http://esp8266.COM● WiFi IoT device solution● Intended as a serial to WiFi bridge

○ UART interfacing○ AT Command set○ Full TCP stack○ Cheap! <$5/each

Feature Set

● Wi-fi, internal antenna b/g/n● Wi-fi Direct (P2P), soft AP● Built in TCP/IP protocol stack● High power +19.5dBm● Low power 32-bit CPU - can run apps● Flash based with built in Boot loader

AT Command Set

● Talk to the module over Serial● Connect to Wi-Fi

● AT+CWMODE=3● AT+CWJAP=<ssid>,<pwd>

● Command to open socket● AT+CIPMUX=1● AT+CIPSTART=1,”TCP”,”192.168.4.100”,8080

● Send and receive● Libraries for Arduino, mbed and others

ESP-01 Interfacing

VCC is 3.3V Blue LED connected to GPIO 1 GPIO 0 low for FLASHRESET active low CH_PD High for active 9600 Default Baud Rate

ESP8266 SoC

● Espressif CPU ● 32-Bit - 80MHz● 64K Boot ROM● 64K Instruction RAM● 96K Data RAM● Integrated WEP, TKIP, AES, and WAPI● SDIO, GPIO(16), UART(2), I2C, ADC(1),

SPI, PWM(10 bit) any pin

Modules

ESP-12

● Common Module, good for product use?● PCB solderable● FCC Certified? probably● $8/each at Amazon● $10 Adafruit breakout board9 GPIO, 2 UART1 ADC, I2C, SPI

Programming

● Node Lua● NodeMCU● Arduino● Xtensa Toolchain

Node Lua

● Lua Program Language● Online IDE● Access to full I/O set● Cloud API● Very limited due to available RAM size

○ A few dozen lines of code● Quick and simple to get some data on the

web.

NodeMCU

● Lua Program Language● Less limited than NodeLua● Use any text editor● Command line utility to load program● Can compile to bytecode on module● Good for small quick projects

Arduino IDE

● C/C++ Program Language● Install from board manager in IDE (1.6.4)● Works pretty much exactly like Arduino

○ Faster, much faster● Base code uses about 46%, medium project

added about 1%. Lots of program space.● Flash process is slow. Hold GPIO0 low and

do reset to start it.

https://github.com/esp8266/Arduino

Xtensa Toolchain

● Programming in C/C++● Easy to setup on Linux and Mac● Windows with Cygwin● Building everything from source● Raw access and ability to contribute to core

Product Problems ● FCC

○ Must know this is good to make a Product○ Claims not easy to validate○ ESP-12 seems to have it.

● Configuration○ How will a user setup the Wi-Fi?○ Need code for AP mode web config

● connect mobile device to ESP AP, captive portal config page○ Or some common method with an App

■ We could make a standard for this● common config app in market, user connect to AP the runs

app to do configuration.

My Projects - Raise

● Paired LEDs/Buttons○ Demo last month○ LED on each, controlled by button on either○ Originally tried with NodeMCU

■ Was a struggle to fit it in the code limits○ Re-coded with the Arduino IDE in C/C++

■ Very easy compared to Lua stuff■ Did not touch any limits on code■ So easy I decided to to a much bigger project

My Projects - Web Monitor

● Web Monitor○ ESP-01 with 8X NeoPixels○ Leds show green/red or flash for status ○ Wi-Fi connection○ Internet - watches Google and connect time○ uCHobby Website - downloads index, checks size○ Sends notice using PushBullet○ Sends an EMail

My Projects - Web Monitor○ NeoPixels○ Wi-Fi connection○ HTTP Client○ PushingBox

● Email and PushBullet○ MQTT (not done)

● Stats and web interface○ Serial Menu○ Configuration (not done)

● can’t share till done.● Wi-Fi, MQTT, Web site and limits.

Lessons / tricks○ Power Issues

■ Decoupling○ Noise

■ High power Wi-Fi○ Data Transfer

● less than 1MBPS○ LED

● Some burn out due to assembly error○ Breadboard Adapters○ Tried a Windows / Eclipse build and had trouble○ Have not tried Arduino to ESP interfacing○ Use Sublime for code editor.

Questions?