Silicon ChipTouchscreen Super Clock - July 2016 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Drilling for oil and our need for fossil fuels
  4. Feature: Directional Drilling: How It Works by Dr David Maddison
  5. PartShop
  6. Project: Universal -33°C to 125°C Temperature Alarm by John Clarke
  7. Project: Brownout Protector For Induction Motors by Jim Rowe
  8. Serviceman's Log: No magic hammers with smart TVs by Dave Thompson
  9. Product Showcase
  10. Project: Touchscreen Super Clock by Geoff Graham
  11. Subscriptions
  12. Project: Stereo LED Audio Level/VU Meter, Pt.2 by Nicholas Vinen
  13. Feature: Australian World Record In Photovoltaic Efficiency by Ross Tester
  14. Review: How Good Are Those 2.4GHz AV Senders? by Allan Linton-Smith
  15. PartShop
  16. Vintage Radio: The Grebe Synchrophase MU-1 5-Valve Radio by Dr Hugo Holden
  17. Market Centre
  18. Notes & Errata: Pocket TENS Unit for Pain Relief, January 2006
  19. Advertising Index

This is only a preview of the July 2016 issue of Silicon Chip.

You can view 40 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 "Universal -33°C to 125°C Temperature Alarm":
  • Universal Temperature Alarm PCB [03105161] (AUD $5.00)
  • Universal Temperature Alarm Prototype PCB [03105161 RevA] (AUD $2.00)
  • Universal Temperature Alarm PCB pattern (PDF download) [03105161] (Free)
  • Universal Temperature Alarm lid panel artwork (PDF download) (Free)
Items relevant to "Brownout Protector For Induction Motors":
  • Brownout Protector PCB [10107161] (AUD $10.00)
  • Brownout Protector PCB pattern (PDF download) [10107161] (Free)
  • Brownout Protector lid panel artwork and drilling diagrams (PDF download) (Free)
Items relevant to "Touchscreen Super Clock":
  • Micromite LCD BackPack PCB [2.8-inch version) [07102122] (AUD $5.00)
  • PIC32MX170F256B-50I/SP programmed for the Micromite-based Touchscreen Super Clock [SuperClockFull.hex] (Programmed Microcontroller, AUD $15.00)
  • VK2828U7G5LF TTL GPS/GLONASS/GALILEO module with antenna and cable (Component, AUD $25.00)
  • CP2102-based USB/TTL serial converter with 5-pin header and 30cm jumper cable (Component, AUD $5.00)
  • DS3231-based Real Time Clock & Calendar module with mounting hardware (Component, AUD $6.00)
  • Matte/Gloss Black UB3 Lid for 2.8-inch Micromite LCD BackPack (PCB, AUD $5.00)
  • Clear UB3 Lid for 2.8-inch Micromite LCD BackPack (PCB, AUD $5.00)
  • Gloss Black UB3 Lid for 2.8-inch Micromite LCD BackPack (PCB, AUD $4.00)
  • Firmware (HEX) file and BASIC source code for the Micromite-based Touchscreen Super Clock [v1] (Software, Free)
  • Micromite LCD BackPack PCB patterns (PDF download) [07102121/2] (Free)
Items relevant to "Stereo LED Audio Level/VU Meter, Pt.2":
  • Stereo LED Audio Level Meter / VU Meter PCB [01104161] (AUD $15.00)
  • PIC32MX150F128D-I/PT programmed for the Stereo LED Audio Level Meter / VU Meter [0110416A.HEX] (Programmed Microcontroller, AUD $15.00)
  • Strip of ten ultra-bright YELLOW M3216/1206 SMD LEDs (Component, AUD $0.70)
  • Strip of ten ultra-bright AMBER M3216/1206 SMD LEDs (Component, AUD $0.70)
  • Strip of ten ultra-bright BLUE M3216/1206 SMD LEDs (Component, AUD $0.70)
  • Strip of ten ultra-bright GREEN M3216/1206 SMD LEDs (Component, AUD $0.70)
  • Strip of ten ultra-bright RED M3216/1206 SMD LEDs (Component, AUD $0.70)
  • Red & White PCB-mounting RCA sockets (Component, AUD $4.00)
  • SMD components for the 100dB Stereo Audio Level Meter/VU Meter (AUD $35.00)
  • Stereo LED Audio Level Meter / VU Meter clear acrylic case pieces (PCB, AUD $15.00)
  • Firmware (C and HEX) files for the Stereo LED Audio Level Meter / VU Meter [0110416A.HEX] (Software, Free)
  • Stereo LED Audio Level Meter / VU Meter PCB pattern (PDF download) [01104161] (Free)
  • Laser cutting artwork and drilling diagram for the Stereo LED Audio Level Meter / VU Meter (PDF download) (Panel Artwork, Free)
