How Using Pico To DIY A Running Alarm Clock

edited September 2022 in Projects

Introduction:

When the set alarm time is reached, the alarm clock will blink red and whistle while scrolling forward until you wake up to chase and press the button to turn off his alarm sound! It is annoying, a bit crazy but fun and a gadget guaranteed to get you up on time.

Material preparation:


Pico*1
TM1637 4-Bits Digital Display*1
Red LED*1
Green LED*1
Button*1
Buzzer*1
N20 reduction motor * 2
L9110 motor drive module * 1
Small wooden board * 2
U-shaped motor fixing plate * 2
Wheel * 2
2 AA battery boxes * 1
Bread board * 1
Paper cylinder * 1

Circuit connection:

Manufacturing steps:

Step 1. Burn the program to Pico board.
import tm1637 from machine import Pin,PWM from utime import sleep tm = tm1637.TM1637(clk=Pin(0), dio=Pin(1)) Sec = 40 Min = 29 Hour = 7 state_value = 0 MotorPinA_1A = 10 MotorPinA_1B = 11 MotorPinB_1A = 12 MotorPinB_1B = 13 button = Pin(2, Pin.IN, Pin.PULL_UP) buzzer = PWM(Pin(3)) led_R = Pin(4, Pin.OUT) led_G = Pin(5, Pin.OUT) def setup(): global motorA1 global motorA2 global motorB1 global motorB2 motorA1 = Pin(MotorPinA_1A,Pin.OUT) motorA2 = Pin(MotorPinA_1B,Pin.OUT) motorB1 = Pin(MotorPinB_1A,Pin.OUT) motorB2 = Pin(MotorPinB_1B,Pin.OUT) def playtone(frequency): buzzer.duty_u16(10000) buzzer.freq(frequency) def bequiet(): buzzer.duty_u16(0) def motor(A1,A2,B1,B2): motorA1.value(A1) motorA2.value(A2) motorB1.value(B1) motorB2.value(B2) if __name__ == '__main__': setup() while True: tm.numbers(Hour,Min,colon=True) Sec = Sec + 1 if Sec == 60: Min = Min + 1 Sec = 0 if Min == 60: Hour = Hour + 1 Min = 0 if Hour == 24: Hour = 0 if (Hour == 7 and Min == 30 and Sec == 0): state_value = 1 if (Hour == 7 and Min == 32 and Sec == 0): state_value = 1 if (Hour == 7 and Min == 34 and Sec == 0): state_value = 1 if (Hour == 7 and Min == 36 and Sec == 0): state_value = 1 if button.value() == 0: state_value = 0 if state_value == 1: tm.numbers(Hour,Min,colon=True) led_R.value(1) led_G.value(0) motor(1,0,1,0) playtone(262) sleep(0.5) tm.numbers(Hour,Min,colon=False) led_R.value(0) playtone(393) sleep(0.5) else: led_R.value(0) led_G.value(1) motor(0,0,0,0) bequiet() tm.numbers(Hour,Min,colon=True) sleep(0.5) tm.numbers(Hour,Min,colon=False) sleep(0.5)
Step 2. Cut the paper cylinder into holes for installing TM1637 4-Bits Digital Display, button and 2 LEDs.


Step 3. Install the N20 reduction motor on the wooden boards and connect it to the L9110 motor drive module.


Step 4. Connect the cables according to the wiring diagram.


Step 5. Put the bread board into the paper cylinder, paste the button, TM1637 4-Bits Digital Display and LEDs on the corresponding hole of the paper cylinder, paste the battery box on the outside of the cylinder, paste the wooden boards on both ends of the paper cylinder to install the wheel.


Step6. Install battery to start. When the set alarm time is reached, the alarm clock will blink red and whistle while scrolling forward until you wake up to chase and press the button to turn off his alarm sound.

Click link below to watch video.
https://www.youtube.com/watch?v=YC9jhr9iqqs

Sign In or Register to comment.