HOME - - - - - - - - Table of contents, my Arduino "How To" articles
Other material for programmers     

User's guide for pendulum regulated

electronic clock

filename: aht2sw-counter-2ug.htm

I have provided Arduino sourcecode, and a discussion of the programming, for an electronic clock which is based upon the swings of a pendulum.

The whole exercise is just "for fun", and for various programming matters illustrated along the way.

This page is an "appendix" to that tutorial. It is a "User's Guide" for the clock, in hopes that it will help readers of the tutorial be clear about what the clock is supposed to do, so that when they are studying the sourcecode some puzzles are less perplexing.


What the clock does, in broad terms...

Displays a time of day... hh:mm, which goes forward according to how many pulses come in from a source of regular pulses, e.g. a pendulum.

Alternatively, the display can show how many pulses there have been. As with the time-of-day display, this would be four digits.

And then there are two displays which indicate that you have entered the mode which lets you change the clock's idea of the time, as to hours, or as to minutes. In these modes, only two digits appear on the display.

Which you see is selected by turning a knob.

When in hh or mm setting mode, there are buttons to change the time displayed- one to increase the number, one to decrease it.

Setup:

We'll get to "everyday" matters in a moment. First, a few notes about setting the clock up.

You need power. The cable with the USB connector on it should be plugged into a source of 5v. No data passes over the cable.

You need a source of 5v pulses, to regulate the clock. Two wires come from the clock, one (the black one) to go the ground of the other circuits, the other to go to the output from the other circuits.

Alternatively, connect the two wires to the clock's ground, if you are just doing tests. One of the buttons will be treated as if it were the source of the time regulating pulses.

------
Some changes will need to be made in the code, on the
if ((ulPulsesFrmPendulum % xx)==0){IncAMinute();};
lines, if your pendulum isn't exactly as long as mine is.

Operation Details

As mentioned: There are four display modes. (No pulses are "lost", by the way, in the course of making changes to the display mode, or in the course of changing the hh or mm settings.)

There is a knob which you turn to change the display mode.

Turn it far enough to the left, and the clock will go into the "Count of pulses" display mode.

Turn it far enough to the right, and the clock will go into its "Set Minutes" mode. The two right hand digits will show something, the two on the left will be dark, not showing anything.

Turn the knob back (to the left) a little from what is far enough to cause the "Set Minutes" mode, and the clock will enter the "Set Hours" mode. The two left hand digits will show something, the two on the right will be dark.

Those are the four display modes. To recap, if you start with the knob turned fully to the left, you will pass through the display modes in the following order... but keep reading before you try it!...

Now... and there is a reason, and you should be able to overcome the slight oddness... here is the thing I wanted you to read before you tried the knob:

The display mode doesn't always change "instantly". Turn the knob a bit... and then wait for a pulse to pass. If the display mode hasn't changed, turn the knob a bit more, and wait again. If it changes... but goes, say, from display mode 0 to display mode 2, but you wanted 1... turn the knob back about half as far as you turned it to get 2, and wait for a pulse to pass.

The knob is attached to a simple potentiometer. If there was an index mark on the knob, and numbers in a circle around it, the "right place" for a given display mode will always be with the index opposite the number it had to be opposite last time.

Details of the different modes

"Count of pulses" display mode: Four digits. The device displays how many pulses have arrived since it last started up. In this mode, four digits are always lit up, so sometimes there are some "leading zeros", e.g. a dozen is show with "0012". The four digits, and the fact that the number changes with each pulse, tells you that you are on the "Count of pulses" display mode. (At the 10,000th pulse, the display goes from 9999 to 0000, and after that, counts up again.)

"Time of day" display mode: Four digits. hh and mm. It should be easy to have the colon on, but for the moment that's being difficult. You can distinguish this display mode from the pulse count by the slower changing of the numbers. (And of course, the rollover at 59 and 23... but who wants to wait to see one of those!)

"Set Hours" display mode: See "Set Minutes"

"Set Minutes" display mode: When in "Set Hours" or "Set Minutes", the device's current idea of the hours or minutes part of the time is on display. Press and hold either the "up" button or the "down" button. Just after each pulse arrives from the pendulum, the setting will go up or down, as appropriate. (It takes a little getting used to, but as there is an up and a down button, it really isn't too tiresome.)

The system continues to count pulses regardless of what display mode you have in action at any time.

If you are counting pulses from something, i.e. you do not have the two wires tied to ground, then pressing the "fake pulse" button does what you would expect.

That button will also work if you have the wires connected to a source of pulses. But it will add "extra" counts to what is recorded, if you do press it.





   Search this site or the web        powered by FreeFind
 
  Site search Web search
Site Map    What's New    Search

The search engine is not intelligent. It merely seeks the words you specify. It will not do anything sensible with "What does the 'could not compile' error mean?" It will just return references to pages with "what", "does", "could", "not".... etc.
In addition to the tutorials for which this page serves as Table of Contents, I have other sites with material you might find useful.....

Sequenced set of tutorials on Arduino programming and electronics interfacing.
Tutorials about the free database supplied with Open Office/ Libre Office.

Some pages for programmers.
Using the parallel port of a Windows computer.


If you visit 1&1's site from here, it helps me. They host my website, and I wouldn't put this link up for them if I wasn't happy with their service.




Ad from page's editor: Yes.. I do enjoy compiling these things for you... hope they are helpful. However.. this doesn't pay my bills!!! If you find this stuff useful, (and you run an MS-DOS or Windows PC) please visit my freeware and shareware page, download something, and circulate it for me? Links on your page to this page would also be appreciated!

Click here to visit editor's Sheepdog Software (tm) freeware, shareware pages.. Material on this page © TK Boyd 12/18


And if you liked that, or want different things, here are some more pages from the editor of these tutorials....

Click here to visit the homepage of my biggest site.

Click here to visit the homepage of Sheepdogsoftware.co.uk. Apologies if the "?FrmAht" I added to that link causes your browser problems. Please let me know, if so?

Click here to visit editor's pages about using computers in Sensing and Control, e.g. weather logging.



To email this page's editor, Tom Boyd.... Editor's email address. Suggestions welcomed!


Valid HTML 4.01 Transitional Page tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org


Why does this page cause a script to run? Because of the Google panels, and the code for the search button. Why do I mention the script? Be sure you know all you need to about spyware.

....... P a g e . . . E n d s .....