how to adjust the volume of an amplifier?

Hello! :slight_smile:

I need some help here. What I want to do is to control the volume of an audio channel through Arduino(using the PWM) for an art installation.
What I thought of doing is hack the RCA cable which sends the signal from the mp3 player to the amplifier, and with a transistor or MOSFET, adjust the volume (by adjusting the voltage with PWM)
Tried it but didnt work, only made a buzzing noise along with the music.
(I also thought of using a digital potentiometer instead of a MOSFET but I read that it s not possible to use PWM with it)

My other idea was to hack in a similar way the potentiometer(volume control) of the amplifier, but again I am not sure if it will work and possibly I will also ruin the machine...

Forgive me if the above is a naive way of thinking, since I am new to electronics and manipulating audio...

Any ideas or suggestions?? :confused:

You could connect a servo to the volume pot of the amplifier and use Arduino to control the servo.

Hi lean_art!
It does not work like this because it's the "analog world". You may need a digital potentiometer like the MCP42010. You can adjust the resistance (and the volume) via SPI with your Arduino.

Or use something like the PGA2311 which is specifically designed to control volume. Easy to control with an arduino.

Ian.

Hello guys!

Thanks for your replies, that 's the information I was looking for for now, I 'll look up the things you mentioned and inform you of the progress!!

Why not use an MP3 module that supports volume control?

I think this manual is for the 1st card here, send it 0xE8 and 0xE9 to change the volume.

AU5120.pdf (144 KB)

Here's another manual

MP3 Module.pdf (83.1 KB)

And a sketch I've been working on to accept button presses from a keypad, display on 7-segment displays, and send to the MP3 module. Trim it up, or just copy the parts you need.

songPlayer.ino (15.3 KB)

Buzzing? You may not have filtered the PWM enough. How are you ensuring that the MOSFET is within the linear ohmic region over the volume range of interest? The signal must also be small enough not to forward bias the internal parasitic diode in the MOSFET.

A bipolar transistor won't work because it is highly nonlinear and monodirectional.

You may also be coupling digital noise from the Arduino.

I favor using PWM well smoothed, driving a yellow or green LED via an Op Amp, which then shines onto a photocell. No wired connection between the two, to keep it well isolated. I just sand the end of an LED flat and epoxy it onto a photocell, then paint it all black and put black heatshrink over it.

The photocell then makes a volume control with another resistor as a voltage divider. I've used this successfully many times. I'm not the only one. It also works with an incandescent bulb, in which case you can drive it with PWM via an NPN transistor without any smoothing. The filament can't cool enough to cause any problems at the Arduino's 490Hz PWM frequency.