This master clock controls the signals sent to the slave clocks, and keeps them synchronized. The firmware in the clock currently supports the National Time synchronization protocol. The master clock also controls the bells that can be set at scheduled times during the day. The firmware in the clock currently supports two bell zones (indoor and outdoor bells).
The firmware in the clock also automatically adjusts to daylight savings time (this can be turned off). This library might also be useful for other clock-projects (make sure to also get the modified DateTime library).
The clock is set up by connecting it to a computer via the Arduino USB port, and running a Java control program with a GUI interface. Once the time has been set, and a bell schedule loaded, the computer can be disconnected.
The design of the clock emphasizes simplicity, with a minimum of controls. Any complex setup is better handled by running the control program on a computer and temporarily connecting to the clock. The picture shows the front panel of the clock. The switch allows bells to be turned off completely if bells are not wanted (holidays, teacher training days etc.) The LEDs are normally all green, anything else indicates an unusual state.
Step 1: Find Out About the Master Clock You Are Replacing
Thus the clocks in the school all showed about the same time, but all wrong, and always wrong. This proves that the expression "even a broken clock is right two times a day" is false.
You will need to know:
* what protocol is used by the slave clocks (can probably guess based on the make of the clocks)
* how many zones are used for bells (indoor, outdoor, different buildings etc)
Your school (or other location) may even have documentation in the form of wiring diagrams. These can be very helpful when installing the new clock.
Step 2: You Need These Items
* Arduino (or similar) with a Atmel '328 and a USB connection (the Duemilanove is perfect)
* 12v wall wart (say 250 mA, depends on the number of relays you will be driving)
* 9V battery, holder, and connector
* LED's (one green, two red/green)
* relays (one for each bell zone, and one or more for the synchronization signal)
* LCD (standard 2x20 character HD44780-compatible display)
* suitable enclosures (large, medium, and small project boxes)
* plug and jack for power (5.5/2.1 mm for example)
* various screws and miscellaneous hardware
* Arduino IDE installed (with the libraries needed, see step 5)
* the Java-based Master Clock Control program (and a Java runtime environment, and the rxtx library)
* USB port available
* USB cable for connecting to the Arduino
* time set to something reasonable
Step 3: Put It Together the Hardware
* one large box for the electronics
* one medium box for the relay circuits (a mix of low voltage and high voltage)
* one small box for the high voltage connections
Make holes in the boxes where screws can hold them together.
Also make holes where wires can go between the boxes.
The small box also needs holes where wires can be hooked up for installation.
The medium box needs a hole for attaching the 9V battery holder.
The large box needs holes for the USB connector of the Arduino and a hole for the power jack.
The lid/top of the large box also needs holes for the LEDs, the switch, and the LCD.
Step 4: Build the Electronics
Step 5: The Arduino Firmware
You will also need to install a number of other libraries (if you do not have them installed yet)
* DateTime (use the modified version attached here)
* DaylightSavings (see the next step)
* LiquidCrystal (comes with IDE)
The libraries together with the code makes the sketch too large to fit in a Arduino ATmega128, which is why an '328 is needed. Perhaps if you remove some code that you do not need for your project it can fit.
Step 6: The DaylightSavings Library
If your daylight savings changes are not identical to the US post 2007 regime, then it is only necessary to modify a single function that is located in its own file. In fact, as more file for different locales are provided, they can all be distributed and chosen by simply using the one correct file. This limits the amount of code generated for this library.
Step 7: The Java Control Program
It is possible to communicate with the Master Clock using the serial tool of the Arduino IDE.
Step 8: Installation
The cleanest way to install the new master clock is to simply bypass the connections of the old master clock. For example, if there is a terminal on the old master clock that pulls to ground when the sync signal is "on", then connect this wire to the sync terminal of the new master clock. The other side of the sync terminal should then be connected to ground so that when the relay connects the wire to the ground the same effect is achieved.
Alternatively, the relay terminals can be connected to a hot wire (120 or 24V AC depending on slave clock specifications) and then to the sync wire. It really depends on the configuration of the existing system and how much you are willing to get your hands dirty.
Step 9: It Works!
This is a great way for all the teachers to know who you are. Random children will come up to you and thank you for "fixing the clocks". Yes, people will even approach you in the local grocery store and thank you! They key here of course, is not to replace the broken master clock right away, but to wait a while before doing so.
The master clock handled the 1 November 2009 transition from daylight savings to standard time. The master clock showed the correct time, but the slave clocks did not. This was due to an electrical wiring problem (bug) where the synchronization signal relay was getting power only from the battery, and the battery was too weak. This was fixed and now the battery drain problem has also been fixed.