Silicon Chip – July 2019

(Frankie) #1

46 Silicon chip Australia’s electronics magazine siliconchip.com.au


project using a Raspberry Pi WH, as
the WiFi allowed us to download the
necessary software packages directly
from the internet.
This also lets us use SSH (secure
shell) via WiFi to tweak our settings
remotely.
So while the Pi Zero is the cheapest
option, and requires the least power to
operate, you do give up some interest-
ing possibilities compared to the WiFi-
enabled variants.


Hardware overview


The Speech Synthesiser consists of
a few parts, primarily the Raspberry
Pi itself plus a ‘hat’ that we have de-
signed, which plugs into it and allows
it to drive one or two speakers.
This is necessary as the Raspberry
Pi Zero does not have any onboard
analog audio outputs.
The circuit for this ‘hat’ is
shown in Fig.1. It connects to
the pin header of the Raspber-
ry Pi via CON1, a 2x20 pin socket.
CON2 is a 4-pin header which makes
the 5V supply from the Raspberry Pi
available (eg, to power an Arduino


board or similar), plus a 2-wire serial
interface for control.
The three resistors between CON2
and CON1 allow a 5V device like an
Arduino to communicate with the
Raspberry Pi’s serial port, which op-
erates at 3.3V.
If you will be controlling the Speech
Synthesiser from a 3.3V micro board
or similar, then you should replace the
two 470resistors with wire links (or
fit them anyway, it won’t matter) and
omit the 1kresistor to disable the
voltage conversion.
This UART serial port is the primary
means of control and communication
between the external microcontrol-
ler and the Raspberry Pi microcom-
puter, which handles all the speech
synthesis and audio playback tasks.
IC3 is a TDA1543 16-bit digital-to-
analog converter (DAC). It is fed digi-
tal audio data, in I^2 S format, from the
Raspberry Pi on pins 12, 35 and 40 of
CON1. These are the bit clock, word
clock and serial data pins respectively.
Pins 6 and 8 of IC3 are the analog au-
dio outputs, which act as current sinks.
The current flow is proportional to

desired audio signal voltage levels for
the two stereo channels.
These currents are converted into
voltages by the two 1kresistors con-
nected between those pins and the
voltage reference output, pin 7, which
sits at around 2.2V and can supply up
to 2.5mA.
The DAC switching artefacts are at-
tenuated due to the filtering action of
the 10nF capacitors across these resis-
tors, and the resulting voltage signals
are coupled to the non-inverting in-
puts of audio amplifiers IC1 and IC2
via 10μF non-polarised capacitors.
IC1 and IC2 are LM386 amplifier ICs
which need minimal external com-
ponents.
Their 5V supply from the Raspberry
Pi is bypassed by a shared 100nF ca-
pacitor. Their outputs are AC coupled
to the speaker terminals, CON3 and
CON4, by a pair of 100μF electrolytic
capacitors which remove the DC bias
in the signal. This is provided by IC1
and IC2, to keep the signals within
their supply rails.
With pins 1 and 8 of IC1 and IC2 left
open, each amplifier provides a volt-
age gain of 20 times.They can both de-
liver around 250mW into an 8load.
The line level signals are fed sep-
arately to pin header CON5 in case
you need to feed them elsewhere, but
keep in mind that these signals are not
ground-reference, but instead have a
DC bias of around 1V.

Software
The software for this project can
be downloaded from the SILICON CHIP
website.
It is a large download, around
400MB. That’s because the software
is supplied as a complete installation
of the Raspbian Lite operating system,

Fig.3: Win32disk-
imagewriter is a
Windows program
used to write the Pi
software to the
microSD card. You
can start with our
pre-configured
image, or a basic
Raspbian Lite inst-
allation if you are
customising your
software. Take great
care using Win32
diskimagewriter as
it can overwrite
your data if used
incorrectly.


Fig.2: the Pi audio hat is quite compact and easy to build, with relatively
few components. Take care with the orientation of the ICs and electrolytic
capacitors. CON1 is mounted on the underside and plugs into the GPIO
header on the Raspberry Pi host. CON2 is for serial communications. The
resistor shown in red is left off for 3.3V signal levels on CON2. Speaker wires
could be soldered directly to the board, rather than fitting headers CON3 &
CON4. The dotted outline at left shows the size of the regular Raspberry Pi
PCB, giving an idea of how
the board would fit on one.
Free download pdf