Arduino Tea Bag Timer
Do you want to make a perfect tea? Checkout this project!
Components and supplies
1
Wood
1
SG90 Micro-servo motor
1
Arduino Nano R3
1
TM1637 Display
Tools and machines
1
Multitool, Screwdriver
Project description
Code
Arduino Tea Bag Timer
arduino
Want to make a perfect tea?
1/* 2 * Carlo Stramaglia 3 * https://www.youtube.com/c/CarloStramaglia 4 5 * This is the Arduino Tea Bag Timer. 6 * Once you setup the time you want your 7 tea to stay in the water, the arm will automatically dip and release the tea bag. 8 9 * October 31st 2021 10 */ 11 12#include <Servo.h> 13#include <TM1637.h> 14#include 15 "OneButton.h" 16 17Servo myservo; 18 19int minutes=00; 20int seconds=0; 21int 22 i=0; 23 24// Display Pins configurations 25// Pin 3 - > DIO 26// Pin 2 - > CLK 27TM1637 28 tm1637(2, 3); 29 30// Push Button PIN definition 31#define PIN_INPUT A2 32 33OneButton 34 button(PIN_INPUT, true); 35 36 37void setup() { 38 Serial.begin(115200); 39 40 Serial.println("Arduino Tea Bag Timer sketch. Carlo Stramaglia https://www.youtube.com/c/CarloStramaglia"); 41 42 myservo.attach(9); 43 myservo.write(90); 44 tm1637.init(); 45 tm1637.setBrightness(5); 46 47 button.attachClick(singleClick); 48 button.attachDoubleClick(doubleClick); 49 50 button.attachLongPressStart(longPressStart); 51 tm1637.clearScreen(); 52 tm1637.colonOn(); 53 54 tm1637.display("0000"); 55 tm1637.colonOn(); 56 delay(100); 57} 58 59void 60 loop() { 61 button.tick(); 62 delay (10); 63} 64 65void singleClick() 66{ 67 68 Serial.println("x1"); 69 minutes++; 70 Serial.println(minutes); 71 if 72 (minutes < 10) 73 tm1637.display(minutes,1,0,1); 74 else 75 tm1637.display(minutes); 76 77 delay(100); 78} // singleClick Add minutes 79 80 81void doubleClick() 82{ 83 84 Serial.println("x2"); 85 if (minutes == 0) return; 86 for (i=90;i>30;i--) 87 88 { 89 myservo.write(i); 90 delay (100); 91 } 92 minutes--; 93 for 94 (minutes ; minutes >= 0; minutes--) { 95 for (int seconds = 59; seconds 96 >= 0; seconds--) { 97 if (minutes < 10 && minutes >0) 98 tm1637.display(seconds 99 + minutes*100,1,0,1); 100 else if (minutes == 0 && seconds >=10) 101 102 tm1637.display(seconds + minutes*100,1,0,2); 103 else if 104 (minutes == 0 && seconds < 10) 105 tm1637.display(seconds + minutes*100,1,0,3); 106 107 else 108 tm1637.display(seconds + minutes*100); 109 110 tm1637.switchColon(); 111 delay(1000); 112 } 113 114 } 115 for (i=30;i<90;i++) 116 { 117 myservo.write(i); 118 delay 119 (100); 120 } 121 tm1637.colonOn(); 122 tm1637.display("0000"); 123 minutes 124 = 0; 125 tm1637.colonOn(); 126 delay(100); 127 128} // doubleClick Timer Start 129 130void 131 longPressStart() 132{ 133 Serial.println("long Press"); 134 minutes = 0; 135 136 tm1637.colonOn(); 137 tm1637.display("0000"); 138 tm1637.colonOn(); 139 delay(100); 140 141} // longPressStart Timer Reset 142
Arduino Tea Bag Timer
arduino
Want to make a perfect tea?
1/* 2 * Carlo Stramaglia 3 * https://www.youtube.com/c/CarloStramaglia 4 * This is the Arduino Tea Bag Timer. 5 * Once you setup the time you want your tea to stay in the water, the arm will automatically dip and release the tea bag. 6 * October 31st 2021 7 */ 8 9#include <Servo.h> 10#include <TM1637.h> 11#include "OneButton.h" 12 13Servo myservo; 14 15int minutes=00; 16int seconds=0; 17int i=0; 18 19// Display Pins configurations 20// Pin 3 - > DIO 21// Pin 2 - > CLK 22TM1637 tm1637(2, 3); 23 24// Push Button PIN definition 25#define PIN_INPUT A2 26 27OneButton button(PIN_INPUT, true); 28 29 30void setup() { 31 Serial.begin(115200); 32 Serial.println("Arduino Tea Bag Timer sketch. Carlo Stramaglia https://www.youtube.com/c/CarloStramaglia"); 33 myservo.attach(9); 34 myservo.write(90); 35 tm1637.init(); 36 tm1637.setBrightness(5); 37 button.attachClick(singleClick); 38 button.attachDoubleClick(doubleClick); 39 button.attachLongPressStart(longPressStart); 40 tm1637.clearScreen(); 41 tm1637.colonOn(); 42 tm1637.display("0000"); 43 tm1637.colonOn(); 44 delay(100); 45} 46 47void loop() { 48 button.tick(); 49 delay (10); 50} 51 52void singleClick() 53{ 54 Serial.println("x1"); 55 minutes++; 56 Serial.println(minutes); 57 if (minutes < 10) 58 tm1637.display(minutes,1,0,1); 59 else 60 tm1637.display(minutes); 61 delay(100); 62} // singleClick Add minutes 63 64 65void doubleClick() 66{ 67 Serial.println("x2"); 68 if (minutes == 0) return; 69 for (i=90;i>30;i--) 70 { 71 myservo.write(i); 72 delay (100); 73 } 74 minutes--; 75 for (minutes ; minutes >= 0; minutes--) { 76 for (int seconds = 59; seconds >= 0; seconds--) { 77 if (minutes < 10 && minutes >0) 78 tm1637.display(seconds + minutes*100,1,0,1); 79 else if (minutes == 0 && seconds >=10) 80 tm1637.display(seconds + minutes*100,1,0,2); 81 else if (minutes == 0 && seconds < 10) 82 tm1637.display(seconds + minutes*100,1,0,3); 83 else 84 tm1637.display(seconds + minutes*100); 85 tm1637.switchColon(); 86 delay(1000); 87 } 88 } 89 for (i=30;i<90;i++) 90 { 91 myservo.write(i); 92 delay (100); 93 } 94 tm1637.colonOn(); 95 tm1637.display("0000"); 96 minutes = 0; 97 tm1637.colonOn(); 98 delay(100); 99 100} // doubleClick Timer Start 101 102void longPressStart() 103{ 104 Serial.println("long Press"); 105 minutes = 0; 106 tm1637.colonOn(); 107 tm1637.display("0000"); 108 tm1637.colonOn(); 109 delay(100); 110} // longPressStart Timer Reset 111
Downloadable files
Arduino Tea Bag Timer
What to make a perfect tea? This is the way!
Arduino Tea Bag Timer
Comments
Only logged in users can leave comments