Silicon ChipAdvanced GPS Computer - Part 1 - June 2021 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Semiconductor shortages are becoming serious / The right to repair
  4. Feature: The Right to Repair (and Modify) by Dr David Maddison
  5. Project: Advanced GPS Computer - Part 1 by Tim Blythman
  6. Feature: The History of USB by Jim Rowe
  7. Project: Recreating Arcade Pong by Dr Hugo Holden
  8. Feature: The History of Videotape – Camcorders and Digital Video by Ian Batty, Andre Switzer & Rod Humphris
  9. Project: PIC Programming Helper by Tim Blythman
  10. Review: The New Arduino IDE 2.0 by Tim Blythman
  11. Project: Programmable Hybrid Lab Supply with WiFi – Part 2 by Richard Palmer
  12. Review: Weller T0053298599 Soldering Station by Tim Blythman
  13. Product Showcase
  14. Serviceman's Log: Trying to fix unbranded, generic equipment is frustrating by Dave Thompson
  15. PartShop
  16. Vintage Radio: 1940 RME Model 69 communications receiver by Fred Lever
  17. Market Centre
  18. Advertising Index
  19. Notes & Errata: Programmable Hybrid Lab Supply with WiFi, May 2021; Arduino-based Power Supply, February 2021; DIY Reflow Oven Controller, April-May 2020; Deluxe Touchscreen eFuse, July 2017
  20. Outer Back Cover

This is only a preview of the June 2021 issue of Silicon Chip.

You can view 37 of the 112 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 "Advanced GPS Computer - Part 1":
  • Advanced GPS Computer PCB [05102211] (AUD $7.50)
  • PIC32MX170F256B-50I/SP programmed for the Advanced GPS Computer [0510221A.hex] (Programmed Microcontroller, AUD $15.00)
  • DS3231 real-time clock IC (SOIC-16) (Component, AUD $7.50)
  • VK2828U7G5LF TTL GPS/GLONASS/GALILEO module with antenna and cable (Component, AUD $25.00)
  • MCP4251-502E/P dual 5kΩ digital potentiometer (Component, AUD $3.00)
  • Micromite LCD BackPack V3 complete kit (Component, AUD $75.00)
  • Matte/Gloss Black UB3 Lid for Advanced GPS Computer (BackPack V3) or Pico BackPack (PCB, AUD $5.00)
  • Firmware for the Advanced GPS Computer [0510221A.HEX] (Software, Free)
  • Advanced GPS Computer PCB pattern (PDF download) [05102211] (Free)
  • Advanced GPS Computer box cutting diagram and lid dimensions (Panel Artwork, Free)
Articles in this series:
  • Advanced GPS Computer - Part 1 (June 2021)
  • Advanced GPS Computer - Part 1 (June 2021)
  • Advanced GPS Computer – Part 2 (July 2021)
  • Advanced GPS Computer – Part 2 (July 2021)
Articles in this series:
  • The History of USB (June 2021)
  • The History of USB (June 2021)
  • How USB Power Delivery (USB-PD) works (July 2021)
  • How USB Power Delivery (USB-PD) works (July 2021)
Items relevant to "Recreating Arcade Pong":
  • Mini Arcade Pong PCB [08105211] (AUD $27.50)
  • Pair of Signetics NE555Ns (Component, AUD $12.50)
Articles in this series:
  • The History of Videotape – Quadruplex (March 2021)
  • The History of Videotape – Quadruplex (March 2021)
  • The History of Videotape - Helical Scan (April 2021)
  • The History of Videotape - Helical Scan (April 2021)
  • The History of Videotape – Cassette Systems (May 2021)
  • The History of Videotape – Cassette Systems (May 2021)
  • The History of Videotape – Camcorders and Digital Video (June 2021)
  • The History of Videotape – Camcorders and Digital Video (June 2021)
Items relevant to "PIC Programming Helper":
  • 8-pin PIC Programming Helper PCB [24106211] (AUD $5.00)
  • 8/14/20-pin PIC Programming Helper PCB [24106212] (AUD $7.50)
  • Relay - 1A DPDT 5V DC coil (EA2-5NU) (Component, AUD $3.00)
  • PIC Programming Helper PCB patterns (PDF download) [24106211-2] (Free)