Articles in this series:
  • Stereo Audio Level/VU Meter: Add Bling To HiFi System (June 2016)
  • Stereo Audio Level/VU Meter: Add Bling To HiFi System (June 2016)
  • Stereo LED Audio Level/VU Meter, Pt.2 (July 2016)
  • Stereo LED Audio Level/VU Meter, Pt.2 (July 2016)

Purchase a printed copy of this issue for $10.00.

Micromite-Based Super Clock By Geoff Graham Yes, we can guess what you are thinking . . . not another clock project. But this one is special because it can show the time using either an analog or digital display. It can also track the time in up to 20 different locations, adjust each location for daylight saving and keep precise time using either a temperature-compensated real-time clock (RTC) module or a GPS module. A S WITH a number of recent projects, our new clock is based on the Micromite LCD BackPack. This time though, we have teamed it with a very accurate real-time clock (RTC) module (or a GPS module) for basic timekeeping. As before, it relies on the touchscreen interface of the LCD panel in order to configure and operate the unit – there are no switches or knobs. This makes it easy to build and it should take no more than an hour or so to assemble. This is more than just a single clock; instead, it’s really 20 separate clocks in one. When it’s displaying the time, a simple tap on either the righthand or lefthand side of the screen switches 58  Silicon Chip the display forwards or backwards to the next clock. Each clock can be configured to display the time as either an analog clock (with hour, minute and second hands), a 12-hour digital clock (with AM and PM indicators) or a 24-hour digital clock. As already indicated, each clock can be configured for the daylight saving rules applying to its particular time zone. In addition, it can be given a unique title, so that you know which location each clock refers to. All these characteristics are independently set for each clock. So, you could have one clock showing UTC, another set for Sydney time, a third set for San Francisco, and so on. You could also have two of the clocks set to a single location with one showing an analog display and the other a digital display, so that you could quickly flip between whatever style takes your fancy. Naturally, it also shows the day and date beneath the time display. If you have relatives in different parts of the world that you telephone regularly, this clock will be a boon. With just a prod of your finger, you can quickly see what the exact time is “over there”. As with all Micromite-based projects, the software is written using BASIC and is stored as plain text. This means that you can “get in there” and modify it to do whenever you want, if you feel so inclined. To do that though, you will need to make up a cable with siliconchip.com.au The Super Clock can display the time in any one of three formats: (1) an analog clock (with second hand), (2) a 12-hour digital clock or (3) a 24-hour digital clock. It’s really 20 clocks in one and each one of the 20 possible time zones/cities can be set independently. A simple tap on either side of the screen takes you to the next clock display. Circuit Uses Either An RTC Or A GPS Module For Accurate Timekeeping This is the RTC (real-time clock) module that’s recommended for use in the Micromite Super Clock. It employs a Maxim/Dallas DS3231 chip which can keep time to ±5s per month (or better) over a 0-40°C temperature range, while its battery back-up facility retains the time during power outages. a USB-to-serial converter, as described in the February 2016 issue. Timekeeping The Micromite Super Clock will work with any one of three time sources: (1) an accurate real time clock (RTC) module based on the Maxim/Dallas DS3231 chip; (2) a GPS module; or (3) the internal Micromite clock which uses a simple RC oscillator. You can use whichever source you wish but we recommend the DS3231 RTC module. This is shown in an above siliconchip.com.au If you have a good GPS signal indoors, you can use a GPS module as the time source instead of an RTC. Its advantages are that you never have to set the time and it is always spot on. This VK­ 2828U7G5LF GPS module and the RTC module at left are available from the SILICON CHIP Online Shop. photo and can be purchased on eBay for a few dollars or from the SILICON CHIP Online Shop. In fact, buying the complete module this way is cheaper than purchasing the bare DS3231 chip from a normal distributor. The Super Clock will also work with any other RTC that’s supported by the Micromite (see the Micromite User Manual for the details). However, we recommend that you use a module based on the DS3231 for this project. The DS3231 RTC is quite advanced and contains all the necessary time- keeping electronics, including a crystal and its associated oscillator. Every 64 seconds, the chip reads the output of its on-chip temperature sensor and then uses a look-up table to determine the amount of trimming capacitance needed to compensate and bring the crystal’s frequency back into line. This is automatically done without any user intervention. The result is a specified accuracy of ±2ppm over the temperature range of 0-40°C. This is a phenomenal result and equates to about five seconds per month. And that’s just the maximum error; most times the DS3231 will achieve a precision much better than that. The DS3231 also includes what the manufacturer calls an “aging offset register” which can be used to further trim the clock’s accuracy. Our Super Clock gives you access to this register, so if you are very particular and have the patience, you can tweak the clock to give even better accuracy than the standard (highly-accurate) temperature-compensated crystal timebase. By contrast, a GPS module will be even more accurate as a time source but they are often not reliable indoors. A metal roof, rain or other factors can cause a GPS module to lose its signal. On the other hand an RTC using the DS3231 will never drop out and with its on-board battery back-up, it will continue to keep accurate time regardless of power outages. GPS time source GPS modules are now quite cheap and if you are sure that you have a good GPS signal indoors (or wherever the clock is to be used), one of these would make an excellent time source. The big advantage of using a GPS module instead of an RTC is that you never have to set the time. What’s more, the time is always spot on since it is derived from the GPS satellites. When power is applied, the Super Clock will first check for an RTC (such as the DS3231) and if one isn’t found it will then search for a GPS module. The BASIC program in the Micromite will automatically adapt to most GPS modules on the market. This includes selecting a baud rate between 4800 and 56,300 and automatically switching between TTL and RS-232 signal levels. If the program cannot find either an RTC or a GPS module, it will pop up a dialog box warning that neither could July 2016  59 Fig.1: most of the work in the Micromite Super Clock is done by IC1 which receives time signals from either an RTC (real-time clock) module or a GPS module (but not both) and drives a touch-screen colour LCD connected to CON3. The RTC module will generally be the one to use since the clock will be used indoors but a GPS module can be substituted if GPS reception isn’t a problem. Power comes from a 5V DC USB plugpack charger and this directly powers the LCD, while 3-pin regulator REG1 provides 3.3V to power IC1. The diode circled in red must be removed if a non-rechargeable CR2032 back-up battery is used in the real time clock (RTC). This diode is part of the charging circuit and removing it prevents the module from recharging the battery. Alternatively, you can leave the diode in place if a rechargeable LIR2032 battery is used – see text. 60  Silicon Chip be found. When you touch the OK button on the screen, the clock will then go on to use the Micromite’s internal timekeeping facility. This source is not very accurate and the time will be lost whenever the power is cycled. However, it’s useful if you do not have an RTC or GPS and just want to experiment with the software. Circuit details Refer now to Fig.1 for the circuit details of the Micromite Super Clock. This shows the connections for both a DS3231 RTC and a GPS module but in practice only one of these is used. Omit the GPS module, diode D1 and 1kΩ resistor if using an RTC. Alternatively, omit the RTC if using a GPS module. The DS3231 RTC module runs off 5V and uses I2C to communicate, so it connects to pins 18 & 17 on the Micromite (IC1) which are the I2C data and clock pins respectively. The I2C protocol requires pull-up resistors on the signal lines and these are provided by the module, which makes it easy for us. The alternative GPS module uses a serial interface and so it connects to pins 22 & 21 which handle the COM1 receive and transmit signals (from the Micromite’s perspective). As shown, the Tx (transmit) line from the module goes to the Rx (receive) pin on the Micromite via a series 1kΩ resistor and has a clamping diode (D1) to 3.3V. These are there to protect the Micromite if the module uses RS-232 signal siliconchip.com.au levels, which can swing ±12V. Alternatively, if you are sure that your module uses TTL signal levels, you can dispense with the diode and replace the resistor with a wire link (although leaving these parts in circuit won’t do any harm). Some GPS modules use a 3.3V supply while others use 5V. As shown on Fig.1, you can connect the module to either supply pin on the Micromite LCD Backpack. DS3231 RTC module As previously mentioned, the DS­ 3231 module can be purchased on eBay. Just search for “DS3231” and you will get hundreds of hits. The module that we purchased, as shown in the photos, is the most common. Make sure that the module that you purchase matches ours because we have tested this variant and it works well. The RTC module is normally supplied without a back-up battery due to air-freight concerns. The battery specified is an LIR2032 which is a rechargeable lithium-ion type. However, this battery type is difficult to find in Australia. In our application though, we don’t need a rechargeable battery because the clock will spend most of its time connected to a plugpack supply. This means that the RTC will not be running off its back-up battery except during the odd power outage. However, these events are so infrequent and the current drawn by the DS3231 chip is so low that a standard non-rechargeable battery can be used instead of the LIR2032. For this reason, if your module isn’t supplied with a battery, we recommend modifying it to take a standard CR2032 battery. This type of battery is available everywhere and will last even longer than the rechargeable version (upwards of 20 years). Modifying the RTC module to take a CR2032 battery simply involves removing a diode, as shown in the photo on the facing page. This diode is part of the charging circuit and once it’s gone, the module cannot charge the battery (which could be disastrous if a non-rechargeable battery is used). Note that the DS3231 module shown in the photos is also equipped with a 32K bit EEPROM memory chip which is not used by the Super Clock. GPS modules The Super Clock will work with siliconchip.com.au Parts List Micromite LCD BackPack Unit 1 double-sided PCB, code 07102122, 86 x 50mm (for 2.8inch LCD) 1 2.8-inch ILI9341-based touchscreen LCD, 320 x 240 pixels 1 UB3 ABS box, 130 x 67 x 43mm (Altronics H0153 or H0203, Jaycar HB6013 or HB6023) 1 laser-cut black or clear acrylic lid to suit UB3 box 1 4-pin tactile switch, through-hole hole (S1) 1 100Ω vertical-mount side adjust trimpot (VR1) (Altronics R2579, element14 9608044 or similar) 1 28-pin DIL low-profile IC socket 1 4-pin 0.1-inch male header (CON1) 1 18-pin 0.1-inch male header (CON2) 1 14-pin 0.1-inch female header socket (CON3) 1 6-pin 0.1-inch right-angle male header (CON4) 1 2.1mm or 2.5mm panel-mount DC socket (Altronics P0622 or P0623) 4 M3 x 12mm tapped spacers 4 M3 x 10mm black machine screws 4 M3 x 6mm machine screws 4 M3 x 1mm (6mm OD) Nylon washers Semiconductors 1 PIC32MX170F256B-50I/SP microcontroller programmed with SuperClockFull.hex (IC1). Note: a PIC32­MX170F256B-I/ SP can also be used 1 Microchip MCP1700-3302E/TO voltage regulator (REG1) Capacitors 1 47µF 16V tantalum or SMD ceramic (3216/1206) 2 10µF 16V tantalum or SMD ceramic (3216/1206) 2 100nF monolithic ceramic Resistors (0.25W 5%) 1 10kΩ RTC version 1 RTC module using the Maxim/ Dallas DS3231 1 LIR2032 or CR2032 battery (see text) 4 single-pin female headers for the interconnecting leads 2 M2 x 10mm tapped Nylon spacers 4 M2 x 6mm Nylon screws GPS Module version 1 3.3V or 5V GPS module with connecting cable 1 1N4004 silicon diode (see text) 1 1kΩ resistor (0.25W, 5%) (see text) 4 single-pin (DuPont) female headers (for interconnecting leads) Cable Parts 1 USB cable with a male type A connector (length to suit) 1 2.1mm or 2.5mm DC plug to suit DC socket 1 4-pin 0.1-inch female header Red & black hook-up wire Where To Buy Parts A kit for the Micromite LCD BackPack is available from the SILICON CHIP Online Shop. This includes a 2.8-inch touch-screen LCD panel, the BackPack PCB, a PIC32 microcontroller programmed with SuperClockFull.hex, all the on-board parts and a laser-cut black or clear acrylic lid with a cut-out to suit the LCD and mounting holes to suit a UB3 box (the black lid has a gloss finish on one side and a matt finish on the other). Note that the kit does not include the box, mounting hardware, power supply, DC socket, off-board headers or any connectors or cable parts. The BackPack PCB and a programmed microcontroller are also available separately. RTC & GPS modules We also have available the RTC module (back-up battery not included) plus two M2 x 10mm Nylon spacers and four M2 x 6mm Nylon screws for mounting. In addition, two different GPS modules with internal battery back-up are available and these are each supplied with a connecting cable. Finally, suitable USB-to-serial con­ verters are on offer and these are each supplied with a short DuPont cable to connect to the Micromite. Browse to the SILICON CHIP Online Shop for pricing and ordering details. July 2016  61 47µF 10k ICSP CON4 (UNDER) 10 µF + + 100nF 1 10 µF REG1 MCP1700-3302E IC1 PIC32MX170F256B-50I/SP http://geoffg.net/micromite.html 07102122 CON3 LCD 100nF 1 2.8-Inch Micromite LCD BackPack Construction CON1 + (UNDER) 5V TX RX GND RESET 3 4 5 9 10 14 16 17 18 21 22 24 25 26 3V3 5V GND CON2 inbuilt back-up battery (which some modules lack). S1 RESET Backlight 100Ω VR1 1 Fig.2: repeated from the February 2016 issue, this parts layout diagram shows how to build the BackPack PCB for the 2.8-inch LCD. Note that pin headers CON1 & CON2 are mounted on the rear of the PCB, while CON3 & CON4 are mounted on the top (see photos). Construction mostly involves assembly of the Micromite LCD BackPack PCB (the 2.8-inch version is the one to use) and this should take no more than half an hour. It uses less than a dozen components and the PCB is silkscreened with the component layout and values, so it’s simply a case of populating the board and plugging it into an ILI9341 LCD touch-screen panel. The parts layout diagram for the LCD BackPack was originally published in both the February and April 2016 issues of SILICON CHIP, together with other details. We’re also reproducing the diagram in this issue – see Fig.2. Use a socket for IC1, take care with component orientation and note that pin headers CON1 & CON2 are mounted on the rear of the PCB (see photo at left). A complete kit for the LCD BackPack is available from the SILICON CHIP Online Shop (see parts list). This kit is supplied with SMD ceramic capacitors (2 x 10μF and 1 x 47μF), as these are more reliable than tantalums (the PCB can accept either type). The SMD capacitors are non-polarised and can be installed either way around. Loading the firmware The colour LCD is mounted on the laser-cut acrylic lid before being plugged into the BackPack PCB. Be sure to fit the LCD to the lid with the correct orientation, so that the display is centred. almost any GPS module, so there are quite a few units to choose from. The basic specifications required are 3.3V or 5V power, a serial interface with TTL or RS-232 signal levels and a baud rate of 4800 to 38,400. Suitable GPS modules include the Fastrax UP501, USGlobalSat EM408, Ublox NEO-7M-C, Ublox NEO6M, Skylab MT3329/SKM53, V.KEL VK16HX, V.KEL VK16E and Ublox VK2828U7G5LF. The last two in this list are available from the SILICON CHIP Online Shop. All of the above GPS modules use TTL levels, so the resistor and diode shown in Fig.1 are not required (ie, 62  Silicon Chip delete the diode and replace the 1kΩ resistor with a link). You should also check the data sheet for the module to determine if it has any special requirements. The most common is that if it has an enable input, then this must usually be connected to the positive supply rail for the module to work. Alternatively, some modules require the enable input to be connected to ground or even left floating, so check the data sheet carefully. The GPS modules supplied by SILICON CHIP must have their enable inputs connected to the positive supply rail and can run off either a 3.3V or 5V supply rail. They also have an The easiest method of loading the firmware is to program the PIC32 chip with the file SuperClockFull.hex. This single firmware file contains everything that you need, including the MMBasic interpreter configured for the display and the BASIC program for the Super Clock. The file can be downloaded to a PC from the SILICON CHIP website and to load it into the Micromite, you will need a PIC32 programmer such as the PICkit 3. Once the chip has been programmed, it’s just a matter of plugging it into its socket and you are ready to go. The only issue that you need to be aware of is that the touch calibration in the above firmware was done with a reasonably standard LCD panel. However, yours might require recalibration if it is significantly different from the “standard” that we used. This can be done by connecting a USB-to-serial converter to the console, halting the program with CTRL-C and re-running the calibration routine siliconchip.com.au as described in the Micromite User Manual (which can be downloaded from the SILICON CHIP website). The touch calibration procedure was also described in detail in the February 2016 issue of SILICON CHIP. The alternative to programming the chip with the combined firmware is to load each software component separately as listed below: • Program the chip with the file Micromite_V5.2.hex (the BASIC interpreter), then configure the interpreter for the display panel and touch. • Using AUTOSAVE or XMODEM, load the file SuperClockFonts.bas into MMBasic and then save it to the library with the command LIBRARY SAVE. • Using AUTOSAVE or XMODEM, load the file SuperClock.bas into MM­ Basic and issue the command RUN. A detailed explanation of how to do this is also included in the Micromite User Manual. USB-to-serial converters suitable for use with the Micromite are available from the SILICON CHIP Online Shop (three different types are currently on offer). All plug straight into a USB port on a PC and are supplied with a short DuPont cable to connect to CON1 on the Micromite LCD BackPack. Pre-programmed chip Don’t want the hassle of programming the PIC32 microcontroller yourself? In that case, you can simply purchase a fully programmed microcontroller from the SILICON CHIP Online Shop. As before, you may have to go through the touch calibration procedure if your LCD panel is significantly different from the standard (although in most cases, it will be fine). Enclosure The Micromite LCD Backpack fits neatly into a standard UB3 enclosure. As with the Micromite Boat Computer M3 x 10mm BLACK MACHINE SCREW ACRYLIC LID WITH CUT-OUT FOR LCD (REPLACES ORIGINAL UB3 BOX LID) TOUCH-SCREEN LCD M3 NYLON WASHER (1mm THICK) M3 x 6mm MACHINE SCREW M3 x 12mm TAPPED SPACER MICROMITE 2.8-INCH BACKPACK PCB M2 x 6mm NYLON SCREWS described in April 2016, a laser-cut acrylic front panel (black) replaces the standard lid supplied with the box and this results in a neat assembly. This panel is designed to suit the 2.8-inch touch-screen LCD panel and has the mounting holes pre drilled, along with a precision cut-out for the LCD. It can be purchased from the SILICON CHIP Online Shop. The first stage of assembly is to attach the LCD panel to the acrylic lid using an M3 x 10mm machine screw, 1mm-thick M3 Nylon washer and an M3 x 12mm tapped spacer at each corner – see Fig.3. This arrangement ensures that the surface of the LCD sits flush with the acrylic lid. The BackPack PCB is then plugged into the LCD and fastened to the spacers by M3 x 6mm machine screws. Note that the self-tapping screws supplied with the UB3 box to attach the lid may have to be replaced with No.4 x 10mm self-tapping screws. This could be necessary because the acrylic panel is thicker than the lid supplied with the box. Power supply The unit requires a 5V power supply 2.8-INCH LCD PCB RTC MODULE Fig.3: here’s how to attach the LCD & Micromite BackPack PCB to the acrylic lid. The LCD goes through a cut-out in the lid and sits flush with its top surface. M2 x 10mm NYLON SPACERs rated at 300mA or more. That means you can use a 5V plugpack or a USB charger. If a USB charger is used, a suitable power cable needs to be made by cutting one end off a standard USB cable (retaining the Type A socket at the other end) and soldering the free end to a suitable DC power plug. The red wire in the USB cable (+5V) should go to the centre pin of the plug and the black to the sleeve. The other two wires (the signal wires) can be cut short, as they are not used (see Fig.4). A matching DC power socket for the incoming power is mounted on the side of the UB3 box. This should be mounted near the base of the case, so that it doesn’t foul the BackPack PCB. Once it’s in place, two flying leads are run from this socket and soldered to a 4-pin header socket which is then plugged into the BackPack’s CON1 connector. Be very careful here as CON1 is not polarised, so make sure that the centre pin of the power socket (+5V) connects to the pin marked with the 5V symbol on the BackPack’s PCB. We speak from experience here as we accidentally connected the cable the wrong way during development. Fig.4: the Micromite Super Clock is powered from a standard USB plugpack charger. To make a suitable power cable, cut one end off a USB cable (retaining the type A male connector at the other end) and solder the red wire to the centre terminal pin of a DC plug and the black wire to the outside pin. The matching DC socket is mounted on the side of the UB3 box and is connected to a 4-pin female header which then plugs into CON1 on the BackPack PCB. siliconchip.com.au July 2016  63 If you are using a GPS module instead of the RTC, the mounting arrangement will depend on the module. The important factor is that the antenna (the ceramic object on the top of the module) should be horizontal and pointing to the sky when the assembly is fitted to the case. The best solution is to attach it to the inside of the top of the enclosure (eg, using a thin smear of neutral-cure silicone), with flying leads running to the appropriate pins on CON2. Using the clock The BackPack PCB plugs into the touch-screen LCD and the two are fastened together and to the lid using spacers and machine screws – see Fig.3. The RTC is mounted on the base of the box towards the bottom edge so that it doesn’t foul CON1 & CON2 on the BackPack PCB. Similarly, the DC socket should be mounted close to the base so that it doesn’t foul the edge of the BackPack PCB or CON3’s soldered pin connections. Miraculously, both the Micromite and the LCD survived but we don’t recommend the practice. RTC or GPS unit mounting The DS3231 RTC module (if used) is mounted on the base of the UB3 box using four Nylon M2 x 6mm screws, two M2 x 10mm Nylon spacers and Nylon nuts. It must be positioned towards the bottom edge of the case (see photo overleaf) to avoid fouling CON1 and CON2 on the underside of the BackPack PCB, as these connectors extend close to the base. Note that Nylon mounting hardware must be used due to the close proxim64  Silicon Chip ity of the holes to the solder pads and tracks on the RTC’s PCB. Before actually fastening the RTC into position, connect four 100mmlong flying leads to its SCL, SDA, VCC & GND terminals. The RTC has solder pads for these terminals at one end and a pin header incorporating these terminals at the other and you can use either set for the connections. The other ends of the flying leads are terminated in single-pin “DuPont” sockets to connect to CON2 on the BackPack PCB. Alternatively, you can solder the leads direct to CON2’s terminals or you could use a multi-pin (10way) header socket for the connection. When the clock is powered up, it will first check for a connected RTC. This only takes a few milliseconds and if it is found, the clock will display the time and begin normal operation. If an RTC is not found, the clock will display a message stating that it is checking for a GPS module. This can take up to 10 seconds as the program scans through the various possible baud rates and TTL/RS232 combinations. If the GPS module cannot be found, the software will report this fact and you will need to sort out why it is “silent”. The most likely cause is that the transmit and receive signals have been swapped. Alternatively, the GPS module may require an enable signal, as described above. When the GPS module has been detected, the display will show the message “Searching for Satellites”, which means that the module is trying to locate enough satellites to get a fix. Initially, this can take up to an hour, so place the module outdoors where it has a clear view of the sky and leave it running. When a lock has been achieved, the clock will switch to showing the time. If neither an RTC nor GPS is found, the software will report this fact in a dialog box with an OK button. Touching this button then lets the clock function by using the Micromite’s internal clock. When the time is displayed, you can then step forward through the configured clocks by repeatedly touching the righthand side of the LCD, or step back by touching the lefthand side. Initially, there are five clocks configured and these are for UTC, Perth, Sydney, New York and Paris. By default, UTC is shown as a 24-hour clock, Perth and Sydney use an analog clock and the rest use a 12-hour digital clock. In addition, siliconchip.com.au Screen 1: tapping the centre of the LCD brings up the main configuration screen. This allows you to change the type of the clock (Hidden, Analogue, 12-Hour Digital or 24-Hour Digital) and to set the date and time. Note that if you build the GPS version, the SET DATE and SET TIME buttons will not be visible; instead, the status of the GPS module will be reported in this screen space. the correct time zone and daylight saving rules are set for each location. Of course, these are only offered as examples and you can jump right in and change them to suit yourself. That’s done by touching the centre of the LCD which will take you to the configuration screen as shown in Screen 1. This screen allows you to change the type of the clock (Hidden, Analog, Digital 12h or Digital 24h, etc), the time and settings for that particular clock, and more. All these settings are stored in non-volatile memory and automatically recalled on power-up. At the bottom of the configuration screen are buttons marked PREV and NEXT. Using these, you can step through all 20 clocks. Note that some clocks initially have their type set to “Hidden” (clocks 6-20). This means that when you are changing the displayed clock by tapping on the screen, the BASIC program will skip over hidden clocks and wrap around at the end of the list. If you want to make a clock visible, set its type (at the top of the configuration screen) to Analogue or Digital and conversely to hide a clock, set its type to Hidden. Underneath the clock’s type is the CONFIGURE CLOCK button which allows you to set the time zone and daylight saving rules for that particular clock. The display below this button will differ depending on the time source that you are using (either an RTC or GPS module). Set Date & Set Time If you are using an RTC module (or siliconchip.com.au Screen 2: this screen allows you to configure a particular clock (the Micromite Super Clock supports 20 different clocks). You can change the title and configure the time zone and daylight saving parameters. Screen 3: it’s easy to assign a title to a clock by pressing the SET button at the top of Screen 2 and then using this keypad. Where do you get those HARD-TO-GET PARTS? Many of the components used in SILICON CHIP projects are cutting-edge technology and not worth your normal parts suppliers either sourcing or stocking in relatively low quantities. Where we can, the SILICON CHIP On-Line Shop stocks those hard-to-get parts, along with PCBs, programmed micros, panels and all the other bits and pieces to enable you to complete your SILICON CHIP project. SILICON CHIP On-Line SHOP www.siliconchip.com.au/shop Miss this one? Screen 4: setting both the time and date for the RTC version is straightforward using this keypad. When you set the time you are setting the local time and all the other clocks will then be automatically updated according to their time zone. the internal oscillator), this bottom section of the screen will show two buttons designated SET DATE and SET TIME. These are used to initially set the time for the RTC. Note that when you are setting the time, you are setting the local time. For example, if the clock is showing Sydney time, you should enter the date and time for Sydney. All the other currently programmed clocks will then automatically update based on their Big, bold and beautiful – and simply the BEST DIY loudspeaker system ever published . . . anywhere! Published in May, 2014 The Majestic Everything about this superb loudspeaker system is impressive: size, physical presence, power handling, efficiency – and most of all, performance. Compare them with commercial loudspeakers ten and twenty times the price! If you want the ultimate build-it-yourself loudspeakers, you want The Majestic! You’ll find the construction details at siliconchip.com.au/Project/Majestic Crossover PCB available from On-Line Shop July 2016  65 Trimming The DS3231’s Aging Offset Register If you are using a DS3231 RTC module, the SET TIME button in the configuration screen has an additional feature; if you hold it down for five or more seconds, you will be taken to the DS3231’s Aging Offset setting. As explained in the text, this can be used to trim the DS3231’s crystal oscillator to achieve an even greater accuracy than normal. By default, the aging offset value is set to zero but you can plug in whatever number you wish from +127 to -127. Typically, a change of ±1 will change the clock’s timing by 0.1 parts per million, which is about a Screen 5: setting the daylight saving rules for a clock is easy and intuitive. The clock will always increment or decrement the time by exactly one hour at 2am (non-daylight saving time) on the start or ending day specified. The only exception is the UK (time zone zero), where the time switch occurs at 1am. respective time zone – so you only need to set the time once. Alternatively, if you are using a GPS module, the SET DATE and SET TIME buttons will not be present because the GPS module itself supplies the exact date and time. Instead, this section of the screen will show a message reporting the status of the GPS module. Most of the time it will show “GPS Time Synchronised”, which means that the GPS has a lock on sufficient satellites to get a precise time. From time to time, the GPS could lose this lock, especially when the quarter of a second over a month. Incrementing the number slows down the clock and decrementing it speeds the clock up. If you want to experiment with this setting, the best method would be to set the time exactly against some standard (eg, an Internet time server) and then recheck the displayed time three months later. Simple arithmetic will then tell you the amount of trim required. You can then experiment with that value and recheck the accuracy a further three months later. Provided you have the patience, you could get the clock’s accuracy to close to spot on within a year or two! clock is located indoors. Rather than display an error message, the Super Clock will switch to using a timebase supplied by the crystal-controlled clock within the GPS module, which is accurate to within a few seconds per day. The clock will keep using this time source for up to 24 hours without a satellite fix and this should be enough to carry it through even the most extended glitch in GPS signal reception. If the clock is running in this mode (ie, using the GPS module’s crystalbased clock), the message on the configuration screen will show “No sync for n.nn hrs”. This indicates that the GPS module has lost its lock on the satellites and has not been able to regain it for the past n.nn hours. After 24 hours of no satellite lock, the BASIC program will restart the Micromite which forces it to go through the full power-up sequence, including finding the initial GPS fix. So, if you initially had the clock running successfully but then find that it is sitting there with the message “Searching for Satellites”, it means that it has run for over 24 hours without a lock and you should move it nearer to a window (or install a DS3231 RTC module instead). Daylight saving settings The Configure Clock menu for a par- Screen 6: an aging offset of +1 will slow the clock by about 0.1ppm while -1 will speed it up by the same amount. You can enter any number from -127 to +127. ticular clock or location allows you to change the name allocated to that location, the time zone and the daylight saving settings – see Screen 2. The daylight saving settings have been designed to suit most countries, although there are some that are just too complicated (for example Iran). For both the start and end of daylight saving, the setting is displayed as something like “1st Sun in Oct”. By touching the SET button, you will be taken to a further screen where you can change the month of the daylight saving change, the day of the week and the position of that day in the month (1st, 2nd, 3rd or last day in the month). The clock will always increment or decrement the time by exactly one hour at 2am (non-daylight saving time) on the start or end day specified. The one notable exception to the 2am change is the UK where the time switch occurs at 1am. The clock accommodates this special case by checking the time zone and if it is zero, it will assume that the country is the UK and the time switch will be made at 1am. That’s it, your Micromite Super Clock is complete. In practice, you will find that the menus are all simple to navigate and set-up and it will only take you a few minutes to familiarise SC yourself with their operation. Issues Getting Dog-Eared? Keep your copies of SILICON CHIP safe, secure & always available with these handy binders REAL VALUE AT $16.95 * PLUS P & P Order now from www.siliconchip.com.au/Shop/4 or call (02) 9939 3295 and quote your credit card number. *See website for overseas prices. 66  Silicon Chip siliconchip.com.au