This is only a preview of the December 2007 issue of Silicon Chip. You can view 32 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 "Infrared Audio Headphone Link For TV":
Items relevant to "PIC-Based Water-Tank Level Meter; Pt.2":
Items relevant to "Playback Adaptor For CD-ROM Drives; Pt.2":
Purchase a printed copy of this issue for $10.00. |
Here’s an improved version of the very popular voice recorder design
we published in May 2005. It can now be set up easily to record two,
four or eight different messages for random-access playback
or a single message for ‘tape mode’ playback.
Also, it now provides cleaner and
glitch-free line-level audio
output suitable for
feeding an amplifier
or PA system. It can
be powered from
any source of
9-14V DC.
By JIM ROWE
An enhanced
45-second
Voice Recorder
Module
Mo
dule
64 Silicon Chip
siliconchip.com.au
T
he solid state voice recorder
module published in the May
2005 issue of S ILICON C HIP
proved to be very popular. It has been
used in all sorts of applications where
messages or sounds needed to be recorded and played back reliably under
either manual or micro control.
But it had limitations – one of which
was that it could only be used to record
and play back one long message or a
number of short messages in sequential ‘tape recorder’ fashion.
This was despite the fact that the
recorder chip we used was capable
of recording and playing back up to
eight messages in ‘random access’
mode. The module needed a fair bit
of ‘hacking’ to make the chip work in
this mode.
Another limitation was that the
playback sound quality of the module
was fairly noisy and each message
played back was accompanied by an
irritating ‘click’ at the start and finish. With the benefit of hindsight this
was due to the way we had chosen
to couple the output audio from only
one side of the recorder chip’s pushpull output.
Hindsight also revealed a third
limitation: the 2005 module had been
designed to operate from a 6V battery,
whereas many people wanted to use it
from a nominal 12V DC source.
It was with these limitations in mind
that we decided to develop the new
and improved sound recorder module
described here.
It’s based on the same HK828 chip
used in the 2005 module but with the
rest of the circuit designed to allow
more flexibility in terms of message
storage and to provide much cleaner
and click-free playback audio. Finally,
the new circuit can run from any
source of DC between 9V and 14V.
The HK828 chip has the ability to
store single or multiple messages with
a total length of between 40 and 60
seconds, depending on the sampling
rate and the voice quality you want.
In this new recorder module the
chip is again teamed up with a lowcost electret microphone to allow easy
message recording, plus an LM358
dual op amp IC which allows the
recorded messages to be played back
as a line level audio signal available
for feeding an external amplifier and
speaker.
A suitable small amplifier for use
with the module would be “The
Champ”, as described in the February
1994 issue of SILICON CHIP. This is
available at low cost ($5.95) from Jaycar Electronics as KC-5152.
We’ve given the new module a set
of ‘jumper links’ so it can be easily
configured to record and play back
messages in any of four modes: either
two, four or eight messages in random
access mode or one or more messages
in sequential access ‘tape mode’. Another link allows the HK-828 chip’s
message start ‘beeps’ to be enabled or
disabled, as you wish.
All message selection, record and
play functions are controlled externally, by connections to a row of screw
terminals along the side of the module.
All functions are enabled by switches
or logic signals. This makes it easy to
record or play back messages using a
set of pushbuttons and a switch or under the control of a PC, microcontroller
or security system if you prefer.
By the way, since the HK828 voice
recorder chip is only available from
Jaycar Electronics in Australia and
New Zealand, kits for the new recorder
module will only be available from
Jaycar and its dealers.
How it works
Because HK828 chip forms the functional heart of the recorder module,
you need to have at least a rough idea
of what goes on inside this chip in
order to understand how the recorder
works. Fig.1 shows the chip’s basic
architecture.
First, the chip includes a high-gain
microphone preamp so that it can be
driven directly by a low cost electret
microphone insert. An automatic
gain control (AGC) circuit follows the
preamp, to ensure that good quality recordings can be made without any need
for manual gain adjustment, despite
input signal level variations.
The output of the AGC circuit is
not connected directly to the chip’s
recording circuitry but is brought out
to the ‘Aout’ pin instead. This is linked
to the ‘Ain’ pin by the user, to record
messages from the microphone. This
arrangement allows the chip to be
used to record from line level signals
in other applications.
Since the main part of the HK828
records by a process of sampling the
audio signals fed into it via the Ain
Fig.1: at right is the block
diagram of the HK828 voice
recorder chip. While the
recording process relies on
audio sampling, the audio is
not stored digitally but using
an analog sample-and-hold
system. The analog samples
are stored in the cells of a
256K flash EEPROM. Each
analog storage cell can store
any of 256 different voltage
levels, making it equivalent
to an 8-bit digital recording.
siliconchip.com.au
December 2007 65
Parts List – Enhanced
Voice Recorder
1 PC board, code EC8271, 119
x 57mm
1 electret microphone insert
(AM-4011)
3 3-way terminal blocks, PC
board mtg
1 2-way terminal block, PC
board mtg
3 2-pin sections of SIL header
strip
3 jumper shunts
1 28-pin DIL IC socket,
15.24mm spacing
1 8-pin DIL IC socket, 7.62mm
spacing
1 2.5mm concentric DC power
plug, PC board mtg (CON1)
1 RCA audio socket, PC board
mtg (CON2)
Semiconductors
1 HK828 voice recorder IC
(IC1)
1 LM358 dual op amp (IC2)
1 78L05 +5V regulator (REG1)
1 PN200 PNP transistor (Q1)
1 5mm green LED (LED1)
1 5mm red LED (LED2)
1 1N4004 1A diode (D1)
Capacitors
1 2200mF 16V RB electrolytic
1 220mF 16V RB electrolytic
1 22mF 16V RB electrolytic
1 10mF 16V RB electrolytic
1 4.7mF 25V tag tantalum
1 220nF 100V MKT metallised
polyester
5 100nF 100V MKT metallised
polyester
1 100nF multilayer monolithic
ceramic
1 150pF disc ceramic
Resistors (0.25W 1%)
1 470kW
1 220kW
2 100kW
8 47kW
9 22kW
2 10kW
2 1kW
2 680W
1 100W
1 47W
Where from, how much?
This kit is only available from
Jaycar Electronics, who also hold
the copyright on the design and PC
board.
Kits will be available from Jaycar
Electronics stores and resellers
(Cat no KC-5454).
66 Silicon Chip
pin, it needs to pass these signals
through a low-pass filter before the
sampling. This is done to prevent
distortion caused by sampling aliases,
hence the “anti aliasing” filter between
the “Ain” input and the sample and
hold circuit block.
Now although the audio is sampled
inside the HK828, this is done using
an analog sample-and-hold system
rather than the more common digital
sampling system. It stores the samples
in an array of 262,144 (256K) Flash
EEPROM analog storage cells, each of
which can store any of 256 different
voltage levels. This gives the equivalent of 8-bit digital recording.
The capacity of the storage array
means that the HK828 can store a total
of 256K samples. How long a recorded
message this gives depends on the
sampling rate that’s used.
For example, if the sample rate
is 8000 samples per second, 256K
samples will correspond to a total
message length of just over 32 seconds (262,144/8000). However if you
sample at 4200 samples/second, the
256K samples will give a total message length of just over 62 seconds
(262,144/4200).
The recording bandwidth or ‘fidelity’ is directly proportional to the
sampling rate. So if you sample at 4200
samples/second, the recording bandwidth will be just over 2kHz, whereas
sampling at 8000 samples/second gives
a bandwidth of just on 4kHz.
Choosing the sampling rate is there-
fore of a compromise: the lower the
sampling, rate the longer the recording
time but the lower the audio bandwidth. Conversely, the higher the sampling rate the higher the bandwidth but
the shorter the recording time.
The HK828 chip has an internal
sampling rate clock oscillator, as well
as an input for an optional external
clock. Either clock signal can be fed
to the sample and hold circuit via the
multiplexer (MUX), to control the
sampling.
The frequency of the internal oscillator is set by varying the value of an
external resistor connected between
the ‘OscR’ pin and ground. Our circuit
uses a 47kW resistor, which sets the
sampling rate to about 5800 samples/
second. This gives a message recording
time of about 45 seconds and a bandwidth of about 2.9kHz, for reasonable
voice-quality recording.
As shown in Fig.1, the recording
and playback of samples in the storage
array is controlled by analog write and
read circuits, along with the message
control and message decoding circuits.
When a message is being played back
the signals pass through another lowpass filter to remove sampling noise,
and are then fed to the inbuilt output
amplifier.
The rest of the circuitry inside the
HK828 chip is used for overall device
control, mode switching and so on.
Circuit details
Fig.2 shows the complete circuit
Silicon Chip Binders
Issues
Getting
Dog-Eared?
Keep Your Copies Safe
With These Handy Binders
REAL
VALUE
AT
$13.95
PLUS
P&P
Price: Just $13.95 plus
$7.00 p&p per order (buy five
and get them postage free).
Available only in Australia.
Just fill in the handy order
form in this issue; or fax
(02) 9939 2648; or phone
(02) 9939 3295 and quote
your credit card number.
Silicon Chip Publications, PO Box 139, Collaroy NSW 2097.
siliconchip.com.au
siliconchip.com.au
December 2007 67
10k
47k
AGC
Ain
Aout
MICref
MICin
MSEL2
MSEL1
BE
12
VssA
7 OSC
R
26 EXT
CLK
19
20
21
18
17
25
24
11
16
VccA
IC1
HK828
VssD
13
SP+
SP–
BUSY
CE
M1
M2
M3
M4
M5
M6
M7
M8
RE
STROBE
28
VccD
14
15
10
23
1
2
3
4
5
6
8
9
27
22
100nF
100nF
REC OR
PLAY
LED1
100
K
A
680
+5V
MULTI-MESSAGE VOICE RECORDER
220k
100nF
47k
100nF
100nF
LK1
47k
100nF
LK2
47k
220 F
10V
47
100k
100k
150pF
6
5
22k
47k
IC2b
3
OUT
IN
OUT
IN
(TAPE MODE)
8 MESSAGES, RANDOM ACCESS
4 MESSAGES, RANDOM ACCESS
2 MESSAGES, RANDOM ACCESS
IN
1
OUT
4
IC2a
8
+5V
IN
2
10 F
REC
MODE
LED2
680
OUT
K
A
C
Q1
PN200
IN
220nF
GND
OPERATING MODE
7
B
E
OUT
REG1 78L05
LK3
LK2
IC2: LM358
LINK1: IN = BEEP DISABLED
OUT = BEEP ENABLED
47k
47k
8x
22k
47k
Fig.2: Most of the circuit action takes place in the HK828 voice storage chip.
IC2, the LM358 dual op amp, performs a balanced-to-unbalanced conversion of the output from the
HK828 and then provides a buffered output which can be fed to an audio amplifier and loudspeaker.
SC
2007
LK3
4.7 F
10V
–
ELECTRET
+
MIC
22 F
10V
1k
A
K
1k
1N4004
470k
47k
C B E
PN200
2200 F
16V
K
A
IN
D1 1N4004
9–14V
DC
COM
A
K
LEDS
LINE LEVEL
AUDIO
OUT
EARTH
CHIP ENABLE
M1 ENABLE
M2 ENABLE
M3 ENABLE
M4 ENABLE
M5 ENABLE
M6 ENABLE
M7 ENABLE
M8 ENABLE
REC ENABLE
OUT
78L05
–
+
details for the new Multi-Message
Voice Recorder.
As shown, signals from the electret
microphone insert are coupled into
the MicIn input of the HK828 (pin
17) via a 100nF coupling capacitor.
Another 100nF capacitor is used to
tie the preamp’s second ‘MicRef’
input (pin 18) to ground, to provide
maximum gain.
The 4.7mF capacitor and 220kW resistor connected between pin 19 and
ground are used to optimise the chip’s
AGC attack and decay characteristics
for speech. The amplified audio from
the mic preamp and AGC circuit appears at pin 21 (Aout) which is coupled
directly to pin 20 (Ain) via another
100nF capacitor.
As mentioned above, the internal
sampling oscillator frequency is set to
5.8kHz by the 47kW resistor connected
to ground from pin 7 (OscR).
Setting the HK828 into record or
playback modes is achieved by an
external switch or logic signal connected to the RecEnable-bar terminal,
which connects to the chip’s RE-bar
pin (27).
The terminal is pulled to ground
for record mode or allowed to rise to
logic high level (+5V) for playback
mode. Note that when the terminal
is pulled down to ground for Record
mode, this also allows transistor Q1
to draw base current and turn on – allowing current to flow through LED2,
the Record Mode indicator.
Link LK1 is used to enable or disable
the HK828’s message starting ‘beep’,
by changing the logic level at pin 11
(“Beep Enable”). Similarly LK2 and
LK3 are used to set the desired message recording and playback mode, as
shown in the small table on the circuit
diagram.
To record a message in one of the
random access modes, all that needs to
be done is to pull down the RecEnablebar line to force the chip into recording
mode, and then pull down one of the
message-select lines (M1Enable-bar,
M2Enable-bar etc) using an external
pushbutton or a logic signal from a PC
or microcontroller.
The message select line must be held
down for the duration of the message
recording; recording ends when the
line is allowed to rise high again.
To play the recorded message, the
RecEnable-bar line is allowed to rise
high again, and the message select line
for the message you want to replay
68 Silicon Chip
Fig.3: the same-size component overlay matches
the photograph at right – between the two there
should be no construction problems.
pulled down again for about 400ms.
The playback audio emerges in
push-pull (ie, anti-phase) fashion from
pins 14 and 15 of the HK828, the SP+
and SP- pins and is connected to a
100W load resistor. The signals are fed
via 100nF capacitors to a balanced-tounbalanced matching stage using IC2b,
one half of an LM358 dual op amp.
This effectively adds the two signals
together, and cancels out the ‘common
mode pedestal’ signal that appears
with them on both outputs.
As a result the output audio signal
at pin 7 of op amp IC2b is clean and
‘glitch free’. This is then passed through
op amp IC2a, connected as a voltage
follower/buffer and then fed to the
line-level audio output socket.
All of the part of the circuit operates
from +5V DC from REG1, an LM78L05
regulator. We are able to use a low
power regulator because the total current drain is quite low: about 4mA in
standby mode, rising to about 45mA
when a message is actually being
played or recorded.
There’s one remaining point which
should be mentioned about the circuit.
You’ll note that the HK828 chip is
provided with a ChipEnable-bar pin
(pin 23), which in this circuit is pulled
down to earth via a 47kW resistor – so
the chip is enabled by default. However the ChipEnable-bar line is also
brought out to a terminal, to allow
you to apply a logic high (+5V) to this
line if you want to disable the chip for
any reason.
You might want to do this if you
have a microcontroller or PC controlling a number of the modules, in which
case it will need to be able to select
between them using their ChipEnablebar lines.
Construction
All of the components used in the
Voice Recorder module on a compact
Resistor Colour Codes
No. Value
o 1 470kW
o 1 220kW
o 2 100kW
o 8
47kW
o 9
22kW
o 2
10kW
o 2
1kW
o 2 680W
o 1 100W
o 1
47W
4-Band Code (1%)
yellow purple yellow brown
red red yellow brown
brown black yellow brown
yellow purple orange brown
red red orange brown
brown black orange brown
brown black red brown
blue grey brown brown
brown black brown brown
yellow purple black brown
5-Band Code (1%)
yellow purple black orange brown
red red black orange brown
brown black black orange brown
yellow purple black red brown
red red black red brown
brown black black red brown
brown black black brown brown
blue grey black black brown
brown black black black brown
yellow purple black gold brown
siliconchip.com.au
JOIN THE TECHNOLOGY
AGE NOW
with
PICAXE
Team this little module with a small audio
amplifier, to provide a great range of sound effects
for a model railway layout, for example. It has the
ability to store up to eight different “sound grabs” which could be switched to
different parts of the layout as trains pass through stations.
PC board. This is coded EC8271,
and measures 107 x 57mm. It can be
mounted inside a standard UB3 size
jiffy box. As all of the terminals and
connectors are along one side the
board, they will all be accessible via
a slot or series of holes along that side
of the box. Only three holes will be
needed in the box lid: two 5mm holes
for LED1 and LED2, and a larger hole
to allow sound to reach the electret
mic insert.
The location and orientation of
all components on the board can be
seen in the overlay diagram of Fig.3,
and also in the matching photo of the
module.
Start board assembly by fitting the
four screw terminal blocks, then the
DC input and audio output sockets.
Follow these with the two IC sockets,
the three 2-pin headers for LK1-LK3
and the short wire link which fits just
near the end of the 28-pin IC socket.
After this you can fit the resistors and
smaller non-polarised capacitors.
Next come the 4.7mF tantalum and
the electrolytic capacitors, which are
all polarised, so make sure you fit
them with their orientation as shown
in the diagram.
Now you’ll be ready to fit the semiconductor parts. These are again all
polarised, so make sure you follow
Capacitor Codes
Value
220nF
100nF
150pF
mF Code IEC Code EIA Code
0.22mF
220n
224
0.1mF
100n
104
n/a
150p
151
siliconchip.com.au
the diagram carefully as a guide to
their orientation. Fit diode D1 first,
then transistor Q1 and the two LEDs,
followed by regulator REG1.
Then fit the electret mic insert.
This has only two wire leads, but it is
polarised, so make sure you check the
back of the insert to make sure which
lead connects to the metal body of the
insert. This is the negative lead, which
must be connected to the earthy outer
pad under the board. The other lead is
the positive lead.
Finally, plug the LM358 op amp
IC2 into its 8-pin socket and the larger
HK828 chip IC1 into its 28-pin socket.
Make sure they’re both orientated as
shown in Fig.3. Your Multi-Message
Voice Recorder should now be complete and ready to go.
Trying it out
To check that your recorder is working correctly, first decide on which
message mode you want to use it in,
and then place jumper shunts on link
headers LK1, LK2 and LK3 to set the
module for that mode of operation.
(Use the table in Fig.2 as a guide.)
Then connect a small toggle switch
and one pushbutton switch for each
message you want to select to the
appropriate screw terminals of the
module, as shown in Fig.4. For the
present switch the toggle switch off,
which corresponds to message playback mode.
The audio output of the module can
now be connected to the line input of
any suitable audio amplifier. Then you
can connect its DC power input to a
source of 9-14V DC.
Developed as a teaching tool,
the PICAXE is a low-cost “brain”
for almost any project
Easy to use and understand,
professionals & hobbyists can
be productive within minutes.
Free software development
system and low-cost in-circuit
programming.
Variety of hardware, project
boards and kits to suit your
application.
Digital, analog, RS232,
1-Wire™, SPI and I2C.
PC connectivity.
Applications include:
Datalogging
Robotics
Measurement & instruments
Motor & lighting control
Farming & agriculture
Internet server
Wireless links
Colour sensing
Fun games
Distributed in Australia by
Microzed Computers
Pty Limited
Phone 1300 735 420
Fax 1300 735 421
www.microzed.com.au
December 2007 69
At this stage neither of the LEDs
should light but you may hear a small
turn-on ‘plop’ from the speaker connected to the external amplifier. If you
wish you can use a digital multimeter
to confirm that the supply voltage at
pin 8 of IC2 is very close to +5V, relative to the module’s earth terminal.
Now switch the external toggle
switch on, pulling the RecEnable-bar
line down to earth potential. This
should switch the module into Record
mode, so LED2 should begin glowing.
(If it doesn’t begin glowing, you either
have the DC power polarity reversed,
or LED2 fitted to the board the wrong
way around.)
Next, press one of the message
select pushbuttons – say MSG1 in
Fig.4. Holding it down, begin talking
into the electret mic to record your
test message.
As you speak, you’ll notice that the
green Strobe LED (LED1) is flashing.
Keep talking until you reach the end
of your message or until LED1 stops
flashing (which indicates that recording has stopped automatically, because
you have reached the end of that segment of the HK828’s memory). Then
release the pushbutton.
To replay the recorded message,
turn the toggle switch off to swing the
module into Play mode and briefly
press the message pushbutton again,
but this time only briefly because in
Play mode, the message buttons only
trigger the replay operation.
Your recorded message should
then be replayed through the external amplifier and speaker. If it does,
your Multi-Message Voice Recorder
is working correctly and should now
be ready for use.
Changing message length
As mentioned earlier, the total message length stored in the HK828 chip’s
memory is determined by the sampling
rate which is set by the resistor connected from pin 7 of the chip (OscR)
to ground.
The 47kW value shown for this resistor in the circuit and overlay diagram
gives a sampling rate of 5800 samples/
second, resulting in a total message
length of 45 seconds and an audio
bandwidth of about 2.9kHz.
We picked this as a reasonable compromise between message length and
recording quality but you can experiment with the value of this resistor to
try longer/shorter recording times and
70 Silicon Chip
Fig.4: Staying
with the model
rail theme, you
could use reed
relays or other
switches to play
back the sound
grabs when the
train triggers
them or they
are switched
by the operator.
If the sound
grabs played
in different
locations you will
need additional
speakers and
relays to switch
them to the
amplifier.
narrower/wider audio bandwidth.
For example, if you change the resistor value to 82kW, this will lower
the sampling rate to about 4200 samples/second and give a total recording
time of just on 60 seconds. However
the audio bandwidth will also drop
to around 2kHz, so the played-back
message(s) will sound rather ‘muffled’ – a bit like talking through a
wet sock!
On the other hand, if you lower
the resistor value to 24kW, this will
increase the sampling rate to about
8000 samples/second and drop the
recording time to just on 32 seconds.
But the recording quality will improve,
as the audio bandwidth will increase
to about 4kHz.
So experiment by all means, and
settle on the resistor value you decide
gives the best combination of total
message length and acceptable audio
quality for your application.
Changing message mode
As noted earlier, header links LK2
and LK3 on the board can be used to
change the module’s message access
mode.
For example with a jumper shunt
fitted to LK2 but removed from LK3,
the module will be able to record and
play two messages (each using half
the HK828’s memory space). You’ll
only need two external pushbuttons
to select one of these messages: MSG1
and MSG2, along with the Record/Play
toggle switch.
If you want to record and play four
messages, remove the jumper shunt
from LK2 and place one on LK3 instead. You’ll now need four external
pushbuttons as well as the Record/Play
toggle switch: MSG1, MSG2, MSG3
and MSG4. Note that in this case each
message will be able to use one quarter
of the HK828’s memory.
Leave the jumper shunts off both
LK2 and LK3 if you want to record
and play any of eight short messages
(each using one eighth of the HK828’s
memory). You’ll now need all eight
external pushbuttons MSG1 - MSG8,
along with the Record/Play toggle
switch.
The last option is to fit jumper
shunts to both LK2 and LK3, which
sets the module for “tape mode” operation.
In this mode you normally only
need one external pushbutton (MSG1),
because the HK828 records and plays
back either one message or a sequence
of messages, using all of its memory
space.
That’s it then – an easy-to-build
solid state Multi-Message Voice Recorder module that can be used for
all kinds of applications, especially
those involving sending pre-recorded
messages over an amplifier or PA
system under the control of a PC or
microcontroller.
SC
siliconchip.com.au
|