This is only a preview of the June 2022 issue of Practical Electronics. You can view 0 of the 72 pages in the full issue. Articles in this series:
|
Advanced GPS Computer
Part I – by Tim Blythman
What’s your transport mode? Shanks’ Pony? Car? RV? Boat? Plane?
Hot Air Balloon? With a 3.5-inch 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!
T
he Touchscreen Boat Computer with GPS has
the time, date and satellite data. These examples also built
in a speedometer and added automatic backlight control.
been a phenomenally popular project.
So, we thought, why not combine all these features (and
Originally released five years ago (August 2017),
it became one of the first projects to show just how handy more) into a newer and even better unit? It could use a
larger 3.5-inch touchscreen to make the display more visand versatile the first Micromite LCD BackPack could be.
ible, with software changes
We’ve had numerous
so that users could adjust
requests for features to be Features and Specifications
the displays to their speadded – it was clear that • Based on Micromite LCD BackPack V3 with 3.5-inch LCD touchscreen
cific needs and liking.
people weren’t just using • Custom display and information screens including current and
While thinking about
it in their boats, but on the
average speed along with time
these improvements, we
road, and even in the sky.
• Powered by a rechargeable battery and/or DC supply
also decided to add a useSuggestions included pro- • Adds automatic volume control to vehicle entertainment systems
ful piece of functionality
viding three simple screens • Automatic backlight control
that takes advantage of the
for use on the road. One • Programmed in MMBasic
unit’s ability to measure
screen offering GPS ground • Points of interest (POIs) can be saved and navigated to
speed – an automatic volspeed and a compass dis- • Internal speaker for warning announcements and tones
ume controller.
play, while the others show
32
Practical Electronics | June | 2022
One of the frequently suggested
improvements we had for our previous GPS design 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.
The new GPS Computer
The Advanced 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.
A large speedometer display is also present, as are
numerous other GPS and time-related data. These include
latitude, longitude, altitude, compass heading and the
average speed.
Thanks to the handy automatic volume control mentioned above, you can feed audio through the device, via a
3.5mm stereo jack socket, and it will automatically adjust
the volume according to your vehicle’s speed. The output is
louder at higher speeds, to help overcome increased noise
from the vehicle. (See the box below for further details of
the thinking behind this upgrade.)
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
W h y do y ou need to turn th e volume up wh en y ou’ re moving faster?
Most sources of noise you hear in a
vehicle vary depending upon your speed.
The major sources vary from vehicle
to vehicle, but it typically consists of a
mix of road (tyre) noise, engine noise
and wind noise. (Engine noise can be
further broken up into induction noise,
mechanical noise, transmission noise
and exhaust noise.)
Road noise
Road noise is the sound that your
tyres make as they rotate and distort
under the weight of the vehicle. This
varies based on speed, road surface,
conditions (eg, water on the road) and
tyre type/condition.
It’s attenuated by the vehicle’s
soundproofing, ut of course some
vehicles have much etter soundproofing
than others.
The only easy way to reduce this is to
swap out your tyres for quieter ones, but
there is usually a compromise between
quietness, grip and cost. So, if you
Practical Electronics | June | 2022
want quiet tyres with lots of grip, they will
probably be costly. And high-performance
tyres are usually noisy even though they
are expensive.
Engine noise
The noise from an engine varies with many
different parameters. There is little of this in
an electric car – usually just a whine.
However, petrol and diesel engines can
vary from whisper quiet to deafening. This
varies to some extent based on load, which
is related to how fast you are going, as well
as whether you’re going up or down a hill
and whether you are accelerating, cruising
or coasting.
Engine noise consists primarily of
induction noise (air going into the engine)
and mechanical noise (fuel injectors,
valves, gears). Combustion noise is
normally muffled significantly by the
water jacket.
Vehicles with forced induction (turbo- or
supercharged) typically have less induction
noise, since the compressor muf es it.
But modern direct-injection petrol or diesel
engines typically have very audible injectors,
while older engines may have more valvetrain noise.
Exhaust noise depends on the type
of engine, load conditions and exhaust
system type and condition. Exhausts
in poor condition or high-performance
exhausts will let a lot more noise through.
Turbocharged cars may have less exhaust
noise since the turbine reduces exhaust
pressure pulses.
Wind noise
You typically only hear wind noise at
higher speeds and usually only if the
other sources of noise are low (ie, a
well-insulated car with a quiet engine
cruising at speed). You may hear whistles
or buffeting.
This varies depending on the
aerodynamic design and anything
attached to the outside of the vehicle,
such as a roof rack, rain shields, bull
bar and so on.
33
The Advanced GPS computer PCB fits to the rear of a stack consisting of a Micromite V3 BackPack and a 3.5-inch 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.
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. Since the user
interface is written in MMBasic, it can be further tweaked
by advanced users, as and when 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 2020 issue.
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.
34
The only optional parts fitted to the Micromite 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 Micromite 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 V3
BackPack, and the circuit for this board is shown in Fig.1.
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
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.
Practical Electronics | June | 2022
Advanced GPS Computer
projects, while two-way header CON4 connects to the
BackPack’s CON9, as noted above.
About half of the parts on the GPS Computer PCB are for
the automatic volume control function, so we’ll start with that.
Practical Electronics | June | 2022
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
35
e
ng
,
y
es
y
s
y
hing
ain
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 and the biasing components means that the signals at pins 7 and 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 analogue 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 full-scale
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 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 their supplies bypassed
with 100nF 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 to 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 analogue 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
analogue signal synthesis.
At this point, there are two options
for where this synthesised audio signal can go.
With two jumpers on each of JP1/
JP2 (across positions 1 and 2, and
positions 3 and 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 and 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 pin 5 and pin
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 and 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 alternatively, you
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.
36
Practical Electronics | June | 2022
could solder the cell’s 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 the charging has been completed. 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. 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 included to prevent the 5V supply from being backfed directly 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
Practical Electronics | June | 2022
Parts list – Advanced GPS Computer
1 Micromite LCD BackPack V3 with DS3231 RTC (see below); PCB available from the
PE PCB Service (August 2020)
1 double-sided PCB coded 05102211, 123x58mm, available from the PE PCB Service
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 5kΩ 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Ω
2 100kΩ
2 47kΩ
5 22kΩ
6 10kΩ
2 5.1kΩ
2 2.2kΩ
5 1kΩ
2 100Ω
1 470Ω
(Code 102)
1 1kΩ mini horizontal trimpot
Additional parts for V3 BackPack PCB (visit micromite.org for Micromite parts)
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
Software: The firmware package for the Advanced GPS Computer, including the
MMBasic source code, HEX file to program the chip, the CFUNCTIONs and some of the
programs that were used to generate the graphics will be available with the next issue.
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,
37
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.
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 is read
by the ADC (analogue-to-digital converter) peripheral on the Micromite’s
pin 4. The software uses the resulting value to modulate the brightness
of the LCD backlight.
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.
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,
which means 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 an accurate 3.3V supply voltage
because the calculated pin voltage
is based on an assumed 3.3V supply. With a 5V USB supply, the 3.3V
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.
38
regulator has no trouble maintaining
this value.
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. (Note that this is also why
LiFePO4 cells are not suitable for this
design, as their normal operating voltage is below 3.6V.)
GPS receiver
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. However,
removing the POWER LED on the GPS
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.
Practical Electronics | June | 2022
module saw this fall to the
expected value.
Prefix
System
$GP
$GA
$GL
$GB
$GN
GPS (USA)
Galileo (Europe)
GLONASS (Russia)
Beidou (China)
Combined data from more than one GNSS
Software operation
The photos of the GPS
Computer that we’ve presented should give you a Table 1: GNSS prefixes
good idea of its capabiliWhen stored in memory, each audio
ties; there isn’t much mystery as to
how it achieves what it does. The sample data set is preceded by a 32-bit
Micromite receives GPS data from number indicating its length. During
the GPS module and displays it on playback, the timer interrupt steps
through the data until it reaches the
the LCD screen.
Of course, there is quite a bit more end, after which it shuts down the
going on than that suggests. We PWM signal.
A software flag can cause the samwouldn’t be surprised if readers find
some interesting ways to use the soft- ple to loop, allowing sounds to be
compactly stored as just one cycle in
ware we’ve written.
memory. For example, a 400Hz sinewave cycle can be stored as 20 samples
CFUNCTIONs
Micromite’s MMBasic is very pow- if the sampling rate is 8kHz.
With the PIC32’s flat 32-bit address
erful, but it isn’t especially fast. Fortunately, there is the option to incor- space, these can be stored in Flash
porate so-called CSUBs and CFUNC- memory (program storage) or RAM
(eg, variables). So the MMBasic code
TIONs into a program.
These are effectively precompiled can create samples at runtime, then
machine-code routines that can run play them back.
There is also a facility to prowithout the MMBasic interpreter’s
overhead, but can be invoked from the duce synthesised vocal effects using
MMBasic code. We use the CSUBs and so-called ‘Linear Predictive Coding’
compression. LPC is a very efficient
CFUNCTIONs for three broad roles.
The first is controlling the 3.5-inch compression method for reproducing
LCD panel. There is no native driver for the human voice. It’s what was used
the ILI9488 display controller on the in many talking toys from the early
3.5-inch panel, and it would be far to 1980s, such as the Texas Instruments
slow to do this in MMBasic. We’ve used Speak & Spell.
The compression is remarkable,
this code previously in the RCL Substitution Box from June and July 2021. needing fewer than 200 bytes per secThe two other functions are diverse, ond. While Texas Instruments probut are combined into another CFUNC- duced custom ICs to convert this to
TION specifically for the GPS Com- speech, it’s now possible to do this
puter. One handles audio synthesis, in software.
The easiest method is to use the
while the other processes data from
open-source Arduino ‘Talkie’ library,
the GPS receiver.
which can be found at: https://github.
com/ArminJo/Talkie
Audio production
This allows an Arduino Uno (and
While it is easy to create rough squarewave tones using a PWM output, they other similar boards) to process LPC
sound harsh. So we’ve written code that data into audio. That page also has
can play back PCM-coded audio sam- links describing how the LPC data is
ples. It’s limited to 8-bit data at 8kHz, stored and decoded.
We’ve included this functionality
as that is a reasonable compromise
between the amount of space needed in the CFUNCTION to process LPC
data to generate synthesised speech.
to store the samples and sound quality.
The PIC32MX170’s TIMER1 is Like any data that has been heavily
pressed into service as the 8kHz sam- compressed and output at a low sampling timer. Since the IR receiver func- ple rate, the sound is not great. But
tion on the Micromite also depends it’s recognisable and makes for a very
on TIMER1, these functions cannot intuitive interface.
So the GPS Computer can deliver
be used at the same time; hence, our
comment earlier that there is no point either sampled audio or synthesised
speech, although not at the same time,
fitting the IR receiver.
Pin 24 is set up to output the 8-bit since they are output on the same pin.
PWM signal on a 156kHz carrier. With
GPS CFUNCTION
256 levels, 156kHz is the highest PWM
frequency available with a 40MHz pro- Our CFUNCTION also contains roucessor clock. The RC filter noted earlier tines to help process the NMEAremoves the 156kHz carrier, leaving formatted data from the GPS modjust the audio frequency components. ule. While MMBasic is quite capable
Practical Electronics | June | 2022
of performing this task, the
CFUNCTION speeds this up
considerably, leaving more
time for other tasks.
The GPS data stream consists of a series of ‘sentences’
which contain a variety of data.
You can read more about their
structure and content on page 19 in
our April 2019 Clayton’s GPS project.
Our code defines several parsers,
each corresponding to a sentence type,
which is recognised from its prefix.
Each parser then processes the data
into an MMBasic string array if it is
valid and correct, and sets a flag to let
the main program know that new data
is available.
We’ve also created some routines to
decode the curious latitude and longitude formats used in NMEA data.
One routine extracts the number of
degrees, another the number of minutes and a third, the fractional number of seconds.
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.
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 2 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.
Reproduced by arrangement with
SILICON CHIP magazine 2022.
www.siliconchip.com.au
39
|