Easy $5 Smart Lamp With Smartphone Web Interface

About: Raphael | Aspiring Game developer | I am currently learning Python and Arduino, and I believe that the best way to learn is to teach people! I intend to use the programming knowledge to learn C++, which is t...

Intro: Easy $5 Smart Lamp With Smartphone Web Interface

Hi! My name is Raphael. This is my first Instructable! My main motive of creating this lamp is to help the lives of mobility-disadvantaged people. Someday, we won't have switches on walls or hard-to-reach plugs, but rather our smartphones to control everything--and I plan on making that dream a reality. And better yet, to make this accessible to everyone, I have set myself the challenge of making this lamp on as low of a budget as possible.

Step 1: What You'll Need

  1. ESP8266/ NodeMCU ($2.00)
  2. White LED ($0.05)
  3. Red LED ($0.05)
  4. Blue LED ($0.05)
  5. Green LED ($0.05)
  6. Jumper Cable ($0.05)
  7. Breadboard ($1.00)
  8. USB Cable ($1.00)
  9. Phone Charger/ Power Bank (Check the box your smartphone came in.)

Step 2: The Wiring

For this step, connect the LEDs to the power rail of the breadboard.

Red - Pin D2

Blue - Pin D4

Green - Pin D5

White - Pin D7

Jumper Cable - GND

Note that the longer LED pin is the positive terminal and should be connected to the NodeMCU. Your board may look different, but the wiring should remain the same.

Step 3: The Code

Download the Arduino IDE and open up this sketch. The only things you should need to change in the sketch is the name and password of your local WiFi network. Fun fact, the code contains the html and CSS code that the webpage runs on, read the comments in the code for further insight.

You'll need to enter this link in your preferences to allow the IDE to download the ESP8266 libraries:

http://arduino.esp8266.com/stable/package_esp8266com_index.json

After that, navigate to tools > boards > board manager > search for ESP8266 > then add the board to your libraries.

Ensure that your settings follow the same as the last screenshot for best results, before hitting the upload button.

Step 4: Putting It All Together

Open up your serial monitor. If the device is successfully connected, it will display the IP address (it looks something like this: "192.168.00.00"). Enter this IP address into your phone's browser. The web interface should appear on your smartphones' browser.

Now that the basic circuitry is completed, the lamp colours are adjustable to your preferences. Now, you can control the lights from your smartphone. With this, it has the potential to automate other aspects in your home, such as ceiling fans and air conditioning.

I hope you enjoyed this Instructable!

Happy coding!

Share

    Recommendations

    • Audio Contest 2018

      Audio Contest 2018
    • Tiny Home Contest

      Tiny Home Contest
    • Furniture Contest 2018

      Furniture Contest 2018

    Discussions