Hi all.
I have a setup where I have connected a 5v mp3 module to a 3W speaker. I have been 'sampling' the signal with my arduino so that i can adjust the brightness of an LED using PWM in response to the amplitude of the signal.
This all works fine until I change the volume which not surprisingly, messes up the sensitivity setting i have created.
So my question is, could anyone recommend a way of keeping the power output constant for my sampling channel but allowing the volume to be changed on another channel?
One option would be to put a potentiometer in between the output and the speaker but this would be very inefficient i believe.
Could anyone suggest a better way?
Many thanks,
Danny
Put the pot between the output and input of the amplifier. Tap off your Arduino signal across the pot, and the amplifier input to the wiper of the pot. Use the Pot to change the volume.
Otherwise look at a VOGAD amplifier.
Put the pot between the output and input of the amplifier
The mp3 module is self contained, its input comes from an sd card.
Tap off your Arduino signal across the pot, and the amplifier input to the wiper of the pot. Use the Pot to change the volume.
Im afraid i dont understand what you mean here.
Otherwise look at a VOGAD amplifier.
I'll chem 'em out.
Could i put the audio out into the positive pin of the pot and the pot output to the speaker(third pin to ground)? i have tried this with a single channel through a 10k pot and the volume dropped way too quickly, only a fraction of a turn...
I'm assuming you only have easy access to the output of the amplifier. You could add a second amplifier that controls your volume and tie into the signal coming out of the first amplifier before it goes into the second and just never change the volume/amplitude of the first stage.
I don't really see what you're trying to accomplish with the potentiometer. I'm also assuming that your "sensitivity" is based on the amplitude of the signal. Putting a pot in there doesn't change that fact that the signal amplitude still fluctuates with volume changes.
Could i put the audio out into the positive pin of the pot and the pot output to the speaker(third pin to ground)?
By positive pin do you mean one end, with the other end ground and the wiper direct to the speaker?
If so no.
By all means you can do it but their are two dangers.:-
-
You can burn out the pot when the wiper is close to the end, because all the power is being dissipated across an increasingly smaller section of track. As a rule of thumb you need about 10 times the current down a pot as the load you are taking out. So for an 8 ohm speaker your pot needs to be less than an 1 ohm, which is silly as most of the power is lost in the pot.
-
As you have found out because of the nature of the impedancies involved, a low load and a high pot, it will very quickly reduce the volume to zero. That is without considering the pot's law, which should be logarithmic for audio work and not linear as normally used with an Arduino.
The mp3 module is self contained, its input comes from an sd card.
I was talking about the output from the mp3 module being fed into an external amplifier. You control the volume by controlling the signal into that amplifier with a pot. The amplifier's input being high impedance, it will not load the pot like example 1)
gonadgranny:
This all works fine until I change the volume which not surprisingly, messes up the sensitivity setting i have created.
Maybe your Arduino program could keep track of the loudest signal and re-adjust itself in proportion to that when you change the volume?
...R
I'm assuming you only have easy access to the output of the amplifier. You could add a second amplifier that controls your volume and tie into the signal coming out of the first amplifier before it goes into the second and just never change the volume/amplitude of the first stage.
I thought of this approach and bought a PAM8403 amplifer chip. problem is the interference is insane. Im not sure if ive hooked it up incorectly or something but it picks up everything. it even picks up the pulse of my arduino sending serial data when its separated from the circuit so it must be receiving radio waves!
So yes im not sure what going on here, more fiddling required...
I don't really see what you're trying to accomplish with the potentiometer.
the potentiometer is just a way of changing the volume with your hands.
I was talking about the output from the mp3 module being fed into an external amplifier. You control the volume by controlling the signal into that amplifier with a pot. The amplifier's input being high impedance, it will not load the pot like example 1)
so it seems that this is a popular approach if i can get the amplifier to work.
question: what i really want is to have the first amplifier on full so i have a strong signal to sample and then a way of reducing the current...a potentiometer it seems is not an option. would something like a buck converter be a silly idea? i know that they operate by switching very quickly so i can see how this might affect the signal.
Maybe your Arduino program could keep track of the loudest signal and re-adjust itself in proportion to that when you change the volume?
This was my initial idea. The main problem with this is that at low volume it becomes (in my experience) too difficult to detect the sound above the static. really i want to sample the output at a high level so the difference between silent and non silent is relatively large and then reduce the output to the speaker.
Just incase anyone is interested i have solved the problem of interference by purchasing another amplifier unit with a capacitor on it and it works flawlessly in amplifying the headphone output on my mp3 module. so yes, now i can sample the output from the mp3 module with the arduino to modulate my led's and feed the un-amplified audio into my amplifier module and change the volume without affecting the reactivity.
Maybe your Arduino program could keep track of the loudest signal and re-adjust itself in proportion to that when you change the volume?
That's basically what I do with my lighting effects.
I save a the (peak) loudness once per second into a 20-second (20-element) [u]moving-average array[/u].
Then depending on the effect, I'll use the average* from the array, or the peak from the array as my reference. For example, my simplest effect turns the light on whenever the signal is below average and off whenever it's below average. My "VU Meter" effect** uses the peak to as a reference for the "top" of the meter.
I use a [u]peak detector circuit[/u], which isn't strictly necessary but it allows me to sample the loudness at about 10 times per second, rather than sampling the audio waveform thousands of times per second.
The peak detector also allows me to use another auto-calibration "trick". When the signal is low, my software automatically switches to the 1.1V reference (and it re-calculates the moving-average array as necessary). ...You can't do that with the ADC input biased to 2.5V for normal AC audio.
- It's not really an average, it's an average of peaks. And if you do use a true-average, make sure to use an average of absolute values (or an average of positive values, or calculate the RMS) because the true-average of an AC audio signal is zero (or if it's biased at 2.5V the average will always be 512 on the ADC).
** Since it's always re-calibrating itself to the loudness and not calibrated to any fixed-standard, it's not really useful as a meter, but it makes a nice meter effect.
I use a peak detector circuit, which isn't strictly necessary but it allows me to sample the loudness at about 10 times per second, rather than sampling the audio waveform thousands of times per second.
I'll have to look into this. I used a simple rc circuit for the same reason and this seemed to work fairly well.
The idea of automatically recalibrating is a very interesting idea. The main problem i faced was that at very low volume the signal was too weak to reliably use to pull data from.