2018年1月23日 星期二

IoT Tutorial for ESP8266







Setup Guide

Intro

An ESP8266 module by itself doesn’t really interact with the physical world, but we can change that pretty easily by hooking it up to:
  • An LED
  • A button
  • A light sensor
Note: If you are using a Gizwits Witty ESP8266 module, then you can skip this entire section - that module integrates all of the external parts necessary for this tutorial.

Parts

In addition to your ESP8266 module, you will need the following:
  • Breadboard
    • Lets you easily connect all of the parts to each other
  • LED
    • A very small, low-power light
  • 330 Ohm Resistor
    • Connected to the LED to prevent it from exploding
  • Photoresistor (aka CDS cell)
    • A resistor which changes its resistance based on how much light lands on its surface
  • 10K (10,000) Ohm Resistor
    • Connected to the photoresistor to create a light sensor
  • Normally-Open (NO) Push Button
    • Connects its two pins when pushed, otherwise leaves them disconnected
These parts are all super cheap, so it never hurts to have them laying around. If you don’t already have these parts, I recommend buying a cheap breadboard and component starter kit like this $13 kit from Amazon

ESP8266 Pins

The naming of pins for ESP8266 can be a bit confusing - there is the name of the pin within Arduino, the name of the pin inside the ESP8266 itself, and the name of the pin as labeled on the module. For the purposes of our tutorial, here is the mapping between the Arduino pin name, the ESP8266 pin name, and a couple different module pin names
Arduino PinESP8266 PinWitty PinNodeMCU PinWemos D1 Mini PinSparkfun ESP8266 ThingAdafruit Huzzah
A0A0ADCA0A0ADCA
4GPIO4GPIO4D2D24#4
15GPIO15GPIO15D8D81515

Circuit Diagram

This is the circuit diagram for the parts we’re using in this tutorial. It assumes you’re using a NodeMCU module and uses the NodeMCU module pin names. If you’re using a different module, substitute pin names and locations as necessary.
Circuit Diagram

Breadboard Diagram

If you don’t know what to do with a circuit diagram, here’s an equivalent breadboard diagram showing you how the different parts should be wired together. It also assumes you’re using a NodeMCU module, so if you’re using a different module, substitute pin names and locations as necessary.



沒有留言:

張貼留言

MQTT Explorer 與 Node-Red 介面的實驗

 MQTT Explorer 與 Node-Red 介面的實驗 MQTT EXplorer 與 Node-Red介面的設定 (1) 設定  MQTT EXplorer Client    (2)        Node-Red LED ON  --> MQTT Explor...