กลับไปหน้ารวมไฟล์
kitchen-timer-b3c132.md

In this project you will learn how to:

  1. Set up a sensor and retrieve values from it.
  2. Create timed events without blocking other code from running.
  3. Produce sound via a buzzer.

Wiring the Modulinos

The Modulino Knob is the primary input for your hourglass. It sets the duration and acts as a start/reset button.

The Modulino Pixels will be used to display the number of minutes selected with the knob. Each minute equals one LED, for every minute added one more LED will light up.

The Modulino Buzzer will be used to give audible feedback so the device notifies you when time is up.

The Modulino Distance is used to control the timer with gestures. Moving your hand close to the sensor will make it act as the button to start and stop the timer.

Wiring diagram

Arrange the Modulino nodes in any order as long as they remain connected via Qwiic cables. It can look like this:

Note: The image shows a UNO R4 board, but any board or shield with a Qwiic connector can be used.

Tidy cables and secure the Modulino nodes so the device is stable. A clean layout makes it easier to debug and nicer to display.

Note: When connecting a Modulino to your board, the orientation and direction do not matter. Just ensure the Qwiic cables are securely and tightly connected. If you need to disconnect the cable, pull gently as close to the connector as possible.

How the project works

  1. Turning the knob updates the LED indicator.
  • Pressing the knob or moving your hand close to the Modulino Movement starts the countdown.
  • LEDs turn off one-per-minute.
  • When the countdown reaches zero, the buzzer sounds.
  • Pressing the knob or moving your hand close to the Modulino Movement when the alarm goes off returns the timer to idle and silences the buzzer.
  • The Modulino Pixels can display 1–24 minutes with blue, green, and red segments.

    1. Minutes 1–8 : blue LEDs light up progressively.
    2. Minutes 9–16 : green LEDs light up progressively.
    3. Minutes 17–24 : red LEDs light up progressively.

    Take the code from the "code" section below and upload it to your board via the Arduino IDE or Arduino Cloud Editor. Make sure you have downloaded the latest board package for the board you are using and the Modulino library if you are using the Arduino IDE.

    State machine

    A state machine organizes the device's behavior into different states so different logic runs depending on what the device is doing. The hourglass needs three states: Idle , Timing , and Alarm .

    The three different states of the device:

    1. Idle : default state, in this state you can set the time.
    2. Timing : the hourglass is counting down.
    3. Alarm : the alarm rings when the countdown ends.

    How to transition between the different states:

    1. Idle → Timing : press the knob while in Idle to start the timer.
    2. Timing → Alarm : when the timer reaches zero.
    3. Alarm → Idle : press the knob to stop the alarm and reset to Idle.

    Optional Expansions

    LED Matrix

    If you are using a UNO R4 board, an animation will play on the board's LED matrix. To get this working, take the animation.h file from the "code" section below and put it in the same folder as the main sketch. You can then see an hourglass animation play on the LED matrix whenever the timer is running.

    Flip to start

    Use Modulino Movement to start the timer by flipping the device like a physical hourglass. In the code there are sections that are commented out, above them it is stated if they are for "Flip to start". If you plug in a Modulino Movement to your Modulino chain and move the sensor it will act as the button to start and stop the timer.

    Conclusion

    You've built a fully working digital hourglass using a Modulino Knob, a Modulino Pixels, a Modulino Buzzer and a Modulino Movement. A device that can read sensor input, use a state machine, manage timed events without blocking the rest of your code, and provide both visual and audible feedback. The project is modular and ready for creative extensions. Enjoy experimenting!


    🛠️ เจาะลึกเบื้องหลังการทำงาน (Deep Dive / Technical Analysis)

    The Arduino Kitchen Timer is a project that transitions directly from the workbench to immediate household use. It is robust, easy to operate, and provides a clear, bright digital readout utilizing the classic TM1637 7-segment display module.

    The TM1637 Shift Mechanism

    Controlling 4 digits (28 individual LEDs) requires a lot of wires. The TM1637 module has a dedicated chip on the back that handles all the heavy lifting.

    • It uses only 2 data pins (DIO and CLK).
    • You load the TM1637Display.h library.
    • Instead of calculating logic gates manually, you just type display.showNumberDecEx(1230, 0b01000000, true); to instantly print 12:30 on the display (complete with the blinking colon in the center!).

    The State Machine (Menubuilding)

    The code relies on three main states:

    1. Setting Mode: The user turns a rotary encoder (or presses Up/Down) to set the starting minutes. The display updates live.
    2. Countdown Mode: Upon pressing "Start," the variable decreases by 1 every second. Math functions (Modulo % 60) convert raw seconds into a Minutes:Seconds format.
    3. Alarm Mode: When the variable hits zero, a Piezo buzzer sounds an aggressive, looping alarm until the user hits the "Stop" button.

    Hardware Needed

    • Arduino Uno/Nano.
    • TM1637 4-Digit Display Display.
    • Push Buttons (x3) or 1 Rotary Encoder.
    • Active 5V Buzzer.

    ข้อมูล Frontmatter ดั้งเดิม

    title: "Kitchen timer"
    description: "Create a timer that can be used to time boiling pasta, board-game turns, or cookies in the oven. Create and explore a playful interface with flashy lights and a buzzer alarm!"
    author: "Arduino_Genuino"
    category: "Home & Automation"
    tags:
      - "Clocks"
      - "Monitoring"
      - "Lights"
    views: 3844
    likes: 5
    price: 2450
    difficulty: "Easy"
    components:
      - "1x Modulino® Distance"
      - "1x Modulino Kitchen timer bundle UNO R4 WiFi"
      - "1x Modulino® Buzzer"
      - "1x Modulino Pixels"
      - "1x Modulino® Knob"
      - "1x Modulino Kitchen timer bundle Nano R4"
    tools: []
    apps:
      - "1x Arduino IDE 2.0"
    downloadableFiles:
      - "https://projects.arduinocontent.cc/9701d45f-90ad-4486-b585-79e4b7a3bb76.ino"
      - "https://projects.arduinocontent.cc/bacc0dec-2435-4b55-85ae-9310e83b5edd.h"
    documentationLinks: []
    passwordHash: "e189b137db24695a980a3ed68f5c7868381ce0efbd325d29cb7bfb636a451115"
    encryptedPayload: "U2FsdGVkX18VwjwFIu6HjnML81gw1Y606AtGivFQ07siyN63sJEcU/nV1on18WUwmXuM8xqQr/xagBfi5OutB85FsqG6f7yY/GObdj5Q3ZMxfJ9n4tU74fCEqjmlZNtDZnUIH3IGOLJ3Xj9e1gmrmKefKxpWW13kZgS7u2N6HFsQKJUOMfWBBTk5O9NnteKP3ScAPoQcF/3Xn2JJHykveTfFddC56oTVA3c0stn/9Pl9W0b7kqDJKS8qqYODwlI6tY9nuDUquUhfbzBKStNFQw=="
    seoDescription: "Build an Arduino Kitchen timer with a fun interface, flashy lights, and a buzzer alarm for cooking or board games."
    videoLinks: []
    heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/kitchen-timer-b3c132_cover.jpg"
    lang: "en"