Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino Nano and TM1637 Real-Time Clock Display

View and Edit Project In Cirkit DesignerImage of Arduino Nano and TM1637 Real-Time Clock Display

Circuit Documentation

Summary

This circuit involves an Arduino Nano microcontroller interfaced with a TM1637 display module. The Arduino Nano is responsible for fetching the current time from an RTC (Real-Time Clock) module and displaying it on the TM1637 display. The connections between the Arduino Nano and the TM1637 display are established through specific digital pins.

Component List

Arduino Nano

TM1637

Wiring Details

Arduino Nano

TM1637

Code Documentation

/*
 * This Arduino sketch displays the current time on a TM1637 display module.
 * The TM1637 is connected to the Arduino Nano as follows:
 * - CLK (TM1637) -> D10 (Arduino Nano)
 * - DIO (TM1637) -> D9 (Arduino Nano)
 * - VCC (TM1637) -> 5V (Arduino Nano)
 * - GND (TM1637) -> GND (Arduino Nano)
 */

#include <TM1637Display.h>
#include <Wire.h>
#include <RTClib.h>

#define CLK 10 // Define the clock pin
#define DIO 9  // Define the data pin

TM1637Display display(CLK, DIO);
RTC_DS3231 rtc;

void setup() {
  display.setBrightness(0x0f); // Set the display to maximum brightness
  if (!rtc.begin()) {
    display.showNumberDec(8888); // Show error if RTC is not found
    while (1);
  }
  if (rtc.lostPower()) {
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // Set RTC to compile time
  }
}

void loop() {
  DateTime now = rtc.now();
  int displayTime = now.hour() * 100 + now.minute();
  display.showNumberDecEx(displayTime, 0b01000000, true); // Display time with colon
  delay(1000); // Update every second
}

This code initializes the TM1637 display and the RTC module. In the setup function, the display brightness is set, and the RTC is initialized. If the RTC has lost power, it is reset to the compile time. The loop function continuously fetches the current time from the RTC and displays it on the TM1637 display, updating every second.