Maker Pro
Maker Pro

Newbie Sequential LED Help

B

BrianLunde

I am a newbie here, have read the threads, FAQ, and Posting Guide and
this looks like the right place for a circuit question. If this
request is out of line, could someone please suggest a better group?
Thanks!

I am in Jr. High and pretty new to electronics but can solder and read
basic circuits. Can someone point me in the right direction for a
circuit that will use an MP3 player channel with tones (or multitones)
to advance a sequence of LEDs? This is for a school project using a
cheap MP3 player with narration. As each new point is made on audio
track A, I hope to use a track B tone to trigger the next LED in a
sequence to highlight the matching text on a display. At the end of
the audio, the file will replay and the sequence will be something
like Audio Point1 = LED1, Audio Point2 = LED2, Audio Point3 = LED3 -
Audio Point1 = LED1, Audio Point2 = LED2, etc. I would like to keep
this to three volts D.C. or less (two AA batteries). Any suggestions?
 
J

John Woodgate

I read in sci.electronics.design that BrianLunde
I am a newbie here, have read the threads, FAQ, and Posting Guide and
this looks like the right place for a circuit question. If this
request is out of line, could someone please suggest a better group?
Thanks!

It's probably OK here; it's a bit more up-market than
sci.electronics.basics
I am in Jr. High and pretty new to electronics but can solder and read
basic circuits. Can someone point me in the right direction for a
circuit that will use an MP3 player channel with tones (or multitones)
to advance a sequence of LEDs? This is for a school project using a
cheap MP3 player with narration. As each new point is made on audio
track A, I hope to use a track B tone to trigger the next LED in a
sequence to highlight the matching text on a display. At the end of
the audio, the file will replay and the sequence will be something
like Audio Point1 = LED1, Audio Point2 = LED2, Audio Point3 = LED3 -
Audio Point1 = LED1, Audio Point2 = LED2, etc. I would like to keep
this to three volts D.C. or less (two AA batteries). Any suggestions?

Yes. 3 V is going to make things DIFFICULT. 6 V would prevent that. For
example, your MP3 player may put out over 2 V r.m.s., with a peak value
over 3 V. Also, your LEDs drop 1.6 to 2.8 V, depending on colour and
operating current, and they should be driven constant-current; not at
all easy from a 3 V supply that drops to 2.4 V maximum with partially-
discharged batteries.

This project seems to me to be particularly interesting, because you
could do it using either analogue or digital techniques, and you trade
circuit design time for software writing time, and learning to program,
in your case, I suppose.

In digital, the unhelpful advice 'use a PIC' is as far as I want to go,
because the clever bits are all in the software.

In analogue, you have a shift-register chip followed by LED drivers. The
shift register is advanced by your Channel B signals, which you will
need to rectify and condition to work the shift register. You need a
chip that can be counted 'up' and 'reset', probably, not 'up' and
'down', judging by your project description, which is praiseworthy;
grammatical and lucid.
 
T

Tim Wescott

John said:
I read in sci.electronics.design that BrianLunde



It's probably OK here; it's a bit more up-market than
sci.electronics.basics



Yes. 3 V is going to make things DIFFICULT. 6 V would prevent that. For
example, your MP3 player may put out over 2 V r.m.s., with a peak value
over 3 V. Also, your LEDs drop 1.6 to 2.8 V, depending on colour and
operating current, and they should be driven constant-current; not at
all easy from a 3 V supply that drops to 2.4 V maximum with partially-
discharged batteries.

This project seems to me to be particularly interesting, because you
could do it using either analogue or digital techniques, and you trade
circuit design time for software writing time, and learning to program,
in your case, I suppose.

In digital, the unhelpful advice 'use a PIC' is as far as I want to go,
because the clever bits are all in the software.

Or possibly "use a DSP", because if you want to decode the tone on-chip
a PIC may not have enough horsepower.
In analogue, you have a shift-register chip followed by LED drivers. The
shift register is advanced by your Channel B signals, which you will
need to rectify and condition to work the shift register. You need a
chip that can be counted 'up' and 'reset', probably, not 'up' and
'down', judging by your project description, which is praiseworthy;
grammatical and lucid.

