Control Devices Over Internet Through Browser. (IoT)
by Harsh Dethe in Circuits > Microcontrollers
9080 Views, 19 Favorites, 0 Comments
Control Devices Over Internet Through Browser. (IoT)
![Screenshot (134)-01.jpeg.jpg](/proxy/?url=https://content.instructables.com/FEV/MEG2/JM0V47TX/FEVMEG2JM0V47TX.jpg&filename=Screenshot (134)-01.jpeg.jpg)
In this Instructable I will be showing you how you can control devices like LEDs, Relays, motors etc. over the internet through web-browser. And you can access the controls securely over any device. The web platform I used here is RemoteMe.org visit the page to know more about it.
Make sure to refer to images which will help you better understand the process.
So lets get started.
Things You Will Need :-
![nodepic.jpg](/proxy/?url=https://content.instructables.com/FXA/INHY/JM0V46ER/FXAINHYJM0V46ER.jpg&filename=nodepic.jpg)
![led.JPG](/proxy/?url=https://content.instructables.com/FQL/MGJX/JM0V46F9/FQLMGJXJM0V46F9.jpg&filename=led.JPG)
![push.jpg](/proxy/?url=https://content.instructables.com/FM1/QUEM/JM0V46JV/FM1QUEMJM0V46JV.jpg&filename=push.jpg)
![bb.jpg](/proxy/?url=https://content.instructables.com/F2C/1EPI/JM0V46R4/F2C1EPIJM0V46R4.jpg&filename=bb.jpg)
For this project you will need :-
- ESP8266 (NodeMCU)
Link for US
Link for Europe - LED
Link for US
Link for Europe - Push Button
Link for US
Link for Europe - Breadboard.
Link for US
Link for Europe
Software :-
- Arduino IDE
- Account on RemoteMe.
Note that you can use an Arduino or Raspberry-pi for the project if you don't have NodeMCU.
Setting Up the Arduino IDE :-
![Screenshot (115).png](/proxy/?url=https://content.instructables.com/FL0/H31M/JM0V43CN/FL0H31MJM0V43CN.png&filename=Screenshot (115).png)
![Screenshot (117).png](/proxy/?url=https://content.instructables.com/FW7/KXSV/JM0V43BE/FW7KXSVJM0V43BE.png&filename=Screenshot (117).png)
![Screenshot (118).png](/proxy/?url=https://content.instructables.com/F1A/UGM5/JM0V43BF/F1AUGM5JM0V43BF.png&filename=Screenshot (118).png)
First to work with NodeMCU Esp8266 you have to add the boards into IDE if you haven't done it already, check out this Instructable here.
After the Boards are available on IDE there are some libraries needed for this project.
To install these libraries :-
- Open IDE and Goto >> Sketch >> Include Library >> Manage Libraries. A popup window should appear. Here you will Search for the required Libraries.
- List of Libraries :-
- RBD_Timer.h
- RBD_Button.h
- RemoteMe.h
- ESP8266WiFi.h
- ESP8266WiFiMulti.h
- ArduinoHttpClient.h
Install these one by one and restart the IDE when done.
With that the IDE is ready for use.
Setting Up Page on RemoteMe:-
![Screenshot (122).png](/proxy/?url=https://content.instructables.com/F4D/E4HB/JM0V3XT8/F4DE4HBJM0V3XT8.png&filename=Screenshot (122).png)
![Screenshot (124).png](/proxy/?url=https://content.instructables.com/F9N/3PZJ/JM0V3XT5/F9N3PZJJM0V3XT5.png&filename=Screenshot (124).png)
![Screenshot (125).png](/proxy/?url=https://content.instructables.com/F78/57NJ/JM0V3XZ3/F7857NJJM0V3XZ3.png&filename=Screenshot (125).png)
![Screenshot (126).png](/proxy/?url=https://content.instructables.com/F7H/3U9L/JM0V3XZ4/F7H3U9LJM0V3XZ4.png&filename=Screenshot (126).png)
![Screenshot (127).png](/proxy/?url=https://content.instructables.com/FXU/ZJJ6/JM0V3XZ2/FXUZJJ6JM0V3XZ2.png&filename=Screenshot (127).png)
![Screenshot (128).png](/proxy/?url=https://content.instructables.com/FYQ/0XEC/JM0V3YBD/FYQ0XECJM0V3YBD.png&filename=Screenshot (128).png)
![Screenshot (130).png](/proxy/?url=https://content.instructables.com/FSD/TS3C/JM0V3Y9Y/FSDTS3CJM0V3Y9Y.png&filename=Screenshot (130).png)
![Screenshot (131).png](/proxy/?url=https://content.instructables.com/F51/A68Q/JM0V3YAF/F51A68QJM0V3YAF.png&filename=Screenshot (131).png)
![Screenshot (132).png](/proxy/?url=https://content.instructables.com/FUH/IKLO/JM0V3YAW/FUHIKLOJM0V3YAW.png&filename=Screenshot (132).png)
For using RemoteMe first you have to signup so you can create your own web pages and start controlling devices.
- Goto RemoteMe.org click on "Application" , Goto Signup and enter your details and hit signup
- You will be greeted with a welcome page, Now to the Left side in the menu select "Devices".
- On the right side you will see an option named "New device" , Clicking on it will give you a drop down menu , Here select "New Web Page".
- Now give a name and Device ID, I have named it 'LED' and given Device ID '203'. (The device ID is the unique number that will distinguish between different devices.)
- Make sure the toggle is set to 'active' and hit 'submit'. A new device named LED with device ID 203 will appear on the page. Now select the down arrow at the right side of the device and you will see an empty slot where you can create webpages.
- Goto this GitHub page. You have to drag three files (index.html, scripts.js & styles.css) and drop them one by one into the empty slot in your device and you are done.
Uploading Code on MCU:-
![Screenshot (133).png](/proxy/?url=https://content.instructables.com/FI8/ZT7H/JM0V3YYM/FI8ZT7HJM0V3YYM.png&filename=Screenshot (133).png)
Below I have provided the code you require to make the project work.
Before you can upload the code, there are some minor changes you have to make in the code.
Once the code is open in the IDE you have to enter your WiFi name and password in the required field so the board can connect to your network.
Make Changes on the following part of the code :- #define WIFI_NAME "Enter your WiFi name" #define WIFI_PASSWORD "Enter your WiFi password" #define DEVICE_ID 203 #define DEVICE_NAME "LED" #define TOKEN "Enter Authentication Token"
To get the Authentication token Goto Remoteme.org >> Applications >> Tokens (In the menu on Left side bellow Devices)
Copy the Token and paste it in the code.
Now connect your NodeMCU to your PC , Select the right port and upload the code.
Downloads
Connections :-
![Screenshot (134).png](/proxy/?url=https://content.instructables.com/FME/65XS/JM0V3PKF/FME65XSJM0V3PKF.png&filename=Screenshot (134).png)
Follow the picture above to make connections:-
The LED is connected to Pin D5 of the MCU.
The push button is connected to Pin D2.
Use a resistor in series with LED to prevent damage to LED.
Testing :-
![arduino diode demo](/proxy/?url=https://content.instructables.com/FKM/697Y/JM0V3PMG/FKM697YJM0V3PMG.jpg&filename=arduino diode demo)
![Screenshot (123).png](/proxy/?url=https://content.instructables.com/F1Q/M9LR/JM0V40NU/F1QM9LRJM0V40NU.png&filename=Screenshot (123).png)
![Screenshot (136).png](/proxy/?url=https://content.instructables.com/FGB/QSM6/JM0V40NS/FGBQSM6JM0V40NS.png&filename=Screenshot (136).png)
![Screenshot (138).png](/proxy/?url=https://content.instructables.com/FEG/2TKG/JM0V40X3/FEG2TKGJM0V40X3.png&filename=Screenshot (138).png)
![Screenshot (139).png](/proxy/?url=https://content.instructables.com/FA2/HHGH/JM0V410T/FA2HHGHJM0V410T.png&filename=Screenshot (139).png)
![Screenshot (137).png](/proxy/?url=https://content.instructables.com/FGU/379F/JM0V40NT/FGU379FJM0V40NT.png&filename=Screenshot (137).png)
Now you have successfully completed the project. It is time to test the build.
- First to check if the connections are right, Press the push-button and you should see the LED turn On, Pressing the button again will turn off the LED.
- Now head over to the RemotMe website and open your application. login using the account with which you signed in.
- Now goto Devices and select the device you just created. Notice the Connection link symbol on the left side befor device ID has turned green which indicates that the ESP board is connected to the server.
- Now click on the "index.html" file and select "open in new tab", in a new tab a web page will appear with a circle. You can click on the circle to turn on and off the LED.
- To control your LED using smartphone. Again go to the device page and click on "index.html". This time select the ,last option "Get anonymous link...", A pop-up window will appear with with a link you can open in any smartphone to control the LED without having to login every time.
- Even better option, you can select the QR option right next to the link. And scan the QR using your Android or iPhone and you will be redirected to the web page with circle.
Checkout the video demo to see how it works.
Hope you like the project, If you have any questions feel free to ask in the comments.
Thank You.