45-second Voice Recorder Module


Here’s a voice recorder design that can 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 provides clean 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.





SOLID-STATE voice recorders are popular projects. They can be used in all sorts of applications where messages or sounds need to be recorded and played back reliably under either manual or micro control.
Such projects often have annoying limitations – for example, they can only be used to record and play back one long message or a number of short messages in sequential ‘tape recorder’ fashion. Such design limitations are often unnecessary, because the recorder chips used are typically capable of recording and playing back up to eight messages in ‘random access’ mode.
Another common limitation is that the playback sound quality can be fairly noisy, and each message played might be accompanied by an irritating ‘click’ at the start and finish.
Reader feedback revealed another limitation: older modules have been designed to operate from a 6V battery, whereas many people wanted to use a nominal 12V DC source.
Design concept
It was with these limitations in mind that we decided to develop the sound recorder module described here.
It’s based on the HK828 chip, with the rest of the circuit designed to al-low flexibility in terms of message storage and to provide much cleaner and click-free playback audio. Finally, the 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 recorder module, the chip is teamed up with a low-cost electret microphone insert to allow easy message recording, plus an LM358 dual op amp IC, which allows the recorded messages to be played back as a line-evel audio signal, available for feeding an external amplifier and speaker.


Getting the message
We’ve given this module a set of  ‘jumper links’, so that 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 HK828 chip’s message start ‘beeps’ to be enabled or disabled, as you wish.
All message selection, record and play functions are controlled externally, via 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.


How it works
The HK828 chip forms the functional heart of the recorder module, therefore 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) 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 pin, it needs to pass these signals through a low-pass filter befor 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 analogue 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 analogue storage cells, each of which can store any of 256 different voltage levels. This gives the equivalent of 8-bit digital recording.



Fig.1: the block diagram of the HK828 voice recorder chip.
While the recording process relies on audio sampling, the audio is not stored digitally, but uses an analogue sample-andhold system.
The analogue samples are stored in the cells of a 256K Flash EEPROM. Each analogue storage cell can store any of 256 different voltage levels, making it equivalent to an 8-bit digital recording.





Sampling rate
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 band width 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 therefore a compromise: the lower the sampling, rate the longer the recording time, but the lower the audio and width.
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. This circuit uses a 47k�� 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.9 kHz, for reasonable voice-quality recording.
As shown in Fig.1, the recording and playback of samples in the storage array is controlled by analogue 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 low-pass 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
The complete circuit details for the Multi-Message Voice Recorder is shown in Fig.2.
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.7μF capacitor and 220kΩ 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 earlier, the internal sampling oscillator frequency is set to 5.8 kHz by the 47 kΩ 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 terminal, which connects to the chip’s RE 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, links LK2 and LK3 are used to set the desired message recording and playback mode, as shown in the small table on the circuit diagram.


Message recording
To record a message in one of the random access modes, all that needs to be done is to pull down the RecEnable line to force the chip into recording mode, and then pull down one of the message-select lines (eg, M1Enable or M2Enable) 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 line is allowed to rise high again, and the message select line for the message you want to replay pulled down again for about 400ms.
The playback audio emerges in push-pull (ie, anti-phase) fashion from pin 14 and pin 15 of the HK828, the SP+ and SP– pins, and is connected to a 100�� load resistor. The signals are fed via 100nF capacitors to a balanced-to-unbalanced 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 this 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 pin (pin23), which in this circuit is pulled down to earth via a 47kΩ resistor – so the chip is enabled by default.
However, the ChipEnable 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 ChipEnable lines.



Construction
All of the components used in the components used in the Voice Recorder module fit on a compact PC board, coded 797, measuring 119mm × 57mm. This board is available from the EPE PCB Service.
The board can be mounted inside a standard UB3-size plastic box.
Since all of the screw terminals and connectors are along one side of 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 links LK1 to 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-polarized capacitors.
Next come the 4.7μF tantalum and the electrolytic capacitors, which are also polarized, so make sure you fit them with the orientation shown in the diagram.
Now you’ll be ready to fit the semiconductor parts. These are also polarized, so make sure you follow the diagram carefully as a guide to their orientation. Fit diode D1 first, then transistor Q1 and the two LEDs, followed by regulator REG1.
Now fit the electret mic insert. This has only two wire leads, but it is polarized, so do 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 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.)
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 now, 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 9V to 14V DC.
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 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.)


Record/replay
Next, press one of the message select pushbuttons – say MSG1 in Fig.4. While
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 brifly 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 47kΩ 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 narrower/wider audio bandwidth.
For example, if you change the resistor value to 82kΩ this will lower the sampling rate to about 4200 samples/second and gives a total recording time of just on 60 seconds. However, the audio bandwidth will also drop to around 2 kHz, 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 24KΩ, this will increase the sampling rate to about 8000 samples/second and drop the recording time to just on 32 seconds.
However, the recording quality will increase to about 4 kHz.
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 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 to 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.