This is a pretty ambitious project. You need to be able to tell the
difference between "tone" and "not a tone", you need to be able to keep
track of LED state, and you need to drive the LED's. It's certainly not
what I'd recommend to the beginner but if you have the courage then go
for it -- you've been warned.

Hopefully someone will come forth with some specific circuit bits that
will help you more than we've done so far...
 
S

Spehro Pefhany

This is a pretty ambitious project. You need to be able to tell the
difference between "tone" and "not a tone", you need to be able to keep
track of LED state, and you need to drive the LED's. It's certainly not
what I'd recommend to the beginner but if you have the courage then go
for it -- you've been warned.

Hopefully someone will come forth with some specific circuit bits that
will help you more than we've done so far...

The good old 567 tone decoder chip might help..

Best regards,
Spehro Pefhany
 
B

BrianLunde

Mr. Woodgate, Wescott, and Pefhany, thank you for your suggestions on
a circuit for advancing LEDs based on a tone as a trigger from an MP3
player.
prevent that. For example, your MP3 player may put out over 2 V
r.m.s., with a peak value over 3 V. Also, your LEDs drop 1.6 to 2.8 V,
depending on colour and
operating current, and they should be driven constant-current; not at
all easy from a 3 V supply that drops to 2.4 V maximum with partially-
discharged batteries.
**6 V is OK.
far as I want to go, because the clever bits are all in the software.
**I took a look at PIC and that is way over my head.
by LED drivers. The shift register is advanced by your Channel B
signals, which you will need to rectify and condition to work the
shift register. You need a
chip that can be counted 'up' and 'reset'
**Wow, that seems like a lot for a newbie. Isn't there a simpler way
to use the higher voltage of the tone to trigger an advance to the
next LED? Wouldn't a relay work?
**Can the 567 react to different frequencies? If so, I could assign a
seperate tone for each LED and that would eliminate the shift-register
chip and let me access the LEDs in any order I want! I could also hold
the tone for as long as I need the LED to be on.
circuit bits that will help you more than we've done so far...
**That would be great. Everything seems easy when you don't know what
you are doing. I can see I have a lot of studying ahead. If anyone can
point me to some simple circuits or information on these topics that
would be great. In the worst case, I can always make this very
analogue with my sister standing behind the display switching LEDs
like the Wizard of Oz. I would get an A+ as long as she didn't knock
the display over.
 
G

GPG

It occurred to me after I hit post, if you only need 4 outputs you can
use the HT9170 on its own, it latches the last input.
 
J

John Woodgate

I read in sci.electronics.design that BrianLunde
Mr. Woodgate, Wescott, and Pefhany, thank you for your suggestions on
a circuit for advancing LEDs based on a tone as a trigger from an MP3
player.

prevent that. For example, your MP3 player may put out over 2 V
r.m.s., with a peak value over 3 V. Also, your LEDs drop 1.6 to 2.8 V,
depending on colour and
operating current, and they should be driven constant-current; not at
all easy from a 3 V supply that drops to 2.4 V maximum with partially-
discharged batteries.
**6 V is OK.

far as I want to go, because the clever bits are all in the software.
**I took a look at PIC and that is way over my head.

by LED drivers. The shift register is advanced by your Channel B
signals, which you will need to rectify and condition to work the
shift register. You need a
chip that can be counted 'up' and 'reset'
**Wow, that seems like a lot for a newbie. Isn't there a simpler way
to use the higher voltage of the tone to trigger an advance to the
next LED? Wouldn't a relay work?

It's not a difficult as it looks. The shift register is a simple chip
and the 'conditioning' is just to rectify the Channel B signal with a
diode and capacitor and maybe follow with a simple one-transistor buffer
amplifier to give a logic-level signal to the shift register.
**Can the 567 react to different frequencies? If so, I could assign a
seperate tone for each LED and that would eliminate the shift-register
chip and let me access the LEDs in any order I want! I could also hold
the tone for as long as I need the LED to be on.

circuit bits that will help you more than we've done so far...
**That would be great. Everything seems easy when you don't know what
you are doing. I can see I have a lot of studying ahead. If anyone can
point me to some simple circuits or information on these topics that
would be great. In the worst case, I can always make this very
analogue with my sister standing behind the display switching LEDs
like the Wizard of Oz. I would get an A+ as long as she didn't knock
the display over.

