This is only a preview of the May 2005 issue of Silicon Chip. You can view 38 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. Articles in this series:
Items relevant to "Voice Recorder":
Items relevant to "MIDI Theremin, Pt II":
Items relevant to "What’s this? Free PC Boards for Schools?":
Articles in this series:
Purchase a printed copy of this issue for $10.00. |
By Jim Rowe
45-Second
Voice Recorder Module
Need to record voice messages of up to 45
seconds long and then play them back at
the touch of a button or under the control of
a PC or microcontroller? Here’s a low-cost,
easy-to-build solid state recorder module
that’s ideal for this kind of application.
W
HEN YOU NEED to record voice
messages with the highest possible reliability, there’s no substitute for
a solid-state voice recorder chip. There
are no moving parts at all, so there are
no tapes or belts to break, no heads to
clog up with gunk, no motors to burn
out and no bearings to jam. Instead,
there’s just a memory chip to store and
replay the message electronically, any
number of times.
Because it’s solid-state, the message(s) can be played back instantly
– there’s no tape to rewind. Small
wonder that most telephone answering
machines changed over to this kind of
recording years ago.
28 Silicon Chip
We’ve described solid-state voice
recorder projects in the past and
they’ve been very popular. However,
the special chips they used eventually
became hard to get and so these projects
eventually fell by the wayside.
This situation recently changed for
the better again, when Jaycar Electronics managed to find a good source for
a new voice recorder IC, the HK828.
This made it possible for us to develop
a new recorder design, incorporating
not only the features that were popular
in the earlier designs but a few more
based on the requests we’ve received
from readers over the years.
The new HK828 chip can 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 our new recorder module, this chip
is teamed up with a low-cost electret
microphone to allow easy message
recording, plus an LM386 power amplifier IC which allows the recorded
messages to be played back through a
small speaker.
In addition, we’ve made provision
for the module to be hooked up to a
600W/600W line isolation transformer
for coupling into another system; eg, an
alarm system or a private phone line.
There’s also a simple interface so that
the module’s functions can be controlled
via a PC or microcontroller.
The new recorder module runs from
6V DC and draws very little current,
so it’s quite suitable for operating from
either a battery (eg, four AA penlight
cells) or from a regulated 6V plugpack
supply.
By the way, since the HK828 voice
recorder chip is only available from
Jaycar Electronics in Australia and
siliconchip.com.au
Fig.1: block diagram of the HK828 voice record/playback IC. The incoming signal from the microphone is amplified
and fed through an AGC stage and anti-aliasing filter before being sampled and stored in a 256K EPROM array.
New Zealand, kits for the new recorder
will only be available from Jaycar and
its dealers – see parts list.
How it works
Because the HK828 chip forms the
functional heart of the unit, you need
to have 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) stage follows this
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 instead brought
out to the “Aout” pin. This is linked
to the “Ain” pin by the user, to record
messages from the microphone. This
arrangement also allows the chip to be
used to record from line level signals
in other applications.
Since the main part of the HK828
records by sampling the audio signals
fed into it via the Ain pin, it needs to
pass these signals through a low-pass
filter before the sampling. This is done
to prevent distortion caused by samsiliconchip.com.au
pling 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. This is done because
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. However, the length
of the recorded message depends on
the sampling rate that’s used. For
example, if the sampling 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 per second, the 256K samples will
give a total message length of just over
62 seconds (262,144/4200).
The recording bandwidth or “fidelity” also depends on the sampling
rate – in this case, directly rather than
inversely. So if you sample at 4200
samples per second, the recording
bandwidth will be just over 2kHz,
whereas 8000 samples per second
gives a bandwidth of just on 4kHz.
Choosing the sampling rate is therefore something 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 internal oscillator is particularly easy to use, because its frequency
is set simply by varying the value of
an external resistor connected between
the “OscR” pin and ground. In this
recorder, we have selected 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
May 2005 29
Fig.2: the complete circuit of the voice recorder uses just two ICs – the HK828 voice record/playback IC (IC1) and an
LM386N audio amplifier. Power can come from a regulated 6V plugpack supply or from batteries (4 x 1.5V cells).
and are then fed to the inbuilt output
amplifier.
The rest of the circuitry inside the
HK828 chip is used for overall device
control and mode switching, etc.
Circuit details
Fig.2 shows the complete circuit
details for the Solid-State Voice Recorder. As shown, signals from the
electret mic insert are coupled into
the MicIn input (pin 17) of the HK828
via a 100nF capacitor. Another 100nF
capacitor is used to tie the preamp’s
“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) and is then fed
to pin 20 (Ain) via another 100nF
capacitor.
As mentioned previously, the inter30 Silicon Chip
nal sampling oscillator frequency is
set to 5.8kHz by the 47kW resistor connected to ground from pin 7 (OscR).
Manual selection of the HK828’s
operating mode (record or playback)
is achieved by switch S2, which connects the chip’s RE-bar pin (27) to
ground for record mode. When S2 is
in the Play position, the RE-bar pin is
pulled up to +6V via the 22kW resistor and the base-emitter junction of
transistor Q1, which forces the HK828
to operate in playback mode.
Note that when S2 is in the Record
position, this not only grounds pin
27 of the HK828 but also turns Q1 on.
This in turn drives LED2 – the Record
Mode indicator – via a 680W currentlimiting resistor.
When the unit is switched to Record mode, recording the message
you want to save in the chip is very
simple – press pushbutton switch S1
and hold it down while you record
the message. During recording, LED1
flashes to indicate that the HK828 is
operating, while LED2 is turned on
continuously.
At the end of the recording, you
simply release S1. However, if your
message is too long for the chip’s
memory, it will automatically stop
recording when the memory is full.
To replay the recorded message,
S2 is first switched back to the Play
position. Then the manual “rewind”
button (S3) is pressed briefly to take
the chip’s CE-bar pin (23) to +5.4V,
which makes sure the HK828 is reset
to the start of its memory.
If you then briefly press pushbutton
switch S1, the HK828 will replay the
message.
The replayed audio emerges from
pins 14 & 15 of IC1 (ie, from SP+ and
SP-). In this circuit, the signal from pin
14 is fed though a 10kW resistor and
10mF coupling capacitor to trimpot
VR1, which is used to set the playback
volume. The signals are then fed to an
LM386N audio amplifier (IC2) which
drives the external loudspeaker.
siliconchip.com.au
This is what the assembled PC board should look like. Note this is a
photo of an early prototype before we fitted the power switch.
In addition, both output pins of the
HK828 are brought out to terminal
pins L1 and L2. These can be used to
connect the recorder module to the
primary winding of a 600W/600W isolating transformer (such as the Jaycar
MA-1510 or MA-1512), so that the
audio can be fed to other equipment
(eg, an alarm system).
The remaining part of the circuit
provides a simple interface which allows the voice recorder module to be
controlled by a PC or a microcontroller.
This involves bringing the HK828
control lines out to 10-pin IDC header
CON1, so they can be manipulated
by an external microcontroller programmed to duplicate the actions of
switch S2 and pushbutton switches
S1 & S3.
Note that when this interface is
connected to a microcontroller, switch
S2 must be left in the Play position.
This is necessary to allow the microcontroller to control the logic level on
IC1’s RE-bar pin (pin 27).
There’s one final point to note about
the HK828 recorder chip and the way
we’re using it here. The HK828 can
actually be programmed to record in
a number of different “message mode”
formats, by manipulating the logic levels on pins 9 (M8option), 24 (MSEL1)
and 25 (MSEL2).
In this circuit, we operate the chip
in “tape mode” format, where it can
record either a single continuous message or a number of shorter messages
in sequence. However, the module’s
PC board has been designed to allow
you to change the format if you wish,
by cutting short tracks and/or fitting
pull-up resistors or links.
It’s not hard to set the HK828 to
siliconchip.com.au
record two, four or eight
short fixed-length messages,
which can be replay-ed
in random-access fashion
(more on this later).
Construction
All of the components
used in the Voice Recorder
module except the speaker
and battery mount directly on a PC board coded
01105051. This board measures 107 x 57mm, which
Fig.3: follow this parts layout to assemble
means that it can be mountthe Voice Recorder. Make sure that all
polarised components are correctly
ed inside a standard UB3installed and be sure to install S1 & S3 as
size utility box.
shown – ie, with the “flats” on the switch
Fig.3 shows the parts laybodies facing LED1 & LED2.
out on the PC board. Start
the assembly by fitting the
eight PC-board terminal
pins, then install the three wire links. to fit them as shown in Fig.3. In parThese links are all relatively long and ticular, note that the 1000mF electrolytic
should be run using insulated hookup capacitor mounts on its side, with its
wire.
leads bent down by 90°.
Next, fit the 28-pin DIL socket for
Now for the semiconductors. Once
IC1, making sure you orientate it with again, these parts are all polarised, so
its notched end towards the right. That follow Fig.3 carefully when installing
done, fit the 10-pin IDC header, with them. Fit diode D1 first, then transistor
its slot side towards the left as shown Q1 and the two LEDs. Finally, fit the
in Fig.3.
LM386N amplifier (IC2). Don’t plug
Once these hardware items are in the HK828 chip into its socket just yet
place, fit trimpot VR1 and the resistors. though – that step comes later.
Table 1 shows the resistor colour codes
Switches S1-S3 can go in next – it’s
but it is also a good idea to check them just a matter of pushing them all the
using a multimeter as the colours can way down onto the PC board and solsometimes be difficult to read.
dering their pins. Note that the “flats”
Next come the low value MKT ca- on the bodies of S1 & S3 must face
pacitors (100nF and 47nF). These are towards LED1 & LED2.
unpolarised so you can fit them either
The electret mic is fitted by solway around.
dering its two leads to the PC board
The tantalum and electrolytic capaci- terminal pins just behind switch S2.
tors can go in next. Unlike the MKT Note that the mic is polarised – the
types, these are all polarised, so be sure
lead which is connected to its metal
May 2005 31
VR1 to set the replay volume to an
acceptable level. This will depend on
the sensitivity of your speaker.
If your recorded test message plays
back as it should, your Solid State
Voice Recorder is working correctly
and should now be ready for use.
One further point – you’ve possibly
noticed the link on the circuit diagram
labelled “Beep Mute” and indicated
on the PC board overlay diagram as
“BM” (just to the right of VR1). This
link may be fitted if you don’t like
hearing the small “beeps” which the
HK828 chip sends out to the speaker
to acknowledge the control signals fed
to it from switches S1-S3. Fitting the
“BM” link grounds pin 11 of IC1 and
disables this “beep” function.
The completed PC board from the opposite angle. Note the mounting method for
the 1000mF electrolytic capacitor (top left).
case must be connected to the lefthand
terminal pin on the board.
Next, solder the battery snap leads
and the speaker leads to their respective terminal pins. It doesn’t matter
which way around you connect the
speaker but take care with the battery
leads (ie, connect the red battery lead
to the “+” terminal and the black lead
to the “-” terminal).
Finally, complete the assembly
by plugging the HK828 chip into its
socket. Make sure that all pins go into
the socket and check that the notched
end of the IC is to the right. Your Solid
State Voice Recorder should now be
ready to go.
Trying it out
To check that your recorder is working correctly, first set trimpot VR1 to
mid-position and connect a 6V battery or regulated 6V power supply to
the battery lead. That done, press the
Rewind button (S3), to make sure that
the HK828 has reset its storage array
address correctly.
Changing message length
Next, set switch S2 to the Record
position and check that the Record
LED (LED2) starts glowing. If it does,
press S1 (the Run/Start button) and
hold it down while you talk into the
electret mic to record your message. As
you speak, you’ll notice that the green
Run LED (LED1) is flashing.
Keep talking until you reach the end
of your message, or until LED1 stops
flashing (indicating that the recording
has stopped, because you reached the
limit of the HK828’s memory). Finally,
release S1 and that’s it – your message
has been recorded.
To replay the message, first set S2
over to the Play position and briefly
press pushbutton S3 to reset the
HK828’s memory address (ie, to “rewind” the unit). Now press pushbutton S1 again but this time only briefly
because in Play mode, S1 only triggers
the replay operation (ie, it only has to
be held down during recording).
Your recorded message should now
be replayed through the speaker, although you may need to adjust trimpot
As mentioned earlier, the message
length stored in the HK828 chip’s
memory is determined by the sampling
rate and this is set by the resistor connected from pin 7 (OscR) to ground.
A value of 47kW – as shown in the
circuit and overlay diagram – gives
a sampling rate of 5800 samples per
second, resulting in a message length
of 45s and an audio bandwidth of
about 2.9kHz.
We picked this as a reasonable
compromise between message length
and recording quality but you are free
to experiment with the value of this
resistor to try longer/shorter recording times and narrower/wider audio
bandwidths.
For example, a value of 82kW, will
lower the sampling rate to about 4200
samples per second and increase the
recording time to 60s. At the same
time, the audio bandwidth will drop to
about 2kHz, so the replayed message(s)
will sound rather muffled.
On the other hand, a value of 24kW
will increase the sampling rate to about
Table 1: Resistor Colour Codes
o
o
o
o
o
o
o
o
o
No.
1
2
6
2
2
2
1
1
32 Silicon Chip
Value
220kW
47kW
22kW
10kW
1kW
680W
47W
10W
4-Band Code (1%)
red red yellow brown
yellow violet orange brown
red red orange brown
brown black orange brown
brown black red brown
blue grey brown brown
yellow violet black brown
brown black black brown
5-Band Code (1%)
red red black orange brown
yellow violet black red brown
red red black red brown
brown black black red brown
brown black black brown brown
blue grey black black brown
yellow violet black gold brown
brown black black gold brown
siliconchip.com.au
Table 2: follow this
table to change the
message recording
mode – see text.
8000 samples per second and reduce
the recording time to 32s. However,
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 recording mode
If you wire up the module exactly
as described, it will operate in “Tape
Mode” . We decided to make this the
default mode because we believe it’s
the most suitable for a majority of applications.
However, if you need the module
to work in one of the HK828 chip’s alternative “random access fixed length
messages” mode, this can be done
fairly easily. All you have to do is cut
one or both of the short narrow tracks
which currently link pins 24 & 25 of
the HK828 to ground and fit one or two
extra 22kW resistors to pull these pins
up to +6V instead.
Table 2 shows how to program the
HK828 for Random Access mode with
either two, four or eight fixed duration
messages, as well as the default Tape
Mode. As you can see, it’s relatively
straightforward. But remember that if
you set it for a relatively large number
of fixed-length messages, they will
each have a relatively short length.
So with the sampling rate left at 5800
samples per second, giving a total
recording time of 45s, you’ll get two
fixed length messages of 22.5s each,
or four messages of 11s each, or eight
messages of only 5.5s each.
Remember too that in any of the
Random Access modes, pin 1 (M1-bar)
of the HK828 chip no longer becomes
the record/replay trigger line for all
messages. Instead, S1 becomes the Record/Start Play button only for the first
randomly accessed message. You’ll
need to connect additional pushbuttons for recording and playing back
the remaining messages.
siliconchip.com.au
For example, if you set pins 24 and
25 for recording two fixed length messages, you’ll need to connect an extra
pushbutton switch between pin 2 (M2bar) of the HK828 and ground, to allow
the second message to be recorded
and played back. This switch can be
connected between pins 9 and 2 of the
10-pin IDC header, by the way.
If you set pins 24 and 25 for recording four or eight fixed length messages,
things get more complicated because
you then need an extra pushbutton
and 22kW pull-up resistor for each of
the additional messages.
These extra pushbuttons and pullup resistors need to be connected
to pins 3 & 4 of the HK828 for four
messages and to pins 3, 4, 5, 6, 8 & 9
for eight messages – although pin 9
won’t need a pull-up resistor, because
it already has one.
The reason for this extra complexity
is that in its random-access modes,
the HK828 has a separate record/
replay trigger line for each message.
That’s why pin 2 is labelled M2-bar,
because it becomes the record/replay
trigger input for message 2. When you
program the chip for four messages,
pin 3 becomes M3-bar (the trigger input for message 3) and pin 4 becomes
M4-bar (the trigger input for message
4). And if you program the chip for
eight messages, pins 5, 6, 8 & 9 become
M5-bar, M6-bar, M7-bar and M8-bar
respectively.
Expansion possibilities
As mentioned earlier, this unit could
be used as a voice module for an alarm
system. For this and other applications
of the Voice Recorder, you’ll probably
want to connect it to a PC or microcontroller so that it can be controlled
automatically.
As shown in Fig.2, all the logic lines
needed for controlling the recorder
chip are available via the 10-pin IDC
header CON1 (pins 6-10), along with
a couple of lines which can be monitored to check the HK828’s status (pins
3 & 5). Interfacing the unit is really
Par t s Lis t
1 PC board, code 01105051, 57
x 107mm
1 electret mic insert
1 10-pin (5 x 2) IDC header
2 SPST PC-mount pushbutton
switches (S1,S3)
2 SPDT mini toggle switch (S2,
S4)
1 28-pin 0.6-inch IC socket
8 PC board terminal pins
1 battery snap lead
1 battery holder (4 x AA cells)
1 20kW horizontal trimpot (VR1)
Semiconductors
1 HK828 voice record/playback
IC (IC1)
1 LM386N power amplifier (IC2)
1 PN200 PNP transistor (Q1)
1 5mm green LED (LED1)
1 5mm red LED (LED2)
1 1N4004 diode (D1)
Capacitors
1 1000mF 10V RB electrolytic
1 470mF 10V RB electrolytic
2 220mF 10V RB electrolytic
1 22mF 16V RB electrolytic
1 10mF 16V RB electrolytic
1 4.7mF 35V TAG tantalum
5 100nF MKT polyester (code
104 or 100n)
1 47nF MKT polyester (code 473
or 47n)
Resistors (0.25W 1%)
1 220kW
2 1kW
2 47kW
2 680W
6 22kW
1 47W
2 10kW
1 10W
Miscellaneous
Hook-up wire for PC board links,
speaker leads, etc.
Where To Buy A Kit
This project has been sponsored
by Jaycar Electronics and they
own the design copyright. A full
kit of parts will be available from
Jaycar Cat. KC-5412.
quite straightforward – just connect
these pins to the printer port of a PC
(or to the I/O pins of a microcontroller)
and then arrange for the software to
control the recorder by duplicating
the actions of switches S1-S3.
Finally, remember to set S2 in the
Play position, so that the PC or microcontroller will be able to toggle the
SC
HK828’s RE-bar line.
May 2005 33
|