Coder Social home page Coder Social logo

so1der / 20x2_clock Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 2.06 MB

Simple clock with ESP8266, DS1307, and 2x20 Character LCD

License: GNU General Public License v3.0

C++ 99.73% C 0.11% CMake 0.14% Makefile 0.01%
character-display clock esp8266 rtc-module

20x2_clock's Introduction

20x2 Clock!

alt tag

So this is a simple clock with a character LCD display, RTC module, and a ESP8266 in role of microcontroller. I choose an ESP8266 cause later I want to create NTP version of this clock, so You dont need to buy a RTC module, cause clock will get time info via Your WIFI network. In order to display hours, minutes, and seconds - You need LCD display that contain 20 columns and 2 rows. Each digits occupies 3 columns on each row. So in clock we have 6 digits, 6*3 = 18, and we have 2 columns left, which we can use for a separator dots. You still can use 16x2 display, but in this case You need to slightly modify code, so seconds wont display.

Features:

  • Easy to set up
  • Big cool digits
  • Minimalism, nothing unnecessary
  • Adjustable brightness. Backlight will dim at night, so clock wont blind you

Gear:

  • ESP8266
  • 20x2 Character LCD Display
  • DS1307 or other compatible RTC with I2C
  • 2N2222 or similar NPN bipolar transistor
  • 1K resistor
  • 10K adjustable resistor
  • Bunch of wires

Here is a schematic:

alt tag

Schematic may be vary according to what microcontroller, RTC, or display You are using. I used 4 bit data bus on display, but thats okay if You use I2C module for display, You will just need to change display initialization(and maybe display library). Display backlight is controlled via 2N2222 transistor, with PWM.

Variables

rs, en, d4, d5, d6, d7 - is a GPIO pins connected to display.

pwm - GPIO pin that connected to a transistor.

backlightDimStartHour and backlightDimEndHour - as the name suggest, contains hours interval, when display backlight will be dimmed.

backlightDayLevel and backlightNightLevel - define how bright backlight will be at day, and how dimmed it will be at night. Its a default PWM range, so int is suitable in range 0 - 255.

pwmFreq - Frequency of PWM that will control backlight. Default value is 1 kHz, but I changed it to 40 kHz cause in 1 kHz high frequency squeal was heared from my display.

Libraries

To work properly, You need to install next libraries:

BigNumbers, as You can see, main library in this project. Very cool library by seanauff. I slightly modified it, how its draws digits "1". You can see comparison below. You can download original library by link above, or use modified one, all libraries, including modified "BigNumbers" are located in folder "libraries" in this project. Still, if You want modified one, anyway go and support original work of seanauff.

alt tag

alt tag

Set up

After You connected all according to schematic, you need to upload firmware to ESP8266, twice. When You do it first time - just upload code from project. When its second time, You need to comment line that responsible for time/date adjustment in RTC module. From this

rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));

To this

//rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));

If You wont do it, it may cause some problems in future, every time when clock will turn on, it will readjust RTC module with time and data that was on the moment you upload firmware into Your ESP8266.

20x2_clock's People

Contributors

so1der avatar

Stargazers

 avatar

Watchers

 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.