Time Restrictor

by Emilialyc0022 in Living > Life Hacks

249 Views, 0 Favorites, 0 Comments

Time Restrictor

Arduino project- 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).

Prepare for Materials

materials.jpg
arduino leonardo board.jpg
lcd screen.jpg
lcd display.jpg
jumper wires.jpg
usb cable.jpg

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)

Connecting LCD Display

Screen Shot 2020-05-23 at 8.39.15 PM.png
connecting lcd front.jpg
connecting lcd back.jpg

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.

Connecting D4 Pin

Screen Shot 2020-05-23 at 8.38.36 PM.png

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

Download LiquidCrystal Arduino Library for I2C LCD Displays

Screen Shot 2020-05-22 at 4.30.11 PM.png

*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.

Download the Code

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

(Optional) Change the Time and Arrow Key

(For Instructables) Changing time and key from Arduino code

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.

Upload Your Code

Arduino project- Time Restrictor

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