Arduino Annoying Screen Time Monitor

By:
Posted: 6th May 2020
Category: Arduino
Comments: 0

This is a rather simple project, however I found this to be useful especially when I have been spending much more time in front of a computer screen due to the covid-19 stay at home order. I am sure that someone will tell me that I am re-inventing the wheel and that there are some mobile apps already available that can do this. My response is: I don't want to clutter my smartphone any more + having another physical annoying device connected to my PC sounds like fun. So I want to have a 3D printed enclosure that will hold the arduino nano and the cheap buzzer (they are popular and the pinout is basic as well : GND, VCC, DAT). It will be connected to the back of my PC via USB so it will start the count as soon as I switch the PC on. I will be aiming for 60 minutes of work followed by a 10 minute break - this will be on repeat. You can connect it to your laptop as well... Here is the design (enclosure and the lid) made in Tinkercad:

After I got them both of the printing plate I assembled it all together which took like 2 minutes. Wrote a very basic sketch (available at the very bottom) and uploaded it to the nano. Job done. You can adjust the timings to your liking. I am sticking with my initial figures as I feel that they will work for me just fine. I am also very aware that I could implement a more sophisticated way of measuring the time and avoid using the delay at all. This is a rather simple code so what can go wrong I ask? No need to probe sensors or run a watchdog reset every 7 seconds etc Below here are few pictures of how the assembled unit looks like. The squash ball has been included to add some perspective (no other suitable items found in the household).

const int buzzer = 3; // buzzer is connected to dpin 3

void setup()
{
pinMode(buzzer, OUTPUT);
}

// Super simple code!
void loop(){

// Wait for 60 minutes...
//delay(3600000);

// 5 min demo
delay(300000);

// buzz 3 times to let me know it is break time !!
for (byte i = 0; i < 3; i++)
{
tone(buzzer, 3000); // the pitch of the buzzer
delay(100); // Buzz for 0.1 second
noTone(buzzer); // Stop the buzzer
delay(500); // Wait half a second
}

// Wait for 10 minutes before letting me know that
// it is time to get back to work
//delay(600000);

// 1 minute demo break
delay(60000);

// Get back to work Buzzer!
for (byte i = 0; i < 3; i++)
{
tone(buzzer, 3000); // the pitch of the buzzer
delay(100); // Buzz for 0.1 second
noTone(buzzer); // Stop the buzzer
delay(500); // Wait half a second
}

}

Hey, like this? Why not share it with a buddy?