Items relevant to "Programmable Hybrid Lab Supply with WiFi – Part 2":
  • WiFi-Controlled DC Electronic Load control PCB [18104212] (AUD $10.00)
  • Programmable Hybrid Lab Supply Control Panel PCB [18104211] (AUD $10.00)
  • Programmable Hybrid Lab Supply Regulator Module PCB [18104212] (AUD $7.50)
  • 2.8-inch TFT Touchscreen LCD module with SD card socket (Component, AUD $25.00)
  • ESP32 DevKitC microcontroller module with WiFi and Bluetooth (Component, AUD $25.00)
  • Software, manuals and laser templates for the Programmable Hybrid Lab Supply (Free)
  • Programmable Hybrid Lab Supply Control Panel PCB pattern (PDF download) [18104211] (Free)
  • Programmable Hybrid Lab Supply Regulator PCB pattern (PDF download) [18104212] (Free)
  • Drilling/cutting diagrams and front panel artwork for the Programmable Hybrid Lab Supply (Free)
Articles in this series:
  • Programmable Hybrid Lab Supply with WiFi – Part 1 (May 2021)
  • Programmable Hybrid Lab Supply with WiFi – Part 1 (May 2021)
  • Programmable Hybrid Lab Supply with WiFi – Part 2 (June 2021)
  • Programmable Hybrid Lab Supply with WiFi – Part 2 (June 2021)

Purchase a printed copy of this issue for $10.00.

