Page cover

clock-deskPico Pi Clock

circle-info

Note: This project is being added here after the completion, so many thoughts or issues that I may have had during the development may be missing. Same with contextual insight as to some of the reasons the way certain code may be the way that it is.

About The Project

This project was intended as a way to learn how to use microcontrollers in what I thought would be a simple and easy way. With the small programming background that I have, I endeavored to create a small desk clock with some basic control and programming functions that would look decent on any desk.

Programming the clock itself was quite the task that I put for myself, as I had no idea how to program a graphics display or work with many of the required libraries to accomplish this task. Below is the Readme file for the project, containing basic tasks and outlines of what the project was meant to be.

chevron-rightClock Readmehashtag

Plans for Clock

General plan outline

For this we will have a clock that has a border and time displayed on the inside in the displayed in a 12 HR format. On the right side of the clock there will be a small animated character that I will import as a jpeg file or something. Preferably not drawing by hand. For this plan we should have a main function that initializes that display and sets our first graphics, from there we should initialize our little buddy to be dancing. Lastly we will initialize the clock itself and find something to reference it from.

So our first step will be to draw a clock design up on the display. This will most likely be a simple border and background color. From there we will statically draw the timer on the screen as 12:00PM while we work on the time class itself. Once the general display has been configured and we have also inserted a basic little image for our buddy we will be able to move onto the clock function itself and how we will update the graphics buffer every minute on the minute. Our little buddy should also be animated to where he is tracking the seconds, so that every 60 seconds he cycles to the start of his animation and the graphics buffer is reset to a new state. Updating the graphics buffer every second should help to preserve and onboard memory that we will be using. This is especially useful since a lot of the memory onboard the Pico will be going to our little buddy's animation.

To-Do List

  • Animation initialization function

  • Set time function

    • Include a way to change hours, minutes, and period individually

  • Make time actually take 60s and not add on time each round to get out of sync

Current State

  • Clock goes through 00:00 to 23:59 properly, including AMPM Now it does the proper 12hr cycle! - Jokes on me, it does not do the proper 12 hour cycle. I need to go through the string construction again and how we analyze when to change the format etc.

  • On startup the AM PM symbol is off screen for some reason This was fixed

  • Character spacing is sometimes off screen

  • No way to input the current time on startup yet A and X button as user input registers

Making a Time String

  • if it is passed 9 don't put a 0 in front

    • if it is passed 9 minutes don't put a 0 in front

  • if it is passed 12 subtract 12 from displayed time

  • otherwise put a 0 in front of each

  • User Input If the user goes up in hours to PM or down to AM we should auto swap


Code base

circle-exclamation
chevron-rightGithub Fileshashtag

The Display

My first task I gave myself when starting this project was figuring out how to write to the Pimoroni display packarrow-up-right that I planned on using as the primary display for the project itself.

Last updated