Contact me
pomodoro means tomato
I chose it to be Smart Devices for my Work Desk to increase my productivity
I always procrastinate in my tasks because of the not focusing in it
and the pomodoro technique helped me a lot in doing it
so I decided to make one with the arduino.
to know more ,visit THIS LINK
the device will be focused on detecting the user if they are near or not
and decide to continue the timer or not .
to start the timer you press the push button and stay near the timer.
tinker cad for simulation and circuit wiring.
Title of Media
Arduino IDE to write the code and upload it
card board for the enclosure
Components
Ardiuno uno
breadboard
jumpers
220ohm resistor
LEDs
Ultrasonic sensor
I2c lcd
buzzer
first starting with the wiring
I wanted to put some good indicators about the situation
so I added
Output:
1- red led to indicate being in work state >>pin3
2- green led to indicate being at break >>pin4
3- buzzer to tell when the break or the work time end >>pin5
4- I2c lcd to monitor the process and to be user friendly
SDA >>pin A4
SCL >>pinA5
the input here are:
1- the ultrasonic to detect if you are at work or not
trigger >>pin 12
echo >>pin11
2- push button to start the timer >>pin6
Title of Media
for the power supply I didn't need an extra power supply
for the wiring I connected the pins as described before
I unified the power vcc and groun to a single side
both of the ultrasonic sensor and the LCD need vcc and ground
so I connected them on the breadboard
and connected the 2 resistors from the ground to the breadboard
and then the leds and from te led anode to the pins of the arduino
I connected the SDA and SCL of the LCD on A4 A5
the pushbutton terminal to the ground and the other to the pin ,using the arduino internal resistance
and connected the trigger and the echo to the needed pins
after uploading the code and placing my hand near + pushing the button
here is the timer at work
after placing it withing the cardboard
the cardboard enclosure as box
after doing the wiring on tinkercad and determining which pin we will use for what
I started to write the code ,starting with including the needed libraries and definigng our constant values
including <wire.h> and <LiquidCrystal_I2C.h> for the lcd sreen
and defining the type of lcd
then we define the pins in constant values
as it is shown
then we make Boolean variables for true or false states
to determine the timer for the pomodoro and the break
we use unsigned long , because time in millis will be huge so we need a very long variable to store it within
and unsigned as we won't use the negative numbers and to increase the storage of the variable .
and writing UL to determine that every value is unsigned long
""you can search what will happen if we use int variables ""
the "last buttonstate so we can use a single pulse from the push button to start the operation.
including libraries ad defining the cons values
this is the function we will use with the ultrasonic to measure the displacement.
the setup function for setting the pins ,and the lcd.
starting the void loop function
in which we see 2 conditions
one for checking the buttonstate to start the operation when pushed
and one for ensuring that the timer hasn't started yet
and if the both are done it starts the timer
here we change the stat of the button
and add more condition to the code
indicating if the user is nearby or not
making the timer work if close and not when far from the timer.
here we check if the pomodoro is running or not
to start calculating the remaining time and show it on the lcd
weset the cursor to write the values
and show the user if the timer is working or not
and setting the led to work if in work time
and if we are in break time to let the green led work
here we check if the remaining time is 0 ,so we can start the breaktime and if there was a break we end it and tell the user he has finished the pomodoro
the last "else"
is for the ultrasonic condition so if the user is away it pauses the timer until returning
finally this is the buzz function we use at the end of every duration finished
here is the the final outcome
Title of Media
making the timer was a real hustle
I was thinking of using a for loop with delay but discovered that the delay function stops everything till the delay is done ,which is not practical at all
then I found about the millis() which calculates the time from the start of powering the arduino
but then I needed a vey big variable to store it within
when I learned about the long variable type
is was a series of problems which lead to each other and solving it one by one helped to complete the program
arduino forum and reddit were a huge help for me
my final project will use the same concepts
for controlling the
I2c lcd, the buzzers , and led
this was a huge work for the logical thinking skill
and using the lcd and commands
Title of Media