Molemi IoT
  • Space farming using food computers for sustainable farming
  • Introduction to Arduino
    • Introduction to Electronics
    • The Breadboard
  • Controlling LEDs with an Arduino
    • The Code
    • Adding a button to control the LEDs
      • The Code
  • Introducing Sensors
    • The CO2 and air quality sensor
    • The Code
      • Explaining the Code
    • Light Intensity Sensor
  • Introducing the NodeMCU
    • Getting Started
      • A simple test for ESP8266
        • The Code
    • A light bulb switch using NodeMCU and the Blynk app
      • Setup Blynk on your Smartphone
      • The Code
    • Controlling a Centurion gate Motor with NodeMCU a 2-channel relay
      • Installing Blynk in Arduino IDE
    • Read and display the water flow sensor on Blynk
      • Setting up Blynk
      • The Code
        • Explaining the code
    • Read and Display temperature sensor readings with NodeMCU.
      • Installing libraries for DS18B20 temperature sensor.
      • Displaying the sensor readings on the serial port
        • Getting temperature readings from different DS18B20 sensors.
          • The Code
            • Display sensor readings on a web server
              • Build the web server
                • Designing and building the web page
                • The Code
    • Display the DHT11 sensor reading on a web server using NodeMCU.
      • Monitoring Room Temp & Humidity using Blynk
      • Installing DHT library on the ESP8266
        • Installing the Asynchronous Web Server library
          • The Code
          • Designing and building the web page
  • Data Science for Farming
    • Getting Started with Colaboratory
    • Introduction to Python for DS using Colab
  • Machine Learning for Farming
  • Molemi Personal Food Computer
    • Bill of Materials
  • Setting up WaziGate on a Raspberry Pi
  • Setting up DHT11 on Raspberry Pi
  • Using Telegram To Control Outputs
Powered by GitBook
On this page
  • The outcome of this workshop/tutorial
  • What will you need?
  • Setting up the circuit

Was this helpful?

  1. Introducing the NodeMCU

A light bulb switch using NodeMCU and the Blynk app

In this activity we will be using the Blynk app to switch a light bulb on and off over the internet.

The outcome of this workshop/tutorial

  • Learn how to setup the circuit for the relay, light bulb and the nodeMCU.

  • Learn how to use a relay module to switch a light bulb on and off.

  • Learn to connect the relay module to the power supply.

  • Learn to setup the Blynk app on your smartphone.

  • Learn how to install the Blynk Library on the Arduino IDE.

  • Learn how to configure the Blynk to connect to your local network.

  • Learn how to configure Blynk code to communicate with your nodeMCU and Blynk app.

What will you need?

  • NodeMCU Dev Kit

  • male-to-male & male-to-female jumper cables

  • A relay Module

  • A 220V light bulb

  • globe holder

  • breadboard

  • 5 V power supply

Setting up the circuit

  1. Connect the positive terminal of the 5V power supply to the positive on the breadboard. Also connect the negative terminal on the negative of the breadboard.

  2. Connect the positive pin of the relay module to the positive on the breadboard. Then connect the negative pin of the relay module to the negative on the breadboard.

  3. Connect the signal pin of the relay to pin D0 on the nodeMCU.

  4. Connect the long leg of the LED to pin D0 of the nodeMCU. Then connect the short leg to the one terminal of the resistor and then connect the other side of the resistor to the

#define BLYNK_PRINT Serial        
#include <ESP8266WiFi.h>        
#include <BlynkSimpleEsp8266.h>        
char auth[] = "authtocken"; // PASTE YOUR AUTHENTICATION CODE HERE        
// Your WiFi credentials.        
char ssid[] = "ssid"; //WIFI NAME        
char pass[] = "password"; //PASSWORD        
void setup()        
{        
 Serial.begin(9600);        
 Blynk.begin(auth, ssid, pass);        
}        
void loop()        
{        
 Blynk.run();        
}        
PreviousThe CodeNextSetup Blynk on your Smartphone

Last updated 5 years ago

Was this helpful?

setup of the circuit to control a light bulb with a blynk app.