E00c050.PDF
(
1276 KB
)
Pobierz
000107-UK sound-light
GENERAL
INTEREST
Sound-to-Light PLUS
Microprocessor-driven lights effects
Design by Ron Wouters
Text by David Daamen
The use of lights effects units in conjunction with music is presently very
popular. Of course we don’t want to stay behind at Elektor. This design
uses a PIC16F84 and has sound-to-light, running lights modes and ‘beat
detection’.
Please note: prototype shown here differs slightly from the PCB layouts shown in Figures 3 and 4.
Most people will remember the running light
units which typically used a 4017, a digital
decade counter whose outputs go high in
turn when a clock signal is applied. And
what about the classic sound-to-light unit:
three lights, each flashing according to the
sounds in different bands of the audio spec-
trum. Those were sound-to-light
units in their most elementary form.
But in the age of the microprocessor
it all has to be faster, better and offer
more functionality. And that is
exactly what this circuit does.
This circuit certainly offers a lot of
functionality, since it combines the
running lights and sound-to-light
modes. The running lights do more
than just go forwards and back-
wards, there is also a choice of sev-
eral pre-programmed patterns. The
unit also has a beat-detection circuit.
50
Elektor Electronics
12/2000
GENERAL
INTEREST
12V
5V
F1
Tr1
B1 = B80C1500
C18
R16
K3
100mAT
IC4
4
100n
7812
12V
IC1
11
IC1 = LM324
B1
C19
T1
C4
R15
47k
100n
C29
C27
C25
C23
8V
68n
R14
1000µ 25V
100n
4µ7 63V
100n
BC547B
5V
2x 15V
8VA
R27
C30
C28
C26
C24
K1
R3
10k
5V
1000µ 25V
100n
4µ7 63V
100n
5V
C1
R1
100k
2
R20
1
1µ
63V
IC1a
7908
8V
CW
3
R4
R5
IC5
S1
C20
P1
47k
C5
R18
1k5
R19
47k
T2
100n
R2
D1
R29
680
Ω
D5
C2
1µ5
R17
C6
BC547B
1µ
14
K2
1N4148
T5
100n
R30
680
Ω
D6
4
6
1
2
MCLR
RB0
RB1
RB2
RB3
RB4
RB5
RB6
RB7
R6
7
3
4
D7
C3
R31
680
Ω
BF256C
5V
3
RA4
IC2
8
5
6
1µ
2
9
7
8
R24
RA3
1
PIC16
10
R32
680
Ω
D8
9
10
RA2
18
17
RA1
RA0
F84
11
11
12
12
D9
13
14
R33
680
Ω
13
T3
R7
10k
R21
1k
R22
10k
R23
47k
OSC2
OSC1
15
16
5
12V
C7
C8
R28
BC547B
1µ
100n
5V
CW
X1
R8
47k
P2
22k
R26
1N4148
C17
C16
IC3
13
6
C13
R9
1k
R10
10k
R11
100k
14
10
7
47p
47p
12V
7805
5V
IC1d
IC1b
D3
D4
12
8
5
X1 = 4.096MHz
1µ
D2
IC1c
9
1N4148
R34
1N4148
R25
R12
R13
T4
C22
C21
D10
C9
C10
C11
C12
C14
C15
4µ7 63V
100n
2µ2
2µ2
470n
47n
1µ
1µ
BC547B
000107 - 11
Figure 1. The sound processing and control section.
The change of pattern of the running
lights is determined by the beat of
the music. All this can be can be
realised in a simple manner by using
a PIC16F84 to control the lights. This
microcontroller is inexpensive, fast,
has a large number of I/O pins and
can be programmed easily.
causes the lights to step through five
pre-programmed patterns.
Sometimes the music can have lit-
tle or no beat to it. When the detec-
tion-algorithm cannot find the beat
during six seconds, it causes the unit
to switch automatically to the
sound-to-light mode. In this case,
the unit is also prevented from
switching back to the running lights
mode. The running lights mode will
only be enabled again when the beat
returns.
It’s also possible that no audio
signal is present at all. When this is
the case there is obviously no point
in having the sound-to-light mode
on. When no music is detected for a
period of 30 seconds the unit starts
flashing the lights in a random pat-
tern. Of course the controller will
revert to its normal mode of opera-
tion as soon as the music signal
returns. This way we can guarantee that
some lights effects will always be produced.
And finally, we can choose to have the unit
work only in the sound-to-light mode.
Circuit
The circuit of the sound-to-light unit consists
of two sections. F
igure 1
is the section which
deals with the signal processing and which
provides the signals for the lamp-drivers. The
sound source (for example a CD player or the
REC-out connection of an amplifier) is con-
nected to the circuit via K1. P1 is used to set
the sensitivity of the input. The amplitude of
the signal should be between 0.7 and 1.5 V
pp
.
After P1 the signal is amplified by IC1a and
T5. This combination of opamp and FET
forms an AGC (automatic gain control) unit
that keeps the signal at a more or less con-
stant level. The values of R5 and C3, which
determine the behaviour of the AGC, have
been chosen such that the beat of the audio
Operation
As we mentioned earlier, the circuit
consists of a running-lights as well
as a sound-to-light unit. The pro-
gram has been implemented such
that the PIC switches between these
two modes every four seconds. In
the sound-to-light mode, the lights
flash to the beat in three bands in
the spectrum of the connected audio
signal. The same audio signal is also
used in the second mode of opera-
tion. Here the beat of the music
12/2000
Elektor Electronics
51
GENERAL
INTEREST
signal is kept intact.
The resulting signal is then fed to three
separate filters: a low pass filter at 160 Hz
(R21, C7, R22 and C8), a band pass filter set
between 225 and 1060 Hz for the mid fre-
quencies (C5, R17, R18 and C6) and a high
pass filter at 2340 Hz (C4 and R14). Following
each filter is an NPN transistor with base and
collector resistors, which converts the signal
to TTL levels. These signals can then
be fed to the PIC for processing.
The signal from the AGC doesn’t
only go to the three filters for the
sound-to-light effect, but also to a
beat-detection circuit. IC1d amplifies
the signal by a factor of 4.7 and is fol-
lowed by a low pass filter with a roll-
off of 18dB. This filter is designed
with a cut-off frequency of 34 Hz,
using R9, C9, C10, R10, C11, R11 and
C12. The output of the filter goes to
IC1c, which is the actual beat-detec-
tor. The inverting input of the opamp
is driven by a slightly delayed signal
via C14 and R12, which causes a
series of pulses to appear at its out-
put, with a frequency depending on
the audio signal. If the right type of
signal is present, the output will fol-
low the beat of the music.
These pulses are integrated by D3
and C15 and then go to IC1b. This
opamp is used as a comparator,
where P2 sets the sensitivity of the
beat-detector. The pulses from the
comparator drive T4 via D4 and R25.
This transistor also converts the sig-
nal to TTL levels.
So now there are four signals
available, of which the first three are
used in the sound-to-light mode. The
fourth signal determines when the
lights change pattern in the running
lights mode.
The program in IC2 selects the
active mode. A ready programmed
PIC can be ordered from
Elektor
Electronics
Readers Services (order
code
000107-41
). For those of you
who wish to program the PIC them-
selves, a diskette is available con-
taining the program (order code
000107-11
). Please note that the pro-
ject software is not available as a
Free Download from our website
because the author receives royalty
payments on every copy sold of the
disk and programmed PIC.
The processor section is very
simple. The only external compo-
nents used by the PIC are R28, X1,
C16 and C17, which are used to
generate its clock signal. S1 is used
to switch between the fixed sound-
to-light mode or alternating
between the two modes. R27 is
used to keep the signal at the input
12V
L5
R5
K5
F5
IC5
14
8
K6
D17
D18
1A T
T
HR5
4x
1N5408
1
CNY65
7
TIC
106M
R10
D19
D20
12V
L4
R4
K4
F4
IC4
14
8
D13
D14
1A T
T
HR4
4x
1N5408
1
CNY65
7
TIC
106M
R9
D15
D16
K7
12V
L3
1
2
3
4
R3
K3
5
6
F3
7
8
14
IC3
8
9
10
D9
D10
1A T
11
12
T
HR3
13
14
4x
1N5408
1
CNY65
7
TIC
106M
R8
D11
D12
12V
L2
R2
K2
F2
IC2
14
8
D5
D6
1A T
T
HR2
4x
1N5408
1
CNY65
7
TIC
106M
R7
D7
D8
12V
L1
R1
K1
IC1
F1
F6
Tr1
14
8
D1
D2
1A T
100mA T
IC6
12V
T
HR1
4x
1N5408
7812
B1
1
CNY65
7
TIC
106M
R6
C4
C3
C2
C1
D3
D4
15V
4VA5
1000µ 25V
100n
4µ7 63V
100n
B1 = B80C1500
000107 - 12
Figure 2. The lamp-driver section.
52
Elektor Electronics
12/2000
GENERAL
INTEREST
of RA4 (pin 3) at a defined level
when the switch is open.
Five outputs of the PIC (RB0-RB4)
are used to drive the lamps. Each
output is connected to K2 via a resis-
tor and LED. These signals are con-
nected to a separate board that
finally drives the lamps. We’ve
designed a separate board since it is
more convenient to place it near the
lamps, or even in the same enclosure
as the lamps. An ordinary low-volt-
age cable (with a minimum of 6
cores) can be used to make the con-
nection.
The lamp-driver board (
Figure 2
)
has an optocoupler (IC1-IC5) for each
channel. In the event of a fault the
control board and any connected
audio equipment will remain isolated
from the deadly mains potential.
When the control board is connected via
K7, the LED in each optocoupler will be con-
nected in series with the LED on the control
board. LEDs D5-D9 will therefore not only
show which lamp should be on, but also that
F1
100mA/T
H1
PIC16F84
Yet again, a microcontroller of the
PIC family from Microchip is used
in this circuit. It’s not surprising
that it is a 16F84. This part is ideal
for design and development work,
because it can be (re)programmed
very easily. There is no need to
erase the device under UV light.
The flash memory is simply over-
written when the device is in its
program mode. Once the design
has been completed, a different
processor can be used for mass
production (for example a cheaper
version without the flash memory).
This is something that we pur-
posely didn’t do. It is always inter-
esting to experiment a little and
this circuit is perfect for that.
There are enough spare inputs left
to use. And you’re not restricted
to switching lamps; many other
mains-powered appliances can be
connected. You could connect a
microphone to the input and use
the high pass filter and some modi-
fied code to make a whistle detec-
tor to switch appliances on and off.
And there are probably many
other (and more original) applica-
tions. For those who want to find
out more about the 16F84 or
other Microchip processors, their
website is at
www.microchip.com
.
On
www.thepicarchive.cwc.net
you’ll find a wide range of PIC-pro-
grammers, programming software,
program examples and projects.
There are also descriptions of ‘in-
circuit’ programmers, so you no
longer have to remove the PIC
from the circuit in order to pro-
gram it.
R6
R5
D1
R4
R7
R8
R9
C18
R10
R1
R2
R3
C9
C13
D2
D3
R11
D4
R12
R25
R14
R15
R22
R23
C8
R19
R17
R18
R33
R32
R31
R30
R29
R16
R20
R27
H3
S1
C20
Figure 3. Copper track and component layout of the control PCB.
12/2000
Elektor Electronics
53
GENERAL
INTEREST
F6
H1
100mA/T
D4
D3
R1
D2
D1
F1
1A/T
IC1
D8
D7
R2
D6
D5
F2
1A/T
IC2
D12
D11
R3
D10
D9
F3
1A/T
IC3
D16
D15
R4
D14
D13
F4
1A/T
IC4
D20
D19
R5
D18
D17
F5
1A/T
IC5
H3
54
Elektor Electronics
12/2000
Plik z chomika:
TirNaNog
Inne pliki z tego folderu:
bge.jpg
(22 KB)
detail10.htm
(5 KB)
detail1.htm
(5 KB)
detail12.htm
(15 KB)
detail11.htm
(7 KB)
Inne foldery tego chomika:
1974
1975
1976
1977
1978
Zgłoś jeśli
naruszono regulamin