ESP8266 Light Sensor

9,815

19

3

Intro: ESP8266 Light Sensor

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.

Step 1: Materials

Materias:
  • 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.

Share

    Recommendations

    • Tiny Home Contest

      Tiny Home Contest
    • Fix It! Contest

      Fix It! Contest
    • Furniture Contest 2018

      Furniture Contest 2018

    3 Discussions

    0
    None
    pulytr.ifttt

    Question 6 months ago on Step 4

    it is fine and easy to made it (copy paste), I also made the DS18B20(copy paste). But how to combine two senzors and send it to? Something tells me that the copy paste of two programs will not work together :))

    0
    None
    Swansong

    1 year ago

    Looks good :) You should enter in the Sensors Contest.

    1 reply
    0
    None
    iotguySwansong

    Reply 1 year ago

    Than you for the suggestion. I will.