top of page

Smart Light System - IOT using ThingSpeak Cloud - Esp8266

Updated: Apr 1

Data collection and analysis plays an important role in the development of #smart devices. By analysis, the first thing is plotting a graph for the output versus time. Different online platforms aid the same and in this article, a similar device is going to be built which will not only display and give desirable output but will also send an analysis of the same.

Smart Control systems have been much necessary for better control and optimal usage of resources like electricity, water, etc. in our day-to-day life. Every system would start with the smallest automated device. A smart light System is one such part of a big #Automation system that gives an idea of how such a system works and how it is analyzed.

Hardware Requirements

The following hardware components are required for the circuit.

Components Required
Components Required

  1. NodeMCU


NodeMCU is a platform provided for #IoT. It basically includes firmware (computer software that contains instructions and controls the hardware) which runs on Esp8266 WiFi SoC (software on-chip). It is open-source firmware available for prototyping and developing kits. MCU means a Micro-Controller Unit. The device contains GPIO (General Purpose Input Output) pins which send and receives data on connection to other devices.

Esp12e module is also an SoC used for WiFi and is used in this project.

The specifications of the Esp12e module are:

  • 32-bit lx106 RISC Microprocessor.

  • 80MHz-160MHz, the adjustable clock frequency.

  • Supports Arctic OS(Operating System).

  • 1 KB Internal #RAM.

  • 4 MB External flash.

  • 2.5V to 3.6V, 3.3V onboard.

  • 600 milliAmp Regulator.

  • 80 milliAmp Operating Current.

  • 20 microAmp Current in sleeping Mode.

  • 17 GPIO pins (which include ADC channels, 2 UART Interfaces, 4 PWM outputs, LED, Reset button, etc.).

Buy NodeMCU from here.

. 2. Breadboard


The breadboard is the basic component of any circuit building process. All components, be it input sensors or output display devices are connected to the NodeMCU or any other microcontroller using wired connections through a breadboard. The holes in the breadboard are in series. There are various sizes like full-sized, half-sized, and mini breadboard.

Buy breadboard from here.

3. Jumper Wires

Jumper Wires
Jumper Wires

These are the main components that are used to establish the connections between different devices of the circuit.

Buy Jumper Wires from here.

4. LED


Light Emitting Diode is a commonly used light source. It is a semiconductor that emits light when current flows through it.

Buy LED from here.


10k Ohm Resistor
10k Ohm Resistor
220 Ohm Resistor
220 Ohm Resistor

Resistors are passive devices that restrict the flow of current or divide the voltage through the circuit. The resistors used for the proper functioning of this circuit are 10k Ohm and 220 Ohm Resistor.

For 10k Ohm Resistor, the 4-band color code is Brown, Black, Orange, Gold where Orange color is the multiplier (1000) and Gold color shows the tolerance level (±5%).

For the 220Ohm resistor, the 4-band color code is Red, Red, Brown, Gold where Brown color is the multiplier(10) and Gold color shows the tolerance level(±5%).

Buy Resistors from here.

6. LDR


Light Dependent Resistors (LDR) are photoresistors that allow to measure the intensity of light and gives the output in terms of Voltage. It converts the analog value of voltage into a #digital range of values (0-1023).

Buy LDR Sensor from here.

Software Requirements

1. Arduino IDE

Arduino IDE Logo
Arduino IDE Logo

#Arduino IDE (Integrated Development Platform) which is used to interface the boards like NodeMCU to run the desired code designed to interface hardware devices.

2. ThingSpeak

#ThingSpeak cloud is an open-source IoT application that provides API to store and retrieve data from the data given through the device connected to it. It uses HTTP and MQTT protocols. ThingSpeak is a cross-platform which is used for data analysis( by plotting real-time graphs) and has a grown relation with Map-labs. It is also having a numerical computing software MatLab for map-works.

Circuit Connections

The circuit connections are as follows.

  • A0 terminal of the NodeMCU is connected to one terminal of LDR and to the 10K Ohm resistor which is then connected to the Ground in the breadboard.

  • The other terminal of the LDR is connected to the 3V3 pin of the NodeMCU.

  • The LED is connected to the NodeMCU board through the 220 Ohm Resistor.

  • One terminal of the resistor is connected to the D1 pin of the NodeMCU board and the other terminal of the resistor is connected to the LED.

  • The negative terminal of the LED is connected to the Ground pin of the board through the beadboard.

  • Finally, the NodeMCU board is connected to the system with the IDE through the USB cable.


Note: Please change the file format to .ino(Arduino IDE) format before you upload the code to the ESP8266 board.


The basic principle of working of the sensor is the principle of Photoconductivity. It states that the conductivity of the LDR(photocell) varies according to the absorption of the light. Also, the resistors in this circuit are provided to protect the sensor from the high electricity flow.

Before interfacing the circuit to the code, the ThingSpeak account must be created, the channel must be set and the configurations must be properly assigned. The #API keys must be obtained after registering the type of device we will be interfacing and the same must be provided to the IDE as input so that the device can connect to the Cloud and further can access the output values from the sensor.

Circuit connected
Circuit connected

The input for the circuit is given from the LDR sensor which detected the intensity of light. The value, as mentioned above is given to the NodeMCU in terms of voltage. This value of the voltage is printed as an output on the serial monitor along with the status of the LED. Based on the input level and the condition set by the user, the LED turns ON and OFF accordingly.

The steps for correctly creating an account on ThingSpeak is explained in the video.

Video By - Abhishek Goud

#Cloud storage and analysis of the input and output from devices are very essential for further development of the device. The proper implementation of the circuit increases the application level of the device.



1,949 views2 comments

Related Posts

See All


Anushka Gupta
Anushka Gupta

Wow, what an incredible article! This blog on the Smart Light System using IoT and ESP8266 is both informative and easy to follow. Thanks to Learn Electronics India for providing such valuable content.


LearnElectronics India simplifies complex concepts beautifully. Thank you!

bottom of page