Silicon ChipInternet Time Display Module For The WIB - February 2010 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Wind farms are a blight for people in their vicinity
  4. Feature: A Look At Automotive On-Board Diagnostics by John Clarke
  5. Feature: Saving the Whales with the Aussie Pinger by Ross Tester
  6. Project: An OBDII Interface For A Laptop Computer by John Clarke
  7. Project: A Milliohm Adaptor for Digital Multimeters by Jim Rowe
  8. Project: Internet Time Display Module For The WIB by Mauro Grassi
  9. Project: A Multi-Function GPS Car Computer, Pt.2 by Geoff Graham
  10. Project: Precision Temperature Logger & Controller, Pt.2 by Leonid Lerner
  11. Vintage Radio: The Mullard Meteor 600 4-Valve Mantel Receiver by Rodney Champness
  12. Book Store
  13. Advertising Index
  14. Outer Back Cover

This is only a preview of the February 2010 issue of Silicon Chip.

You can view 17 of the 104 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Items relevant to "An OBDII Interface For A Laptop Computer":
  • OBDII Interface for Laptop Computers PCB pattern (PDF download) [05102101] (Free)
  • OBDII Interface for Laptop Computers front panel artwork (PDF download) (Free)
Items relevant to "A Milliohm Adaptor for Digital Multimeters":
  • Milliohm Meter Adaptor PCB [04102101] (AUD $10.00)
  • Milliohm Meter PCB pattern (PDF download) [04102101] (Free)
  • Milliohm Meter front panel artwork (PDF download) (Free)
Items relevant to "Internet Time Display Module For The WIB":
  • dsPIC33FJ64GP802-I/SP programmed for the Webserver in a Box (WIB) [0711109A.HEX] (Programmed Microcontroller, AUD $25.00)
  • Webserver in-a-Box (WIB) Programming Tables (PDF download) (Software, Free)
  • dsPIC33 firmware (HEX file) and website files for the Webserver in-a-Box project (Software, Free)
  • Webserver in-a-Box (WIB) PCB pattern (PDF download) [07111092] (Free)
  • Webserver in-a-Box (WIB) front panel artwork (PDF download) (Free)
  • Webserver in a Box (WIB) Internet Time Display Module PCB [07102101] (AUD $10.00)
  • PIC18F1320-I/P programmed for the Internet Time Display Module [0710210A.HEX] (Programmed Microcontroller, AUD $15.00)
  • PIC18F1320 firmware and source code for the WIB Internet Time Display module [0710210A.HEX] (Software, Free)
  • Webserver in-a-Box (WIB) Internet Time Display PCB pattern (PDF download) [07102101] (Free)
Articles in this series:
  • WIB: Web Server In A Box, Pt.1 (November 2009)
  • WIB: Web Server In A Box, Pt.1 (November 2009)
  • WIB: Web Server In A Box, Pt.2 (December 2009)
  • WIB: Web Server In A Box, Pt.2 (December 2009)
  • Web Server In a Box, Pt.3 (January 2010)
  • Web Server In a Box, Pt.3 (January 2010)
  • Internet Time Display Module For The WIB (February 2010)
  • Internet Time Display Module For The WIB (February 2010)
  • FAQs On The Web Server In A Box (WIB) (April 2010)
  • FAQs On The Web Server In A Box (WIB) (April 2010)
Items relevant to "A Multi-Function GPS Car Computer, Pt.2":
  • GPS Car/Boat Computer PCB [05101101] (AUD $12.50)
  • PIC18F4550-I/P programmed for the GPS Car Computer [0510110E.HEX] (Programmed Microcontroller, AUD $20.00)
  • VK2828U7G5LF TTL GPS/GLONASS/GALILEO module with antenna and cable (Component, AUD $25.00)
  • Firmware (HEX file), source code and USB driver for the GPS Car Computer [0510110E.HEX] (Software, Free)
  • GPS Car/Boat Computer PCB pattern (PDF download) [05101101] (Free)
Articles in this series:
  • A Multi-Function GPS Car Computer, Pt.1 (January 2010)
  • A Multi-Function GPS Car Computer, Pt.1 (January 2010)
  • A Multi-Function GPS Car Computer, Pt.2 (February 2010)
  • A Multi-Function GPS Car Computer, Pt.2 (February 2010)
