Study Better With a Smart Desk Lamp - IDC2018IOT




Introduction: Study Better With a Smart Desk Lamp - IDC2018IOT

People in the western world spend a lot of time sitting. At the desk, driving around, watching TV and more. Sometimes, sitting too much can harm your body and harm your focusing abilities. Walking and standing up after a given time is crucial to perform better in life.

As students we spend a lot of time studying. Trying to come up with a cool project, we thought about the pains that we have in the studying process. We believed that there must be a better way to manage studying habbits in a nicer way than only through apps and notifications.

We came up with an idea of creating a smart desk lamp which could help you schedual your time, be aware of how much you've studied, and schedule your breaks. The smart lamp comes with colorful LED colors which change according to the state. Our lamp contains three option:

1. Pomodoro mode

The pomodoro technique is a productivity study technique for maximizing effiecieny while studying.

You can read more about the technique here

The user defines the length of the study and break time, with defaults of 25/5 minutes study/break time.

During study mode, the lamp will provide strong warm-white light and puts your phone on silence mode.

After the defined time has passed, the phone will be unmuted and the lamp will show red color which indicates that it is break time. We chose red because it's not a peasant study light, encouraging you to stand up and leave your desk :)

2. Chill mode

The lamp is colored in a pleasant and comfortable light to create a nice ambient lighting.

3. Interactive timer lighting

The lamp starts at a starting color and changes color the longer you sit at your desk. This is a nice indication when people sit for 1-2 hours and more and dont want to time themselves with Pomodoro. It's a nice and different alternative to looking at your watch :)

Additional Features

- Daily sitting time measurement

The app gives you the overall time you've spent at your desk

- Energy saving based on motion

A motion sensor detects movement, turning the lamp off after a given time of absence.

- Muting and unmuting your phone.

A feature to help you concentrate in pomodoro mode.

Challenges and limitations

When we can to think about the project, we found it very confusing to find an object or another means of conveying the message. We wanted to use lighting as a way of interaction, but weren't sure as to where should we place it.

We though of creating a room lighting, maybe to mount the LED strip on the desk, but these options turned out to be a bit cheesy and ineffective. Additionaly, we thought of creating a cute figure or a pretty object to be the light feedback, but ended up using a desk lamp, which is quite logical decision :)

Another limitiatin the wiring. We are using a PIR sensor and an ultrasonic sensor, both are communicating via wires with the NodeMCU board. This creates a quite cumbersome look to the whole system. A future improvement is to create a case where the board and the ultrasonic sensors are already mounted in the lamp, and the PIR sensor communicates via Bluetooth, without having to strech a long cable up the wall.

The sytem is currently limited to supporting only Android users with muting an unmuting the phone, as Apple doesnt provide such a service via IFTTT.

Step 1: Components


- NodeMCU Board with Wifi connection

Used as the main board for the system. We used this board as it has easy Wifi connection to be used with Blynk

- Ultrasonic Sensor HC-SR04

We use the sensor to know whether you're sitting at your desk. The sensor is aimed at the chair, so that when someone is sitting we can detect it by his distance from the sensor

- PIR Motion Sensor

The motion sensor is hung above the desk, to know whether someone is in the room. If no movement has been detected for X minutes, we turn off the LEDs to save energy

- 5m RGB LED Strip

Used as a light source, taped inside the lamp head mount.

- A desk lamp with a light bulb mount

We need a lamp where the LED strip can be mounted inside. usually, old desk lamp that use light bulbs are a perfect fit.


- Blynk application

Used as the controlling app for the system. Chosen for its ease of use and fast ramp up



Used to mute and unmute your phone with Webhooks and Android services.

Step 2: Connecting the Sensors

PIR Sensor

The three wires with female connectors.

Connect the PIR sensor to 5v VCC, ground and a middle wire as the data wire.

Connect the data wire to pin D5 in NodeMCU

Ultrasonic sensor
Connect the ultrasonic sensor to a small matrix and connect the left most pin to ground and right most pin to 5v vcc.

Connect the trigger pin to D1 and the echo pin to D2 in NodeMCU.

Step 3: Connecting the Led Strip

We took a 3 meters led strip.

First we need to connect the led strip wires. The led strip has two different connectors.

One goes to the ESP and one to external auxiliary power source.Take a 5v power source (a mobile USB charger is a great option). Solder the two Vcc and Ground wires to the external power source cable.

Connect to the board the data cable (the middle one) to pin D4. Then, connect the other ground wire to ground.

We remain with an unused power cable, that's ok.

