The author would like to thank the following for their assistance: Mr. Dave Levesque, Mr. Greg Whiting, Phoenix Contact, Littelfuse, and Digi-Key.
■ FIGURE 2.
I did some research, and found the math for
computing the sunrise and sunset times at
algorithm.htm. I put this into an Excel spreadsheet to
verify the results. A little experimenting shows that setting
your position to the nearest degree of longitude and
latitude provides a set of results accurate to within a few
minutes. This is adequate for lighting systems control.
A little more research found that a real time chip
(RTC) and a math coprocessor married to a PIC was the
solution I was looking for. The end result is what I call the
electronic version of a photocell (shown in Figure 1).
So now, I have a board level design that can mount
inside a building’s electrical room only a few feet from the
lighting power supply. This gives me easy access to install,
operate, and maintain all control parts of the lighting
The sunrise and sunset time is computed every time
the board is powered up or at midnight every day, and
there is correction for daylight savings time.
The Circuit and
Figure 2 is the schematic of the system which has the
1. LCD1 is a four-line LCD display with serial interface
and 5 VDC supply connected to TS-DISP via a
three-wire servo cable. Communications between
the display and the circuit are set at 19200 baud.
2. U2 is a µM-FPUv3.1 coprocessor that handles all
the math for computing the sunrise and sunset
times. The program code for this is available at the
article link. The coprocessor can be programmed
on the board using PORT1 and setting JUMP1 per
the instructions on the schematic; then using 5V
FTDI Basic from www.sparkfun.com. I/O into the
PIC is with one pin using R9 as a buffer resistor.
3. U3 is a DS1302 time keeper chip with its own
June 2013 41