• Home
  • IOT
  • Articles
  • IoT (Internet of Things) Project: Google Firebase controlling LED with NodeMCU

IoT (Internet of Things) Project: Google Firebase controlling LED with NodeMCU

Last updated on May 30 2022
Kritika Singh

Table of Contents

IoT (Internet of Things) Project: Google Firebase controlling LED with NodeMCU

In this blog, we’ll control the LED with NodeMCU using Firebase database. within the previous section of this project, Google Firebase using NodeMCU ESP8266 we covered the way to create project on Firebase and its configuration with NodeMCU. Before browsing this project, we recommend you to read our previous tutorial.

A program to regulate LED (ON/OFF) using Google Firebase database and NodeMCU

Open your previous code and make slightly changes: add pin connection, set firebase status.

1. #include 
2. #include 
3. #include 
4. #include 
5. #include 
6. #include 
7. 
8. // 
9. // Copyright 2015 Google Inc. 
10. // 
11. // Licensed under the Apache License, Version 2.0 (the "License"); 
12. // you'll not use this file except in compliance with the License. 
13. // you'll obtain a replica of the License at 
14. // 
15. // http://www.apache.org/licenses/LICENSE-2.0 
16. // 
17. // Unless required by applicable law or agreed to in writing, software 
18. // distributed under the License is distributed on an "AS IS" BASIS, 
19. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
20. // See the License for the precise language governing permissions and 
21. // limitations under the License. 
22. // 
23. 
24. // FirebaseDemo_ESP8266 may be a sample that demo the various functions 
25. // of the FirebaseArduino API. 
26. 
27. #include 
28. #include 
29. 
30. // Set these to run example. 
31. #define FIREBASE_HOST "nodemcu-demo-697d8.firebaseio.com" 
32. #define FIREBASE_AUTH "YOUR_FIREBASE_AUTH" 
33. #define WIFI_SSID "NETGEAR64" 
34. #define WIFI_PASSWORD "*TECKLEARN#" 
35. 
36. void setup() { 
37. Serial.begin(9600); 
38. 
39. // hook up with wifi. 
40. WiFi.begin(WIFI_SSID, WIFI_PASSWORD); 
41. Serial.print("connecting"); 
42. while (WiFi.status() != WL_CONNECTED) { 
43. Serial.print("."); 
44. delay(500); 
45. } 
46. Serial.println(); 
47. Serial.print("connected: "); 
48. Serial.println(WiFi.localIP()); 
49. 
50. Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH); 
51. pinMode(D1,OUTPUT); 
52. Firebase.set("LED_STATUS",0); 
53. } 
54. 
55. int n = 0; 
56. 
57. void loop() { 
58. // set value 
59. n=Firebase.getInt("LED_STATUS"); 
60. // handle error 
61. if (n==1) { 
62. Serial.print("LED is ON"); 
63. digitalWrite(D1,HIGH); 
64. Serial.println(Firebase.error()); 
65. return; 
66. delay(100); 
67. } 
68. else{ 
69. Serial.print("LED is OFF"); 
70. digitalWrite(D1,LOW); 
71. } 
72. 
73. // update value 
74. 
75. }

Compile and upload code to NodeMCU ESP8266. Open the serial monitor and consider the status, its current status is 0, and LED has OFF.

iot 18
iot

In the database, we got LED_STATUS: 0 and LED has OFF.

 

iot 19
iot
iot 20
iot

Now, manually change the led status to 1, and it turns the LED ON.

iot 21
iot
iot 22
iot

So, this brings us to the end of blog. This Tecklearn ‘IoT(Internet of Things) project of Google Firebase controlling LED with NodeMCU’ blog helps you with commonly asked questions if you are looking out for a job in Internet of Things (IoT). If you wish to learn IoT and build a career in Internet of Things (IoT) domain, then check out our interactive, Internet of Things (IoT) Training, that comes with 24*7 support to guide you throughout your learning period. Please find the link for course details:

IoT (Internet of Things) Training

Internet of Things (IoT) Training

About the Course

Internet of Things or IoT, as it is widely known, simply put, is a network of devices which can communicate with each other with regards to sending, receiving and analyzing data. Tecklearn’s IoT Training as an online training platform delivers you the best in the industry IoT knowledge by certified and experienced trainers to master IoT. Interactive sessions include two real-time projects to provide in-depth understanding of advanced IoT concepts that covers IoT methods and technologies, application deployment, network and communication protocols and integrations, security measures and real-time data management on the internet. You will learn IoT introduction, significance, building your own IoT devices, sensors, IoT communication and security. This training will help you be a part of the IoT revolution underway around the globe.

Why Should you take IoT (Internet of Things) Training?

• The average salary for an IoT Engineer is $163,514 per year in the United States. (Indeed.com)
• Many industries such as Eddie Stobart Transport and Logistics Company, the Amazon, Dell, Aviva, German Auto Manufacturer Daimler, the John Deere Company and Walt Disney Land are all utilizing the Internet of Things technology to monitor various activities and advance their existing systems.
• Gartner Says 5.8 Billion Enterprise and Automotive IoT Endpoints Will Be in Use in 2020

What you will Learn in this Course?

Introduction to Internet of Things
• What is IoT, how does it work
• IoT vs IIoT
• Business Cases of IIoT
• Industry 4.0
• Properties of IoT device
• IoT Ecosystem
• IoT Decision Framework
• IoT Solution Architecture Models
• How IoT is Transforming Businesses
• Major IoT Boards in Market
IoT Communication Protocols
• Types of wireless communication
• Major wireless Short-range communication devices and properties
• Comparison of these devices (Bluetooth, WIFI, ZigBee, 6LoWPAN)
• Major wireless Long-range communication devices and properties, Comparison of these devices (Cellular IoT, LPWAN)
IoT Architecture
• The IoT Stack Architecture and the various components and layers
• The app, the data processing and platform
• IoT OS like Contiki, FreeRTOS and mbe
• The edge and the connected thing or device
IoT Sensors and Device Platforms
• Introduction to IoT Sensors and the role they play in getting the IoT systems work efficiently
• Micro-electromechanical systems revolutionizing IoT sensors
• Use Case of Water Quality Monitoring
• Use Case: Sericulture
• Difference between microcontroller and microprocessor
• IoT Device Platforms – Arduino, Raspberry Pi etc
• Smartphone Centric Architecture
• IoT Application Layer protocols
• Hands On
Arduino Platform and Arduino Interfacing
• Arduino physical board, libraries and the Integrated Development Environment
• Arduino Shields various operations such as heat and light sensing, GPS, UI display
• Programming Arduino using C language
• Controlling external devices using pins on the Arduino board
• The Arduino Interface
• Reading inputs from various sources and providing an output
• Working with sensors for sensing and controlling the physical world
• Deploying various types of sensors and connecting it to the Arduino
• Constant conversion between analog and digital signals for information exchange between the physical and digital domains
• Hands On
Raspberry Pi Platform and Raspberry Pi Interfacing
• Introduction to Raspberry Pi
• Set up of Raspberry Pi environment
• Coding for the Raspberry Pi using Python
• Deploying Python-based Integrated Development Environment
• Interfacing the Raspberry Pi with the physical world
• Introducing the various input and output devices
• Raspberry Pi expansion boards for building complex hardware setup
• Real-time demo of Raspberry Pi interfacing
• Hands On
Arduino Uno Wifi and IoTivity
• Iotivity
• Iotivity Architecture
• Hands On
Netduino Platform and Netduino Interfacing
• Introduction to Netduino Platform
• Setting up the Netduino environment
• Coding for the Netduino
• Interfacing the Netduino with the physical world
• Introducing the various input and output devices
• Real-time demo of Netduino interfacing
• Hands On
IoT for Arduino, NodeMCU and Netduino
• Control LED light using Netduino board
• NodeMCU
• Blynk
Project: Building WSN with MQTT, Raspberry Pi & Arduino
Got a question for us? Please mention it in the comments section and we will get back to you.

0 responses on "IoT (Internet of Things) Project: Google Firebase controlling LED with NodeMCU"

Leave a Message

Your email address will not be published. Required fields are marked *