Pages: [1]   Go Down
Author Topic: Connecting an 8 ohm speaker to Arduino  (Read 5916 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm a complete beginner to electronics, and recently bought a Make kit from MakerShed.  I got through the lessons in "Getting Started with Arduino" book, but then broke out on my own by trying a simple sketch I found on Arduino.cc (see full link below).
The problem is I didn't know how to use extra wiring to connect these super small red and black wires that come with the 8 ohm speaker to the Arduino Uno.  The wires are very small.  So I stuck them in directly to the Arduino Board in Pin 8 (red) and Grd (black), and the program played the melody as stated after I compiled and uploaded it to the board. So far so good?

The program is at http://arduino.cc/en/Tutorial/tone

While it did play the melody, I didn't use the resistor, and didn't know how to connect connecting wires to the small wires instead just painstakingly put the teeny tiny wires of the Speaker into the 8 pin and grd.  It was a super pain in the a--.  Is there better/correct way to connect the wires to play the melody?

After the above "success" in that at least the program ran, I tried improving the connection and so tried tying a couple of jumper cables around the super small red and black wires, but in the process broke the speaker wires off of the speaker, and so after I buy a new 8 ohm speaker, can someone tell me how to correctly deal with the connection from Speaker to Arduino and what kind of connecting cables I need, and how to connect these teeny tiny red and black wires?

Thanks for your help,

Confused smiley-roll
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 627
Posts: 34230
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If you connected the speaker directly to the arduino like you said you have damaged your arduino pin by pulling too much current from it. It might still work for now but it is damages.
You need at least a 120R resistor in line with the speaker for direct connection. Ofcourse it will not be as loud but then you are not rapeing your output pin.
For best results you need to use a transistor and capacitor to connect your speaker. Google for lots of schematics.
Logged

UK
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4153
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

To drive an 8Ω speaker you really need a power amplifier.

The simplest form is a transistor with base bias resistors and a capacitor to decouple the DC offset of the Arduino's signal.

Logged

Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

British Columbia, CA
Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Digital components with low current capability shouldn't be directly driving reactive loads unless very high series resistances are present.  Even through a 120 ohm resistor, the kickback can develop a very high voltage across an output pin, and it's of the wrong polarity.  It causes a current to flow between the substrate and n-doped well in any PMOS devices present on the chip (if any, I haven't seen atmel's schematic for it's mega series).  This can crash the processor, cause memory errors, and may even damage the chip.

Use diode protection, and a drive transistor if you can.
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I would strongly recommend you get some lm328 chips if you are interested in speaker and audio projects, it a low cost amplifier on a chip. If you search around youtube you will find, ipod amplifiers, guitar amplifier etc etc all built using this great little chip.

I have one on an Audino Arduino based synthesisor, I simply copied the minimal circuit from the lm328 datasheet and use it to drive a pc speaker from the Arduino, its a great chip so but three or four.

You could also get some lm3916 chips and add a vu meter to your projects. they are both incredibly simple chips to use.

Duane B

rcarduino.blogspot.com
Logged


United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6619
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

First try the 120 ohm resistor as Mike suggested, see (a) in the image. If that isn't loud enough, try the simple amplifier shown in (b). If that's too loud, connect a resistor in series with the speaker.


* Scan 90.JPG (70.73 KB, 1654x1166 - viewed 554 times.)
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Offline Offline
Faraday Member
**
Karma: 65
Posts: 2529
Now, More Than Ever
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you're in the USA, RadioShack still has available an "audio output transformer".
http://www.radioshack.com/product/index.jsp?productId=2103254
You still need a transistor, wire the primary/high-impedance side (its leads) as the load in Common Emitter circuit and connect the low impedance leads to your 8Ω speaker.
I think it does a pretty good job that way.

They do have fine, stranded leads which aren't directly compatible with the breadboard.  Perhaps you can do some spot soldering to make some solid wire transitions or make some strip'em-and-twist'em pig-tails, as necessary.

I could make a case for direct Arduino output to it, too (adding a smallish resistor in series with the primary) - and probably the old flyback diode (because it's a coil still.)
Logged

"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

Pages: [1]   Go Up
Jump to: