Silicon Chip – July 2019

(Frankie) #1

siliconchip.com.au Australia’s electronics magazine July 2019 47


with some extra packages and settings
incorporated.
Raspbian Lite dispenses with the
graphical user interface normally in-
cluded with Raspian, reducing the
install size (and therefore download
size) substantially.
You can fit the software on a 2GB
microSD card, although larger cards
can be used. You can either write our
supplied image directly to your card,
or follow the instructions below to set
up the operating system in a step-by-
step fashion. The step-by-step meth-
od is more involved and requires a bit
more knowledge of the Linux com-
mand line.
One disadvantage of using our 2GB
image is that your file system will be
limited to 2GB, even if you use a larger
card, and much of the space is already
taken up by the operating system.
If you need more than 2GB (eg, you
want to store a large number of audio
files on the card), then you should use
the step-by-step process and a higher-
capacity card.
The step-by-step approach is also
best if you wish to customise your
setup, but note that you will need
a Raspberry Pi variant with WiFi to
download the packages.
As noted above, we’re using espeak-
ng and madplay to provide the audio
functions. We also need to apply some
custom settings to enable the UART se-
rial control interface and the I^2 S (digi-
tal audio) interface. Plus, if you’re us-
ing a WiFi-enabled variant, it’s neces-
sary to set up the WiFi interface.
We’re also configuring the Pi to boot
from the microSD card in a read-on-
ly mode.
This allows us to simply remove
power when we’re finished with the
unit, rather than having to send a se-


rial command to perform a ‘clean shut-
down’, as would be necessary if the
card was writeable during use.
This does not permanenly make
the card read-only, as you can
easily add a jumper to enable
write access temporarily.

Building the DAC and
amplifier board
The DAC/amplifier ‘hat’ board is a
handy little device that can be fitted
to any variant of the Raspberry Pi. Use
the PCB overlay diagram, Fig.2, as a
guide during construction.
Start by fitting the resistors. As men-
tioned earlier, leave out the 1k resis-
tor at upper-right if you will be con-
trolling the Raspberry Pi from a mi-
crocontroller that has 3.3V I/O levels.
Follow with the ICs, which can ei-
ther be soldered directly to the board
or plugged into sockets. Regardless,
ensure they are orientated correctly,
with their pin 1 indicators towards the
bottom of the board as shown in Fig.2.
Next are the MKT and ceramic ca-
pacitors, which are not polarised, then
the electrolytic capacitors, which are.
Their longer leads indicate the posi-
tive end and this must face towards
the right side of the board, as shown
by the + signs on the overlay diagram
and PCB itself.
The stripe on the capacitor cans in-
dicates the negative end and so should
face away from the + signs.
Finally, fit the pin headers, with the
2x20 pin socket mounted on the un-
derside of the board as shown. You
might like to plug it into the Raspberry
Pi board before soldering it, to ensure
it sits correctly.
You could use a stackable header
here, which would be useful if you
plan to connect any of the other Rasp-

berry Pi I/O or supply pins to exter-
nal circuitry (other than the serial
port, which is already wired to CON2
for you).
Alternatively, you could dispense
with CON1 entirely and solder the hat
directly to the Pi. But if you do this,
take care that the underside of the DAC
and amplifier board does not touch the
top of the Pi. You may like to slide a
strip of plastic or insulating card be-
tween the two to ensure separation.
Keep in mind that you will need ac-
cess to the microSD card slot. 5V DC
power can be fed to the Pi through
CON2 if necessary.
Similarly, you could solder wires
directly to the speakers rather than
fit headers for CON3 and CON4.
Once the board is complete, plug it into
the Raspberry Pi, and you are ready to
install the software.

Simple software setup
The simplest way to set up the soft-
ware for the Speech Synthesiser is to
download our firmware image. This
is a .img file which has been put into
a .zip archive to make it smaller. The
.img file is a byte for byte ‘snapshot’
of the SD card.
Unfortunately, that means it’s not
possible to do a simple copy and paste,
as the file needs to overwrite every-
thing including the existing file sys-
tem on the card.
So we need to use a program
called Win32diskimagewriter to
write the image to the SD card.
Win32diskimagewriter is written to
work on Windows computers and can
be downloaded from siliconchip.com.
au/link/aaps
If you have a different operating sys-
tem, then alternatives such as Etcher
(www.balena.io/etcher) or the “dd”

The DAC board simply plugs into the header socket on the
Pi board, as seen at left and above. The complete assembly
is quite compact. If you require an even smaller footprint,
the stackable header can be replaced by a simple female
header, or even omitted and the DAC and amplifier board
soldered directly to the Raspberry Pi.
Free download pdf