Author Topic: Overloaded output? Arduino mega (Atmel)  (Read 3235 times)

0 Members and 1 Guest are viewing this topic.

Offline superUnknown

  • Regular Contributor
  • *
  • Posts: 66
Overloaded output? Arduino mega (Atmel)
« on: July 29, 2013, 01:17:09 pm »
I've been hooking up a speaker thru a pot and directly to PWM pins on an Arduino. I've noticed that it's loud for a few seconds and then is rather faint thereafter. There's still output, just less volume. When I try a new pin, same thing...
I've hooked it up according to the book "Arduino Cookbook" What gives? Have I fried the pins permanently? What is happening on a MCU level?
 

Offline c4757p

  • Super Contributor
  • ***
  • Posts: 7805
  • Country: us
  • adieu
Re: Overloaded output? Arduino mega (Atmel)
« Reply #1 on: July 29, 2013, 01:55:25 pm »
1) Probably. 2) What kind of speaker?
No longer active here - try the IRC channel if you just can't be without me :)
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 7683
  • Country: nz
Re: Overloaded output? Arduino mega (Atmel)
« Reply #2 on: July 29, 2013, 02:14:52 pm »
Connect to the i/o through a 200R resistor, that will stop the speaker from drawing too much current.

Another thing to investigate is backemf being generated by switching the inductor (speaker).
Maybe you're getting some high voltage ringing which is damaging things.
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline superUnknown

  • Regular Contributor
  • *
  • Posts: 66
Re: Overloaded output? Arduino mega (Atmel)
« Reply #3 on: July 30, 2013, 12:59:08 am »
Datasheets   2403-260-00001
Product Photos   2403 260 00001
Standard Package   2,688
Category   Audio Products
Family   Speakers
Series   -
Type   Magnetic
Frequency Range   300Hz ~ 20kHz
Impedance   8 Ohm
Sound Pressure Level   73dB
Power - Rated   0.5W
Power - Max   1W
Height   3.61mm
Size / Dimension   15.00mm L x 11.00mm W
Shape   Rectangular
 

Offline c4757p

  • Super Contributor
  • ***
  • Posts: 7805
  • Country: us
  • adieu
Re: Overloaded output? Arduino mega (Atmel)
« Reply #4 on: July 30, 2013, 01:14:17 am »
Ohm's law. 5V across 8 ohms is 5/8 = 625 mA. Average current if you're PWMing could hover around 300mA, more likely about 100mA. Absolute maximum, as in "never ever ever draw this much", per pin on most ATmegas is 40mA. Yes, you're overloading the everliving shit out of the chip.

Either connect it through a 200R resistor as Psi suggested, or use a small audio output transformer as was often done in the past when driving a low-impedance speaker from a low-current, relatively high-voltage (from the speaker's point of view) circuit.

Even better, use a cheap audio amplifier chip like LM386.

My guess is that the "Arduino Cookbook" is intending that you use a high-impedance speaker. My suggestion is to replace it with a dinner cookbook.
« Last Edit: July 30, 2013, 01:19:48 am by c4757p »
No longer active here - try the IRC channel if you just can't be without me :)
 

Offline xrunner

  • Super Contributor
  • ***
  • Posts: 4866
  • Country: us
  • hp>Agilent>Keysight>?
Re: Overloaded output? Arduino mega (Atmel)
« Reply #5 on: July 30, 2013, 01:18:36 am »
Ohm's law. 5V across 8 ohms is 5/8 = 625 mA. Average current if you're PWMing could hover around 300mA, more likely about 100mA. Absolute maximum, as in "never ever ever draw this much", per pin on most ATmegas is 40mA. Yes, you're overloading the everliving shit out of the chip.

Yep - beat me to it. Use a transistor driver is another idea.
I am a Test Equipment Addict (TEA) - by virtue of this forum signature, I have now faced my addiction
 

Offline amyk

  • Super Contributor
  • ***
  • Posts: 6865
Re: Overloaded output? Arduino mega (Atmel)
« Reply #6 on: July 30, 2013, 07:34:00 am »
I've been hooking up a speaker thru a pot and directly to PWM pins on an Arduino. I've noticed that it's loud for a few seconds and then is rather faint thereafter. There's still output, just less volume. When I try a new pin, same thing...
You've fried the output driver transistors. Taking a look at some die photos is a good idea to familiarise yourself with how very tiny they are; they're the structures next to the bond wires, which are themselves thinner than a hair. They can not source or sink much current at all.
 

Offline superUnknown

  • Regular Contributor
  • *
  • Posts: 66
Re: Overloaded output? Arduino mega (Atmel)
« Reply #7 on: August 14, 2013, 11:26:40 pm »
Cool! Thanks all!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf