loading

Make such
application in which LED can be control from mobile or website from any remote location where internet connectivity is available.

Requirement:

1 ) ESP8266-E12 WiFi module as shown in picture. You can get start and setup it with help of this post.

2) Download and install firebase-arduino-master library in Arduino IDE.

3) Need gmail account for create Firebase project.

Step 1: Create Project on Firebase.

Go to firebase console and create new project

https://console.firebase.google.com/?pli=1

Step 2: Add Host Name to Arduino Sketch

Click on Database now you will see the host name show in image

Copy that host name and past in Arduino code given below at line
#define FIREBASE_HOST "fir-app-example.firebaseio.com"

Step 3: Add Database Secrete Key to Arduino Sketch

Go to Setting>Project Setting>SERVICE ACCOUNTS>DATABASE Secretes.
Copy "Database Secrets" Shown in above image.

Copy and paste Database Secrets at the line in code
#define FIREBASE_AUTH "examplesd2asdasdasdasd2asd3asd2asd2as32das3d2as2da3"

Step 4: Add Router Name and Password

Change line with your WiFi router name and password

#define WIFI_SSID "Wifi Router Name"
#define WIFI_PASSWORD "Router Password"

Step 5: Download Following Code in Arduino

#include
#include

// Set these to run example.

#define FIREBASE_HOST "fir-app-example.firebaseio.com"

#define FIREBASE_AUTH "examplesd2asdasdasdasd2asd3asd2asd2as32das3d2as2da3"

#define WIFI_SSID "Wifi Router Name"

#define WIFI_PASSWORD "Router Password"

#define LED 2

void setup() {

pinMode(LED,OUTPUT);

digitalWrite(LED,0);

Serial.begin(9600);

WiFi.begin(WIFI_SSID, WIFI_PASSWORD);

Serial.print("connecting");

while (WiFi.status() != WL_CONNECTED) {

Serial.print(".");

delay(500);

}

Serial.println();

Serial.print("connected: ");

Serial.println(WiFi.localIP());

Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);

Firebase.setInt("LEDStatus",0);

}

void loop() {

if(Firebase.getInt("LEDStatus"))

{

digitalWrite(LED,HIGH);

}

else

{

digitalWrite(LED,LOW);

}

if (Firebase.failed()) // Check for errors {

Serial.print("setting /number failed:");

Serial.println(Firebase.error());

return;

}

delay(1000);

}

Step 6: Restart ESP8266

After reseting ESP8266check serial terminal whether the ESP is get connected with your router and got IP adress.
Goto https://console.firebase.google.com/project/fir-app-9adb8/database/data you can now see the new variable created in database.

Step 7: Change Value of LEDStatus From Database

Double click "LEDStatus" and edit it to 1. instantly (its depends on your internet connection) LED on ESP 8266 module get Turn off.

Step 8: You Can Create Your Own App for Android

If you have knowledge of Android you can create App for control LED from mobile. You need to read Firebase documentation and integration methods.

I created my android app for controlling LED from mobile. As Firebase can be assess from world wide so you have end to end IoT application.

<p>As per your Steps I followed upto Step 4 . In the Step 5 , I<br>just copy the code and paste it in new Sketch File and also I include the<br>Firebase library . When I started to compile means it leaves ERROR in the<br>Program .Please solve this problem ........</p><p>Following Error was coming in my<br>Program</p><p>Arduino: 1.8.3 (Windows 10),<br>Board: &quot;Generic ESP8266 Module, 80 MHz, 40MHz, DIO, 115200, 512K (64K<br>SPIFFS), ck, Disabled, None&quot;</p><p>In file included from<br>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/db/commands.h:5:0,</p><p>from<br>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/db/DatabaseProtocol.h:5,</p><p>from<br>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/SerialTransceiver.h:4,</p><p>from C:\Users\*\Documents\Arduino\sketch_jun20a\sketch_jun20a.ino:7:</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/command.h:13:19:<br>error: expected ')' before '*' token</p><p>Command(Firebase* fbase) :<br>fbase_(fbase) {}</p><p>^</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/command.h:20:3:<br>error: 'Firebase' does not name a type</p><p>Firebase&amp; fbase() {</p><p>^</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/command.h:25:3:<br>error: 'Firebase' does not name a type</p><p>Firebase* fbase_;</p><p>^</p><p>In file included from<br>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/db/DatabaseProtocol.h:5:0,</p><p>from<br>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/SerialTransceiver.h:4,</p><p>from<br>C:\Users\*\Documents\Arduino\sketch_jun20a\sketch_jun20a.ino:7:</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/db/commands.h:14:22:<br>error: expected ')' before '*' token</p><p>GetCommand(Firebase* fbase) :<br>Command(fbase) {}</p><p>^</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/db/commands.h:21:22:<br>error: expected ')' before '*' token</p><p>SetCommand(Firebase* fbase) :<br>Command(fbase) {}</p><p>^</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/db/commands.h:28:25:<br>error: expected ')' before '*' token</p><p>RemoveCommand(Firebase* fbase) :<br>Command(fbase) {}</p><p>^</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/db/commands.h:35:23:<br>error: expected ')' before '*' token</p><p>PushCommand(Firebase* fbase) :<br>Command(fbase) {}</p><p>^</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/db/commands.h:47:27:<br>error: type/value mismatch at argument 1 in template parameter list for<br>'template&lt;class _Tp, class _Dp&gt; class std::unique_ptr'</p><p>std::unique_ptr&lt;Firebase&gt;<br>firebase();</p><p>^</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/db/commands.h:47:27:<br>error: expected a type, got 'Firebase'</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/db/commands.h:47:27:<br>error: template argument 2 is invalid</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/db/commands.h:50:27:<br>error: type/value mismatch at argument 1 in template parameter list for<br>'template&lt;class _Tp, class _Dp&gt; class std::unique_ptr'</p><p>std::unique_ptr&lt;Firebase&gt;<br>new_firebase_;</p><p>^</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/db/commands.h:50:27:<br>error: expected a type, got 'Firebase'</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/db/commands.h:50:27:<br>error: template argument 2 is invalid</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/db/commands.h:<br>In constructor 'firebase::modem::BeginCommand::BeginCommand()':</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/db/commands.h:42:35:<br>error: no matching function for call to<br>'firebase::modem::Command::Command(std::nullptr_t)'</p><p>BeginCommand() : Command(nullptr)<br>{}</p><p>^</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/db/commands.h:42:35:<br>note: candidates are:</p><p>In file included from C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/db/commands.h:5:0,</p><p>from C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/db/DatabaseProtocol.h:5,</p><p>from C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/SerialTransceiver.h:4,</p><p>from C:\Users\*\Documents\Arduino\sketch_jun20a\sketch_jun20a.ino:7:</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/command.h:11:7:<br>note: constexpr firebase::modem::Command::Command()</p><p>class Command {</p><p>^</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/command.h:11:7:<br>note: candidate expects 0 arguments, 1 provided</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/command.h:11:7:<br>note: constexpr firebase::modem::Command::Command(const<br>firebase::modem::Command&amp;)</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/command.h:11:7:<br>note: no known conversion for argument 1 from 'std::nullptr_t' to 'const<br>firebase::modem::Command&amp;'</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/command.h:11:7:<br>note: constexpr<br>firebase::modem::Command::Command(firebase::modem::Command&amp;&amp;)</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/command.h:11:7:<br>note: no known conversion for argument 1 from 'std::nullptr_t' to<br>'firebase::modem::Command&amp;&amp;'</p><p>In file included from C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/db/DatabaseProtocol.h:5:0,</p><p>from C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/SerialTransceiver.h:4,</p><p>from C:\Users\*\Documents\Arduino\sketch_jun20a\sketch_jun20a.ino:7:</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/db/commands.h:<br>At global scope:</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/db/commands.h:55:25:<br>error: expected ')' before '*' token</p><p>StreamCommand(Firebase* fbase) :<br>Command(fbase) {}</p><p>^</p><p>In file included from C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/SerialTransceiver.h:4:0,</p><p>from C:\Users\*\Documents\Arduino\sketch_jun20a\sketch_jun20a.ino:7:</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/db/DatabaseProtocol.h:16:62:<br>error: 'Firebase' is not a type</p><p>std::unique_ptr&lt;Command&gt;<br>CreateCommand(const String&amp; text, Firebase* fbase);</p><p>^</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/db/DatabaseProtocol.h:18:27:<br>error: type/value mismatch at argument 1 in template parameter list for<br>'template&lt;class _Tp, class _Dp&gt; class std::unique_ptr'</p><p>std::unique_ptr&lt;Firebase&gt;<br>fbase_;</p><p>^</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/db/DatabaseProtocol.h:18:27:<br>error: expected a type, got 'Firebase'</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/modem/db/DatabaseProtocol.h:18:27:<br>error: template argument 2 is invalid</p><p>In file included from C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/thing/FireThing.h:6:0,</p><p>from C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/Thing.h:1,</p><p>from C:\Users\*\Documents\Arduino\sketch_jun20a\sketch_jun20a.ino:8:</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/thing/Transcriber.h:50:27:<br>error: type/value mismatch at argument 1 in template parameter list for<br>'template&lt;class _Tp, class _Dp&gt; class std::unique_ptr'</p><p>std::unique_ptr&lt;Firebase&gt;<br>fbase_;</p><p>^</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/thing/Transcriber.h:50:27:<br>error: expected a type, got 'Firebase'</p><p>C:\Users\*\Documents\Arduino\libraries\firebase-arduino-master\src/thing/Transcriber.h:50:27:<br>error: template argument 2 is invalid</p><p>sketch_jun20a:83: error: expected<br>constructor, destructor, or type conversion before '(' token</p><p>delay(1000);</p><p>^</p><p>sketch_jun20a:85: error: expected<br>declaration before '}' token</p><p>}</p><p>^</p><p>exit status 1</p><p>expected constructor, destructor,<br>or type conversion before '(' token</p><p>This report would have more<br>information with</p><p>&quot;Show verbose output during<br>compilation&quot;</p><p>option enabled in File -&gt; Preferences.</p>
<p>After adding the zip library in my arduino IDE i cannot find the following code given in the step 5..</p>
<p>Looks like there's an error with the way the pointer declaration is made in the argument Firebase* at command.h help will be appreciated since I'm not C++ developer. Thanks!</p>
<p>Compilation error at command.h file at Firebase* any ideas why and how to solve? Thank you!</p>
<p>setting /number failed:....T_T..</p>

About This Instructable

1,191views

5favorites

More by dkhairnar:Start Programming ESP3212 With Arduino IDE Arduino 2.4 TFT Touch Screen LCD Interface Gesture Controlled HID Mouse Using STM32 and Accelerometer 
Add instructable to: