This is only a preview of the August 2009 issue of Silicon Chip. You can view 33 of the 104 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 "An SD Card Music & Speech Recorder/Player":
Items relevant to "Lead-Acid/SLA Battery Condition Checker":
Items relevant to "A 3-Channel UHF Rolling-Code Remote Control, Pt.1":
Purchase a printed copy of this issue for $10.00. |
By MAURO GRASSI
An SD Card Music &
Speech Recorder/Play
This digital recorder stores WAV files on low-cost MMC/SD/
SDHC cards. It can be used as a jukebox, a sound effects player
or an expandable “dicta-phone”. You can use it as a free-standing
recorder or in conjunction with any Windows, Mac or Linux PC.
30 Silicon Chip
siliconchip.com.au
A universal IR remote is used to control the Digital Speech
Recorder or you can use the on-board buttons. Recordings
can be made direct to the memory card via a mic or line
input or you can copy audio files onto the card from a PC.
I
N MAY 2005 and December 2007
we published two very popular
solid-state voice recorder projects.
The 2007 design was an improved version of the original project, employing
the same voice recorder chip. These allowed you to record a number of short
messages (up to about one minute of
speech) and play them back at the
touch of a button. The messages were
stored in “analog EEPROM” cells in
an analog 8-bit format.
This project takes the message re-
corder concept to a whole new level
and employs a common SD memory
card or MMC (multimedia card) for
message storage. Depending on the
size of the card, you can store and play
back many hours of audio. We’ve also
added infrared remote control and it
can be used to play back any WAV file
that you have downloaded or recorded
on your PC.
We are presenting this project in a
very simple module format; it is just
a PC board with an SD card socket, a
er
The unit works with all commonly-available MMC, SD and SDHC memory
cards. You can copy files from a PC onto these cards via an MMC/SD/SDHC
card reader like the one shown at bottom right.
siliconchip.com.au
2-line LCD panel and eight pushbutton
switches to select the audio files and
other features. If you want to build
the unit into a case, you can take the
LCD panel off the board and separately
mount it and the same goes for the
switches and sockets.
Compatible memory cards
The compatible cards to use with
this project are MMC (MultiMedia
Card), SD (Secure Digital) and SDHC
(Secure Digital High Capacity) cards.
SD cards come in capacities up to 2GB.
Beyond that, you will find SDHC cards
with capacities from 4GB to 32GB.
The current version of the standard
does not specify cards with capacities
higher than 32GB, although these will
become common in the future.
This project will work with most
presently available cards. SD cards
in particular have dropped in price
dramatically and you can now pick
up a 1GB SD card for less than $10.
In operation, the unit can be run
from either a 12V battery or a DC
plugpack supply. It can drive stereo
headphones or an external amplifier
and loudspeakers.
WAV file format
The WAV file format from Microsoft can carry both compressed and
August 2009 31
Parts List
1 PC board, code 01108091, 164
x 136mm
1 16 x 2 LCD module (Jaycar
QP-5515, Altronics Z-7013)
1 1kΩ horizontal-mount trimpot
(VR1)
1 10kΩ log 16mm dual-gang pot
(VR2)
8 SPST 6mm tactile switches
(S1-S8) (Jaycar SP-0601,
Altronics S-1124)
1 DPDT PC-mount slide switch
(S9) (Jaycar SS-0823, Altronics S-2060)
1 2.5mm PC-mount male DC
connector (Jaycar PS-0520,
Altronics P-0621A)
1 TO-220 mini heatsink (Jaycar
HH-8502, Altronics H-0630)
1 10MHz crystal (X1)
1 SD surface mount card socket
(Jaycar PS-0024)
3 3.5mm PC-mount stereo jack
sockets (Jaycar PS-0133,
Altronics P-0092)
1 infrared receiver module (IRD1)
(Jaycar ZD-1952, Altronics
Z-1611)
1 40-pin IC socket (to be cut)
1 28-pin IC socket (0.3-inch)
1 16-pin IC socket
2 8-pin IC sockets
12 M3 x 12mm Nylon screws
(some to be cut)
8 M3 x 9mm tapped Nylon spacers
1 500mm 0.8mm-dia. length
tinned copper (for links)
1 32-way machined pin socket strip
1 40-pin header strip
1 electret microphone insert (optional – see text)
uncompressed audio but this speech
recorder can only record and play back
uncompressed WAV files. The samples
are stored as 16-bit signed integers.
The sampling rate of the encoded
audio is stored in the WAV file header
and is read by the recorder to vary the
playback sampling speed.
Both stereo and mono files can be
played. When playing mono files,
both output channels (L & R) carry
identical signals. A stereo WAV file
contains information for the left and
right channels interleaved, meaning
every second sample is taken for each
channel.
32 Silicon Chip
Semiconductors
1 dsPIC33FJ64GP802-I/SP microcontroller (IC1) programmed with
0110809A.hex (Altronics LCD) or
0110809J.hex (Jaycar LCD)
1 74HC595 8-bit shift register (IC2)
2 LM833N dual op amps (IC3-IC4)
8 1N4148 signal diodes (D1-D8)
1 1N4004 silicon diode (D9)
1 7809 3-terminal regulator (REG1)
1 7805 3-terminal regulator (REG2)
1 LM317T variable regulator (REG3)
1 3mm red LED (LED1)
1 3mm green LED (LED2)
1 3mm yellow LED (LED3)
Capacitors
1 1000µF 16V electrolytic
2 470µF 25V electrolytic
3 470µF 16V electrolytic
1 220µF 16V electrolytic
5 100µF 16V electrolytic
3 10µF electrolytic
1 10µF tantalum
1 4.7µF electrolytic
2 220nF MKT polyester
2 150nF MKT polyester
3 100nF MKT polyester
5 100nF monolithic
2 18pF ceramic
Resistors (0.25W, 1%)
1 220kΩ
3 1kΩ
7 100kΩ
1 180Ω (R2)
5 39kΩ
1 110Ω (R1)
2 27kΩ
7 100Ω
5 22kΩ
3 10Ω
4 10kΩ
1 0Ω (R3)
2 2.2kΩ
(Note: 10Ω & 160Ω resistors may
be required to adjust REG3).
WAV files essentially store the PCM
(Pulse Code Modulation) samples of
the audio waveform. The sampling
frequency is twice the highest reproducible frequency in the audio stream.
Note that WAV files have a “.wav” file
extension.
Firmware overview
The firmware is responsible for all
the features of our new Digital Speech
Recorder. When you play a file, the
firmware reads the WAV header that
stores the sampling rate of the audio
file. It then sets up an interrupt to push
data into the DACs (Digital-to-Analog
Converters) in the microprocessor at
the requested sampling rate from the
memory card.
When recording, data from the
micro’s ADC (Analog-to-Digital Converter) is written to a WAV file on the
memory card using double buffering.
The audio buffer stores up to 10KB
of audio samples and each sample is
16 bits.
FAT files
In this case, FAT does not stand for
fat or obese! Instead, it stands for “File
Allocation Table” and is a file management system that’s commonly used for
hard disk drives and memory cards.
This Digital Speech Recorder recognises the FAT/FAT32 file system,
meaning you should be able to read
the cards using any Windows, Mac or
Linux box coupled to a card reader or
by using a laptop PC with an inbuilt
card reader.
If you want more information on
the FAT file system, refer to http://
en.wikipedia.org/wiki/File_Allocation_Table or to a host of other internet
sites.
If your memory card has a different file system on it, you will need to
format the memory card first using a
FAT/FAT32 system. Be sure to back
up whatever was on the card before
you do this, because the formatting
process will erase everything that may
be on the card.
File sizes
Because this project does not decode
compressed audio files, the size of the
WAV files used is rather large compared to common MP3 files or similar
audio formats. A WAV file can be up
to 10 times larger than an equivalent
MP3 file at the 44.1kHz sampling rate.
Unlike MP3, uncompressed WAV is a
lossless encoding format. Using lower
sampling rates can reduce file sizes but
this will also reduce the audio quality
and bandwidth.
Because we are using cheap and
readily available SD or MMC cards, we
are not too concerned about the size of
the files. Even at 40MB per 4-minute
audio track, you can still store around
25 songs (or 100 minutes) of audio on
a $10 1GB SD card.
Circuit description
Refer now to Fig.1 for the circuit
details. As shown, it’s based around
a powerful 16-bit DSP microconsiliconchip.com.au
Using Audacity To Convert MP3 Files To WAV Files
C
ONVERTING MP3 FILES (and
other compressed audio formats)
to WAV files suitable for the Speech
Recorder is easy using a program
called “Audacity”. This excellent freeware program allows you to convert
at different sampling rates and can
also be used as a basic sound editor.
Audacity can be downloaded from
http://audacity.sourceforge.net/
download/. There are versions for
Windows, Mac and Linux. Follow the
on-screen prompts after executing
the downloaded installation program.
troller from Microchip, the dsPIC33FJ64GP802 (IC1).
The reasons for choosing this microcontroller are fourfold. First, it is
one of the first microcontrollers from
Microchip to have an integrated stereo
DAC (Digital-to-Analog Converter).
Second, it is very fast, running at
40MIPS (Millions of Instructions Per
Second). You need such speed when
you are reading from a memory card
in real time and dumping audio data
onto the DACs!
Third, it has enough on-board RAM
and program memory to implement
the features of this project and comes
in a through-hole package which is
easier to install than an SMD. And finally, it runs from a 3.3V supply which
is compatible with the supply requirements for a typical memory card.
IC1’s system clock is derived from a
10MHz crystal (X1) via a PLL (Phase
Locked Loop) stage to derive a 40MHz
instruction clock. The two accom
panying ceramic 18pF capacitors provide the correct loading for the crystal.
siliconchip.com.au
As indicated, Audacity can open
MP3 (and other compressed) files.You
can then export them to WAV format
and copy them to an MMC/SD/SDHC
card for use with this unit.
The first step in the conversion is
to select the required sampling rate.
This is a compromise between audio
quality and the size of the file. The
higher the sampling rate selected, the
higher the audio quality but the bigger
the file size.
Having selected the sampling rate,
it’s then just a matter of clicking “File”
In operation, the microcontroller
is responsible for implementing the
hardware layer to read and write sectors to the MMC/SD/SDHC card. This
low-level layer is called by higher layers that implement a FAT/FAT32 file
system. The result is that we can read
and write files.
The SPI (Serial Peripheral Interface)
outputs of the microcontroller connect
to the SD card and to IC2, a 74HC595
8-bit shift register that’s used to drive
the LCD module. This shift register
is used as a “port expander” because
there are simply not enough output
pins on the microcontroller.
The output of the shift register is
also used to scan the eight on-board
tactile switches, S1-S8. These are
connected via diodes D1-D8 which
effectively form a wired AND gate
and they are active low. The microcontroller can detect a switch press
by loading the shift register with the
values 0xFE, 0xFD, 0xFB, 0xF7 and so
on, up to 0x7F (one 0 bit).
Note that the E (enable) line to the
and then selecting the “Export As
WAV...” option.
There is no reason to choose a
sampling rate higher than 44.1kHz,
as this is high enough to encompass
the whole of the audio spectrum (remember that the sampling rate will
be double the highest reproducible
frequency and that the audio spectrum
reaches up to about 22kHz). Having
converted the files to WAV files, it’s
then just a matter of copying them
from the PC to the memory card via
a card reader.
LCD module is kept low during this
scan, so as not to affect the contents
of the display.
Remote control
The speech recorder and audio player can also be operated using a remote
control. The infrared signals are amplified, filtered and demodulated by an
infrared module (IRD1). Its supply is
decoupled using a 10Ω resistor and
10µF electrolytic capacitor. The data
line passes through a voltage divider
consisting of two 27kΩ resistors to pin
14 (RB5) of IC1.
Note that the infrared module works
from a +5V rail whereas the microcontroller decoding the signal runs from a
3.3V rail. The purpose of the voltage
divider is to roughly halve the signal
level from the module so that it can be
used with a 3.3V device.
SPI mode
As noted above, the SPI peripheral
on the microcontroller is used to drive
the LCD and scan the tactile switches.
August 2009 33
+9V
10
+5V
10 F
LED1
LED2
LED3
A
A
A
K
100nF
100nF
1k
K
100
+3.3V
2.2k
K
100
1
100
MCLR
11
7
6
RB4
RB3
RB2
13
Vdd
39k
4
28
AVdd
22
RP11
21
RP10
18
RP9
17
RP8
Vdd
7
Dout
5
CLK
2
Din
1
CS
3
Vss1
6
10
IRD1
(MMC/SD/SDHC
MEMORY CARD
SOCKET)
3
27k
1
14
27k
2
RB5
IC1
dsPIC33FJ
64GP802-I/SP
+3.3Vf
RB1
RB0
100 F
39k
100
MIC IN
4
+9Vf
2
100nF
5
39k
100 F
2.2k
Vss2
CON1
+9V
2x
100k
3
10
100nF
X1 10MHz
8
3
2
IC3a
1
150nF
18pF
18pF
9
AN0
RA4
AN1
12
DACRp 23
OSCo
DACLp
OSCin
Vss
8
25
Vdd 20
CORE
AVss Vss
19
27
10 F
TANT
39k
220k
100k
1k
4.7 F
LINE IN
100nF
5
6
IC3b
4
7
150nF
IC3, IC4: LM833N
39k
100k
100k
22k
100nF
IRD1
LEDS
SC
2009
DIGITAL AUDIO RECORDER/PLAYER
K
A
1
3
2
Fig.1: the circuit is based on a dsPIC33-FJ64GP802 microcontroller and a 16 x 2 LCD module. The micro scans the
switch inputs via shift register IC2, drives the memory card, decodes the signals from the infrared receiver module
(IRD1), writes to the LCD module and performs the ADC conversions on the analog inputs.
34 Silicon Chip
siliconchip.com.au
D9 1N4004
REG1 7809
+9V
OUT
REG2 7805
+5V
OUT
REG3 LM317T
+3.3V
OUT
R1
110
470 F
16V
100 F
16V
IN
GND
IN
IN
12V DC
INPUT
470 F
25V
GND
470 F
25V
ADJ
R2
180
220 F
16V
470 F
16V
R3
0
+5V
10
(ALTRONICS LCD MODULE PIN NUMBERS SHOWN;
JAYCAR MODULE PIN NUMBERS IN BRACKETS)
4
15
2(1)
Vdd
ABL
CONTRAST
VR1
1k
RS
16x2 LCD MODULE
CONTRAST
3
6 EN
(D7) (D6) (D5) (D4) (D3) (D2) (D1) (D0)
11
14
12
MR
Q1
SRCK
Q2
Q3
DS
LCK
Q0
IC2
Q4
74HC595
Q5
Q6
Q7
13
Q7'
OE
(8)
GND
1(2)
R/W
5
KBL
16
(7)
(9)
(10)
(12)
(11)
D0 D1 D2 D3 D4 D5 D6 D7
7 8 9 10 11 12 13 14
(14)
16
Vdd
1k
(13)
100nF
10
S9 ON/OFF
A
K
15
K
A
1
2
3
4
S1-S8
5
6
K
7
A
D1-D8
9
Vss
8
100
+9Vf
470 F
10k
8
3
2
10 F
VR2a
10k
LOG
IC4a
1
100k
100
100 F
LINE
OUTPUTS
22k
22k
10k
1000 F
100nF
10k
22k
220nF
100 F
PLAY
VOLUME
5
6
IC4b
7
100
4
VR2b
10k
LOG
7809, 7805
LM317T
GND
10 F
100k
22k
10k
OUT
220nF
D2–D9: 1N4148
A
ADJ
IN
GND
OUT
siliconchip.com.au
OUT
K
1N4004
IN
A
K
August 2009 35
Main Features & Specifications
•
•
•
•
•
•
•
•
Uses an MMC/SD/SDHC card to store audio files
•
•
Unit can learn remote control codes
•
THD+N: 0.7% at 1kHz
Stores mono recordings as Microsoft WAV files at 16kHz sampling rate
Plays back Microsoft WAV files at up to 44.1kHz sampling rate
Uses FAT/FAT32 file system (transfer files to any PC operating system)
Has mono microphone and line inputs for recording
Stereo socket for line output or headphone use
2-line LCD to display file names, show volume and other settings
Can be controlled using on-board switches or any RC5 universal remote
control
Signal-to-noise ratio: -70dB unweighted (22Hz to 22kHz) with respect
1.6V RMS
The microphone itself can be an
on-board electret microphone insert
or you can use a PC microphone (eg,
Jaycar AM-4087) plugged into the
3.5mm stereo input jack – see photo.
A 2.2kΩ resistor provides the biasing
current for the electret microphone
and its DC supply is decoupled from
the +9Vf supply using a 100Ω resistor
and 100µF capacitor.
IC3b is the line input preamplifier.
It has a gain of 5.5 (+14.9dB), as set by
the 100kΩ and 22kΩ feedback resistors
connected to pin 6.
The outputs of both preamplifier
stages are fed to the ADC inputs (AN0
& AN1) of IC1 via 150nF capacitors.
Each ADC input is biased to half the
+3.3V rail via voltage dividers, each
consisting of two 39kΩ resistors.
Power supply
However, it’s also used to read from
and write to the MMC/SD/SDHC card.
This means that we are using the
MMC/SD/SDHC card in SPI mode
(MMC/SD/SDHC cards can be used
in either native mode or in SPI mode).
The advantage of SPI mode is that any
off-the-shelf microcontroller that has
an SPI peripheral can be used, making
the hardware layer easy to implement.
The interface with SPI may be simple but the penalty is slower transfer
speeds. However, SPI speeds are
adequate for real-time playing (and
recording) of audio. SPI also requires
less interface pins and they are at a
premium, as you can see.
Analog stages
The outputs of the two internal
DACs are fed via dual-gang potentiometer VR2 to an LM833N low-noise
dual op amp (IC4a & IC4b). Both op
amp stages are wired as AC-coupled
non-inverting amplifiers with a gain
of 5.5. The 220nF capacitor to ground
from each feedback divider network
rolls off the DC gain and sets the lowfrequency response.
The outputs at pins 1 & 7 are each
fed to the line output socket via a 100Ω
resistor and a 100µF capacitor and can
either drive stereo headphones or the
line inputs of a stereo amplifier. Note
that the LM833 is not really intended
for driving low impedance loads but it
is a low-cost solution for a headphone
output.
There are two analog input channels, the microphone input and the
line input, and they are provided by
another LM833N low-noise dual op
amp (IC3). IC3a is the microphone
preamplifier. It is a non-inverting stage
with a gain of 221 (+46dB), as set by
the 220kΩ and 1kΩ feedback resistors
connected to pin 2. The 4.7µF capacitor sets the low-frequency rolloff.
On-Board Control Button Functions
If you don’t wish to use a remote control with this project, you can use the
on-board buttons to control it. Their functions are as follows:
Functions while not playing
or recording:
S1: Random Shuffle
S2: Up
S3: Record Mic
S4: Delete A File
S5: Record Line In
S6: Down
S7: N/A
S8: Play
36 Silicon Chip
Functions while playing or
recording:
S1: Volume Up
S2: N/A
S3: Choose Display Up
S4: Stop
S5: Choose Display Down
S6: N/A
S7: Volume Down
S8: Pause
The circuit can be powered from
either a 12V battery or a 12V DC plugpack supply.
In operation, the 12V DC supply is
fed in via on-off switch S9 and reverse
polarity protection diode D9. Note that
a 470µF 25V capacitor is connected
adjacent to the DC input socket and is
not protected from reverse polarity by
D9 (this reduced the hum the most).
There are three 3-terminal regulators
to provide the required supply rails.
First, a 7809 9V regulator (REG1) provides the 9V rail for the analog stages.
It has 470µF and 1000µF capacitors
across its output at different positions
on the PC board. Further decoupling
is provided by a 100Ω resistor and
470µF capacitor to provide the +9Vf
rail which provides the biasing for the
op amp stages.
The main +9V rail is also fed to
REG2, a 7805 regulator, to derive the
+5V rail. This is used to power the
LCD module, shift register IC2 and
the infrared receiver module (IRD1).
This +5V rail also feeds REG3, an
LM317T adjustable voltage regulator.
This produces the +3.3V rail that’s
used by the microcontroller and MMC/
SD/SDHC card.
The accuracy of the +3.3V rail is important because some MMC/SD/SDHC
cards operate over quite a narrow voltage range. The firmware checks that
the inserted card operates at 3.3V and
so it is crucial that the supply rail be
quite close to +3.3V.
The output voltage of REG3 is set
by the divider network between its
output terminal and its ADJ terminal
siliconchip.com.au
MMC, SD & SDHC Memory Cards
Both MMC (MultiMedia Card) and SD (Secure Digital) cards are a type of nonvolatile storage that uses FLASH memory technology. Similarly, SDHC (HC = high
capacity) cards are a type of SD card with capacities between 4GB and 32GB.
All three types of cards can be used with this project. While they all look alike,
MMC cards have only seven contacts, whereas SD cards have nine.
Note that miniSD and microSD cards can also be used as these are essentially
SD cards with a smaller form factor. You will, however, need an external adaptor
to convert them to standard size to connect to the Digital Speech Recorder.
MMC/SD/SDHC cards are commonly used in portable devices like mobile phones,
computers, cameras and audio players, among others. They conveniently store a
lot of data in a small form factor, consume little power and are light. Cards with
increasingly larger storage capacity have been steadily appearing since their
introduction in the late 1990s.
Helping to put you in Control
Control Equipment
Digital Stepper Motor
Drives We could not
believe the speed and
quietness of these
new drives. Based on a
DSP with advanced
control algorithm.
Software is provided to
tune the performance resulting in
faster, cooler and quieter stepper
motors From $99+GST
Digital Servo Motor
Drive This is a1880VDC, 0-20A, 20-400W
drive. It is based on DSP
control technology and
high smooth servo control algorithm. It has a PC based and
handheld configuration tools, including
Pro Tuner for easy tuning. $229+GST
LEVEL (dB)
Serial Graphic LCD
The Serial Graphic LCD
backpack is soldered to
the 160x128 pixel
(100x130mm) Graphic
LCD and provides the
user a simple serial interface to a full
range of controls. $99.95+GST
Serial 7 Segment Display
FREQUENCY (Hz)
Fig.2: this graph shows the frequency response for recordings made on the
Digital Speech Recorder. Note that the response is limited to half the sampling
frequency which is fixed at 16kHz for recording. The frequency response can be
much wider for files recorded on a PC and transferred to the memory card.
to ground. The output is set at:
VOUT = 1.25V x (1 + (R2/R1))
With R2 = 180Ω and R1 = 110Ω, we
get a supply of 3.29V (close enough to
3.3V). However, the 1.25V reference in
the regulator can vary between 1.2V
and 1.3V.
For this reason, provision is made
on the PC board for an additional
resistor (R3) to allow you to adjust
the 3.3V supply rail if necessary. We
will touch on this point later, in the
setting-up procedure.
Construction
All parts are mounted on a singlesiliconchip.com.au
sided PC board coded 01108091 and
measuring 164 x 136mm. Fig.3 shows
the parts layout on the board.
The first thing to do is to carefully
inspect the board for hairline cracks
and for shorts between adjacent tracks.
It’s rare that you will find a fault but
it’s easier to spot any problems at this
stage than after the parts have been
installed.
Begin the assembly by soldering in
the 18 wire links. You can straighten
the link wire by clamping one end in
a vice and then pulling on the other
end with a pair of pliers to stretch it
slightly. Don’t forget link LK1 under
the LCD module.
The display can be controlled in one of two
ways: (1) serial TTL communication or (2) SPI
serial communication. The display will
give you full control of all digits, decimal
points, the colon and the apostrophe.
50x15mm $17.50+GST
MyPCProbe Is a simple
to use temperature or
temperature and humidity
sensor which connects to
a PC via a USB port. It
comes with an intuitive
and easy-to-use Windows software
which plots and records data, shows
gauges, bargraphs and digital readouts.
From $149+GST
Large 7 Segment Display.
No really this display is
153mm tall and can be seen
from 30 metres plus away. A
controller is coming soon
$19.95+GST
Contact Ocean Controls
Ph: 03 9782 5882
www.oceancontrols.com.au
August 2009 37
12V DC IN
D9
470 F
25V
4004
(JAYCAR LCD MODULE)
470 F
25V
B.v eR
19080110
REDR O CER H CEEPS
9 0 0 2/ 5 0 G M
+
REG1
7809
+
+
470 F
16V
100
ALTRONICS LCD MODULE
REG2
7805
LK11
+
S9
470 F
16V
1k
LED2
100
100
100
LED1
100 F
10 F
100 F
VR2
2x10k LOG
S
LED3
PLAY
VOLUME
LINE OUT
100
2.2k
4.7 F
100k
220k
100k
IC3
LM833
220nF
100k
100k
LK17
100nF
100nF
R
T
LK16
LK18
22k
22k
R
1k
100nF
22k
100
100
+
(PS-0024)
100 F
+
MMC/SD/SDHC
CARD SOCKET
(UNDER)
10 F
+
LK5
39k
IRD1
39k
39k
39k
39k
10
100nF
150nF
10k
10k
10k
10k
+
LK4
1k
IC1 dsPIC33FJ64GP802-I/SP
10 F TANT
+
100k
LK12
+
27k
27k
VOL DOWN
22k
N/A
100nF
100k
DISPLAY DOWN
X1
100nF
150nF
S7
S6
LK13
LK14
LK15
N/A
IC4
LM833
LK10
LK9
LK7
LK8
LK6
S5
100 F
100nF
220nF
LK1
2.2k
18pF
10 F
18pF
+
PAUSE
DOWN
REC LINE IN
+
22k
LK3
STOP
10
1000 F
100k
0
180
+
16V
VOL UP
PLAY
S8
S4
100 F
110
N/A
+
+
470 F
S1
DISPLAY UP
DELETE FILE
IC2 74HC595
100nF
220 F
SHUFFLE
UP
+
LM317T
+
4148
4148
D1 D5
10
4148
D2 D6
4148
REC MIC
4148
4148
D3 D7
4148
4148
D4 D8
S2
S3
VR1
REG3
LK19
14 13 12 11 10 9 8 7 6 5 4 3 2 1 16 15
LK2
+
MIC
R
S
LINE IN
T
S
T
MIC IN
Fig.3 (above): install the parts on the PC board as shown on this parts
layout diagram. Take care to ensure that all polarised parts are correctly
oriented and leave the ICs and the LCD module off the board until after
the initial power supply checks have been completed.
Fig.4 (left): the memory card socket (CON1) is a surface-mount device
(SMD) and is installed on the underside of the PC board as shown here.
Lightly solder tack one pin first, then check the socket’s alignment before
soldering the remaining pins.
The resistors are next on the list and
again one of these is under the LCD
module. Table 1 shows the resistor
colour codes but you should also check
each resistor using a DMM before
soldering it to the board. Resistor R3
can be either a 0Ω resistor or you can
simply install a wire link (note: this
0Ω resistor may have to be changed
later – see section on trimming the
3.3V rail).
38 Silicon Chip
Follow these parts with the diodes
and the infrared receiver (IRD1). Note
that D9 is a 1N4004 type, while the
remaining eight diodes (D1-D8) are
all 1N4148 signal types. These diodes
must all be installed with the correct
orientation (the striped end is the
cathode), while IRD1 must go in with
its domed lens facing outwards.
The three LEDs (LED1-3) can be
installed at this stage as well. Make
sure that these are oriented correctly
and match the colours shown on Fig.3.
Installing the regulators
The three TO-220 regulators (REG1REG3) can now go in. As shown, these
are all mounted horizontally, with
their leads bent down at right-angles
about 6mm from their bodies. In addition, the 7805 regulator must be fitted
with a mini heatsink before it is bolted
siliconchip.com.au
Table 2: Capacitor Codes
Value
220nF
150nF
100nF
18pF
µF Value IEC Code
0.22µF
220n
0.15µF
150n
0.1µF
100n
NA
18p
EIA Code
224
154
104
18
This prototype PC board differs
slightly from the final version
shown in Fig.3 on the facing page.
Table 1: Resistor Colour Codes
o
o
o
o
o
o
o
o
o
o
o
o
o
siliconchip.com.au
No.
1
7
5
2
5
4
2
3
1
1
7
1
Value
220kΩ
100kΩ
39kΩ
27kΩ
22kΩ
10kΩ
2.2kΩ
1kΩ
180Ω
110Ω
100Ω
0Ω
4-Band Code (1%)
red red yellow brown
brown black yellow brown
orange white orange brown
red violet orange brown
red red orange brown
brown black orange brown
red red red brown
brown black red brown
brown grey brown brown
brown brown brown brown
brown black brown brown
black
5-Band Code (1%)
red red black orange brown
brown black black orange brown
orange white black red brown
red violet black red brown
red red black red brown
brown black black red brown
red red black brown brown
brown black black brown brown
brown grey black black brown
brown brown black black brown
brown black black black brown
black
August 2009 39
Transferring Files & Recording
To The Memory Card
To transfer audio files from
a PC to the memory card,
you will need a low-cost SD/
SDHC/MMC-card reader. The
one shown in the accompanying
photo is available from Jaycar for
less than $10 (Cat No: XC-4756).
Note that before copying the files
(eg, music tracks) to the MMC/SD/
SDHC card, they must first be converted to WAV format. This can be
done using a freeware sound editor
program called “Audacity” – see panel
on page 33.
As indicated earlier, you can also
directly record files to a memory
card in the Digital Audio Recorder.
Basically, you have two choices when
making recordings: either use the
microphone input or feed signals in
down. Each regulator is secured using
an M3 x 5mm machine screw and nut.
The next step is to install the four
IC sockets. If you don’t have a 28-pin
0.3-inch socket (or have a 0.6-inch
socket instead), you can cut it down
the middle and install the two strips
for IC1. Orientate each socket so that
its notch matches that shown on the
overlay. This will make it easier when
it comes to installing the ICs later on.
You will also need to cut down a
40-pin IC socket to make the connector
for the LCD module. If you are using
via the recorder’s line input.
When using the microphone input,
you can use either an onboard electret microphone (see photo) or you
can plug an electret microphone into
the MIC In socket. Suitable external
electret microphones are available
from Jaycar and Altronics. Be sure to
disconnect the on-board microphone if
you are using an external microphone.
Note that the microphone and line
inputs differ in the gain of their respective preamplifier stages, so be sure
also to choose the correct input.
the Altronics module, you will need a
single row of 16 pins. Alternatively, if
you are using the Jaycar module, you
will need two rows of seven pins and
they must be installed with what were
originally their outside edges touching
in the middle, otherwise they won’t
fit in place.
Now move on to the capacitors.
There are four different types: monolithic, ceramic, MKT and electrolytic.
The first three types can go in either
way around but the electrolytic capacitors are polarised and each must
Defining The Remote Control Codes
If you wish to use a remote control
with this unit, you will need an RC5compatible remote. RC5 is an infrared
communications protocol that was
initially developed by Philips and is
used by many Philips appliances.
This means that if you have a universal remote, there’s a good chance it
will work if you set it to control a Philips
appliance. For example, we tested
the project with the Jaycar AR-1726
remote and can confirm that it works.
Setting up the remote is straightforward. You start by pressing the S2
& S6 (UP & DOWN) buttons together
40 Silicon Chip
while booting the recorder, to enter the
remote control programming menu.
You are then prompted to press the
key you want to define for that function.
For example, you may be prompted
to “Press Play” and you then simply
press the relevant button on the
remote which is to be assigned that
function.
A recommended set-up using the
AR-1726 Remote from Jaycar is
shown in Table 3. It should be set to
the VCR 917 code which corresponds
to the default programmed into the
recorder’s firmware.
This larger-than-life size view shows
how the card reader is mounted on
the copper side of the PC board.
be oriented as shown on Fig.3. The
negative terminal is marked on the
body of each capacitor.
The switches can go in next. The
power switch (S9) is a DPDT slide type,
while the rest (S1-S8) are momentary
pushbutton tactile types. Note that
these tactile switches are not symmetrical in the horizontal and vertical
directions, being slightly longer in the
vertical direction.
It’s just a matter of installing them
with their terminals positioned as
shown (they won’t fit the wrong way).
The larger items can now be installed. These include trimpot VR1,
dual-gang potentiometer VR2, the DC
connector and the three 3.5mm stereo
jack sockets. If you intend using an
electret microphone, then you will
also have to install a 2-pin socket strip
to accept its connecting leads. Note
that the electret microphone should
not be connected while you are using
an external microphone.
Installing the card socket
The memory card socket is mounted
in the underside of the PC board – see
Fig.4. This is an SMD device so you
must carefully position it over its
pads and solder one of the pins first
to anchor it in position. Once that is
done, you can solder the rest of the
pins. Note that there are two mounting
terminals on either side of the device
that must also be soldered to matching
pads near the front edge of the board
(see Fig.4 and photo).
The initial assembly can now be
completed by fitting four M3 x 12mm
Nylon spacers to form the mounts for
siliconchip.com.au
Table 3: Recommended Key Assignments For Digitech AR-1726 Remote Control
Button
Recommended Key
Definitions for the
Digitech AR-1726 Remote
Function(s)
0
Unused
Press ‘0’
1
In Triggered mode, used to play file rec001.wav
Press ‘1’
2
In Triggered mode, used to play file rec002.wav
Press ‘2’
3
In Triggered mode, used to play file rec003.wav
Press ‘3’
4
In Triggered mode, used to play file rec004.wav
Press ‘4’
5
In Triggered mode, used to play file rec005.wav
Press ‘5’
6
In Triggered mode, used to play file rec006.wav
Press ‘6’
7
In Triggered mode, used to play file rec007.wav
Press ‘7’
8
In Triggered mode, used to play file rec008.wav
Press ‘8’
9
In Triggered mode, used to play file rec009.wav
Press ‘9’
VOL UP
In Normal mode, used to select a file to play. While playing, used to increase the volume
Press ‘Vol Up’
VOL DOWN
In Normal mode, used to select a file to play. While playing, used to decrease the volume
Press ‘Vol Down’
CH UP
While playing, used to select what is displayed in the second line on the LCD module
Press ‘Ch Up’
CH DOWN
While playing, used to select what is displayed in the second line on the LCD module
Press ‘Ch Down’
MENU
Used to delete the selected file; confirmation is requested
Press ‘Menu’
STOP
Used to stop a playing file or a recording
Press ‘Stop’
PLAY
Used to play the selected file
Press ‘Play’
PAUSE
FAST FWD
Used to pause a playing file or a recording
Used to start random shuffle
Press ‘Pause’
Press ‘FF’
REWIND
Unused
RECORD
Used to initiate a recording from the microphone input
Press ‘Rec’
OK
Unused
Press ‘Ok’
EXIT
Unused
Press ‘Exit’
LINE
Used to initiate a recording from the line input
the PC board. DO NOT fit the ICs or the
LCD panel at this stage. These parts
are installed only after the supply
rails have been checked and that step
comes next.
Power supply checks
You will need a 12V DC 300mA
(or higher) regulated plugpack with
a 2.5mm connector to power this
project. Suitable plugpacks include
the Jaycar MP-3147 and the Altronics
M-9243. However, you will need to cut
off the 2.1mm connector on the Altronics unit and replace it with a 2.5mm
connector. Be sure to get the polarity
correct – the centre pin is positive.
Before applying power, make sure
that the LCD is unplugged and that
no ICs have been fitted. That done,
apply power and move S9 to its ON
position (ie, to the right). Now, using
a DMM, measure the voltage between
siliconchip.com.au
Press ‘Rewind’
the OUT and GND terminals of REG1
– you should get a reading of 9V. If not,
switch off immediately and check for
supply errors. If no voltage is present,
then D9 may be reversed or the supply
polarity could be incorrect.
Assuming all is OK, check the voltage on the OUT terminal of REG2. This
time, you should get a reading of 5V.
Finally, check the voltage on the
OUT terminal (ie, the centre terminal)
of REG3. It should be close to 3.3V. If
any of the above voltages is incorrect,
disconnect power immediately and
check your work.
Note: the OUT terminal of REG3
is the centre lead of the device. By
contrast, the OUT terminal of both
REG1 & REG2 is one of the outside
leads – see Fig.1 for the pin-outs.
Trimming the 3.3V rail
If the 3.3V rail is more than 3.4V or
Press ‘->’
less than 3.2V, you will need to change
one or both of the values for R2 and
R3. For example, if the voltage from
REG3 is 3.17V, you will need to install
a 10Ω resistor for R3 and this should
bring it pretty close to 3.3V.
Alternatively, if the output voltage
is 3.41V, you should change the value
of R2 to 160Ω and R3 to 10Ω, giving a
total value for R2 + R3 = 170Ω (or you
could use 150Ω for R2 and 22Ω for R3).
Again, this should bring the voltage
from REG3 pretty close to 3.3V.
If all three supply voltages are now
close to their nominal values, you can
disconnect power and insert the four
ICs in their sockets. These ICs should
all be oriented correctly of course.
Installing the LCD module
The LCD module can now be installed. The Altronics module is secured to the board on two M3 x 9mm
August 2009 41
Screen grab showing the playing view.
The time since the beginning of the track
and the volume level are shown. Note that
the time will blink on and off if track is
paused.
Screen grab showing file selection.
You can scroll through the file system by using
the Up and Down buttons and press Play when
you are satisfied with your selection. The
currently selected file is shown with '>'.
The previous directory is shown as '[..]'.
You can press Play or Record to enter a
directory. Note that directory names are
enclosed in square brackets to differentiate
them from normal files.
The playing view.
The time since the beginning of the track,
the sampling rate and whether the track is
mono or stereo are shown. This view shows
that the sampling rate is 44.1kHz and it is
a stereo track that’s being played.
The recording view. The time since the
beginning of the track, the sampling rate
and whether the track is mono or stereo are
shown. This view shows that the sampling
rate is 16kHz and that it is a mono track
that’s being recorded.
When playing a random selection
through shuffle, this is the play screen
shown. Notice the 'RND' indicator that's
only shown in this mode.
A screen readout showing the size of the
inserted memory card and the remaining
free space on it. This screen is displayed
once on startup.
Fig.5: this diagram show some typical displays on the LCD, together with
accompanying explanations. The unit shows file names, time elapsed while
playing, the recording source, volume, sampling rate, card size, free space
and other information.
tapped Nylon pillars as shown in Fig.3,
while the alternative Jaycar module is
secured using four M3 x 9mm tapped
Nylon pillars, ie, one at each corner
(all the necessary mounting holes are
on the PC board).
Your Digital Speech Recorder &
42 Silicon Chip
Audio Player is now completed and
ready for use.
You should transfer the audio WAV
files you wish to play to an MMC/
SD/SDHC card using your PC or Mac,
making sure the card is formatted
with a FAT/FAT32 file system. Once
the memory card has been inserted
in its socket on the underside of the
PC board, you can apply power. The
firmware should display the version
on the LCD panel and then compute
the free size on the memory card. Your
player is then fully operational.
Configuring the unit
The Digital Speech Recorder can be
used in either of two modes: normal
or triggered.
By default, the unit works in normal mode. However, if you wish to
configure it for triggered operation,
you simply create a file “trigger.txt”
and place it in the root folder of the
memory card you are using. You can
do this using a card reader and a PC.
The file need not contain anything – it
just needs to be there (as an empty file).
The microcontroller will look for
this file on boot up and switch the
mode of operation to triggered if it is
present. On the other hand, if this file
is absent, the recorder boots for normal
operation.
The differences between these two
modes of operation are explained
below.
Normal mode
In Normal operation, you begin by
using the UP and DOWN buttons (S2
& S6) or the VOL UP and VOL DOWN
buttons on the remote control to scroll
through the file system on the card.
When you’ve selected the correct
file, you simply press PLAY (S8) to
play it. A screen grab showing a typical view of the filesystem is shown in
Fig.5 (second from top). Of course,
only two files are ever shown at any
one time. A directory is indicated by
its name being enclosed in square
brackets. Press PLAY to enter a directory. The previous directory is shown
as “[..]” – see Fig.5.
The delay in playing a new file is
very small, of the order of a fraction of a
second. This makes this project perfect
for playing sound effects on demand.
Pressing SHUFFLE (S1) or FAST
FF on the remote enters random shuffle mode. In this mode, there is an
“RND” indicator on the display and a
random selection of tracks (eg, songs)
is continuously played from the root
directory. You exit this random shuffle
mode by pressing STOP (S4).
Pressing REC MIC (S3) or REC
LINE-IN (S5) starts a recording from
the microphone or line input respecsiliconchip.com.au
Configuring The Software To Suit The LCD Module
If you look closely at the PC board
for this project, you will notice that the
Jaycar and Altronics LCD modules are
wired with their data lines “transposed”.
Basically, the D0 line on the Altronics
module is connected to the D7 line of
the Jaycar module, while the D1 line
on the Altronics module is connected
to the D6 line of the Jaycar module and
so on. This was done to simplify the PC
board layout.
It means, however, that the firmware
must drive these two LCD modules
differently. As a result, the microcontroller must either be programmed with
0110809A.hex if you are using the Altronics LCD module or with 0110809J.
hex if you are using the Jaycar LCD
module.
You can also toggle either version
to drive the alternative module. This
is done by holding down buttons S4
& S8 together while applying power.
Note that this needs only to be done
once, as the new setting is stored in
non-volatile memory.
If nothing appears on the LCD at
initial switch-on, try adjusting the contrast (VR1). If that doesn’t work, you
may have the wrong software for your
particular LCD module, so switch off
and reapply power while holding down
S4 & S8.
If you buy a kit, then the default will
be correct for that kit supplier’s LCD
module.
tively. Alternatively, you can press the
Record or Line buttons on the remote.
When recording a file, the filename
will be of the form rec???.wav with ???
a string of three decimal digits. The
filename recorded will be shown when
the recording is ended using either the
STOP button (S4) on the board or the
STOP button on the remote.
In practice, it’s more complicated
“in the telling” than “in the doing”.
A few minutes spent pressing buttons
will quickly reveal how it works.
Triggered Mode
In Triggered mode, you simply press
one of the eight buttons to play the file
“rec00?.wav” where “?” is a digit from
1-8. For example, pressing S3 will play
the file “rec003.wav”.
This close-up view
shows how an on-board
electret microphone can
be installed (it plugs into
a 2-pin header near the
external microphone
socket but watch the
polarity). Do NOT install
this if you intend using
an external mic.
You can also press the corresponding digits on the remote control to play
each of these eight files.
Basically, the Triggered mode is
useful for quickly playing back one
of eight tracks (or messages) once they
have been recorded. After recording
the messages (using Normal mode),
it’s just a matter of copying a file called
“trigger.txt” to the root folder of the
card as detailed above and restarting
SC
the Digtial Speech Recorder.
Looking for real performance?
• Learn how engine management systems work
• Build projects to control nitrous, fuel injection and turbo
boost systems
160 PAGES
23 CHAPTE
RS
Fro m the
pu blis he rs
of
• Switch devices on and off on the basis of signal frequency,
temperature and voltage
• Build test instruments to check fuel injector duty cycle, fuel mix
ture and brake and coolant temperatures
• Speedo Corrector, Turbo Timer, Nitrous Fuel Controller & Digital
Thermometer Projects
Intelligen
t
turbo timer
I SBN 095
852
9 7809
5
8 5229
4
$19.80 (inc GST)
Price: Aust. $A19.80 plus $A10 P&P ($A12 P&P NZ; $A18 P&P elsewhere).
See the order form in this issue.
294 - 4
TURBO B
OOST
& nitr
ous fuel co
ntrollers
6
NZ $22.00 (inc
GST)
How eng
in
manageme e
nt works
Order by phoning (02) 9939 3295 & quoting your credit card number; or fax the details to (02) 9939 2648;
or mail your order with cheque or credit card details to Silicon Chip Publications, PO Box 139, Collaroy, NSW 2097.
siliconchip.com.au
August 2009 43
|