Basic Stamp Speaker Circuit
eiplanner
Posts: 112
Hey All,
I am a newbie to electronics in general. I have just completed the "What is a Microcontroller" text and all exercises therein.
I am looking to program my basic stamp to read sheet music note by note and play the chords on an 8 ohm .5 watt speaker.
I have spent more than 10 hours online for 2 days trying to find the circuit diagrams to accomplish this. I found the sheet music conversion program that Parallax recently wrote, but this is output to a piezo speaker. I want to do it on my normal speaker. I am pretty sure it is not the same circuit as the one for the piezo and I do not want to damage my stamp by just connecting it and giving it a try.
Can someone point me to an exact schematic that shows all the connections, devices and their values, from my BS2 Homework Board to my 8 ohm speaker.
Thank you for tolerating me and my novice/newbie status. I really am enjoying my new toys and the world of possibilities.
P.S. I forgot to state that I want to build the entire circuit from scratch myself on my homework board and am not looking for any other controllers that accomplish this for me........Thank You
I am a newbie to electronics in general. I have just completed the "What is a Microcontroller" text and all exercises therein.
I am looking to program my basic stamp to read sheet music note by note and play the chords on an 8 ohm .5 watt speaker.
I have spent more than 10 hours online for 2 days trying to find the circuit diagrams to accomplish this. I found the sheet music conversion program that Parallax recently wrote, but this is output to a piezo speaker. I want to do it on my normal speaker. I am pretty sure it is not the same circuit as the one for the piezo and I do not want to damage my stamp by just connecting it and giving it a try.
Can someone point me to an exact schematic that shows all the connections, devices and their values, from my BS2 Homework Board to my 8 ohm speaker.
Thank you for tolerating me and my novice/newbie status. I really am enjoying my new toys and the world of possibilities.
P.S. I forgot to state that I want to build the entire circuit from scratch myself on my homework board and am not looking for any other controllers that accomplish this for me........Thank You
Comments
I would recommend using some kind of external amplifier. One of the Nuts and Volts Columns (#67) gives a simple circuit using the LM386 which is available from RadioShack along with the other parts needed. I think the whole thing should fit easily on the Homework Board.
www.parallax.com/Portals/0/Downloads/docs/cols/nv/vol2/col/nv67.pdf
" border="0">
Thanks for the info and I'll post the outcome ASAP
I have the below pictured Audio Amp Driver circuit currently configured on my homework board using pin 0 for my input to the driver.
I also have the LM324 OpAmp IC on my board. I seem to be misplacing the inputs and outputs on the Amp because my sound never changes with the amp connected from when it is disconnected. It is a quad amp with the configuration in the other picture below.
I am such an extreme novice that I need someone to tell me step by step wire by wire, where to connect these inputs and outputs on the amp as well as where my two speaker wires connect to this circuit.
You can make an amp with one (non-inverting amplifier), but it won't work too well with a low-ohm speaker.
Get the LM386.
·
I will be getting the LM386 tomorrow.
-Phil
Crikey!
There are various types of the·LM386, 300-700 mW depending.· Wow,·it's throw-weight major big-time.
Post Edit --
The nominal output powers: N-1 = 325mW, N-3 = 700mW, N-4 = 1000mW (rare)
Post Edited (PJ Allen) : 12/14/2009 1:15:07 PM GMT
Your simple circuit worked for me. Thank you. At least I have an audible sound now that I can use to work on my program.
However, it's a very raw sound that I will later get the proper components to clean it up. At least I am up and running.
This link : http://sci-toys.com/scitoys/scitoys/computers/solderless/ic_amplifier/ic_amplifier.html
that was provided by eod_punk earlier in this thread shows a pretty clear step by step how to for a 1 watt amplifier using the LM386.
I will probably build that model for my final setup unless anyone knows of a problem or a safety issue with it.
Thanks to all for the assistance!
It does significantly amplify the sounds out of the speaker, but when my basic stamp program ends, my speaker continuously
spills out noise. Can someone help me eliminate the noise on this circuit or do I have to build a different one?
hangHere: GOTO hangHere
What happens is that the Stamp drops into a low power mode on an END or STOP statement where it goes to sleep for a while and wakes up periodically. When it goes to sleep, the I/O pin you're using (all of them actually) are put briefly into input mode, then re-initialized to whatever mode they were in. I think the constant switching of the I/O pin is causing the noise. One other thing to try is to put the speaker's I/O pin explicitly into input mode before the STOP or END statement. If you're using pin #5, do:
INPUT 5
END
Post Edited (Prettybird) : 12/29/2009 4:52:26 AM GMT
Neither worked. There is a brief (1/2 sec) period when the program gets to the INPUT or the GOTO statement that is totally quiet and then the noise comes back. It's as if the program is forcing an end on it's own.
' SchoolDays.bs2
' Play the 1907 hit "School Days" by Will Cobb and Gus Edwards with the
' piezospeaker.
' {$STAMP BS2}
' {$PBASIC 2.5}
Notes DATA "D", "F", "C", "F", "b", "A", "b", "C", "b", "A", "R", "A",
"e", "G", "A", "e", "G", "A", "R", "A", "A", "G", "D", "F",
"G", "D", "F", "G", "R", "G", "G", "Q"
Octaves DATA 7, 6, 7, 6, 6, 6, 6, 7, 6, 6, 6, 6,
7, 6, 6, 7, 6, 6, 6, 6, 6, 6, 7, 6,
6, 7, 6, 6, 6, 6, 6
Durations DATA 2, 2, 2, 2, 2, 4, 2, 4, 2, 2, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 2, 4, 4, 4,
4, 4, 4, 4, 4, 4, 2
Dots DATA 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1
index VAR Byte
offset VAR Nib
noteLetter VAR Byte
noteFreq VAR Word
noteDuration VAR Word
noteOctave VAR Nib
noteDot VAR Bit
DO UNTIL noteLetter = "Q"
READ Notes + index, noteLetter
LOOKDOWN noteLetter, [noparse][[/noparse] "C", "d", "D", "e", "E",
"F", "g", "G", "a", "A",
"b", "B", "R", "Q" ], offset
LOOKUP offset, [noparse][[/noparse] 3186, 3435, 3699, 3978, 4274,
4588, 4920, 5272, 5645, 6040,
6459, 6902, 0, 0 ], noteFreq
READ Octaves + index, noteOctave
noteOctave = 8 - noteOctave
noteFreq = noteFreq / (DCD noteOctave)
READ Durations + index, noteDuration
noteDuration = 1000 / noteDuration
READ Dots + index, noteDot
IF noteDot = 1 THEN noteDuration = noteDuration * 3 / 2
FREQOUT 0, noteDuration, noteFreq
index = index + 1
LOOP
hanghere: GOTO hanghere
END
In an ideal world, such an analog circuit would be designed to be as noise free as possible, but that's an ideal
And of course, noise de-coupling caps (sometimes several of them) on the amp circuit, as close as possible to the amp, can reduce unwanted noise a great deal.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
and I just keep getting the static noise. It's not a real faint noise, it's a fairly loud one. The circuit (pictured earlier on this thread) came from the manufacturer's data
sheet. It's a circuit that produces a 200 gain. Do you all think the noise is specific to the high gain or am I still going to get it if I lower the circuit to a 50 gain?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
In the circuit below, to the left of the amp, you see the 10uf series cap -- this filters DC, as does the 220 on the final output wire to the speaker. The exact values of the series caps may depend on your particular setup or the amp itself.
To the left of the 10k volume control and series cap, is the low pass filter that's good for a micro.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
Post Edited (Zoot) : 12/29/2009 6:32:49 AM GMT
I feel like I should be able to have the higher gain without the noise.
Mabe throwing a 10 mfd cap or higher across the chip power leads. I found it noisy too at first.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php