This is only a preview of the July 2021 issue of Silicon Chip.
You can view 41 of the 112 pages in the full issue, including the advertisments.
Items relevant to "20A DC Motor Speed Controller":
Articles in this series:
Articles in this series:
Items relevant to "Model Railway Level Crossing":
Items relevant to "Silicon Labs-based FM/AM/SW Digital Radio":
Items relevant to "Advanced GPS Computer – Part 2":
Purchase a printed copy of this issue for $10.00.
Advanced GPS Computer part two – construction and use Our new GPS Computer has many more features than the last two, and combines all their best features. Now that we have finished describing how it works, let’s move onto the construction and usage instructions. We’ll also delve into how the software works, for those who are interested. by Tim Blythman W e have a lot to cover in this article; after describing the assembly of the custom board, putting it all together and fitting it into its case, we also need to explain how to use its many features. Since the software is quite complicated and we had to solve some interesting problems to make it work, we also have a separate panel explaining some of the code’s trickier details, including the CFUNCTIONs that do most of the hard work. You can read that one if you are interested, or skip it if you aren’t. So without further ado, let’s move on to putting the Advanced GPS Computer together. Construction You will need to build the Micromite V3 BackPack 76 Silicon Chip module with a 3.5in LCD touchscreen. Its construction was detailed in the August 2019 issue (siliconchip.com. au/Article/11764) If you haven’t already done so, you will need to fit the DS3231 RTC IC and its accompanying passive components to the V3 BackPack (see photos overleaf). This is a surface-mounting part, so the usual cohort of SMD gear will be required. There are also a few SMDs on the GPS Computer PCB. A fine-tipped temperature-adjustable soldering iron is highly recommended, along with fine solder wire, flux paste, tweezers, a magnifier and solder-removal wicking braid. The flux releases smoke when soldering, so good ventilation and/or fume extraction is needed. Australia’s electronics magazine siliconchip.com.au One tile which we are sure will be popular is a simple, clear, large, easy-to-read speed readout. The units can be changed between many common road, nautical and aeronautical options. There’s even enough room left over to add a handful of other tiles below this. Start by applying flux to the pads for the DS3231, then carefully tack one lead in place, ensuring that its pin 1 matches the dot marked on the PCB. If necessary, adjust its position to centre the chip on its pads and ensure it is sitting flat on the PCB, then solder the remaining pins. Remove any bridges between pins by applying extra flux and then pushing the braid against the bridge with the iron. Allow it to draw up the excess solder before carefully pulling it away. Fit its bypass capacitor next, followed by the two resistors, and trim their leads short. When fitting header socket CON9, ensure it is fitted on the PCB’s underside and soldered from the top. Check that it is square and vertical so it will mate properly with the matching socket on the board underneath. You might like to leave this for later, and line up all the headers at the same time by sandwiching them between the two PCBs for alignment. This will guarantee that the headers will match. Also make sure to fit female headers to the underside of the V3 BackPack for the standard Micromite I/O pin connections. any bridges, as described above for the DS3231 on the V3 BackPack PCB. Once the surface-mounted parts are fitted, clean the PCB with a flux cleaner and allow it to dry before continuing. Through-hole parts Continue by fitting the fixed resistors. The values are marked on the PCB silkscreen; check each batch with a multimeter to confirm their values. After soldering, trim the leads close to the PCB so it will fit in the enclosure later. GPS Computer PCB assembly Refer to the PCB photos and overlay diagram, Fig.2, during construction to assist with component placement and orientation. Start with the surface-mounted components on the GPS Computer PCB. This includes Q1, Q2, IC3 and IC4. Apply flux to the pads and rest the parts in place. Take care not to mix up Q1 and Q2. Q1, Q2 and IC4 should only fit one way, but you’ll need to check IC3’s orientation. Its pin 1 should be towards the centre of the PCB. Tack one lead of each component and check the remaining pins are flat and square within their pads, adjusting if necessary. Then solder the remaining pins and remove siliconchip.com.au Australia's Australia’s electronics magazine The Advanced GPS computer PCB fits to the rear of a stack consisting of a Micromite V3 BackPack and a 3.5in LCD. A tactile switch can be mounted to the rear at the pads labelled SW2 (S2) to allow operation from the rear of a UB3 Jiffy Box. An integrated Li-ion battery and holder fit into a cutout within the rear PCB. July uly 2021 77 2021 77 Fig.2: the GPS Computer add-on board has four SMDs plus quite a few through-hole components. Of the surface-mounted devices, only IC4 has pins that are relatively close together, but there are only six of them. Ensure IC3 & IC4 are fitted with the correct orientation, then solder Q1 & Q2 and move onto the through-hole parts. The large rectangular cut-out is sized to fit a standard Li-ion rechargeable battery, either soldered directly to the board or in a holder. The TX wire of the GPS module should go to the RX pin on the PCB. 220mF Fit the two diodes next. The larger 1N5819 type (D1) is near CON2, while the smaller 1N4148 is near CON4. Observe their polarity and match the cathode bands to the PCB silkscreen. IC1 and IC2 go near the middle of the PCB, with their pin 1 markings facing away from the other. Carefully bend the leads so that the pins will slot into the PCB. Tack one lead in place and confirm the parts are flat before soldering the remainder. Fit CON1 and CON2 next. We found that these needed to be pressed quite firmly to snap into place, but this means that you can confirm their position before soldering. VR1 is next, ensuring that its wiper goes to the topmost pin and that it sits flat against the PCB. The 220µF electrolytic capacitor is mounted on its side, so install it next, right near VR1. Check that the negative-striped lead is closest to CON1. It’s easiest to bend the leads 90° before soldering it in place. There are six 1µF ceramic capacitors; four near IC1 and two near IC2. Their values are marked on the PCB. Follow with the two 4.7µF ceramic caps near IC4. None of these are polarised. Then mount the four 100nF MKT capacitors, then the solitary 10nF capacitor. Again, none are polarised. We’ll leave off some parts for now, including JP1, JP2, LDR1, LED1, the battery holder and tactile switch, so that we can align them correctly as part of the mechanical assembly after the headers are fitted. Headers and mechanical assembly Space in the UB3 Jiffy Box is tight, especially if you will be fitting the speaker and GPS module internally. Thus, we mount header sockets on the Micromite board and then solder individual male pins to the GPS Computer PCB, to save 2mm in height. We’ve made a custom front panel for this project (rather than reusing the existing 3.5in BackPack laser-cut panel) for two reasons. Firstly, it needs holes for the LDR and LED. Secondly, we have reverted to a design that sits ‘on top’ of the UB3 Jiffy Box, rather than slotting into the top cavity. This gains us another 3mm of usable space inside. This also allows us to add another hole above VR1 to enable adjustments to be made after the unit is fully assembled. The battery holder, LDR1 and LED1 all need to be fitted carefully to ensure they align neatly within the enclosure; that’s why we’ve left them until now. The battery holder needs to clear both the BackPack PCB and the case. There’s a bit of wiggle room, but it’s easier to judge when all the parts are present. As a rough guide, the battery holder’s centre axis should be in line with the PCB. Similarly, the LDR and LED are fitted to be near-flush with the top of the enclosure, and this is another thing that’s easier to do with everything present. It’s also easier to check and judge the holes that need to be made in the enclosure now. Everything is effectively fitted to the back of the front panel, which is then installed into the enclosure. So start with the front panel, with the matte side facing out. The LCD module fits with its 14-way header at the opposite end to the LDR and LED openings. Note from our photos how the silver connections at the The V3 BackPack should look like this when fitted with the DS3231 RTC IC and its associated passives. The 5V USB power jumper is required too, as seen in the lower left corner. Also note the two pin header (CON9) soldered to the underside of the BackPack PCB. 78 Silicon Chip Australia’s electronics magazine siliconchip.com.au When constructing the PCB, note that the Micromite and GPS headers are individual pins that are installed without their plastic shrouds by fitting them into their matching headers before soldering. The LED and LDR (shown with yellow heatshrink on their leads) are installed last to ensure they align with the front panel; SW2 with the back panel. touch panel’s edge align with the front panel. The LCD module is mounted using four 12mm M3 machine screws, and is stood off the front panel with M3 Nylon washers, which provide space for the soldered ends of the LCD module headers. Secure the LCD module to the front panel with four 12mm tapped spacers. If you haven’t fitted the header sockets to the underside of the Micromite V3 BackPack already, then do this now. You can use the GPS Computer PCB as a jig by slotting (but not soldering) the corresponding headers in place, to align the female headers squarely with their PCB. Now slot the Micromite V3 BackPack onto the LCD module, using its 14-way header. Then secure the GPS Computer PCB to the BackPack using 15mm machine screws threaded through the GPS Computer PCB, through the shorter spacers and BackPack into the previously installed tapped spacers. Check that the pads on the GPS Computer PCB line up with the sockets on the BackPack. Then remove the pins from their plastic spacers (eg, pull them out with pliers) and slot them into the headers through these pads. There are 24 in total; one 18-way, one four-way and one two-way. Ensure they are down firmly and level before soldering. When all are soldered, trim their ends. Fit the LED and LDR next. Align each component with its front panel hole and the GPS Computer PCB pads. A piece of masking tape over the holes in the front panel is a simple way to hold the parts flush against it. The LDR is not polarised, so can be fitted either way, but the LED orientation will matter. Set a DMM to diode test mode and connect its probes to the LED leads so that it lights up red. Failing that, use a 5V supply and a 470Ω current-limiting resistor. The lead to the red DMM probe (+) or positive supply lead is then inserted into the LED hole on the PCB nearest CON2. Slip small diameter heatshrink tubing over the LDR and LED leads to prevent them from contacting anything if something comes loose. Before fitting the battery, check that the charging circuit is working correctly. Apply power to the USB socket on the BackPack PCB; the voltage at the battery terminals should settle around 4.3V. The LED should also briefly light up green (perhaps after showing red), indicating that the charge IC has reached its ‘full’ voltage. If it is showing red, try reversing the LED. If it is near 5V, then there might be a fault which is connecting USB power directly to the battery. Do not connect the battery if this is the case! Fix the problem before proceeding, as such a fault could damage the battery or cause a fire. Disconnect USB power and unplug the GPS Computer PCB. Connecting the battery If you have a battery with tabs, you should take great care not to bridge any parts to the battery except the terminal you are working on. Beware that your iron may be Earthed and there may be a path for current through it if it touches anything else. And of course, double-check the polarity! We have fitted the V3 BackPack with female headers (like the RCL Substitution Box from June & July 2020). This allows shortened male headers to be installed on the GPS Computer PCB, making the final assembly more compact, to better fit into the box. siliconchip.com.au Australia’s electronics magazine July 2021 79 Fitting a holder is preferred, as we don’t have to worry about working with the live battery, and can pop it out before working on anything. It will also be much easier to change in future should it fail. Note from our photos that the battery faces outwards, allowing it to be changed if needed. In the unlikely event of it falling out, it will be held against the plastic enclosure rather than being thrust against the sharp edges of the BackPack PCB. Bend the leads so that the battery holder can be fitted to the PCB, then slot the leads into their pads. Then reattach the GPS Computer PCB to the BackPack to check locations and clearance. You might even like to use a plastic spacer to provide positive separation. Check the polarity, then use a generous amount of solder to secure the battery holder. When finished, remove the GPS Computer PCB. You can now fit JP1 and JP2, using a similar technique to the other headers, removing the pins from the plastic housing to reduce their height. If you have a spare fourway header socket, this can be used to secure and align the pins as they are soldered. Alternatively, if you intend to have a permanent setting for JP1 and JP2, these can be replaced with small wire loops soldered directly to the PCB pads. Press the PCBs together to check that JP1 and JP2 do not foul the BackPack PCB. Then fit the battery and reattach the PCB to the stack. Now is a good time to trim the short lead stubs at the back of the GPS Computer PCB. Installing the GPS module As we noted last month, we found that the POWER LED on the VK2828 GPS module drew about 2mA, even with the ENABLE pin taken low. Removing the LED brought this down to 40µA, so we suggest you do the same before fitting it. Next, solder the GPS module and speaker to their terminals. Note there are only four connections needed. Since the VK2828 modules have two spare leads, these can be terminated to either of the spare pads on GPS1 to stop them from floating around. We attached the GPS module and speaker to the PCB’s rear using double-sided tape during testing. Once everything is working, they can be secured with neutral-cure silicone sealant. We wouldn’t use hot-melt glue as it could loosen if the unit is inside a hot vehicle parked out in the sun. The assembly should slot into the UB3 case comfortably. If not, check your clearances before proceeding. Case cutting Fig.3: you can either cut holes in the lid supplied with the Jiffy box, or replace it with one of our laser-cut panels with all the holes neatly pre-made. That just leaves three holes in the sides of the box (two round holes for the 3.5mm jack sockets and a rectangular one for USB) plus a 4mm hole in the rear of the case to access the tactile power-on switch. Or you can fit a chassis-mounting switch instead. 80 Silicon Chip There are four holes to cut in the case; refer to the cutting diagram, Fig.3. It’s a good idea to check this against your assembled board, to ensure that everything is aligned and any minor variations in construction are accounted for. The 3.5mm sockets are set behind the panels to prevent the PCBs from catching on the case. Thus, you might need to enlarge these holes if you have bulky 3.5mm leads. This is easily done with a larger or stepped drill bit, or a tapered reamer. To create the square hole for the USB lead, we suggest drilling a 10mm hole within the outline. Then open out the corners with a needle file or similar. You can use a pencil to draw guidelines on the enclosure before cutting. A simple wipe with a finger is enough to remove pencil marks. Australia’s electronics magazine siliconchip.com.au Code in depth Since we have had so many requests for tweaks and updates to the Boat Computer, we will provide a bit more background on the inner workings. We are pretty much at the limits of what MMBasic can store in the Micromite’s flash memory, so some things have been done in terse and non-obvious ways to save flash memory. The following is quite in-depth. It isn’t critical to understand it; you certainly won’t need it to operate the GPS Computer with its default programming, but rather if you’re interested in making changes to the code. As with many Micromite projects, the colour scheme is set by several CONST values near the start of the program. Altering these is one of the simplest ways to personalise the GPS Computer. The chime sound heard alongside messages is defined just after the splash screen is displayed and is held in the BELL variable. Although declared as an integer type to allocate memory, it is processed as an array of bytes. It is created by a formula which generates a decaying sine wave which goes for 8000 samples, or one second. Changing this formula is the easiest way to customise this sound. The click sound (when buttons are pressed) and voice warning are stored in flash memory as part of the library file. The tile feature works through the TILE function, which calls individual functions based on each tile type. These specific functions can draw the tile graphics (using the coordinates they are set to), report their width or height (so the COMPOSE page can display them), or react to a button press. Creating new tiles will require other tiles to be replaced. The tile name is stored in the T_TYPE string array. Many tiles depend on other functions that return strings representing numerical values adjusted for and suffixed with the currently selected units. Any time the Micromite is not busy, it calls the IDLE subroutine, which attends to background tasks such as receiving and processing GPS data. It behaves like MMBasic’s PAUSE, but does other activities and can return control to the main program if a touch is detected on the touch panel. It also periodically updates the top right of the display, and adjusts the volume and backlight as needed. The number of pages, tiles and POIs are limited by the amount of available VAR SAVE flash memory; for the Micromite, this is 2kB. If you wish to adjust the balance of these items, the PG_CNT, ITEM_COUNT and POI_COUNT constants can be changed. We have already pushed these number to their limits, so increasing any one will require another to be decreased. Note that the MAIN MENU page only has room for up to six pages, so any more than this will not be accessible through the existing interface. as the API (application programming interface) numbers paired with named constants. For example, function 0 (CONST AUDIO_INIT) starts the timer interrupt in preparation for other functions. If you are using the LPC samples, then the CFUNCTION needs to know the location for some constant parameters. These can be set by pointing them to one of the data CFUNCTIONs noted earlier using API function 11, thus: Library and CFUNCTIONs When API number 49 (GPS_PARSE) is executed and finds a valid sentence, it reports the matching parser’s API number and copies the sentence elements (which are simply separated by commas) into the remaining array elements. Since certain items are always found at certain sentence locations, the appropriate array elements always contain the necessary data. Note that the string array dimensions and lengths are hard-coded into the CFUNCTION and must match. Once the elements are copied, the array elements containing latitude and longitude can be decoded into degrees, minutes and fractional minutes by using API numbers 61, 62 and 63, respectively. These return integers as there is much more overhead required for CFUNCTIONs to work with floating point numbers. The ILI9488 display driver is not new, and is based on code by Peter Mather at the Back Shed Forum (an excellent resource for Micromite related discussion). See www.thebackshed.com/forum/ ViewTopic.php?TID=11419 Apart from the GPS and audio CFUNCTION, we’ve also incorporated some CFUNCTIONs as wrappers for data to be stored in flash. These aren’t actual executable code, but can be stored compactly without the overhead of MMBasic. The COMBINED CFUNCTION incorporates the audio and GPS features that we use in this project. Each sub-function is invoked by calling the COMBINED function with a different first parameter. These parameters are listed near the start of the MMBasic code siliconchip.com.au JUNK=COMBINED(LPC_SET_CONST_PTR, PEEK(CFUNADDR LPC_CONST)) With this done, we can play audio samples. API function 4 (AUDIO_GET_STATE) reports the current state to avoid interrupting playback in progress. API function 1 (AUDIO_SET_PTR) sets the PCM data pointer, while API function 2 (AUDIO_PLAY) starts playback, like this: IF COMBINED(AUDIO_GET_STATE)=0 THEN JUNK=COMBINED(AUDIO_SET_PTR, PEEK(CFUNADDR CLICK)) JUNK=COMBINED(AUDIO_PLAY) ENDIF Replacing API function 2 with API function 6 (AUDIO_LOOP) will cause the sample to loop, while API function 7 (AUDIO_END_ LOOP) will cause a looping sample to revert to non-looped playback. This means that it will complete the current cycle instead of being cut off abruptly. We’ve written a small program in C which can convert WAV files into MMBasic CFUNCTION data; this is in the software collection as sample.c, compiled for Windows as sample.exe. Playback of LPC data works similarly, using API functions 8 (AUDIO_LPC_PTR) and 9 (AUDIO_LPC_START) respectively. We’ve included a spreadsheet document which can translate Arduino LPC sample definitions into CFUNCTION data. GPS decoding works similarly. API number 48 (GPS_SET) sets a pointer to a string variable which is filled with data from the GPS module by the MMBasic code. The MMBasic string variable format consists of one byte indicating the length, followed by up to 255 data bytes containing the string contents, eg: JUNK=COMBINED(GPS_SET, PEEK(VARADDR GPS_DATA)) API numbers 50-55 (GPS_PARSER0 – GPS_PARSER5) set pointers to string arrays. The first element of each array is filled with the sentence signature that is scanned for: GPRMC_PARSE(0)=“$GPRMC” Australia's Australia’s electronics magazine July uly 2021 81 2021 81 Here’s a side view to show how tightly everything is packed into the stack of PCBs, allowing room for a GPS module and speaker inside the UB3 Jiffy Box. The diagram also shows the location for a hole if you have a PCB-mounted tactile switch fitted to the S2 pads. A button with its actuator top 12mm above the PCB will sit just behind the panel (requiring a pen or similar to operate), while one that is around 15mm will sit just proud of the enclosure and be more accessible. So you should choose a height that suits how accessible you want the switch to be. Alternatively, any momentary switch can be run back to the terminals marked S1. This will allow you to fit a panel-mount pushbutton to the side or top of the case if the back is not suitable. We haven’t included any speaker vent holes; these will depend on your speaker’s size and location. Programming the chips There are a few ways to program the microcontrollers for this project. Screen1: on power-up, and whenever the EXIT button is pressed, the GPS Computer displays the MAIN MENU screen. Four custom pages are accessible through the buttons at left, while the buttons at right provide options to change settings and customise pages. 82 Silicon Chip If you have ordered from the SILICON CHIP ONLINE SHOP, then the micros will already be programmed, and you should jump ahead to the setup section. You can use the in-circuit serial programming (ICSP) interface to upload a HEX file (using either the Microbridge or an external programmer such as a PICkit 4), but remember to detach the GPS Computer PCB so that its connections do not cause a conflict. Use your programmer’s instructions to upload the HEX file, which you can find on the SILICON CHIP website. If you have a V3 BackPack that is already running MMBasic, you don’t need to worry about ICSP programming. We usually use MMEdit to work with BASIC files, but the process is much the same if you use TeraTerm instead. We’ve used MMBasic version 5.5.3, and we recommend you do the same, especially if you are installing MMBasic from scratch. We have not tested our code with other versions. Load the GPS Computer Library.bas file into the Micromite. Then, via the terminal, run the commands: LIBRARY SAVE CPU RESTART The Micromite will reset and load the ILI9488 display driver. Now you can run: OPTION TOUCH 7, 15 GUI CALIBRATE These commands are noted in the comments at the start of the library file. You can test the touch and LCD with these commands: GUI TEST LCDPANEL GUI TEST TOUCH Screen2: this page allows some troubleshooting of the GPS Computer. The satellite count is a good indicator of any problems the GPS module might have; we typically saw 1112 satellites using a VK2828 GPS module. Australia’s electronics magazine siliconchip.com.au Next, load the main GPS Computer.bas file and run it. If you have trouble with the GPS Computer.bas file, try the crunched version (with a ‘c’ suffix). This has had all the extraneous whitespace and comments removed. We found that our program was so large that even the ‘crunch on load’ option does not remove enough whitespace; it appears to leave some behind to maintain line numbering. This will get the Micromite to the same state as if it were programmed with an ICSP programmer and HEX file. Reassemble the stack if it is not complete, and supply power via the USB socket. A splash screen will appear for a few seconds, after which the MAIN MENU page (Screen1) should be displayed. If not, you might need to run the MMBasic program from the prompt, using a serial terminal program at 38,400 baud. Pre-programmed micros should not need this. While the splash screen is displayed, the Micromite is busy generating audio data for later playback. It requires less flash memory to generate these into RAM than to hard-code them, so we put up with the brief delay while this happens. Since the flash memory is quite full, but barely half the RAM is used, this is to our advantage. All screens will display the information seen at top right. You can quickly check the time, GPS status (a red or green G) and battery state at a glance. The time can be set to 12-hour or 24-hour format; the 24-hour format shows seconds as it does not need room to show the AM/PM indicator. At first start, the red “G” will be displayed until the GPS receiver is outputting valid data, which could take 15 minutes for the first time, even under good conditions. The battery icon should show a green charging symbol when connected to USB power. Pressing any button will trigger a short click to let you know that the button press has been detected, while a short chime accompanies messages and errors. The volume of these can be adjusted using VR1. The RAW DATA page (Screen2) can help with checking the GPS state. Check the satellite count; if you aren’t seeing at least four satellites after 15 minutes, and you have good visibility of the sky, there might be a problem with the GPS module. Zero satellites may mean that the GPS module is not receiving signals at all. The EXIT button will always return to the MAIN MENU. The SETTINGS page sets most user preferences such as units and GPS Computer behaviour. The five top items down the left-hand side (Screen3) are the settings for display units; pressing each button cycles between three and six options. These include three styles for latitude and longitude, including degrees, minutes and seconds, decimal degrees and the decimal minutes mode which GPS modules use. The latitude and longitude sign can be displayed as N/S or E/W, negative sign only (with implied positive sign) or explicit positive and negative signs. Both horizontal distance and vertical distance units can be set independently. The choices are metres, feet, kilometres, miles, nautical miles or flight level. Flight level is measured as multiples of 100ft and is often used for altitude in aviation. Speed offers the choice of metres per second (m/s), kilometres per hour (km/h), miles per hour (mph) or knots (equal to nautical miles [NM] per hour). None of these options are stored permanently until the SAVE button is pressed. This reduces wear on flash memory, and allows you to test settings before committing to them. The bottom item at left is for adjusting some numerical values. The ← button cycles between time zone, backlight high, backlight low, speed high, speed low, volume high and volume low. You can adjust each value with the + and – buttons. A short press increments or decrements each value by a small amount, while holding the button down allows it to change quickly. The time zone changes by 15-minute increments; see Table 2 for some handy timezone offsets. The backlight high and low settings set the brightness in high and low light conditions, respectively; the GPS Computer interpolates between these. Set the high level to be Screen3: we have crammed a lot onto this screen to cater to most users’ preferences. The SAVE button is needed to save any parameters to flash memory (to be saved through power-down), including POIs and custom page layouts. Screen4: the POI (point of interest) EDITOR allows the current coordinates to be quickly saved with the ADD HERE button. Any POI can be activated by scrolling up or down and then pressing the SET button at right. Setup and basic use siliconchip.com.au Australia’s electronics magazine July 2021 83 Table 2: Time zone offsets for Australia and New Zealand. comfortable in daylight, and the low level to be comfortable at night (or when the sensor is covered). When the GPS Computer displays a green “G” icon, pressing the TIME button will save the current GPS time to the RTC. If you get an error message, it might be that the RTC IC is not connected or not working correctly. The 12HR or 24HR button toggles how the time is displayed; the style shown on the button is currently active. The button marked “S<” or “S-” indicates whether the synthesised audio output is activated; again, the button shows the current state. Battery sensing Similarly, the high-speed setting corresponds to the speed at which the high volume setting is used, and the low-speed setting to low volume. Note that the displayed units will match the currently selected units. Internally, all speeds are in m/s and converted as needed. See Fig.4 for a graphical explanation of this. We suggest leaving the low and high speeds around these values, then getting a passenger to adjust the volume levels to be comfortable when travelling around the low and high speeds. This is because there won’t be much road or engine noise below 30km/h, and not much change above 80km/h. If you find this isn’t the case, then you can try tweaking these values too. Remember that both brightness and volume are programmed to ramp quite slowly (around 10% per second), so give the unit time to respond to significant changes. The RTC always keeps track of coordinated universal time (UTC), and the local time to display is calculated from that, based on current time zone and daylight savings settings. Turning daylight saving mode on and off is done by pressing the DST button. A “+” indicates that daylight savings is in effect and one hour is added to the current offset; a “–” means no adjustment from the set time zone. In practice, if you live in a state which uses DST, you should only need to adjust the time twice a year by merely pressing the DST button to turn daylight savings on or off. The six buttons at top right of the SETTINGS page control battery behaviour. The HI voltage is the threshold below which it is assumed that USB power is not available, while the LO voltage sets the lower limit for battery operation, below which the unit will shut down. In use, the battery icon will be green above HI and yellow between HI and LO. A bar-graph showing rough stateof-charge and a percentage are shown in the yellow phase. Below LO, the TO timer starts counting, and this is shown in red next to a red battery icon. When the timer expires, the software takes pin 9 low, meaning that the unit will power off if running from battery power. Any time the voltage rises above LO, the timer will reset. The defaults of 3.8V for LO and 4.4V for HI mean that the GPS Computer should run for as long as practicable from a Li-ion battery. The MAIN MENU page also shows the state of pin 9 as POWER(1) or POWER(0). Pressing the button will toggle the pin state. You can use this to force the GPS Computer to shut down even if it has some remaining battery life. The MAIN PAGE also has a SLEEP button, which turns off the backlight and puts the Micromite into its lowest power mode. The GPS module is still fully powered, so should be able to maintain a satellite fix. This is handy for conditions where you wish to save power but also require the GPS Computer to start up again with minimum delay. Pressing the screen for around one second will cause the GPS Computer to leave sleep mode. The long press is needed as the Micromite can only test for touches once per second in its low-power sleep mode. Screen5: the ADD HERE button provides a default name based on the coordinates; You can alter it by pressing the cancel button and using the keyboard. You will be prompted to confirm the name before it is stored. Screen6: custom coordinates can be entered in either degrees/minutes/seconds or decimal degrees. They are confirmed in the currently selected display units for latitude and longitude before being displayed in the POI list. Speed-based volume control 84 Silicon Chip Australia’s electronics magazine siliconchip.com.au Points of Interest (POIs) The POI EDITOR feature (Screen4) is accessed from the POI button on the MAIN PAGE. Five POIs are displayed from a larger list, and the complete list can be accessed by pressing the scroll buttons at left. One POI is marked in green; this is the currently active POI and is activated by one of the SET buttons at right. The current POI is used in any of the screens that provide POI tracking. Each non-empty entry shows a custom name, an absolute compass heading toward the POI, as well as its latitude, longitude, altitude and distance away. Pressing the ADD HERE button creates a POI with the current GPS coordinates; a default name based on the latitude and longitude is offered, but can be altered by pressing CANCEL. The ADD POI button allows all this data to be entered manually, such as creating POIs from a map or GPS coordinates. Screen5 & Screen6 show the relevant entry displays. Latitude and longitude can be entered in either decimal or degrees/minutes/seconds format; the value is converted to the currently set units for confirmation. Both ADD buttons will always look for an empty slot, so there is little risk of overwriting an existing POI. The DELETE button needs to be used to clear a slot, and an error message is provided if there are none. Finally, the REFR button refreshes the display. This is necessary as the headings and distances do not automatically refresh. Fig.4: if you are using the speed-sensitive volume control feature, this is how it works. The volume is fixed from stationary up to the low-speed threshold, after which it rises until reaching the maximum volume setting at the high-speed threshold. The COMPOSE page (Screen7) shows why the GPS Computer is so much more flexible than the Boat Computer. With so many people asking for specific combinations of information to be displayed, it made sense to make this as versatile as possible. So we’ve designed 23 different ‘tiles’, each capable of displaying a small amount of information. There are four pages which can each be customised with up to six tiles each. The restriction here is mainly due to the limited amount of flash memory available to save variables. As for other settings, the page composition is not saved until the SAVE button is pressed on the settings page. So you can easily experiment with layouts without committing to them. The COMPOSE page shows an overview of each page, allowing it to be edited as needed. The NEXT and PREV buttons cycle between the pages. The page and item number is shown at the top of the page, with its title below. You can edit the title by pressing the TITLE button; this title is used on the MAIN PAGE. On each page, the currently selected tile is marked in yellow, the others in grey. Pressing inside the display area will move the selected tile, if it doesn’t conflict with anything else. To align a tile, you can hold your finger on the touch panel and move it slowly in the desired direction. It's not quite drag-and-drop, but it's fairly intuitive. Pressing CLEAR will delete the selected tile and ADD will bring up a menu of the available tiles (Screen8). The GPS Computer will attempt to fit it in the current screen, and will report an error if it can’t. The algorithm does not try all possible locations, so you might have luck retrying if a tile doesn’t fit the first time. Pressing SEL<> cycles between the tiles on each page. Screen7: the COMPOSE page displays a mockup of the customisable pages, allowing the layout to be viewed before use. Note that each page also has an EXIT button at lower right. Screen8: there are 23 different tiles to choose from, so pretty much any combination of data can be displayed. A large speed display allows the GPS computer to be set up as a highly accurate speedometer. Composing your own displays siliconchip.com.au Australia’s electronics magazine July 2021 85 Tiles: a brief overview of each tile's features Sleep: Adds a button to put the GPS Computer into sleep mode, the same as the SLEEP button on the MAIN PAGE. Heading: Shows a dial with top fixed at north and an arrow indicating the current track (absolute bearing direction of travel, in degrees). School Time: A small banner that flashes and makes a warning announcement during school hours (internally set to 8:00-9:30am and 2:30-4:00pm) according to current local time. Compass: Shows a dial with the current track fixed at top and compass points rotating around to indicate the bearing. The track is also shown numerically inside the dial. Volume: A bar graph showing the current volume level; coloured green under 100%, yellow up to 200% and red above 200%. Each bar is around 8%. Small Speed: This text box displays the speed in text format using the current speed format and units. Current POI name: Displays the name of the currently selected POI. Latitude/Longitude/Bearing: Similarly, these tiles display GPS data such as latitude, longitude and altitude, also using the appropriate selected display format. POI heading: Shows direction to currently selected POI in text format. Large Speed: A text display of speed (using current units) which takes up most of the available screen. Average Speed: A digital average speed display. The button shows the time over which the average has been accumulated; pressing this button resets this. In other words, the average speed is measured from the time when the button was last pressed. Naturally, this doesn’t accumulate during sleep or shutdown. PAGE 1–PAGE 4: These add a shortcut button to the specified page. Their title will change if the page title changes. POI Compass/Distance to POI/Altitude difference to POI: Show the direction (in dial format)/horizontal distance/vertical distance to currently selected POI. POI Page/Settings Page: Shortcut buttons to the specified pages. Screen9: the larger 3.5in LCD and touch panel allows us to provide a full-sized keyboard to enter just about any ASCII character, except that the backtick is replaced by a degree symbol (not shown). 86 Silicon Chip Conclusion While we have gone into quite a bit of detail regarding how you can tweak the MMBasic code, we expect that many people will make good use of the COMPOSE feature to set up their own pages. We’re always interested to hear what people are doing with our projects, and no doubt our readers will think of SC something else to add. Screen10: a number of useful messages are provided when something interesting occurs. These are accompanied by a brief chime through the speaker to attract your attention. Australia’s electronics magazine siliconchip.com.au