Time Restrictor

Introduction: Time Restrictor

It's very easy for a lot of us to get off-task during work. And you might set a time, let's say 5 minutes of video or games for a little break, and then you go back to work. But most of the time, you definitely watch more than 5 minutes or even half an hour, like I always do. This instructable is a countdown timer that automatically switches your computer page when the time is up, so that it forces you to go back to work. If you try to switch back to the "entertaining page", it will still force to switch back unless you reset the timer or unplug the power. The 2 things you would be changing will be the time you want to countdown (where to change is noted in the code) and the key you want to press. For example, if your working page is at the right of your entertaining page (video, games, shopping, etc.), you set the pressed key with Ctrl and right arrow key(if you're using Mac).

Step 1: Prepare for Materials

1. Arduino Leonardo board ×1

Available at :

Arduino official store- https://store.arduino.cc/usa/leonardo

Amazon- https://www.amazon.com/Arduino-org-A000057-Arduino...

2. LCD screen ×1

Available at: Amazon- https://www.amazon.com/SunFounder-Serial-Module-Di...

3. Jumper wires (male to female ×4) (male to male ×1)

Available at:

Amazon- https://www.amazon.com/male-female-jumper-wires/s?...

Amazon- https://www.amazon.com/s?k=male+to+male+jumper+wir...

4. Laptop ×1

5. USB cable (usually come with the Leonardo board)

Step 2: Connecting LCD Display

Connect the LCD display to the Arduino board with the four jumper wire (male to female). Counting from up to down, the orders are negative charge, positive charge, SDA, SCL, as shown in the chart.

2 things to notice here, SDA pin and SCL pin are also D2 and D3, so try to avoid using these 2 pins(D2 and D3). Also, the reverse polarity here would burn up the chip, so make sure you double-check the polarity before connecting to power.

Step 3: Connecting D4 Pin

Use the jumper wire (male to male) to connect the D4 pin and GND pin(negative charge).

Step 4: Download LiquidCrystal Arduino Library for I2C LCD Displays

*Skip this step if you have downloaded it before*

Download LiquidCrystal_12C from here https://github.com/marcoschwartz/LiquidCrystal_I2C...

Open up your Arduino software, and click "sketch" > "Include Library" > "Add .ZIP Library" and select the LiquidCrystal_12C you just download.

Step 5: Download the Code

Copy the code for this project from here: https://create.arduino.cc/editor/emilialyc/8bb819b...

Step 6: (Optional) Change the Time and Arrow Key

Here, you can set your time and the key you want to press. Find the grey text on the right where it says "set the time you want to be counting down" and change the number to whatever time you want in seconds.

Find the gray text where it says "press Ctrl key. Code 128 represents Ctrl key (ASCII code)" and replace the number in the parentheses to the code number of the key you want to press.

Step 7: Upload Your Code

Plug the USB cable to the Arduino board and your computer, and upload your code. (You might need an adaptor for Mac) 

Be the First to Share


    • Lamps Challenge

      Lamps Challenge
    • Rice & Grains Challenge

      Rice & Grains Challenge
    • CNC and 3D Printing Contest

      CNC and 3D Printing Contest