Digital Clock with the Parallax P1 Microcontroller
![Ludis](https://forums.parallax.com/uploads/userpics/422/n5QVIWFIH8AYX.jpg)
I’m happy to share with you my digital clock with the Parallax P1 microcontroller.
Thanks to Parallax, @JonnyMac , and the forums.
Objective:
-Learn how to use the P1/P2 Microcontrollers and how to write drivers.
-I wanted a creative clock and alarm for my office to help me keep track of time.
How:
-Digital clock with Segment LEDs and 2x 50 pixel LEDs
-Real Time Clock with temperature compensation and battery backup
-Visual alarm that displays a pixel LED “light show” on every passing hour.
-Temperature and humidity indications
-Ability to adjust brightness and color of pixel LEDs and to adjust brightness of segmented displays
-Ability to adjust the weekday, month, day, year, hour, minute, and civilian or military time
What:
-Parallax P1 Microcontroller, Propeller Mini package
-HT16K33, Adafruit Featherwing, 16 and 8 Segment LEDs, I2C
-CM2302 Temperature and Humidity Sensor, One Wire
-DS3231 Real Time Clock, I2C
-2x 50 Pixel LEDs WS2811, One Wire
-3x KY040 encoders with pushbuttons
-Prop Plug
-ATX PSU 250W
-12VDC Wall PSU 8A
Notes:
-This uses methods learned from JonnyMac’s P2 presentations and coding! I probably couldn’t have learned this without his presentation.
-I started with the P1 because the documentation available at the time was a little easier for me to read. I will be moving to the P2 next.
-I really enjoyed learning how to write the drivers. I wrote my own versions based on JonnyMac’s example coding and the datasheets.
-The coding is about 1750 total lines of code. Includes SPIN and PASM.
-Includes drivers for I2C, one-wire, and encoders. IC drivers include DS3231, CM2302, WS2811, and HT16K33
-The cogs are really powerful! They make coding much easier. Took me some time to figure out using cogs with PASM.
-The clock and Pixel LEDs sit behind my computer. Randomly 1 out of 3 pixel light shows are displayed to signify the passing hour. I see the light show and it helps me keep track of time when I’m using my computer or desk. I can become so focused that I lose track of time easily.
-I’ve tracked the RTC time versus my computer time and they are extremely close over weeks period.
-My dad made the digital clock box out of oak wood based on my specifications. Turned out great! Thanks, Dad! Looking into 3D printer for the next project.
-All the electrical components are solderless.
-This project took me ~6 months at a medium pace.
-Schematic made with KiCad.
Thanks for looking! Ask questions anytime. – Ludis, Pittsburgh PA USA
Functional Requirements:
See attached functional requirements document
Schematic:
See attached electrical schematic
Comments
Fantastic job @Ludis
The encoders work really well; nice and responsive, quick to use, and a reassuring solid click as you press them to select.
Seems the parts inside the box fit about perfectly- not much space wasted
That box turned out well.
The oscillating LEDs remind me of a kidney. Not sure why, maybe the color
Pretty cool feature.
Thanks for making the video and inspiring me (and I hope many others) with what you've created.
Fantastic job I really like what you did with this project![:) :)](https://forums.parallax.com/resources/emoji/smile.png)
I like the LED light bulbs where did you find could please post a website link to where you can find them thanks
Thanks, @VonSzarvas, I do appreciate your feedback. Yes the responsiveness of the encoders and the pixel LEDs turned out really well. Arranging everything inside the box took a number of revisions and a few mistakes lol. In the end it worked out. I'm glad this can inspire you and others. I hope the schematic can help out as well.
Thank you very much @sam_sam_sam . The pixel LEDs (50 pc each) are posted on the Parallax website under the P2 Live Forum Holiday Spin2 Kit SKU 64030. These use the WS2811 chips. I purchased a set for JonnyMac's presentation then I liked them so much I purchased another one and decided to use both! lol
https://parallax.com/product/p2-live-forum-holiday-spin2-kit/
https://youtube.com/watch?v=59oUoNd9TbQ Spin 2 Beginners Series Part 1: RGB LEDs with JonnyMac
Fantastic project!
It is customary when you post to Customer Projects that you post the code and PCB files. If you have a problem with that, I understand.
OK @Publison I haven't decided yet what i want to do for providing the coding. I do agree that is a necessary part of learning the P1 and P2. Until I decide, anyone can ask about specifics and I can provide, as necessary. Thanks.
Congratulations. A really nice project. Thanks for sharing.
Thank you, @Cluso99 . Much appreciated. I'm looking forward to working with the forums on the next project.
Ludis,, would you mind sharing the code for the RTC clock? Just a simple clock. I have a Propeller WX activity board, 4 digit 7 segment display with backpack from Adafruit, and a PCF8523 RTC. As you can see, I'm a beginner.
Thanks, Bernie
Yeah! I attached the Main code and the RTC code. Let me know if you have any questions. I'm a beginner too. If I missed something let me know. Have fun.
See the code under titles:
PUB main
'Set Initial Clock Variables
'Set global variables to RTC byte buffer, then write to RTC
'Read RTC and Display
Those should point you to the PUB and PRI sections