Giter VIP home page Giter VIP logo

arduino-fast-clock's Introduction

Arduino Fast Clock V1.0

This project is an Arduino based Fast Clock implementation. This project was built for the Youtube Model Builders and especially the YTMB Arduino Workshop group. Because this was for that Arduino Workshop, there is a complete build video linked below.

Please visit the Youtube Model Builders web site for more information, and dont forget to download and subscribe to their amazing free YTMB eMag.

Typically used in model railroading, this fast clock runs faster than an ordinary clock. You can specify exactly how fast you want it to run. For example, if set to a 2:1 ratio, it will advance 2 minutes for every 1 real minute. When set to 10:1, it will advance 10 minutes for every 1 real minute. Or stated anoter way, it will advance one minute every 6 real seconds.

Note: Because of the way the fast clock runs, it is best to select a speed ratio that is an even multiple of 60, otherwise it may not appear to update smoothly. i.e. choose one of the following: 1:1, 2:1, 3:1, 4:1, 5:1, 6:1, 10:1, 12:1, 15:1.

The following video is episode #21 recorded Apr 11, 2018. It will walk you through a complete build for the Fast Clock. Enjoy.

IMAGE ALT TEXT HERE

Parts List

  • 1 - Arduino Uno or similar
  • 1 - 4x20 LCD display with I2C backpack
  • 1 - TM1637 LED display w/SPI connections
  • 1 - Rotary Encoder
  • 1 - DS3231 RTC (Real Time Clock) module
  • 2 - 100 nF capacitor (0.1uF) (# 104 may be printed on the cap.)
  • 2 - 10K Resistor (Brown, Black, Orange)

Library Dependencies

The following libraries musty be installed for this project.

Click here for instructions How to Install Libraries from Github

  • LiquidCrystal_I2C by marcoschwartz Get it here on GitHub

    Note This library may conflict with the NewLiquidCrystal library. If you have NewLiquidCrystal library installed, you may need to uninstall it and use this library instead.

  • TM1637Display by Avishay Get it here on GitHub

    Note As of4/10/2018, there is a bug in this library which prevents it from being seen by the ArduinoIDE. This can be easily fixed by finding the TM1637 library in your libraries folder. Open the library.properties file and add maintainer= as a new row in the file. Update This issue was fixed on 4/16/2018. Downloading this library after then should not require this modification.

  • DS3232RTC by Jack Christensen Get it here on GitHub

  • Bounce2 by Thomas O Fredericks Get it here on GitHub

  • TimeLib by Paul Stoffregen Get it here on GitHub

  • LiquidMenu by Vasil Kalchev Get it here on GitHub

    Note: By default, the LiquidMenu library will not work with an I2C 4x20 LCD. To fix that you will need to edit the "LiquidMenu_config.h" file. Change the I2C option from "false" to "true". You will find the LiquidMenu_config.h file in the library folder. You can use Notepad or any other text editor to make the change.

    Or - You can download the version that's included with the this project in github. See above.

Pin Connections

Device Device pin Arduino Pin Protocol
Rotary Encoder GND GND none
Rotary Encoder VCC+ VCC+ none
Rotary Encoder SW 4 none
Rotary Encoder DT 2 none
Rotary Encoder CLK 3 none
LCD GND GND I2C
LCD VCC+ VCC+ I2C
LCD SDA A4 I2C
LCD SCL A5 I2C
RTC GND GND I2C
RTC VCC+ VCC+ I2C
RTC SDA A4 I2C
RTC SCL A5 I2C
TM1637 LED GND GND SPI
TM1637 LED VCC+ VCC+ SPI
TM1637 LED DIO 12 SPI
TM1637 LED CLK 11 SPI

alt text

Fast Clock Source Code

The source code for the Fast Clock project can be found in the "Fast_Clock.ino" file.

The easiest way to copy the code to your Arduino IDE is to

  1. Open the code by doing one of the following:
    • Click on the file name ( Fast_Clock.ino ). It will open the code on a new page. Find and click the "Raw" button. It's near the top of the code block about 2/3 the way over on the right side of the screen. That'll open the code in a window with nothing else.
    • Click this link to go directly to the Raw code.
  2. Hit Ctrl-A then Ctrl-C.
  3. Open the Arduino IDE and open a new blank project.
    1. Delete any code that Auduino inserts
    2. paste (ctrl-V) the code into the blank Arduino Window.
  4. Save the project with a meaningful name like "Fast_Clock".

Interesting Links

Having Issues

Are you having problems or noticed a bug in the code? At the top of this page is a tab called "Issues". Click there, then open a "New Issue" and tell me about the problem, you're having. If it's a code problem, I can work on fixing it.

arduino-fast-clock's People

Contributors

futski-iii avatar

Stargazers

 avatar

arduino-fast-clock's Issues

Clock runs backwards

Discovered that when the ratio is set negative, the Fast Clock will run backwards.
Need to build guard rails to keep ratio between 1 and 60

Has anyone successfully built one?

I've been working on this project for several weeks. Ordered all the parts, installed the latest Arduino IDE, double checked the libraries. Ran the example sketches for the individual components, and it still doesn't work. The fastclock.ino verifies and completes the upload. However, the displayed clock data is gibberish. A series of horizontal bars, sanscrit characters, and not much else. There is an entire block of code that has been commented out.

// This block sets the real and fast clocks
{
InitialSetClocks();

/* // Get time from the Real Time Clock
if (timeStatus() != timeSet) { // Check if RTC set the real clock
realClock = 1; // When RTC fails, Set real clock time to midnight 1/1/1970
setTime(realClock);
}
realClock = now();
prevRealClock = realClock;
// Set default start time for fastClock
timeParts.Hour = DEFAULTHH;
timeParts.Minute = DEFAULTMM;
timeParts.Second = 0;
timeParts.Wday = weekday(); // Set Day of week, sunday is day 1 - Default to Real Clock
timeParts.Day = day(); // Set Day of month - Default to Real Clock
timeParts.Month = month(); // Set Month - Default to Real Clock
timeParts.Year = year() - 1970; // Set year offset from 1970 - Default to Real Clock
fastClock = makeTime(timeParts); //Create FastClock storage
//fastClock = 68400UL; //Set starting fasttime
*/

Is there an operational piece of code that is available to get this program working?
Setting DEBUG _MODE on does show that the RTC is functioning while looking at the serial monitor.
Nothing else works except the charges on my Paypal parts bill.

Can't get past line 214 in fastclock.ino

All librarys appear to be correctly installed. However, the verify phase bombs at line 214. [lcd.init();
I've changed the LiquidMenu config.h to true. I've run the example 'Hello World' code on the 4X20 Display and that works fine. Any clue?
The error message is: 'class LiquidCrystal_I2C' has no member named 'init'
I ensured that the old LiquidCrystal library is not on the system.

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.