In this tutorial we will show how to build WiFi light sensor. We will use ESP8266 and LDR (light dependent resistor) and connect to EasyIoT Cloud. Sensor is plug and play. ESP8266 Arduino IDE will be used to upload program to ESP8266.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Materials
- ESP8266 WiFi module
- Resistor 10K
- LDR Photoresistor
- 5V Power supply (phone charger)
Step 2: Get Security Token
No EasyIoT Cloud configuration is needed, just register to EasyIoT Cloud service. After registration go to Configuration->Tokens And press button Add token. Remember Token - you will need it to modify program.
Step 3: Program
Program is written in Arduino ESP8266 IDE. See Arduino ESP8266 IDE tutorial how to connect ESP8266 module to computer to upload program. You will also need ESP8266 EasyIoT Cloud REST API V1 library.
Program is available at GitHub. In program change AP name and password and token:
#define AP_USERNAME "xxx"
#define AP_PASSWORD "xxx"
#define TOKEN "xxx"
Program at beginning reads setting in EEPROM. If module ID is 0 this means module is not added to EasyIoT Cloud. In this case module is added to EasyIoT Cloud, adds parameters and change module type. Then it reads voltage on analog pin and sends to EasyIoT Cloud.
Step 4: Hardware
In our case we use ESP8266 NodeMCU, but you can use any other ESP8266 with AI. Just connect 10K resistor and LDR to 3.3V and GND. Resistor and LDR connection connect to ESP8266 analog input A0.
After programming module is automatically added to EasyIoT Cloud. Just login to EasyIoT Cloud and you will see module in WEB interface.
Participated in the
Sensors Contest 2017