Items relevant to "Precision Temperature Logger & Controller, Pt.2":
  • Software for the Precision Temperature Logger and Controller (Free)
Articles in this series:
  • Precision Temperature Logger & Controller, Pt.1 (January 2010)
  • Precision Temperature Logger & Controller, Pt.1 (January 2010)
  • Precision Temperature Logger & Controller, Pt.2 (February 2010)
  • Precision Temperature Logger & Controller, Pt.2 (February 2010)

Purchase a printed copy of this issue for $10.00.

Internet Time Display Module . . . a simple add-on for the Web Server In a Box (WIB) to show local time By MAURO GRASSI Looking for a really accurate clock? This simple add-on board for the WIB (Web Server In A Box) displays the time and date, as gathered from an internet time server. You can use it as a clock you never need to adjust and it can even be configured in the WIB to automatically adjust for daylight saving time. I N THE NOVEMBER & December 2009 issues of SILICON CHIP, we published the WIB (Web Server In a Box), an ethernet-based web server with a memory card. This simple add-on board allows the time and date to be displayed on a 7-segment 4-digit LED display. The time is gathered from the internet and is re-synchronised every 10 minutes by the WIB for update on the display. In operation, the time and date in68  Silicon Chip formation gathered by the WIB is sent to the add-on module via the on-board serial port. The hours, minutes, seconds, day, month and year can all be displayed. A single pushbutton switch allows you to scroll through the time and date readings or you can set the unit to automatically scroll through the time and date displays. Circuit operation Take a look now at the circuit dia- gram of Fig.1. It’s based on a single microcontroller (IC1), in this case a PIC18F1320. Apart from that, there’s just the four 7-segment LED displays, 12 transistors to drive the displays and a handful of minor parts. To keep the cost down, an 8MHz RC oscillator internal to IC1 is used as the system clock. Its accuracy is quite sufficient for our purposes – it really only affects the baud rate of the UART (universal asynchronous siliconchip.com.au +3.3V 100nF 14 Vdd RB7 RB6 RB5 CON1 RB0 Vdd RA6 Vdd RA7 1k RB2 PGC RB3 IC1 PIC 18F1320 9 -I/P Tx PGD Tx 10 Rx RA3 Rx 4 RA5/ MCLR MCLR RA2 S1 RA1 GND RA0 RA4 13 8x 330 Q1 B 12 E C B E 470 F 16V (Q2–Q7 NOT SHOWN) Q8 C 11 DISP1 8 DISP2 a 15 f 16 e 17 a b g 2009 e c d g 330 7 330 6 B b f e b c d f e g b c d dp dp C Q9 E C B Q10 E C B Q11 E 330 1 a g dp 330 2 a c d dp 18 C B Q12 E 3 Vss 5 SC  f DISP4 DISP3 2 Q1-Q8: BC327 WIB TIME DISPLAY MODULE Q9-Q12: BC337 B E B C E C Fig.1: the circuit uses microcontroller IC1 to process the serial data from the WIB PC board. IC1 then drives four 7-segment LED displays in multiplex fashion via switching transistors Q1-Q12. receiver/transmitter) used to receive the time and date information from the WIB and in any case, the baud rate is synchronised automatically to the baud rate of the UART in the WIB (more on this later). In operation, IC1 receives the time and date information on its Rx pin (pin 10). This data is then processed by the internal firmware and IC1 then drives the 7-segment LED displays (DISP1-4) in multiplex fashion via switching transistors Q1-Q12. The 7-segment LED displays each have a common cathode and these are driven (one at a time) by the RA3-RA0 outputs of IC1 via NPN transistors Q9-Q12. A single 2Ω resistor is used to limit the peak current through the displays. This needs to be substantial to obtain reasonable brightness. The 330Ω resistors provide base current limiting for the transistors. By contrast, the corresponding anodes of each display digit are connected together and these are driven siliconchip.com.au by IC1 via PNP transistors Q1-Q8. Transistors Q1-Q7 drive the segments, while Q8 drives the decimal point. Switch S1 is used to scroll between the time and date displays and to select the display mode. Normally, pin 4 (RA5/MCLR-bar) of IC1 is pulled high via a 1kΩ resistor but each time S1 is pressed, pin 4 is pulled low. A short press, ie, less than 1s, scrolls to the next display, while a long press (longer than 1s) is used to change the display mode. This is described in greater detail later in the article. Power for the circuit is derived from the +3.3V rail on the WIB board and is fed via connector CON1. A 470µF electrolytic capacitor and a 100nF monolithic capacitor provide supply decoupling for the module. The PGC, PGD and MCLR-bar lines are used only for programming the PIC microcontroller, if necessary. These inputs are all made available on CON1, as are the power supply and receive (Rx) connections. A transmit output WIB Time Display Module: Main Features • • Displays local time and date derived from an internet time server • Six different display modes for time and date (including static and scrolling displays) • • Three line interface to the WIB with automatic baud rate adjustment Can be configured in the WIB to automatically adjust to daylight saving time Persistent settings (settings stored in EEPROM) February 2010  69 DISP1 DISP2 DISP3 DISP4 330 330 Q6 330 330 Q5 Q12 330 Q10 330 2 330 330 Q9 Q4 330 330 Q11 Q7 330 Q8 Q2 Q3 330 Q1 100nF IC1 PIC18LF1320 CON1 10120170 G M 9 0 0 2/ 9 TO CON3 ON WIB BOARD (TERM BLOCK) Vdd MCLR Vdd Tx GND Rx P6C P6D + 470 F S1 1k 7 8 Tx Rx GND CON5 ON WIB BOARD Fig.2: all the parts are assembled on a single PC board measuring 76 x 69mm. Take care with the orientation of switch S1 and the microcontroller and be sure to use the correct transistor type at each location. Parts List 1 PC board, code 07102101, 76 x 69mm 1 piece of red Perspex, 51 x 18mm 4 M3 x 25mm Nylon screws 4 M3 x 12mm Nylon spacers 4 M3 Nylon nuts 1 18-pin IC socket 2 20-pin IC socket strips or 1 x 40-pin IC socket (to be cut in half) 1 SPST PC-mount momentary switch (Jaycar SP-0721, Altronics S-1096) 1 0.5m-length of 0.7mm tinned copper wire (for links) Semiconductors 1 PIC18F1320-I/P microcontroller programmed with 0710210A. hex (IC1) 8 BC327 PNP transistors (Q1-Q8) 4 BC337 NPN transistors (Q9Q12) 4 7-segment red common cathode LED displays (Jaycar ZD-1855, Altronics Z-0190) Capacitors 1 470µF 16V electrolytic 1 100nF monolithic Resistors (0.25W, 1%) 1 1kΩ 1 2Ω 12 330Ω 70  Silicon Chip from the microcontroller has also been made available but is unused in this application. Firmware overview The firmware scans the pushbutton switch (S1), debounces it and differentiates between a short and a long press. It also listens for activity on the serial port. In operation, the time and date are sent by the WIB (when the time module is enabled) as a packet of bytes. Note that the time module in the WIB must be enabled via the SNTP set-up page, as shown in Fig.5 (ie, in the default website supplied with the WIB). The baud rate is gathered automatically from a synchronisation header in the packet. This means that the module will work with any serial port baud rate of between 600 and 115,200 bps (although even higher speeds will work). When the firmware receives a packet, it will display it according to the currently set display mode. There are seven display modes in total, as outlined below and switch S1 is used to select between them. Note that any settings made using S1 are persistent, ie, they are stored in EEPROM and are retained if the power is switched off. These settings include the display mode, whether the time is displayed in 12 or 24-hour format, and the order in which the day and month are displayed. These are preferences that can vary according to locality but the default values are good for Australia. Building it The WIB Time Display Module is built on a single-sided PC board coded 07102101 and measuring 76 x 69mm. Fig.2 shows the assembly details. Before starting the construction, you should inspect the board for defects, including shorts between tracks and open circuit tracks. That done, you can begin by installing the 19 wire links. Many of these go under the LED displays, so it’s vital that they go in first. You can use 0.7mm (or similar) tinned copper wire for the links. These links should all be nice and straight, so that they don’t short together. If necessary, you can straighten the link wire by clamping one end in a vice and then stretching it slightly by pulling on the other end with a pair of pliers. Once the links are in, you can move on to the resistors. There are just three different values and you should refer to the resistor colour codes in Table 1 to distinguish between them. You should also check them using a digital multimeter, just to make sure. Make sure that the correct value is installed at each location. Next, the eight BC327 PNP transistors can be soldered in place. These are transistors Q1-Q4 on the left and siliconchip.com.au 15 59 A 41 A HOLES 'A' ARE 3mm DIAMETER 18 72 65 (TOP OF CASE) EXISTING LED HOLES A 12 A 51 40 10mm DIAMETER HOLE A A 26 24 15 5 45 95 22 108 158 Fig.3: the drilling and cutout diagram for the lid of the case. The display cutout can be made by drilling a series of holes around the inside perimeter, then knocking out the centre piece and filing to a smooth finish. Q5-Q8 on the right. They will only go in one way but be sure to install them in the correct locations. Once these are in, you can install the four BC337 NPN transistors. These are transistors Q9-Q12 and they are located just below DISP2 and DISP3. The next thing to do is to solder in the socket for IC1. Note that the notch must match the component overlay shown in Fig.2. If you are building the WIB Time Display Module from a kit, the microcontroller will be supplied preprogrammed. If not you will need to program it with the firmware file 0710210A.hex which can be downloaded from the SILICON CHIP website. Once programmed, install IC1 in its socket with the correct orientation. Mounting the displays The four 7-segment LED displays are M3 x 25mm NYLON SCREWS M3 x 12mm NYLON SPACERS ALL DIMENSIONS IN MILLIMETRES LID OF CASE TIME MODULE PC BOARD M3 NYLON NUTS Fig.4: this cross-sectional diagram shows how the WIB Time Display Module is secured to the lid of the case. It’s mounted on four M3 x 12mm Nylon spacers and secured using M3 x 25mm Nylon screws. mounted by plugging them into two 20-pin socket strips. You can either use SIL pin socket strips for this job or you can cut a 40-pin IC socket into two 20-pin strips. Once the pin strips are in, plug the four displays in with their decimal points are at bottom right. Be sure to push each display down as far as it will go and make sure that all the pins go into the sockets. Switch S1 is next on the list. It must be installed with the flat side of its body oriented as shown in Fig.2. The assembly can then be completed by installing the two capacitors and Table 1: Resistor Colour Codes o o o o siliconchip.com.au No. 1 12 1 Value 1kΩ 330Ω 2Ω 4-Band Code (1%) brown black red brown orange orange brown brown red black gold gold 5-Band Code (1%) brown black black brown brown orange orange black black brown red black black silver brown February 2010  71 Because of the higher current consumption when the display module is connected, you will need a higherrated plugpack than the one originally specified in the November 2009 article. In that article, we specified a 6-9V 300mA plugpack but you should make that a 6-9V 500mA plugpack if you are using the WIB Time Display Module as well. The existing regulator on the WIB board will cope with the increased current without problems, although it will run warmer. Boxing it Fig.5: in order for the clock to work, you have to enter in the settings for a valid NTP server in the NTP Settings page of the default website supplied with the WIB. You also have to enable the Time Module by clicking the “1” button (circled in red). Fig.6: the default Serial Port Baud Rate of 115200 (circled) can be left as it is on the Home page of the default website but just about any value between 600 and 115,200 bps can be used as the display module automatically synchronises to the baud rate. 8-way socket connector CON1. Take care with the orientation of the 470µF capacitor. Connecting it to the WIB As shown in Fig.2, only three leads are required to connect the Time Display Module to the WIB PC board. The +3.3V (Vdd) and GND (ground) connection can be picked up at the 72  Silicon Chip screw terminal blocks, while the Rx connection must be connected to the Tx (UART transmit) output pin on CON5 of the WIB. You can either make the connections to CON1 & CON5 by soldering the leads to the underside of the PC boards or you can plug the leads directly into the sockets and apply a small amount of solder to secure them. The completed PC board can either be mounted in a separate case or it can be installed in the WIB case. If you choose the latter, then you will have to drill some additional holes in the lid and make a cutout for the LED displays. Fig.4 shows the drilling details for the lid. You can make the display cutout by drilling a series of holes around the inside perimeter of the marked area, then knocking out the centre piece and filing the job to a smooth finish. Once the holes have been drilled, the module can be mounted in position on four M3 x 12mm Nylon spacers and secured using M3 x 25mm Nylon screws – see Fig.4. That done, test fit the two halves of the case together without the end pieces and check that there is adequate clearance between the two boards (ie, no shorts). If everything is correct, the case can then be fully assembled and the lid secured in place using the self-tapping screws supplied. A 51 x 18mm piece of red Perspex can be pushed into the display cutout to give a good finish. A couple of dabs of epoxy adhesive on the edges will hold it in place. The red Perspex diffuses the light and makes the digits look uniform in brightness. Auto baud rate detection As stated previously, the firmware in the WIB Time Display Module uses automatic baud rate detection. This means that the module will work with most serial port baud rates between 600 and 115,200 bps. Make sure, however, that the time data is being sent out by the WIB. This is done by enabling it in the SNTP window of the default website supplied with the WIB (and downloadable siliconchip.com.au from the SILICON CHIP website). Basically, you have to enter in the settings for a valid NTP server as described on pages 90-91 of the December 2009 issue. You then have to turn on the Time Module by clicking the “1” button (circled on Fig.5). Fig.7: this diagram shows the different display modes that can be accessed by pressing switch S1 – see text. Note that the time can be shown in either 24-hour or 12-hour format. The date can also be shown, as can the firmware version, and the display can be turned off. Timeout display In normal operation, the WIB sends out data packets containing the current time and date to the Time Display Module via the serial port. However, if the Time Display Module does not receive a packet during the timeout period (about 3s), it will change its display to four dashes and a periodically blinking decimal point. This means that the time module does not have valid time and date data to display. This can occur when the Time Module function is disabled in the WIB. A timeout can also occur if the UART baud rate in the WIB is suddenly changed (ie, on the home page of the supplied website). In this case, the Time Display Module will initially show the timeout display described above. However, it will then automatically adjust to the new baud rate within a matter of seconds and again begin displaying the correct time. Display modes Before applying power to the unit, check the board carefully for incorrect parts placement and missed solder joints. Once you are satisfied that all is OK, apply power to the WIB and check the display. The unit should initially show the timeout display (four dashes) but should then begin displaying the correct time once the WIB has booted up and accessed an Internet time server. The default display is 24-hour time (hours and minutes) but this can be altered, as explained below. As stated previously, S1 is used to change the display readings and the mode of operation. The circuit responds to two types of button presses – a short press of less than 1s and a long press of greater than 1s. A short press always takes you to the next display reading, ie, from hours and minutes to minutes and seconds and then to the day and month and then to the year and so on. Let’s take a closer look at the different display reading and modes: Mode 1: time in either 24-hour or 12hour mode, consisting of the hour and minutes with a decimal point between them blinking at 2Hz. Mode 2: time in minutes and seconds format, with a decimal point blinking at 1Hz. Mode 3: the date in either day.month or month.day format, together with a periodically blinking display showing the word day. Mode 4: the year as a 4-digit number, together with a periodically blinking display showing the word year. Mode 5: the time and date shown as a continuously scrolling string. Mode 6: the time, including the hour, minutes and seconds, shown as a continuously scrolling string. Mode 7: the firmware version shown as an “F” followed by the 3-digit version number (useful for debugging). Mode 8: Off (the display is not driven). Long button presses A long button press gives a different display mode, depending on the display mode that you are already in. These are as follows: (1) In Mode 1, it toggles the 24-hour mode on and off. (2) In Mode 2, it takes you back to Mode 1. (3) In Mode 3, it toggles whether the date is shown as day.month (eg, for Australia) or month.day (eg, for the US). In Modes 4-8, long button presses SC are ignored. Issues Getting Dog-Eared? Keep your copies safe with these handy binders. REAL VALUE AT $14.95 PLUS P&P Available Aust, only. Price: $A14.95 plus $10.00 p&p per order (includes GST). Just fill in and mail the handy order form in this issue; or fax (02) 9939 2648; or call (02) 9939 3295 and quote your credit card number. siliconchip.com.au February 2010  73