GithubHelp home page GithubHelp logo

bmterra / lcd_nixie_clock Goto Github PK

View Code? Open in Web Editor NEW

This project forked from g0hjq/lcd_nixie_clock

0.0 0.0 0.0 767 KB

Pseudo Nixie LCD clock in Micropython for the Waveshare kit and Pi Pico

Python 100.00%

lcd_nixie_clock's Introduction

lcd_nixie_clock

Pseudo Nixie LCD clock in Micropython for the Waveshare kit and Pi Pico

This project contains the MicroPython code for a Raspberry Pi Pico RP2040 to drive the Waveshare Programmable RGB Pseduo Nixie Tube clock. See https://www.waveshare.com/lcd-clock-a.htm

image

Features

  • Shows the time in 12 or 24 hour format
  • Shows time in on the LCDs in the style of Nixie tubes. Other types of display may be shown
  • Shows Hours, minutes and seconds, or Hours, Minutes and Alarm status
  • Alarm sounds the buzzer and flashes the LED neopixels
  • Controlable brightness
  • Ten preset RGB lighting patterns. More may be added if desired

Limitations

  • Due to the lmiited amount of eeprom in the Pi Pico, only one set of font files may be loaded at any one time, however alternative .raw font files may be created and uploaded via Thonny. Additional 7-segment and dot-matrix like fonts are generated by the software.
  • The temperature and humidity from the BME280 sensor are not displayed. The sensor is on the PCB, inside an unventilated case, so is never going to be able to give accurate readings.
  • Due to the way the LCD chip enable pins and DC pins are wired, it is not possible to use the standard Adafruit driver libraries. This uses modified versions of the Waveshare 1.14" python examples to drive all 6 LCDs. As it is written in Micropython, the performance is not optimum, but adequate for this project
  • The time is maintained by a battery backed up DS3231 temperature compensated clock chip. This is reasonably accurate, but could be improved by reading the time over Wifi from an NTP server. Possible future enhancement?
  • I wanted to animate the RGB LED lighting in the RP2040's second core, but was unable to do this reliably. It would often crash after an hour or so. I suspect this may be due to the experimental nature of micropython multi-threading support. Maybe this can be revisited at some time in the future.

Font Files

The ten images for the digits 0 to 9 are stored in .raw files. This is explained here: https://www.penguintutor.com/programming/picodisplayanimations . You can create your own set of font files as follows:

  • Create a set of 10 image files at resolution 240 x 135 pixels.
  • Rotate the images anticlockwise 90 degrees and save as .png files 0.png to 9.png
  • Run the conversion program animation_convert.py. This will produce files 0.raw to 9.raw
  • Use thonny to upload the .raw files to the root directory of the pi pico

Other Fonts

Additional 7-segment and dot-matrix like fonts in various colurs are generated by the Python code in display.py

PXL_20230707_190128832

PXL_20230707_184316827

Files

  • main.py : The main program file in Micropython
  • ds3231.py : Driver for the DS3231 real time clock chip
  • display.py : LCD driver for the Waveshare ST7789 1.14" 240x134 pixel LCD. Also includes a 5x8 ASCII text font which is shown magnified 4x
  • leds.py : Controls the RGB neopixel LEDs behind each digit. Consider adding more effects and/or animations, maybe running as a seperate thread in the second core.
  • setings.py : Saves and retrieves the alarm time, display mode and other setting values in the settings.json file below.
  • settings.json : Contains the setting values. This file is written to every time one of the clock settings is changed. settings.json will be created automatically if it does not exist

Installation

Use Thonny to upload the following files to the root directory of the Raspberry Pi Pico. Do not copy the fonts directory or its contents.

  • display.py
  • ds3231.py
  • leds.py
  • main.py
  • settings.py
  • 0.raw
  • 1.raw
  • 2.raw
  • 3.raw
  • 4.raw
  • 5.raw
  • 6.raw
  • 7.raw
  • 8.raw
  • 9.raw

Open main.py in the Thonny editor and press RUN.

Because the top program file is named "main.py", the clock will start automatically when powered on.

Setting the Clock

  • Press the Mode button to enter the first setting screen (Alarm On/Off).
  • Press the Left and Right buttons to change the value. (The buttons should now be labeled Down and Up). 0 means OFF and 1 means ON
  • Further presses of the mode button cycle through all the various settings before returning to normal time-keeping.
  • If no setting button is pressed for 5 seconds, the clock will automatically return to normal time-keeping.
  • The adjust timing setting allows very slight adjustments to be made to the Quartz oscilator. The default value is 128, which should be a pretty good starting point accurate to a few seconds a month. Lower values speed up the clock, and higher values slow the clock. If you have access to a very accurate frequency counter, the exact 1Hz timing signal can be monitored on Pin 24 (GPIO 18) of the Raspberry Pi Pico.

lcd_nixie_clock's People

Contributors

g0hjq avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.