Hello,
I am working on a project that involves wiring a 5V speaker to my Arduino. When I connect the speaker directly to the Arduino's 5V pin, the speaker turns on normally. However, when I try to attach it to an I/O pin, the speaker starts up for about a second and then immediately turns off and starts up again repeatedly. Does this have something to do with the current draw from the I/O pins? Would a transistor help to solve this issue?
Thanks!
There is no such thing as a 5volt speaker.
Do you mean a 5volt buzzer?
Or an audio amplifier that needs to be powered from 5volt?
Post a link to that "speaker".
Leo..
This is the speaker I am using: https://www.ebay.com/itm/182708999120
I have deconstructed it so I have access to the electronics inside. When I connect it to the 5V and ground pins on the Arduino is powers on as normal.
What is the supply current rating?
I would connect the input of your amplifier to the Arduino pin through a seriese 0.1uF capacitor. If you still get trouble then connect the end of the capacitor that used to go to the input to one end of a 10k resistor with the other end of the resistor to the amplifier’s input. At the same time connect an other resistor, this time 1K from the input to ground. Make sure their is a common connection between your amplifier and the Arduino.
I don't think OP has easy access to the sound input of the amplifier. I see a 3.5mm socket.
This is a BT and FM device, and I think OP is trying to power it from an Arduino pin.
Not possible ofcouse, because a 3watt amp (most likely class-D) could be drawing >500mA.
OP, what exactly are you trying to do with the Arduino.
Just power this speaker on/off, or use it as an amplifier to hear tones generated with the Arduino.
Leo..
Originally I was hoping to replace Arduino Bluetooth with the speakers own built in Bluetooth to control the speaker and play music but I realized that the HC-05 doesn't support audio transfer, only serial transfer, so right now all I want is to be able to power on and off the speaker from my phone using the Arduino.
This link (ElectricRCAircraftGuy.com--RC, Arduino, Programming, & Electronics: Arduino Power, Current, and Voltage Limitations) says the 5V pin on the Arduino has an output current limit of 500mA~1A and that the I/O pin has an output current limit of 40mA. If it is as you say, that the amp is drawing >500mA of current, that would explain why is works using the 5V pin and it does not work using the I/O pin. I'm pretty new to electronics, would using a transistor fix this issue?
Thanks for all the help so far by the way!
This page, first diagram, shows how to use a mosfet as a low-side switch (switch to ground).
"load" is the speaker. The diode is not needed here, and + of the speaker can connect directly to 5volt.
That page you linked to is missing an important piece of information.
Max current draw on an external supply (7-12volt) depends on input voltage.
An Uno tops at ~500mA with 7volt on the DC socket, and that drops to ~100mA with 12volt on the DC socket, because of power dissipation (heat) in the regulator.
A Nano can't supply any current from the 5volt pin with 12volt on RAW.
List the exact hardware you have if you want proper advice.
Leo..