What’s your transport mode? Shanks’ Pony? Car? RV? Boat? Plane? Hot Air Balloon? With a 3.5in touchscreen, our new Advanced GPS Computer is a great tool for on the road, in the water or even up in the sky. It can be customised to exactly how you want it. You’ll wonder how you ever did without it! Advanced GPS Computer Part I – by Tim Blythman T he Touchscreen Boat Computer with GPS has been a phenomenally popular project. First released five years ago (April 2016; siliconchip. com.au/Article/9887), it became one of the first projects to show just how handy and versatile the first Micromite LCD BackPack could be. Over the years, we’ve had numerous requests for features to be added. It was clear that people weren’t just using it in their boats, but on the road, in the bush and even in the sky. The latest minor revisions came in November last year, with two contributors to Circuit Notebook each adding their own touches (see siliconchip.com.au/Article/14644). One example was tweaked to provide three simple screens for use on the road. One screen provides GPS ground speed and a compass display, while the others show the time, date and satellite data. The second example is also designed as a speedometer, and adds automatic backlight control. So we thought, why not combine all these features (and more) into a newer and even better unit? It could use the larger 3.5in touchscreen to make the display more visible, with software changes so that users could adjust the displays to their liking. 24 Silicon Chip While doing this, it also made sense to integrate the features of our GPS Finesaver with Automatic Volume Control from June 2019 (siliconchip.com.au/Article/11673). That project also needed an update, mainly to give it a larger display. So the Advanced GPS Computer supersedes both the GPS Boat Computer and the GPS Finesaver, combining the features of both and adding new capabilities and refinements. The new GPS Computer The GPS Computer is a culmination of all these features and advancements. Naturally, it incorporates the POI (Point Of Interest) feature from the Boat Computer. This allows GPS coordinates to be ‘bookmarked’. The GPS Computer can then display the heading and distance to the POI, allowing simple navigation, or perhaps helping you to find that favourite fishing spot again! It won’t give you turn-by-turn navigation, but it can at least point you in the right direction. The large speedometer display is also present, as are numerous other GPS and time-related data. These include latitude, longitude, altitude, compass heading and average speed. Australia’s electronics magazine siliconchip.com.au The automatic volume control feature from the GPS Finesaver works precisely like it did in that device. You can feed audio through the device, via a 3.5mm stereo jack socket, and it will automatically adjust the volume according to vehicle speed. The output is louder at higher speeds, to help overcome increased noise from the vehicle. Our GPS Finesaver article goes into more detail about why this is a handy feature to have. Our revised design adds many more new functions. An audio synthesiser can inject warning sounds, alerts and even spoken words to the audio path, which can be fed either to the 3.5mm output jack or a small onboard amplifier and speaker. An RTC (real-time clock) IC provides accurate timekeeping, even if the GPS receiver has not locked onto enough satellites. A rechargeable battery provides an integrated power supply. The battery state is displayed onscreen, and the unit allows low-power sleep operation, which keeps the GPS active as well as a complete power-off mode. But we think that the most important new feature is the high degree of customisation that is possible. Four user-customisable displays are available that can be changed to show various parameters in different units. The displayed screens are also fully customisable to show exactly the combination of information that you want. As the user interface is written in MMBasic, it can be further tweaked by advanced users as needed. Hardware Our photos show the main electronics for the GPS Computer consisting of three boards sandwiched together. This stack fits neatly into a plastic UB3 Jiffy box. The top two boards will be familiar to readers as the Micromite V3 BackPack and its accompanying 3.5in LCD touchscreen. If you aren’t familiar with that device, we recommend reading the article describing it in the August 2019 issue Features & Specifica tions • Based on Micromite LCD BackPack V3 with 3.5in LCD touchscreen • Custom display and inf ormation screens including current and average speed along with time • Powered by a rechargea ble batter y and/or DC sup ply • Adds automatic volum e control to vehicle entert ainment systems • Automatic backlight con trol • Programmed in MMBas ic • Points of interest (POIs) can be saved and navigated to • Internal speaker for wa rning announcements and tones (siliconchip.com.au/Article/11764). The Micromite V3 BackPack used here is close to its minimum configuration. JP1 is fitted so it will draw power from its USB socket, and it is set up for pulse-width modulation (PWM) backlight control. This is necessary to allow for automatic backlight adjustment. The only optional parts fitted to the V3 BackPack board are to enable the RTC feature, and include the DS3231 clock IC and its accompanying passives; two 4.7kΩ I2C pull-up resistors and a 100nF bypass capacitor. Also, a two-pin header is fitted to the BackPack’s CON9 to supply power to the battery input of the RTC IC. The other optional parts supported by the V3 BackPack should not be fitted as they might conflict with some pin assignments. In particular, the parts in the flash IC box must not be fitted, nor should the IR receiver. The latter won’t cause a conflict, but the receiver is unusable from within MMBasic when programmed with this project’s software. Add-on PCB The third board in the stack mentioned earlier is the custom add-board for this project. It just plugs into the Micromite BackPack, and the circuit for this board is shown in Fig.1. One of the frequently suggested improvements we had for the GPS Finesaver from June 2019 was that its display was too small. The Advanced GPS Computer offers a speed display which takes up most of the 3.5in LCD. And if you don’t want a speed display, you can customise it to include a selection of other information. siliconchip.com.au Australia’s electronics magazine June 2021  25 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. Note that an integrated Li-ion battery and holder fit into a cutout within the rear PCB. Connection to the BackPack is via three headers. The 18-way and four-way headers provide connections for the Micromite’s I/O and power pins, as for most Micromite projects, while two-way header CON4 connects to the BackPack’s CON9 as noted above. About half of the components on the GPS Computer PCB are to implement the automatic volume control function, which is broadly the same as that implemented in the GPS Finesaver. We’ll start with that. Audio path Stereo audio comes in via 3.5mm jack CON1. We’ll follow one audio channel signal as they are identical. A 100kΩ resistor DC-biases the signal to ground to prevent it from floating when nothing is connected, after which it passes through a 1kΩ series resistor. This protects against high currents flowing into the device, and blocks RF signals that the external wiring might pick up. The signal is AC-coupled by a 1µF ceramic capacitor and biased (via a 22kΩ resistor) to a 2.5V mid-rail. This rail is generated by a pair of 10kΩ resistors across the 5V supply, bypassed by a 220µF capacitor to eliminate supply noise. IC1 is an MCP4251 5kΩ dual gang digital potentiometer with 257 steps. The ‘lower’ end of the track (pin 10 for the left channel or pin 5 for the right channel) is tied to the 2.5V rail, while the other ends are connected to the conditioned audio signals (pin 8 for the left channel, and pin 7 for the right). The 5kΩ resistance in series with the 1kΩ input resistance 26 Silicon Chip and the biasing components means that the signals at pins 7 & 8 are around 80% of the initial magnitude. The signals on the potentiometer ‘wipers’, pins 9 (left) and 6 (right), are attenuated depending on the internal potentiometer setting. This is controlled by an SPI serial bus on pins 1 (CS), 2 (SCK) and 3 (SDI) of IC1. The bus is driven from pins 10, 25 and 3 of the Micromite respectively, via the 18-way I/O header. Note that the MCP4251 is designed to accept different analog and digital voltage levels. So it will happily accept the 3.3V digital control signals from the Micromite alongside the 5V maximum audio signals and digital supply voltage. Dual-channel rail-to-rail op amp IC2 is set up to provide a gain of about three times, both to improve the output drive level and expand the volume range. Thus, the fullscale output corresponds to around 240% of the incoming signal; close to 1% per potentiometer step. A rail-to-rail op amp is needed here due to the narrow Fig.1 (opposite): the Micromite V3 BackPack PCB includes the USB data interface, a 32-bit microcontroller, the touchscreen interface and a DS3231 real-time clock IC. The remaining functions are on the GPS Computer PCB, the circuit of which is shown here. It primarily has a GPS module for speed, time and location data, a digital pot for volume control, op amps for signal conditioning, a power amplifier to drive the small speaker for warning sounds, plus a Li-ion battery charger that runs from 5V. Australia’s electronics magazine siliconchip.com.au siliconchip.com.au Australia’s electronics magazine June 2021  27 supply range. We’ve specified an LMC6482, but other similar rail-to-rail devices like the MCP6272 should work fine. Both IC1 and IC2 have 100nF supply bypass capacitors. The volume-adjusted audio is fed into non-inverting input pins 3 and 5 (left and right) of IC2, with a 10kΩ/5.1kΩ divider connected between the output pins (1 for left and 7 for right) and inverting input pins (2 for left and 6 for right). These dividers set the gains to around three times. The output signals are AC-coupled and passed through 100Ω resistors to ensure stability and protect the op amp outputs, then biased to ground via 22kΩ resistors and made available at CON2, the 3.5mm output socket. Signal injection Another signal can be injected into the audio path from the Micromite’s pin 24, which is PWM-capable and thus can generate tones or PWMsynthesised analog signals. The signal from pin 24 is fed into VR1 to provide level control. VR1, the 470Ω series resistor and 10nF capacitor form a low-pass filter to remove any supersonic artefacts from PWM analog signal synthesis. At this point, there are two options for where this synthesised audio signal goes. With two jumpers on each of JP1/ JP2 (across positions 1 & 2, and positions 3 & 4), the 2.2kΩ resistors and 1µF capacitors AC-couple this signal into the left and right channels of the existing stereo path, just before they are fed into IC1. This has the advantage that the warning sounds will be heard through your vehicle speakers. The disadvantage is that these components introduce a small amount of cross-talk between the channels, reducing stereo separation slightly. In this mode, the jumpers on positions 3 & 4 feed the audio from the op amp outputs to a pair of mixer resistors and then into inverting input pin 4 of SSM2211 audio amplifier IC3. Its non-inverting pin, pin 3 is tied to pin 2, which outputs a mid-rail bias voltage and is bypassed by a 100nF capacitor. A second 100nF capacitor provides supply bypassing between, pins 6 and 7. IC3’s SHDN pin 1 is held low to enable the amplifier. The output signal from pin 5 is fed back to pin 4 via a 22kΩ resistor, giving close to unity gain, as the two 47kΩ input resistors are effectively in parallel. A speaker connected at CON3 is driven by the push-pull signal from pins 5 and 8 of IC3. The unity-gain setting means that (as much as possible) the full 5V headroom is available to both the op amp and amplifier. IC3 is capable of delivering around 1W into 8Ω or up to 1.5W into 4Ω. The alternative configuration is to have a single jumper on both JP1 and JP2, between positions 2 & 3. This keeps the 3.5mm audio path separate from the synthesised audio, and only the synthesised audio is fed to the speaker connected to CON3. Battery circuitry A small Li-ion cell is connected to the circuit at the BAT+ and BAT- terminals. A slot in the PCB provides space for a 14500-size cell (roughly the same as AA cells). The cell can be connected via a PCB-mounting cell holder, or by soldering the cell tabs directly to the PCB. It provides power to the real-time clock IC on the BackPack via D2 and CON4. The diode drops the voltage slightly from the 4.2V that a fully-charged Li-ion cell delivers, reducing the quiescent current slightly. The diode also prevents power from being fed back into the cell. The cell is charged from 5V USB power when available. IC4 is an MCP73831 battery charging IC (in a small SOT-23-5 SMD package). The 4.7µF supply bypass capacitor between pins 4 (VIN) and 2 (ground) is as specified in the data sheet, while the 10kΩ resistor between pin 5 (PROG) and ground sets the charge current to a nominal 100mA. The cell and another 4.7µF capacitor are connected between pin 3 (BATTERY) and ground. Pin 1 (STAT) is driven low during charging and high when charging is complete. This is displayed on bi-colour LED1, with one lead connected to the STAT pin and the other to the midpoint of a 1kΩ/1kΩ divider between 5V and ground. When STAT is low, the red LED illuminates with current flowing via the upper resistor, while the green LED illuminates when charging completes, STAT goes high and current flows through the lower resistor. With 5V power absent, the LED is off, and no current flows through the divider. Schottky diode D1 feeds the battery voltage into the rest of the circuit, and is forward-biased when the circuit is drawing current from the cell. The diode is needed to prevent the 5V supply from being back-fed directly Many readers have made their own tweaks to the various screens used by the older Micromite Boat Computer. This new GPS Computer allows custom screens to be laid out without having to delve into the MMBasic code. At left, we see the screen that allows various tiles to be placed, while at right, the screen is seen in use, containing exactly the information that is needed. 28 Silicon Chip Australia’s electronics magazine siliconchip.com.au into the cell when powered externally. High-side P-channel Mosfet Q1 switches battery power to the majority of the circuit, but is usually held off by the 1kΩ resistor between its source and gate. The gate can be pulled low by switches S1 or S2, or N-channel Mosfet Q2. When the gate is pulled down, the battery supplies power to the circuit. Mosfet Q2 is similarly held off by the 10kΩ resistor on its gate, and can be turned on by Micromite pin 9 going high. S1 is simply a two-pin header to which any momentary switch can be wired, while S2 is a PCB footprint suiting a tactile switch; in effect, they (and Q2’s drain and source) are simply connected in parallel. Typical operation is as follows. When USB power is applied, the Micromite starts up and runs its program. One of the first things it does is pull pin 9 high, so that Q2 conducts and thus Q1 is switched on. This means that if USB power is removed, the Micromite will continue to run from the battery. If the Micromite wishes to shut down and stop running from the battery (either due to the battery being depleted or a user request), it pulls pin 9 low, shutting off Q1 and disconnecting its own supply. If the user wishes to start up the Micromite from battery power, they simply press S1 or S2 for a second, turning on Q1 and allowing the Micromite to start up. It then sets pin 9 high which latches Q1, allowing the switch to be released. Sensing A handful of other components are provided to sense some other parameters. LDR1 and a 1MΩ resistor form a divider with an output voltage related to the current ambient light intensity. This is filtered by a 100nF capacitor, to avoid sudden changes, and read by the ADC (analog-to-digital converter) peripheral on the Micromite’s pin 4. The software uses the resulting value to modulate the LCD backlight brightness. With a nominal LDR resistance between 100kΩ and 10MΩ, the measured voltage spans around 0.3V to 3V. It is mapped to brightness levels selected by the user. The backlight brightness is controlled by a PWM signal from the Micromite’s pin 26 and effected by components on the V3 BackPack board. siliconchip.com.au Parts list – Advanced GPS Computer 1 Micromite LCD BackPack V3 with DS3231 RTC (see below) 1 double-sided PCB coded 05102211, 123x58mm 1 UB3 Jiffy box 1 laser-cut acrylic panel to suit (Cat SC5856) 1 VK2828U7G5LF or similar GPS module (GPS1) [Cat SC3362] 1 PCB-mount AA cell holder (for BAT1) 1 14500 Li-ion cell with nipple (BAT1) 2 PCB-mount switched stereo 3.5mm sockets (CON1,CON2) [eg, Altronics P0094] 1 small, slim 4-8Ω 1W speaker [eg, Digi-Key 2104-SM230808-1] 1 100kΩ-10MΩ LDR (LDR1) [ORP12 or equivalent; eg, Jaycar RD3480] 1 tactile switch (S1/S2) [see text for overall height considerations and alternatives] 1 2-pin male header (CON4) 1 18-pin male header (CON5) 3 4-pin male headers (CON6,JP1,JP2) 4 jumper shunts (JP1,JP2) 4 M3 x 15mm panhead machine screws 4 M3 x 10mm panhead machine screws 4 M3 x 12mm tapped spacers 4 M3 x 10mm tapped or untapped spacers 4 M3 Nylon washers 1 10cm length of 1.5mm diameter heatshrink tubing 1 10cm length of light-duty hookup wire (for the speaker) Semiconductors 1 MCP4251-502E/P dual 5kW digital potentiometer, DIP-14 (IC1) 1 LMC6482AIN dual rail-to-rail op amp, DIP-8 (IC2) [MCP6272 is a substitute] 1 SSM2211SZ push-pull 1.5W amplifier, SOIC-8 (IC3) [Digi-Key, Mouser, RS] 1 MCP73831T-2ACI/OT Li-ion battery charger, SOT-23-5 (IC4) [Digi-Key, Mouser, RS] 1 3mm bi-colour (2-wire) red/green LED (LED1) 1 1N5819 1A schottky diode (D1) 1 1N4148 small signal diode (D2) 1 IRLML2244 P-channel Mosfet, SOT-23 (Q1) 1 2N7002 N-channel Mosfet, SOT-23 (Q2) Capacitors 1 220µF 16V electrolytic 2 4.7µF 16V multi-layer ceramic [eg, RCER71H475K3K1H03B from Digi-Key, Mouser or RS] 6 1µF 50V multi-layer ceramic [eg, Jaycar RC5499] 5 100nF 63V/100V MKT (Code 104 or 100n) 1 10nF 63V/100V MKT (Code 103 or 10n) Resistors (all 1/4W axial 1% metal film) 1 1MΩ (Code brown black green brown or brown black black yellow brown) 2 100kΩ (Code brown black yellow brown or brown black black orange brown) 2 47kΩ (Code yellow violet orange brown or yellow violet black red brown) 5 22kΩ (Code red red orange brown or red red black red brown) 6 10kΩ (Code brown black orange brown or brown black black red brown) 2 5.1kΩ (Code green brown red brown or green brown black brown brown) 2 2.2kΩ (Code red red red brown or red red black brown brown) 5 1kΩ (Code brown black red brown or brown black black brown brown) 1 470Ω (Code yellow violet brown brown or yellow violet black black brown) 2 100Ω (Code brown black brown brown or brown black black black brown) 1 1kΩ mini horizontal trimpot (Code 102) Additional parts for V3 BackPack PCB (In addition to the basic 3.5in BackPack V3 kit, Cat SC5082) 1 DS3231 real-time IC, SOIC-16 (IC4) [Cat SC5103] 1 2-pin female header socket (CON9) 1 18-pin female header socket (for Micromite I/O) 1 4-pin female header socket (for Micromite power) 1 100nF MKT capacitor 2 4.7kΩ 1% 1/4W axial resistors Australia’s electronics magazine June 2021  29 an accurate 3.3V supply voltage as the calculated pin voltage is based on an assumed 3.3V supply. On a 5V USB supply, the 3.3V regulator has no trouble maintaining this. When running from battery power, the Li-ion cell is not allowed to discharge below about 3.6V. Otherwise, the Micromite chip’s supply can drop below 3.3V (dropping about 0.2V due to D1 and another 0.2V in the regulator), which would affect ADC readings. This is also why LiFePO4 cells are not suitable for this design, as their normal operating voltage is below 3.6V. GPS receiver An LDR and LED fitted to the Advanced GPS Computer PCB protrude through the front of the enclosure. Their leads are protected by yellow heatshrink. This view also shows how the battery holder is recessed. The supply voltage is also monitored, by reading the voltage on the audio circuit’s mid-rail divider, via pin 5. The measured battery divider voltage is doubled in software to get its actual value. Two thresholds are used to determine the GPS Computer’s power state – the upper level discriminates between the 5V delivered by USB power, and the 4.3V of a fully-charged cell. A second threshold is used to determine a lower limit for the battery, to allow the Micromite to shut down before the battery is discharged excessively. Between these thresholds, a rough state-of-charge figure is calculated and is displayed when running from battery power. The Micromite’s pins 4 and 5 are also used for in-circuit programming, so the GPS Computer PCB must be disconnected if the chip needs to be reprogrammed. The optional flash IC that can be installed on the V3 BackPack uses pin 4 too; thus, it also would conflict with the GPS Computer’s operation. The 3.3V reference for the Micromite’s ADC depends strongly on having 30 Silicon Chip Of course, it wouldn’t be a GPS computer without being able to receive a GPS signal. Six-way header GPS1 allows a GPS module, such as the VK2828 type, to be attached. The header provides power and routes the GPS serial data back to the Micromite’s COM1 RX at pin 22. Power is supplied to the GPS module from the battery downstream of D1, allowing the 5V supply to preferentially feed the GPS module when available (via Q1). If this were not done, the GPS module would draw current from the battery even when USB power was available, and the charging circuit would not detect that charging is complete. The GPS module’s EN pin is connected to the nominal 5V rail, allowing the GPS module to go into lowpower mode when the GPS Computer switches off (either USB power is unavailable or Q1 is off). This allows the GPS module to retain satellite information when the GPS Computer is off, allowing faster satellite acquisition when needed. While the VK2828 datasheet indicates a 40µA power-down current, we measured around 2mA being consumed by the module. Removing the POWER LED on the GPS module saw this fall to the expected value. Software operation The photos of the GPS Computer that we’ve presented should give you a good idea of its capabilities; there isn’t much mystery as to how it achieves what it does. The Micromite receives GPS data from the GPS module and displays it on the LCD screen. Of course, there is quite a bit more going on than that suggests. We Australia’s electronics magazine wouldn’t be surprised if readers find some interesting ways to use the software we’ve written. CFUNCTIONs Micromite’s MMBasic is very powerful, but it isn’t especially fast. Fortunately, there is the option to incorporate so-called CSUBs and CFUNCTIONs into a program. These are effectively precompiled machine-code routines that can run without the MMBasic interpreter’s overhead, but can be invoked from the MMBasic code. We use the CSUBs and CFUNCTIONs for three broad roles. The first is controlling the 3.5in LCD panel. There is no native driver for the ILI9488 display controller on the 3.5in panel, and it would be far to slow to do this in MMBasic. We’ve used this code previously in the RCL Substitution Box from June and July 2020 (siliconchip. com.au/Series/345). The two other functions are diverse, but are combined into another CFUNCTION specifically for the GPS Computer. One handles audio synthesis, while the other processes data from the GPS receiver. Audio production While it is easy to create rough square-wave tones using a PWM output, they sound harsh. So we’ve written code that can play back PCM-coded audio samples. It’s limited to 8-bit data at 8kHz, as that is a reasonable compromise between the amount of space needed to store the samples and sound quality. The PIC32MX170’s TIMER1 is pressed into service as the 8kHz sampling timer. Since the IR receiver function on the Micromite also depends on TIMER1, these functions cannot be used at the same time; hence, our comment earlier that there is no point fitting the IR receiver. Pin 24 is set up to output the 8-bit PWM signal on a 156kHz carrier. With 256 levels, 156kHz is the highest PWM frequency available with a 40MHz processor clock. The RC filter noted earlier removes the 156kHz carrier, leaving just the audio frequency components. When stored in memory, each audio sample data set is preceded by a 32-bit number indicating its length. During playback, the timer interrupt steps through the data until it reaches the end, after which it shuts down the PWM signal. siliconchip.com.au A software flag can cause Prefix System the sample to loop, allow$GP GPS (USA) ing sounds to be compactly $GA Galileo (Europe) stored as just one cycle in $GL GLONASS (Russia) memory. For example, a $GB Beidou (China) 400Hz sine wave cycle can $GN Combined data from more than one GNSS be stored as 20 samples if Table 1: GNSS prefixes the sampling rate is 8kHz. With the PIC32’s flat 32-bit address sound is not great. But it’s recognisable space, these can be stored in flash and makes for a very intuitive interface. So the GPS Computer can deliver memory (program storage) or RAM (eg, variables). So the MMBasic code can either sampled audio or synthesised create samples at runtime, then play speech, although not at the same time, since they are output on the same pin. them back. There is also a facility to produce synthesised vocal effects using GPS CFUNCTION Our CFUNCTION also contains so-called Linear Predictive Coding compression. LPC is a very efficient routines to help process the NMEAcompression method for reproducing formatted data from the GPS module. the human voice. It’s what was used While MMBasic is quite capable of in many talking toys from the early performing this task, the CFUNCTION 1980s, such as the Texas Instruments speeds this up considerably, leaving more time for other tasks. Speak & Spell. The GPS data stream consists of a The compression is remarkable, needing fewer than 200 bytes per sec- series of ‘sentences’ which contain a ond. While Texas Instruments pro- variety of data. You can read more about duced custom ICs to convert this to their structure and content on p63 in speech, it’s now possible to do this in our April 2018 “Clayton’s GPS” project (siliconchip.com.au/Article/11039). software. Our code defines several parsers, The easiest method is to use the open-source Arduino “Talkie” library, each corresponding to a sentence type, which can be found at https://github. which is recognised from its prefix. Each parser then processes the data com/ArminJo/Talkie This allows an Arduino Uno (and into an MMBasic string array if it is other similar boards) to process LPC valid and correct, and sets a flag to let the main program know that new data data into audio. That page also has links describing how the LPC data is stored is available. We’ve also created some routines to and decoded. We’ve included this functionality in decode the curious latitude and longithe CFUNCTION to process LPC data to tude formats used in NMEA data. One generate synthesised speech. Like any routine extracts the number of degrees, data that has been heavily compressed another the number of minutes and a and output at a low sample rate, the third, the fractional number of seconds. There are a total of 23 different tiles that can be placed, including numerous parameters drawn from the GPS data and related to selected POIs (points of interest). A number of tiles appear as buttons, adding further functions to a screen, such as being able to quickly access a different screen. siliconchip.com.au With several different satellite navigation systems coming online to complement GPS, we’re also seeing variations in the data that receivers produce. Such systems include the Russian GLONASS and Chinese Beidou systems. (See our article in the November 2019 issue at siliconchip.com.au/Article/12083). For example, some receivers now generate sentence prefixes of “$GN” instead of “$GP”, even though the data is otherwise identical. This simply reflects that the receiver is using a different satellite system to calculate its position. The various strings generated by different types of receivers are shown in Table 1 above. But since it is only the third character of these sentences that changes, we simply ignore it instead of checking it, allowing the unit to process data from any receiver which outputs a similar format. Part II next month . . . In the next issue, we’ll describe construction of the Advanced GPS Computer PCB, modification of the Micromite V3 BackPack to add a realtime clock IC, loading of software and how to assemble the parts into a completed unit. Since we expect some people to be interested in making their own changes to the software, as they did with the previous GPS Computer, we’ll also delve deeper into how various parts of the software work. You might even be curious about using the various CFUNCTIONs in your own projects. SC 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 formats. There’s even enough room left over to add a handful of other tiles below this. Australia’s electronics magazine June 2021  31