{"id":16378,"date":"2022-10-26T23:12:10","date_gmt":"2022-10-27T03:12:10","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/?p=16378"},"modified":"2022-10-26T23:12:10","modified_gmt":"2022-10-27T03:12:10","slug":"pomodoro-productivity-phone-stand","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/pomodoro-productivity-phone-stand\/","title":{"rendered":"Pomodoro Productivity Phone Stand"},"content":{"rendered":"<p>I created a phone stand that helps me stay focused when I should be working, making sure I&#8217;m not using my phone by emitting an annoying beep when my phone is not on the phone stand.<\/p>\n<h3>Images + Videos of Project<\/h3>\n<div style=\"width: 620px;\" class=\"wp-video\"><!--[if lt IE 9]><script>document.createElement('video');<\/script><![endif]-->\n<video class=\"wp-video-shortcode\" id=\"video-16378-1\" width=\"620\" height=\"1102\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/final-vid-1.mp4?_=1\" \/><a href=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/final-vid-1.mp4\">https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/final-vid-1.mp4<\/a><\/video><\/div>\n<div id=\"attachment_16417\" style=\"width: 1930px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16417\" loading=\"lazy\" class=\"wp-image-16417 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/prop-scaled.jpg\" alt=\"\" width=\"1920\" height=\"2560\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/prop-scaled.jpg 1920w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/prop-225x300.jpg 225w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/prop-768x1024.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/prop-1152x1536.jpg 1152w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/prop-1536x2048.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/prop-973x1297.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/prop-508x677.jpg 508w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><p id=\"caption-attachment-16417\" class=\"wp-caption-text\">Front view of the phone stand.<\/p><\/div>\n<div id=\"attachment_16416\" style=\"width: 1930px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16416\" loading=\"lazy\" class=\"wp-image-16416 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/prop__scale-scaled.jpg\" alt=\"\" width=\"1920\" height=\"2560\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/prop__scale-scaled.jpg 1920w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/prop__scale-225x300.jpg 225w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/prop__scale-768x1024.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/prop__scale-1152x1536.jpg 1152w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/prop__scale-1536x2048.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/prop__scale-973x1297.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/prop__scale-508x677.jpg 508w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><p id=\"caption-attachment-16416\" class=\"wp-caption-text\">Overall photo for proportion and scale.<\/p><\/div>\n<h3>Detail Photos<\/h3>\n<div id=\"attachment_16410\" style=\"width: 1930px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16410\" loading=\"lazy\" class=\"wp-image-16410 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/detail_3-scaled.jpg\" alt=\"\" width=\"1920\" height=\"2560\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/detail_3-scaled.jpg 1920w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/detail_3-225x300.jpg 225w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/detail_3-768x1024.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/detail_3-1152x1536.jpg 1152w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/detail_3-1536x2048.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/detail_3-973x1297.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/detail_3-508x677.jpg 508w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><p id=\"caption-attachment-16410\" class=\"wp-caption-text\">Detail photo of the electronics on the back of the phone stand.<\/p><\/div>\n<div id=\"attachment_16409\" style=\"width: 1930px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16409\" loading=\"lazy\" class=\"wp-image-16409 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/detail_2-scaled.jpg\" alt=\"\" width=\"1920\" height=\"2560\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/detail_2-scaled.jpg 1920w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/detail_2-225x300.jpg 225w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/detail_2-768x1024.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/detail_2-1152x1536.jpg 1152w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/detail_2-1536x2048.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/detail_2-973x1297.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/detail_2-508x677.jpg 508w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><p id=\"caption-attachment-16409\" class=\"wp-caption-text\">Detail photo of the potentiometer cutout.<\/p><\/div>\n<div id=\"attachment_16411\" style=\"width: 1930px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16411\" loading=\"lazy\" class=\"wp-image-16411 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/detail-scaled.jpg\" alt=\"\" width=\"1920\" height=\"2560\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/detail-scaled.jpg 1920w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/detail-225x300.jpg 225w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/detail-768x1024.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/detail-1152x1536.jpg 1152w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/detail-1536x2048.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/detail-973x1297.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/detail-508x677.jpg 508w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><p id=\"caption-attachment-16411\" class=\"wp-caption-text\">Detail photo of breadboard and Arduino connections.<\/p><\/div>\n<div style=\"width: 620px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-16378-2\" width=\"620\" height=\"1102\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/use-of-the-thing-1.mp4?_=2\" \/><a href=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/use-of-the-thing-1.mp4\">https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/use-of-the-thing-1.mp4<\/a><\/video><\/div>\n<h3>Process<\/h3>\n<p><span style=\"font-weight: 400\">I wouldn\u2019t say that there were significant milestones within the project, as from the beginning I had a good idea of the steps I needed to take. I would say that I broke the project down into smaller parts, however.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400\">First, I got the LCD display to count down values according to a Pomodoro timer. This, in my opinion, was the most challenging part, as my software skills aren\u2019t particularly strong, and I had to manipulate some event timers to get it to work. I combined that with a potentiometer, and I had a changeable Pomodoro display.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400\">Then, I did some wrestling with the IR sensor, and after the hardware challenges I had to figure out with the resistors, and non-functional IR sensors, I included the distance value to my LCD display.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400\">The final step was adding a buzzer, which wasn\u2019t particularly challenging hardware nor software wise, and incorporating my electronics with my laser cut phone stand, which I had completed beforehand.\u00a0<\/span><\/p>\n<h3>Process Images<\/h3>\n<div id=\"attachment_16408\" style=\"width: 1693px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16408\" loading=\"lazy\" class=\"wp-image-16408 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/35ecf0d9418e408db97482f6a1db21ea-0001-scaled-e1666839843318.jpg\" alt=\"\" width=\"1683\" height=\"2233\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/35ecf0d9418e408db97482f6a1db21ea-0001-scaled-e1666839843318.jpg 1683w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/35ecf0d9418e408db97482f6a1db21ea-0001-scaled-e1666839843318-226x300.jpg 226w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/35ecf0d9418e408db97482f6a1db21ea-0001-scaled-e1666839843318-772x1024.jpg 772w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/35ecf0d9418e408db97482f6a1db21ea-0001-scaled-e1666839843318-768x1019.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/35ecf0d9418e408db97482f6a1db21ea-0001-scaled-e1666839843318-1158x1536.jpg 1158w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/35ecf0d9418e408db97482f6a1db21ea-0001-scaled-e1666839843318-1544x2048.jpg 1544w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/35ecf0d9418e408db97482f6a1db21ea-0001-scaled-e1666839843318-973x1291.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/35ecf0d9418e408db97482f6a1db21ea-0001-scaled-e1666839843318-508x674.jpg 508w\" sizes=\"(max-width: 1683px) 100vw, 1683px\" \/><p id=\"caption-attachment-16408\" class=\"wp-caption-text\">Ideation sketches for the laser cutting component of the phone stand.<\/p><\/div>\n<div id=\"attachment_16412\" style=\"width: 1930px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16412\" loading=\"lazy\" class=\"wp-image-16412 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/process_1-scaled.jpg\" alt=\"\" width=\"1920\" height=\"2560\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/process_1-scaled.jpg 1920w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/process_1-225x300.jpg 225w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/process_1-768x1024.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/process_1-1152x1536.jpg 1152w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/process_1-1536x2048.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/process_1-973x1297.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/process_1-508x677.jpg 508w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><p id=\"caption-attachment-16412\" class=\"wp-caption-text\">Trying (unsuccessfully) to get potentiometer + IR sensor + LCD all working in conjunction<\/p><\/div>\n<div id=\"attachment_16413\" style=\"width: 1930px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16413\" loading=\"lazy\" class=\"wp-image-16413 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/process_2-scaled.jpg\" alt=\"\" width=\"1920\" height=\"2560\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/process_2-scaled.jpg 1920w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/process_2-225x300.jpg 225w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/process_2-768x1024.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/process_2-1152x1536.jpg 1152w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/process_2-1536x2048.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/process_2-973x1297.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/process_2-508x677.jpg 508w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><p id=\"caption-attachment-16413\" class=\"wp-caption-text\">Functioning electronics of the IR sensor.<\/p><\/div>\n<h3>Discussion<\/h3>\n<p><span style=\"font-weight: 400\">I would say that overall, I think my project went about as well as I expected it to go.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400\">One critique I received was that the phone stand might be improved if \u201cthe wires and electronics\u00a0 were hidden in some type of enclosure\u201d, and I would say that I definitely agree with that comment, as the back of the phone stand worked, but didn\u2019t look very nice. When I was designing my device, the aesthetics were one of my last considerations, and I simply thought that by hiding all the wires behind the phone stand, to the user, the wiring wouldn\u2019t be too obvious and not that much of a concern. While I think that held true, looking back, when I laser cut my phone stand, I could have easily incorporated some sort of box to store my electronics. Though I don\u2019t expect to make another iteration of this project, if I were to make another phone stand, I would probably include some sort of box to store the electronics behind the phone stand, and I would also recut my cutouts for the LCD display\/potentiometer to the correct measurements. Most of my focus in this project focused on the technical elements of the project, as I thought that my limitations in coding and hardware would make the project a bit challenging for me. With the help of Zach, I learned how to laser cut, and the coding wasn\u2019t as challenging as I thought it would be, as using the event loops and different conditions, I managed to make a semi-working phone stand. Though my code did have bugs, it was mostly functional, so I was quite pleasantly surprised with my skills.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400\">Another comment I received during the critique stated \u201cThe distance sensor was very accurate and the design as simple yet effective\u201d, which I appreciated. Lots of comments commented on the simplicity and cleanliness of my design, and I would also agree with those comments. All in all, I think I learned a lot from this project, as it allowed me to build my skills with software as well as prototyping, and laser cutting. I think the idea I had from the beginning was pretty straightforward, and I had a good vision for what I needed to accomplish and reasonable expectations for myself, which contributed to the successes of my project. <\/span><\/p>\n<h3>Schematic Diagram<\/h3>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-16525 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Electronic-Schematic-Proj-2.jpg\" alt=\"\" width=\"1021\" height=\"981\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Electronic-Schematic-Proj-2.jpg 1021w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Electronic-Schematic-Proj-2-300x288.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Electronic-Schematic-Proj-2-768x738.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Electronic-Schematic-Proj-2-973x935.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Electronic-Schematic-Proj-2-508x488.jpg 508w\" sizes=\"(max-width: 1021px) 100vw, 1021px\" \/><\/p>\n<h3>Block Diagram<\/h3>\n<h3><img loading=\"lazy\" class=\"alignnone wp-image-16526 size-full\" style=\"font-size: 16px\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Proj-2-Block.jpg\" alt=\"\" width=\"852\" height=\"312\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Proj-2-Block.jpg 852w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Proj-2-Block-300x110.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Proj-2-Block-768x281.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Proj-2-Block-508x186.jpg 508w\" sizes=\"(max-width: 852px) 100vw, 852px\" \/><\/h3>\n<h3>Code<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\">\/*\r\n * Pomodoro Productivity Phone Stand\r\n * Frances Adiwijaya\r\n * \r\n * Description: \r\n * \r\n * This code controls the arduino behind a pomodoro phone stand. \r\n * It will display, on an LCD, the work\/break time left in varying\r\n * pomodoro intervals, changeable by a potentiometer. \r\n * It will also use a speaker to beep when the phone is far from an \r\n * IR sensor, and the LCD will display a message to tell the user\r\n * to return the phone to the phone stand\r\n * \r\n * Pin Mapping: \r\n * \r\n * Arduino Pin   |   Description\r\n * ------------------------------\r\n * A0            |   Potentiometer \r\n * A3            |   Infrared Sensor\r\n * 6             |   Buzzer\r\n * SDA           |   SDA pin on LCD\r\n * SCL           |   SCL pin on LCD \r\n * \r\n * Sources: \r\n * \r\n * LCD Code: \r\n * https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/tutorials\/I2C-lcd\r\n * IR Code: \r\n * https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/tutorials\/IR-proximity-sensor\r\n * Event Timer Code: \r\n * https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/tutorials\/code-bites#blink-without-blocking\r\n * Buzzer Code:\r\n * https:\/\/create.arduino.cc\/projecthub\/SURYATEJA\/use-a-buzzer-module-piezo-speaker-using-arduino-uno-89df45\r\n * \r\n *\/\r\n\r\n\/\/import necessary libraries\r\n#include &lt;Wire.h&gt;\r\n#include &lt;LiquidCrystal_I2C.h&gt;\r\n\r\nLiquidCrystal_I2C screen(0x27, 16, 2);\r\n\r\n\/\/ set up the (constant) variables\r\n\/\/ for the mode: work = 0, break = 1, longbreak = 2\r\nint mode = 0;\r\nint breakcount = 0;\r\nunsigned long workTimer = 0;\r\nunsigned long breakTimer = 0;\r\nunsigned long longbreakTimer = 0;\r\nunsigned long updateTimer = 0;\r\nlong UPDATEWAIT = 1000;\r\nconst int POTPIN = A0;\r\nconst int IRPIN = A3;\r\nlong interval = 1000;\r\nlong BREAKWAIT = 0;\r\nlong WORKWAIT = 0;\r\nlong LONGBREAKWAIT = 0;\r\nint breakcounter = BREAKWAIT \/ 1000;\r\nint workcounter = WORKWAIT \/ 1000;\r\nint longbreakcounter = LONGBREAKWAIT \/ 1000;\r\nconst int BUZZERPIN = 6;\r\n\r\n\r\n\/\/ initialize screen and pins\r\nvoid setup() {\r\n  \/\/ put your setup code here, to run once:\r\n  pinMode(POTPIN, INPUT);\r\n  pinMode(IRPIN, INPUT);\r\n  Serial.begin(9600);\r\n  Serial.println(\"starting...\");\r\n  screen.init();\r\n  screen.backlight();\r\n  pinMode(BUZZERPIN, OUTPUT);\r\n\r\n}\r\n\r\nvoid loop() {\r\n  \/\/ check the value of the potentiometer and map it to the time intervals\r\n  unsigned long potVal;\r\n  potVal = analogRead(POTPIN);\r\n  potVal = map(potVal, 0, 1023, 1000, 30000);\r\n  unsigned long breaktime = potVal \/ 5;\r\n\r\n  int distanceVal = analogRead(IRPIN);\r\n  Serial.println(distanceVal);\r\n\r\n  \/\/ create the pomodoro intervals\r\n  BREAKWAIT = breaktime;\r\n  WORKWAIT = potVal;\r\n  LONGBREAKWAIT = breaktime * 4;\r\n\r\n\r\n\r\n  \/\/ put your main code here, to run repeatedly:\r\n  \/\/ if we're in break mode:\r\n  if (mode == 1) {\r\n    \/\/ if the break timer is up enter the statement\r\n    if ((millis() - breakTimer &gt;= BREAKWAIT)) {\r\n      Serial.println(\"switching to work\");\r\n      \/\/ increment the short break count\r\n      breakcount += 1;\r\n      \/\/ reset all timers\r\n      longbreakTimer = millis();\r\n      workTimer = millis();\r\n      breakTimer = millis();\r\n      \/\/ recheck the intervals\r\n      breakcounter = BREAKWAIT \/ 1000;\r\n      workcounter = WORKWAIT \/ 1000;\r\n      longbreakcounter = LONGBREAKWAIT \/ 1000;\r\n      \/\/ switch to work mode\r\n      mode = 0;\r\n    }\r\n    \/\/ update the LCD display every second, and count down\r\n    if ((millis() - updateTimer &gt;= UPDATEWAIT)) {\r\n      screen.clear();\r\n      screen.setCursor(0, 0);\r\n      screen.print(\"break: \");\r\n      breakcounter = breakcounter - 1;\r\n      Serial.println(breakcounter);\r\n      screen.print(breakcounter+1);\r\n      updateTimer = millis();\r\n    }\r\n  }\r\n  \/\/ if we're in work mode:\r\n  if (mode == 0) {\r\n    \/\/ if the work timer is up\r\n    if ((millis() - workTimer &gt;= WORKWAIT)) {\r\n      \/\/check if we're on a break or a long break\r\n      \/\/if next is a longbreak, enter the statement\r\n      if (breakcount &gt; 3) {\r\n        Serial.println(\"switching to longbreak\");\r\n        \/\/ reset all timers\r\n        longbreakTimer = millis();\r\n        workTimer = millis();\r\n        breakTimer = millis();\r\n        breakcounter = BREAKWAIT \/ 1000;\r\n        workcounter = WORKWAIT \/ 1000;\r\n        longbreakcounter = LONGBREAKWAIT \/ 1000;\r\n        \/\/ switch to longbreak mode\r\n        mode = 2;\r\n      }\r\n      \/\/if next is a regular break, enter the statement\r\n      else {\r\n        Serial.println(\"switching to break\");\r\n        \/\/ reset all timers\r\n        longbreakTimer = millis();\r\n        workTimer = millis();\r\n        breakTimer = millis();\r\n        breakcounter = BREAKWAIT \/ 1000;\r\n        workcounter = WORKWAIT \/ 1000;\r\n        longbreakcounter = LONGBREAKWAIT \/ 1000;\r\n        \/\/ switch to break mode\r\n        mode = 1;\r\n      }\r\n    }\r\n    \/\/ if the IR distance sensor registers a value too large, enter the loop\r\n    if ((distanceVal &lt; 200)) {\r\n      \/\/ display a message on the LCD\r\n      screen.clear();\r\n      screen.setCursor(0, 0);\r\n      screen.print(\"Put Phone Back!\");\r\n      Serial.println(\"IR Val\");\r\n      Serial.println(distanceVal);\r\n      \/\/ beep the buzzer\r\n      delay(200);\r\n      tone(BUZZERPIN, 1000); \/\/ Send 1KHz sound signal...\r\n      delay(1000);        \/\/ ...for 1 sec\r\n      noTone(BUZZERPIN);     \/\/ Stop sound...\r\n      delay(1000);        \/\/ ...for 1sec\r\n    }\r\n    \/\/ update LCD to count down every second\r\n    if ((millis() - updateTimer &gt;= UPDATEWAIT)) {\r\n      screen.clear();\r\n      screen.setCursor(0, 0);\r\n      screen.print(\"work: \");\r\n      workcounter = workcounter - 1;\r\n      Serial.println(workcounter);\r\n      screen.print(workcounter);\r\n      updateTimer = millis();\r\n    }\r\n  }\r\n  \/\/ if we're in longbreak mode\r\n  if (mode == 2) {\r\n    \/\/ if the timer is over, enter the statement\r\n    if (millis() - longbreakTimer &gt;= LONGBREAKWAIT) {\r\n      Serial.println(\"switching to work\");\r\n      \/\/ reset the breakcount\r\n      breakcount = 0;\r\n      \/\/ reset all timers\r\n      longbreakTimer = millis();\r\n      workTimer = millis();\r\n      breakTimer = millis();\r\n      breakcounter = BREAKWAIT \/ 1000;\r\n      workcounter = WORKWAIT \/ 1000;\r\n      longbreakcounter = LONGBREAKWAIT \/ 1000;\r\n      \/\/ switch to work mode\r\n      mode = 0;\r\n    }\r\n    \/\/ count down on LCD\r\n    if ((millis() - updateTimer &gt;= UPDATEWAIT)) {\r\n      screen.clear();\r\n      screen.setCursor(0, 0);\r\n      screen.print(\"long break: \");\r\n      longbreakcounter = longbreakcounter - 1;\r\n      Serial.println(longbreakcounter);\r\n      screen.print(longbreakcounter+1);\r\n      updateTimer = millis();\r\n    }\r\n  }\r\n}<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I created a phone stand that helps me stay focused when I should be working, making sure I&#8217;m not using my phone by emitting an annoying beep when&#8230;<\/p>\n","protected":false},"author":227,"featured_media":16416,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[89],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/posts\/16378"}],"collection":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/users\/227"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/comments?post=16378"}],"version-history":[{"count":13,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/posts\/16378\/revisions"}],"predecessor-version":[{"id":16534,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/posts\/16378\/revisions\/16534"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/media\/16416"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/media?parent=16378"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/categories?post=16378"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/tags?post=16378"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}