Next we need to elegantly wrap the LED strip inside using the glue the LED strips comes with originally. If needed you could tape it with an extra tape as we did.

Step 4: Mounting Everything Together

Place the PIR sensor so that it faces the whole room. If needed you could use an unused ethernet cable internal wires. We soldered the 3 cables going through the sensor to the Ethernet cable.

Set the ultrasonic sensor on the lamp so it faces the chair and could see if someone is sitting at the chair or not.

Connect the LED strip auxliary power.

Step 5: The Code

The Top level .ino file is final_project.ino

Open it with the Arduino editor, and the rest will open in different tabs, just make sure they are in the same folder.

Attached are also the arduino editor definitions.

Parameters you might want to change:

#define MAX_DISTANCE 80

The distance in cm between the sensor and the person sitting. Below this number the system will consider it sitting.

// Blynk Wifi and Auth Details
char auth[] = "2b183af4b6b742918d14ab766fbae229";

char ssid[] = "NETWORK_NAME"; char pass[] = "PASSWORD";

Step 6: Creating IFTTT Applets

In order to mute and unmute the phone on breaks, you have to create a personal applet in IFTTT.

Follow the following steps to create a webhook based IFTTT applet which can mute your phone.

This works only for Android device, and you have to install to IFTTT app on your device, giving it also permissions to access your ringtone volume.

After you create your applets, both for Mute and Unmute, go to this page and replace the key you see in the Blynk webhooks, under General tab with the given keys here.

Step 7: Our Blynk Application

Our Blynk application contains two tabs.

The first tabs lets you see the number of pomodoros you studied today on the LCD screen, lets you choose the study and break times and lets you switch between the different study modes.

The second tab gives you the total study time (total sitting time) and contains the webhooks used to mute and unmute your phone.

Use the QR code to access the app and use it

Step 8: Seeing Everything in Action!

- Connect the Aux LED strip power to the power.

- Connect the NodeMCU board to a power source

- Enter your blynk application.

- The lamp starts from the Chill mode, and should show the lights on if Wifi has connected correctly.

- Enter Blynk and try switching to Pomodoro mode, currently the initial default is quite fast just to see that it works, but change the slider values in the application to set it to the true time.

- Use the application to switch between study mode and see after some time how longs you've been sitting.

Happy studying!!! :)

Step 9: Future Features

There are many ways you can take this project forward and customize it. In the time limitation we had we implemented only the above features, but here are some cool ideas to take it to a new level.

1. Add study habbits analytics

As we know you sitting habbits, we can recommend you on optimal study times and optimal break times. This can be done with analyzing the sitting times with machine learning algorithm, suggesting the user how he should study better. The amount of effort to create a good algorithm can take between weeks and months, to get to a good working output.

2. Add interaction via notifications

We can notify via phone when the break has ended, send a daily summary message with your performance, give your tips and suggestions and more. approx. 2 work days

3. Change light color and intensity based on time of day - like Flux computer addon

Make the light color warmer or colder depending on the time of day.

Additionally, add a light sensor that knows how bright the surrounding it, to change the intesity of the LED strip to prevent glare.

This can be done in approx. 1 work day.

4. Add Alexa or Google Home Assitant support

Currently to project and the study modes interact only via the lightings. This can be changed and used with a home assitant, to get another type of feedback. Integrating Alexa or Google Home demands creating a dedicaed app to it, and probably using another IFTTT service.

Depending on the complexity of the Voice control app, this can be completed withing 2-3 work days.

5. Mount the LED strip as room ambient lighting instead of just desk lamp

Can be used to create ambient lighting, in addition to being a study assitant. We can add mood lights, light based alarm clock and much more.

about 1-2 work days

Step 10: Build It Yourself!

If you liked the idea and want to create it yourself, getting everything you need is exremely simple.

We've attached a list with the product we used for this project, to my life easier

- NodeMCU Board with Wifi connection

- Ultrasonic Sensor HC-SR04

- PIR Motion Sensor

- 5m RGB LED Strip

- A desk lamp with a light bulb mount

Be the First to Share


    • Puzzles Challenge

      Puzzles Challenge
    • Lamps Challenge

      Lamps Challenge
    • CNC and 3D Printing Contest

      CNC and 3D Printing Contest



    Question 4 years ago on Step 3

    Can u help me out in connecting these wire of my rgb stripe...
    Iam confused how to do it


    4 years ago

    Cool lamp idea! As a student, I need this!


    Reply 4 years ago

    Thanks buddy! As someone who studies a lot with the pomodoro technique I found it useful as well :)

    I like having different types of interactions, and having a light feedback is really cool