Building Connected Things with an ESP8266 and Microsoft Azure
Table of Contents
- Table of Contents
- Bill of Materials
- Connecting the Sensors
- Create the Lua Program in ESPlorer
- Run the App on the Device
- Conclusion & Next Steps
In this lab, you will create a simple Thing using a Windows 10 IoT device and the Universal Windows Platform.
Bill of Materials
In this lab series you will need the following:
- Microsoft Azure IoT Starter Kit w/ Adafruit Feather HUZZAH, including
In this lab, you will combine the nightlight you previously built with a DHT22 – which measures temperature and humidity. You will collect the ambient light, the temperature and humidity and use it as a minimal weather station. This data will get sent to Azure so you can start exploring the data processing pipeline for IoT data.
Connecting the Sensors
Connect the DHT22 to the ESP8266 (Huzzah Feather) as shown in these images:
- Connect the DHT22 Left Connection (when facing it) to +3V
- Connect the DHT22 Right Connection (when facing it) to Ground
- Connect the DHT22 Connection 2nd from Left when facing it, to Huzzah Feather Pin 12 (NodeMCU Pin 6)
Create the Lua Program in ESPlorer
As in the previous lab, you’ll write lua code in ESplorer. This code (below), operates the photocell and LED as a nightlight.
- Launch ESPlorer.jar, select your serial port, and press the ‘Open’ button
- Create a new script in Esplorer with these contents. Save it as Lab03.lua
Run the App on the Device
To run the application you will save it to the ESP8266, reset the device, then invoke the code.
- Press the button ‘Save to ESP’ on the lower left of the ESPlorer interface.
- Push the reset button on the ES8266
- When it’s done booting, click the ‘Reload’ button on the right side. You should see a list of files on the ESP8266
- Double click the file on the right hand side that you saved. This should execute your code.
Conclusion & Next Steps
Congratulations! You have created the ThingLabs Weather Station. In the following labs you will use the Weather Station to connect to Azure IoT services and track all of this data. The concepts you learned in this lab are:
- Working with multiple sensors.
- Maintaining state while constantly polling sensors for state changes.
In the next lab you will set up an Azure IoT Hub to use with the ThingLabs Weather Station.