It's always a good idea to find useful occupations for sisters, but they
often won't co-operate that the critical time. Electronics is more
reliable and you don't have to pay it with candy (or Gucci products
later in life!).(;-)
 
F

Fred Bloggs

BrianLunde said:
I am a newbie here, have read the threads, FAQ, and Posting Guide and
this looks like the right place for a circuit question. If this
request is out of line, could someone please suggest a better group?
Thanks!

I am in Jr. High and pretty new to electronics but can solder and read
basic circuits. Can someone point me in the right direction for a
circuit that will use an MP3 player channel with tones (or multitones)
to advance a sequence of LEDs? This is for a school project using a
cheap MP3 player with narration. As each new point is made on audio
track A, I hope to use a track B tone to trigger the next LED in a
sequence to highlight the matching text on a display. At the end of
the audio, the file will replay and the sequence will be something
like Audio Point1 = LED1, Audio Point2 = LED2, Audio Point3 = LED3 -
Audio Point1 = LED1, Audio Point2 = LED2, etc. I would like to keep
this to three volts D.C. or less (two AA batteries). Any suggestions?

This is a two-chip circuit- how many LEDs do you have, what color are
they, and what is the range of tones available, and with what frequency
separation, for that B-track?
 
T

Terry Pinnell

I am a newbie here, have read the threads, FAQ, and Posting Guide and
this looks like the right place for a circuit question. If this
request is out of line, could someone please suggest a better group?
Thanks!

I am in Jr. High and pretty new to electronics but can solder and read
basic circuits. Can someone point me in the right direction for a
circuit that will use an MP3 player channel with tones (or multitones)
to advance a sequence of LEDs? This is for a school project using a
cheap MP3 player with narration. As each new point is made on audio
track A, I hope to use a track B tone to trigger the next LED in a
sequence to highlight the matching text on a display. At the end of
the audio, the file will replay and the sequence will be something
like Audio Point1 = LED1, Audio Point2 = LED2, Audio Point3 = LED3 -
Audio Point1 = LED1, Audio Point2 = LED2, etc. I would like to keep
this to three volts D.C. or less (two AA batteries). Any suggestions?

I've suggested an approach at
http://www.terrypin.dial.pipex.com/Images/BrianLEDs.gif
(Also posted in alt.binaries.schematics.electronic)

However, your spec was incomplete so my circuit makes a variety of
assumptions.

Please clarify a few points so that we can possibly suggest a better
practical circuit:

1. How many 'audio points' N are there? Presumably N also = the number
of unique LEDs in your sequence? You said "As each new point is made
on audio track A, I hope to use a track B tone to trigger the next
LED." Your example used N=3, but I take it that really was just an
example, and not a spec? For N not greater than 9, a simplish 4017
circuit could be used for the sequencing; or two of them for N <= 19.

2. Is N fixed? IOW, are you designing for one specific narration tape
or to cope with *any* such tapes, allowing for a different number of
'points' on each?

3. Are the gaps between track B tones silent, and how long are these
gaps, at minimum? If so, you don't really need the complexity of a 567
tone-decoding circuit. Simply detecting the presence of significant AC
would be adequate.

4. What amplitude of audio tone do you propose? (BTW, like John W, I'd
suggest you forget about 3V. Why not use 9V from an NiMH PP3, which is
no larger than 2 x AAs?

5. Have you settled on *one* tone? Or, as your later post implied, do
you now want several? (I'd strongly recommend not.)

6. What frequency of tone do you propose?

7. Is the duration of the tone intended to correspond to the time
during which a single LED is lit? (If so, presumably that will also be
the time for that section of narration?)
 
B

BrianLunde

Thanks again Mr. Woodgate, GPG and Bloggs for the information on a
tone triggered advance of LEDs and sisters.

Mr. Bloggs to answer your questions,
**I would like red but if the voltage is too high I am open to any
color.
**It is 128Kb MP3 so we should be safe with 1kHz to 7kHz although this
could go to 10kHz if needed.
**If you mean the jump from tone to tone it could be 2kHz so the tones
would be 1kHz, 3kHz, 5kHz. If you mean a fourth tone to act as a
separator it could be 7kHz.
 
J

John Fields

I am a newbie here, have read the threads, FAQ, and Posting Guide and
this looks like the right place for a circuit question. If this
request is out of line, could someone please suggest a better group?
Thanks!

I am in Jr. High and pretty new to electronics but can solder and read
basic circuits. Can someone point me in the right direction for a
circuit that will use an MP3 player channel with tones (or multitones)
to advance a sequence of LEDs? This is for a school project using a
cheap MP3 player with narration. As each new point is made on audio
track A, I hope to use a track B tone to trigger the next LED in a
sequence to highlight the matching text on a display. At the end of
the audio, the file will replay and the sequence will be something
like Audio Point1 = LED1, Audio Point2 = LED2, Audio Point3 = LED3 -
Audio Point1 = LED1, Audio Point2 = LED2, etc. I would like to keep
this to three volts D.C. or less (two AA batteries). Any suggestions?

---
Sounds like fun, and thanks for a well thought out and well written
inquiry. :)

Here's how I'd do it:

At the beginning of track B I'd record a tone (say 1000Hz, it doesn't
matter much what frequency) at a level twice that of the other tones
recorded on track B, which would be the same frequency and duration as
tone 1. The reason for that is that detecting the higher voltage tone
will allow the rest of the circuitry to be reset, so that everything
will start up in a known state at the beginning of the program.

In order to detect the tones what I'd do would be to use a window
comparator set so that the first tone went through both thresholds,
but that the subsequent lower voltage tones only went through the
first threshold. A simple way to do that would be to rectify and
filter the tones and use the resultant DC "envelope" to do the
triggering. Viewed with a fixed pitch font, like this:


+3V
|
[1K8]
|
+----------+
| | +3V
[LM385-1.2] [9310R] |
| | U1A [4K7]
GND +---|--|-\ | _____
| | | >--+-+--->RESET
| +--|+/ |
DC<--+ | |
| +--[1M]----+
| | +3V
|[2000R] |
| | U1B [4K7]
AUDIO B>---[1µF]-+-[1N5817>]--+-----+-+---|--|-\ |
| | | | | >--+-+--->CLOCK
| | | +--|+/ |
| |+ | | |
[10K] [2.2µF][100K] +--[1M]----+
| | | | LM393
| | | [1000R]
| | | |
GND>-------------+------------+-----+-----+

With the values shown and AUDIO B = 1000 Hz coming from a 50 ohm
source, I get the following coming out of "DC" with no comparator in
the circuit:

AUDIO B DC
mVPP VDC
--------+-------
250 50
300 75
400 110
500 150
600 190
700 230
800 270
900 310
1000 350

So, with tone 1 being recorded at 1VPP and the rest of the tones
recorded at 500mVPP, we can expect an input to the comparators of
about 350mVDC for tone 1 and 150mVDC for the rest of the tones.

Now, if we look at our voltage divider R1,R2,R3, and decide that our
trigger points need to be at 100mV for tone 1 and at 300mV for all the
others, then we wind up with something like this:


+1.235V
|
[R1]
|
350mV +--->300mV
|
[R2]
|
150mV +--->100mV
|
[R3]
|
+--->0V
|
GND

Now, since we're putting about 1mA into the LM385, (with Vcc = 3V) if
we steal about 100µA from it to run the divider, R3 will need to drop
100mV at 100µA,
so we have:

R3 = 100mV/100µA = 1000 ohms

Likewise,

R2 = 200mV/100µA = 2000 ohms

and,

R1 = (1235mV - 300mV)/100µA = 9350 ohms.

9310 ohms is a standard 1% value, so if we use it instead of 9350, the
current through the divider will increase to 100.325µA and our divider
will look like this:


+1.235V
|
[9310R]
|
350mV +--->300.975mV
|
[2000R]
|
150mV +--->100.325mV
|
[1000R]
|
+--->0V
|
GND

Not too bad...




Now for the logic:

HC161 Vcc
+-------------+ |
| __| |
CLOCK>------|> PE|O--+
_____ |__ | |
RESET>------|MR CEP|---+
| | |
| CET|---+
| Q3 Q2 Q1 Q0 |
+-------------+
| | | |
| | | |
| | | |
| | | |
+-------------+
| A3 A2 A1 A0 |
| |
| Y15|O-----[<HLMP4700]---[510R]---Vcc
| Y14|O .
| Y13|O .
| Y12|O .
| Y11|O .
| Y10|O .
| Y9|O .
| Y8|O .
| Y7|O .
| Y6|O .
| Y5|O .
| Y4|O .
| Y3|O .
| Y2|O .
| Y1|O .
| Y0|O-----[<HLMP4700]---[510R]---Vcc
+-------------+
HC154

When the counter is reset by tone 1, Y0 will go low and the LED
corresponding to AUDIO POINT 1 will light. Thereafter, when the
following tones are detected the counter will be incremented once for
each tone detected and the LEDs will light in sequence. If you don't
want RESET to make the AUDIO POINT 1 light up, then just leave it out
and start with the LED on Y1. Then what will happen is that on RESET
everything will go blank, and the next time a tone is detected the Y1
LED will go on and start the sequence. With the HC154 you can have a
total of 16 LEDs, so you you can highlight 16 different events.

HC family logic is specified to work from 2V to 6V, so your two AA
cells ought to work OK, and the only things drawing any current are
the LEDs (but only one at a time),the reference, and the comparators
so that's a total of about 5mA. A typical alkaline AA is rated for
2450mAH, so at 3mA thats 2450mA/5mA = 490 hours, so the thing will run
non-stop for about 3 weeks before the battery voltage will decay to 2V
and the cells will need to be replaced. The comparators will also be
drawing current through their pullups, but only when the tones are
present, so that really won't affect anything much. The length of
time it takes for the detector filter cap to charge up is going to
depend primarily on what the output impedance of your player looks
like, but if you record the tones for 1 second that ought to be plenty
of time to drive the comparators past their thresholds. BTW, the
CLOCK output goes high and increments the counter when the tone dies,
not when it starts, so you may want to take that into consideration
when you're determining how long you want the tones to last.
 
J

John Fields

Now, if we look at our voltage divider R1,R2,R3, and decide that our
trigger points need to be at 100mV for tone 1 and at 300mV for all the
others, then we wind up with something like this:

Ooops... Should read: ... "300mV for tone 1 and 100mV for all the
others," ...
 
B

BrianLunde

Mr. Pinnell, all I can say is W--O--W! I was really worried about how
I was going to make this happen, but not any more!
**I am going to Radio Shack to pick up parts after school tomorrow and
work on this over the weekend. Thank you, thank you, thank you!!!!!!!!
simplish 4017 circuit could be used.
**There are only three audio points and N = the number of unigue LEDs.
Your circuit looks great!
tape or to cope with *any* such tapes, allowing for a different number
of 'points' on each?
** N is fixed for this project. However, it would be good to know how
to vary the circuit for four or five more points.
gaps, at minimum? If so, you don't really need the complexity of a 567
tone-decoding circuit. Simply detecting the presence of significant AC
would be adequate.
**I was going to hold each tone for the duration of the point at about
a minute each with a second of no tone between each point.
I'd suggest you forget about 3V. Why not use 9V from an NiMH PP3,
which is no larger than 2 x AAs?
**9V is fine.
do you now want several? (I'd strongly recommend not.)
**One tone is fine. I thought different frequency tones might be
easier to work with.
**I see you used 2kHz with good results so I will try the same. The
only problem might be that my MP3 tone will not be as pure as yours. I
assume it will work fine, but I may have to try other frequencies if
there is a problem.
7. Is the duration of the tone intended to correspond to the time
during which a single LED is lit? (If so, presumably that will also be
the time for that section of narration?)
**That is correct.

Could you tell me more about the type of diodes you have at D1 and D2?
Here is a list of available diodes from Radio Shack.
http://www.radioshack.com/category.asp?catalog_name=CTLG&category_name=CTLG_011_002_006_000&Page=1

Also here is the 4017 decade counter/divider they carry.
http://support.radioshack.com/support_supplies/doc31/31110.pdf

Thanks SO much!

Brian Lunde
 
J

JeffM

this looks like the right place for a circuit question.
I tend to think of this group as being
for a person who, despite having a strong understanding of electronics,
(think: pro) has gotten stuck on a design in progress
and is looking for someone to help unstick him.

sci.electronics.misc might have been a more apt group, but
(as you have seen) your courtesy and good descriptions of problems
can put folks here in a forgiving (and reflective) mood.

Can the 567 react to different frequencies?
I could also hold the tone for as long as I need the LED to be on.
BrianLunde
Speff's LM567 idea is a winner because of its simplicity.
Seeing that you have a track dedicated to tones,
and only 1 LED will be lit at a time, it seems a no-brainer
(no initialization/reset/toggle nonsense).

Its minimum detectable input spec of 25mVrms keeps things simple.
You will need 1 tone detector for each frequency.
(Select the values to tune each unit.)


The only downside to the 567 is the supply voltage;
with its 4.75V - 9.0V allowable range,
a 6V supply would be the way to go.
 
T

Terry Pinnell

[email protected] (BrianLunde) wrote:

Thanks for the follow-up. If you like, we can come back to any
outstanding points about possible enhancements when you have the basic
circuit working.
Could you tell me more about the type of diodes you have at D1 and D2?
Here is a list of available diodes from Radio Shack.
http://www.radioshack.com/category.asp?catalog_name=CTLG&category_name=CTLG_011_002_006_000&Page=1

The plain silicon switching diodes, cat # 276-1620, will be fine. I
woud expect virtually *any* diode (rectifier, Schottky,
silicon-switching, germanium) to work. When they were commonly
available, germanium diodes used to be popular for this sort of
purpose. The voltage drop across Ge is about 0.25 V versus 0.7 for Si,
so you can detect a lower level of AC.
Also here is the 4017 decade counter/divider they carry.
http://support.radioshack.com/support_supplies/doc31/31110.pdf

That's fine too. It's a handy chip, so I'd get a few if they're not
too pricey. As it's CMOS, take basic care with handling to avoid
static damage. I usually touch some metal instrument case before I
pick up CMOS ICs.

Don't worry about quality of the tone, or its frequency. As we're only
detecting its amplitude, these are of no significance. But I meant to
ask whether you were confident of getting that relatively high
amplitude tone, say 7V pk-pk? And can you measure it OK? A 'scope
would be nice, but a DMM set to its AC range should display around
2.5V RMS.
 
S

Seth Koster

I am in Jr. High and pretty new to electronics but can solder and read
basic circuits. Can someone point me in the right direction for a
circuit that will use an MP3 player channel with tones (or multitones)
to advance a sequence of LEDs? This is for a school project using a
cheap MP3 player with narration. As each new point is made on audio
track A, I hope to use a track B tone to trigger the next LED in a
sequence to highlight the matching text on a display.

Do you have a seperate output for the B audio? If not, the
narration could cause state change if it inadvertantly triggers the
logic. I don't know much about mp3 players, so I don't know the
outputs.

At the end of
the audio, the file will replay and the sequence will be something
like Audio Point1 = LED1, Audio Point2 = LED2, Audio Point3 = LED3 -
Audio Point1 = LED1, Audio Point2 = LED2, etc. I would like to keep
this to three volts D.C. or less (two AA batteries). Any suggestions?


If three leds are all you are using, and you only need to light
each one individually, you need four states. This, for me, would be
most easily done using a couple flip flops and some input and output
logic.
If you are into electronics much at all, and to even think of
trying this indicates you are, it would be a great opportunity to
teach yourself a bit about digital logic since this idea is just about
perfect as a beginning sequential logic problem, as well as a
beginning combinational logic problem. If you get a book on digital
logic (I cannot recommend a good one, but hopefully someone else can),
you will learn how to draw up your state diagram, figure out
conditions for state switching and how to minimize your logic.

Let:
L0 = no LEDs on
L1 = LED #1 on only
L2 = LED #2 on only
L3 = LED #3 on only
For a basic idea, imagine that you have four logical states, each
using two bits, state 00, state 01, state 10 and state 11, and each
state triggers some logic which turns on the appropriate LED. We're
using SR flip flops here (an SR latch (or flip flop, in this case) has
two inputs, SET and RESET, if you send a logic pulse to SET, the SR
outputs a 1, or approx 5V, and if you send a logic pulse to RESET the
SR outputs a 0, or approx 0V).
So:

00 = L0, 01 = L1, 10 = L2, 11 = L3.

If you reset flip flop 1 (Q1) and reset flip flop 2 (Q2) (this means
trigger both flop flops so they both output zeroes), you get state 00
If you reset Q1 and set Q2 you get state 01
If you set Q1 and reset Q2 you get 10
If you set both Q1 and Q2 you get state 11.

Your input logic would be something like:

(I'm using ' for NOT, so Q1' means Q1 = 0 and Q1 means Q1 = 1. Q1
is the output of flip flop Q1)
(B means that the B audio has sent an appropriate signal)

If Q1' AND Q2' AND B, then RESET Q1 and SET Q2 (IE set flip flop to
state 01)
If Q1' AND Q2 AND B, then SET Q1 and RESET Q2 (now we're in state
10)
If Q1 AND Q2' AND B, then SET Q1 and SET Q2 (here we are in state
11)
If Q1 AND Q2 AND B, then RESET Q1 and RESET Q2 (back to state 00,
all LEDs off)

So you'd need four 3 input AND gates to handle all of the input
logic, as well as a couple inverters to drive the Q1' and Q2' (keep
reading, it will be explained).
This will just keep rolling through the LEDs every time your B
audio triggers the logic gates. First L0, then L1, then L2, then L3,
then L0, etc... You can figure out logic to drive any combination of
LEDs as long as you remember to have one state for each different
output.

Your output logic would be something like this:

Q1' AND Q2' = L0 (do nothing)
Q1' AND Q2 = L1
Q1 AND Q2' = L2
Q1 AND Q2 = L3

You'll have three AND gates, each one driving an LED (remember to
put a resistor in series with each LED), and a couple inverters, the
first piece of logic (Q1' AND Q2' = L0) would be unimplemented since
you just need to make sure you don't turn on any LEDs for it.
Wiring the circuit:
When you see "Q1 AND Q2 = L3" you need three wires, one wire comes
from Q1 and goes to one input of the AND gate, one wire comes from Q2
and goes to the other input of the AND gate, and one wire comes from
the output of the AND gate and goes to L3 (through a resistor, though
you could use a common cathode resistor for all the LEDs, but thats
not important for this discussion). Where it says Q1', send the Q1
output first into an inverter (a NOT gate, it takes a 0 and outputs a
1, or takes a 1 and outputs a 0) and then send the inverted output to
the AND gates. The input logic uses the same ideas, using three
inputs on each AND gate. Do not just send two inputs to a three
input AND gate, the AND gate will not output a 1 unless ALL inputs are
1s (approx 5V). You do not need a seperate NOT gate for each AND
gate, so you really only need two of the NOT gates of the six you will
get on the chip. All of the Q1' inputs into the AND gates come from
the output of the NOT gate which has Q1 as its inputs, and all of the
Q2' inputs into the AND gates come from the NOT gate which has Q2 as
its input.

You might notice that the outputs of the flip flops not only drive
the LEDs, but also create much of your input logic. Using outputs to
influence inputs is virtually universal in sequential logic (logic
where you need to go from one state to another), and is a very handy
thing.
If you want to try this out, it would take five chips: Two 74LS11
three input AND gates at three gates per chip (two unused), one
74LS279 S-R latch chip with four S-R latches (you'll use two), one
74LS08 two input AND gate chip with four gates on the chip (one
unused), and one 74LS04 inverter chip (4 unused). Some input stuff
depending on what the B audio outputs, and for output some resistors
and LEDs (and the power supply, obviously). All the chips together
shouldn't cost more than a few dollars if you order from an average
mail order house.

Other very bright people have posted circuits, and I doubt I could
do better so I'll abstain. I assume the information given above
should be enough to let you design your own schematic anyway, with
maybe some reading. Doing so would not only be educational but
probably get you an A if you show the teacher why and how it works.
Certainly this is not the lowest chip count way to solve the problem,
but it is probably the most basic way when it comes to using digital
logic (unless you want to build up the SR latches using two additional
AND gates and four of the unused NOT gates, it wouldn't change chip
count unless you used the two unused three input AND gates with one
input on each tied high, but it might confuse the issues at hand so
I'll leave it unless someone asks how to do so). Any digital circuit
which handles this problem is going to use this same basic idea
(sequential logic and four states, driven by and driving combinational
logic), merely using more complex circuitry inside each chip to lower
parts count.

Both digital and analog circuitry are very important, most designs
use some of each, but many people not in a specific program of study
tend to concentrate on analog when they are getting started (at least
this was true when I started, today it might be different).

!Caution: Soapbox Alert!
In my opinion a major reason why manufacturing is so expensive in
the USA and various computer programs (dare I say OSes) are so buggy,
is that not enough time is spent on drawing up the state diagrams of
systems and applying some basic logic analysis. I've met many
programmers who have never really applied basic logic techniques to
their programs, either they never learned it or they were never fully
impressed with the importance of logic simplification for writing
tight code. Hey, I'm guilty too! I can't count the times I've
hacked a project together thinking "This is way too simple to mess
around.", but that thinking often leads to more complex logic using
more gates (or code) than necessary and increasing the overall cost,
not only in terms of component costs, but also in manufacturing and in
debug time and costs. This doesn't just mean a cellphone costs a bit
more, it also means people could lose their jobs if another company
makes the device cheaper. Yes, a state diagram for a large program
can be very intensive, but this is all the more reason to be sure
everything is going to work as smoothly as possible, with the tightest
possible code. Anyway, FWIW, thats my opinion, subject to change and
with no warantee of any value.
!Soapbox Alert Over!

I'd recommend spending some time on digital and learning about
basic switching logic and the related math. It's not that hard if
you have an application to apply it to, and as you go you'll learn
about boolean algebra, Karnaugh mapping, Demorgan's theorems and
combinational and sequential logic. This may sound difficult, but
its not really, and it all applies (I don't like doing math if I am
not applying it to something in the real world). Once you learn it
and use it a while, figuring out how to do this idea or any other
using various states will become second nature.
An added benefit is that if you ever decide to program computers,
at any level, knowing how to simplify logic and draw a state diagram
will make you much better at it!
Above all, have fun!
 
B

BrianLunde

Mr. Fields and Koster, thanks for your suggestions. I am just starting
out but the general support here has gotten me excited enough to take
this beyond my school project. Since this project is due June 3rd, I
am going to try Mr. Pinnell's circuit and then take the summer to
study enough to work with everyone else's suggestions. I have a Radio
Shack LCD Autoranging Pocket Multimeter and a 15/30W soldering iron.
Radio Shack seems to be cutting way back on components but I did find
a supplier in Binghamton New York for the 4017 Decade Counter Divider
and capacitors called Unicorn Electronics at
http://www.unicornelex.com. If anyone knows of a good electronics
store in New York City, that would be a help. Also a good introduction
to electronics and circuits without all the math would be good. I
won't be getting into more advanced math until high school so maybe an
Electronics for Dummies type book.

Now for a few comments on this newsgroup. I am amazed at how giving
everyone has been here. This is a great place and I hope that in a few
years, I have learned enough to return and give back to the people who
helped me so much. In the meantime, I will take Mr. JeffM up on trying
sci.electronics.misc while I lurk here to learn from the pros. Mr.
Woodgate, Westcott, Pefhany, JeffM, GPG, Bloggs, Pinnell, Fields and
Koster - thanks for taking so much of your time to help me. You are
all my superheros, sort of the Incredible Hulks of Electronics!
 
S

Seth Koster

You might look at mail order houses, given your age I'm sure money is
an issue and mail order can be considerably cheaper if you're buying
enough to offset the shipping. Jameco is pretty good, and you get a
break on price on packs of 10 whereas Mouser often makes you buy a
hundred of a certain item to get a break. Check out the Mouser and
Digi-Key catalogs if you need a great selection. I know some
catalogs have no minimum order, but I dont know which ones. Radio
Shack can break your bank if you need many parts. An mpf102 (common
FET transistor) at Mouser is 12 cents ( 8 cents if you buy 25), at
Radio Shack 99 cents.
The math you'll need to learn about passive components is pretty
simple, I'm sure given your excitement, attitude and intelligence
you'll have no problems. Reading and studying is fine, but keep
playing with circuits, this should be fun. I dont think I'm quite in
the league of others you mentioned, but thanks for the compliment!
It is refreshing to see that some of today's youth know how to be
gracious, you'll go far with that attitude.
 
Top