From Waveshare Wiki
Revision as of 07:45, 9 August 2022 by Eng52 (talk | contribs) (→‎Demo)
Jump to: navigation, search

Rectangle Electronic Clock For Raspberry Pi Pico
Accurate RTC, Multi Functions, LED Digits





The Pico-Clock-Green is an LED digit electronic clock designed for Raspberry Pi Pico. It incorporates high-precision RTC chip DS3231, I2C communication interface, photosensor, buzzer, and buttons, and features multiple functions including an accurate electronic clock, temperature display, auto-brightness adjustment, alarm, and button config. The important part is that rich open-source codes and development tutorials are also provided to help you fast get started with Raspberry Pi Pico and make your own original electronic clock.


  • Standard Raspberry Pi Pico header, supports Raspberry Pi Pico series.
    • Onboard high precision RTC chip DS3231, with backup battery holder, maintains accurate timekeeping when main power is off.
    • Real-Time Clock Counts Seconds, Minutes, Hours, Date of the Month, Month, Day of the Week, and Year with Leap-Year Compensation Valid Up to 2100.
    • Optional format: 24-hour OR 12-hour with an AM/PM indicator.
    • 2 x programable alarm clock.
    • Digital temperature sensor output: ± 3°C accuracy.
  • Onboard two SM16106 LED display driver chips and one SM5166PLED display control chip on board, which are used to control the display of 8 x 24 matrix LEDs.
  • Embedded photosensor for auto brightness adjustment due to the ambient light, power saving, and eye care
  • Embedded buzzer for alarm or hourly ring, etc.
  • 3 x buttons for configuration.
  • Comes with development resources and manual (Raspberry Pi Pico C/C++ and MicroPython examples).


  • Operating Voltage: 3.3V~5V
  • Backup battery voltage: 2.3V ~ 5.5V
  • Operating temperature: -40°C ~ +85°C
  • Power consumption: 100nA

Product Size


Setup environment

1. For the Raspberry Pi environment setting, please refer to link.
2. For the Windows environment setting, please refer to link.
Related resource: Raspberry Pi Pico C/C++ SDK Manual

Raspberry Pi

  • Open a terminal of Raspberry Pi by SSH or press Ctrl+Alt+T at the same time while using the screen to open the terminal.
  • Download and unzip the demo codes to the directory Pico C/C++ SDK. Reference for users who have not yet installed the SDK.
#Note that the directory of SDK may be different for different users, you need to check the actual directory. Generally, it should be ~/pico/.
wget  -P  ~/pico   https://files.waveshare.com/upload/a/ab/Pico-Clock-Green.zip
cd  ~/pico  
unzip Pico-Clock-Green.zip 


  • Hold the BOOTSEL button of Pico, and connect the USB interface of Pico to Raspberry Pi then release the button.
  • Compile and run the LCD1602-RGB-Module-demo examples.
cd ~/pico/Pico-Clock-Green/build/
cmake ..
sudo mount /dev/sda1 /mnt/pico && sudo cp Pico-Clock-Green.uf2 /mnt/pico/ && sudo sync && sudo umount /mnt/pico && sleep 2


  • Download and unzip the demo to your Windows desktop, refer to Raspberry Pi's guides to set up the Windows software environment settings.
  • Find the Pico-Clock-Green.uf2 file under the build file under the demo directory, press and hold the BOOTSEL button of Pico, connect the USB of Pico to the PC with a MicroUSB cable, and drag the uf2 file into Pico, and then the Pico will run the demo directly.
  • 【Note】 If some users want to modify the demo, after debugging, you can use the following method to generate a .uf2 file:

1. Copy the Pico-Clocd-Green folder to your pico-examples file directory, and then modify the CMakelists.txt configuration file in the pico-example directory as shown in the figure below.
2. Open Visual Studio Code, open your pico-examples folder, select Pico-Clocd-Green, and click Generate, you can find the Pico-Clock-Green.uf2 file in the build folder.
3. Arag the uf2 file into Pico, and then Pico will run the demo directly.



Demo Function Descroption

  • Time display interface: The week, hour, and minute can be displayed under the time display interface, supporting the 12/24 hour format.
  • Status bar: The status bar can display the Scroll switch, Alarm switch, Countdown, Temperature (Celsius/Fahrenheit), Timing, Hourly ring, Automatic brightness, and the AM/PM status display will be turned on when the 12-hour clock is displayed.
  • Scrolling display: After the scrolling is turned on, it will scroll every three minutes, and the scrolling will display the year, month, day, hour, and temperature.
  • Temperature display: Display after scrolling on, you can choose Celsius or Fahrenheit display.
  • Alarm clock settings: The alarm clocks are set by week (set the alarm time, select the day of the week on which the alarm will sound).
  • Button sound: You can turn on or off the button sound, bp: ON or bp: OF.
  • Timekeeping: up to 59 minutes and 59 seconds of timekeeping, a beeping sound will be heard when the countdown is connected.
  • Auto Light: After turning on auto-brightness, you can adjust the brightness according to the environment.

Function instructions

  • Button description: There are three buttons from top to next. We define them as Config mode switch, Up-adjusting button, Down-adjusting/Exit button. The short-press time range: <=300ms; the long-press time range >300ms.
  • Button function description:
    • Config mode switch button: short press to switch Setting mode; long press to enter Alarm setting.
    • Up-adjusting button: short press to switch State; long press to enter Timekeeping setting.
    • Down-adjusting/Exit button: short press to switch state; long press to exit to Time display state.
  • Short press the Config mode switch button to switch the normal mode setting. When the status is being switched, the current position will flash 【Including Time, Button sound switch (BP: ON or BP: OF), Scroll switch (DP: ON or DP: OF ), Time display mode (MD:1 12-hour system or MD:2 24-hour system), Hourly ring signal switch (FT: ON or FT: OF)】
  • The Time Setting: Enters the year, month, day, hour, and minute in the normal setting mode. When selected, the current position will flash. Set the time through the Up-adjusting button or Down-adjusting button. When the setting mode is switched/press the Exit button/no operation exit (10 seconds without any operation) ), the current position value will be written to RTC, if the value has never been changed, it will not be overwritten. Note that the second will be cleared when setting.
  • Alarm setting: Loong presses the Config mode switch button to enter the Alarm setting; A0/A1: ON/OF, short press the Up-adjusting and Down-adjusting button to select which alarm clock to set; short press the Config mode switch button to enter the hour and minute setting, and then select the day of the week on which the alarm will sound(the Week state will jump to Monday, select the day of the week through the Up-adjusting and Down-adjusting button), short press the Config mode switch button again, and the alarm will be set successfully.
  • Timekeeping setting: Long press the Up-adjusting button to enter the Time Setting, and select TM.OF/UP/DN through the Up-adjusting button and Down-adjusting button, (OF: off/UP: up counting/DN: down counting);
    • Up counting: The timing result is updated every 3 seconds. When the Config mode switch button is pressed, the counting result will be displayed. Press the Config mode switch button again to return to the time display state;
    • Down Counting: After finishing the time setting, the countdown will start. After the timer expires, the buzzer will be triggered automatically.
  • Celsius/Fahrenheit selection: In the time display state, short press the Up-adjusting button to switch the temperature display mode.
  • Auto Light: In the time display state, short press the Down-adjusting to turn on or off the auto brightness mode.





Other shared resources

  1. Python code shared by Malcolm


If you require technical support, please go to the Support page and open a ticket.