Automatic Volume Adjuster for LOUD MOVIE MUSIC
Intro: Automatic Volume Adjuster for LOUD MOVIE MUSIC
In this project I will solve one of the biggest problems I have with modern movies. The problem is that the conversation volume is way too low in comparison to the music volume. That is why I combined an Arduino microcontroller with a microphone and an IR LED in order to create an automatic volume adjuster. It basically detects when loud movie music starts playing, lowers the volume and then brings the volume back up when the music is over. Let's get started!
STEP 1: Watch the Video!
STEP 2: Order Your Components!
Here you can find a parts list with example seller (affiliate links):
LiPo Battery: https://s.click.aliexpress.com/e/_ASwccg
Charge/Protect board: https://s.click.aliexpress.com/e/_d7ZzZsT
Switch: https://s.click.aliexpress.com/e/_9AUg2y
3.3V regulator: https://s.click.aliexpress.com/e/_AAYr2o
Capacitors: https://s.click.aliexpress.com/e/_dU4FEsB
Resistors: https://s.click.aliexpress.com/e/_dTPpXjt
Electret Mic: https://s.click.aliexpress.com/e/_AP8fDA
OpAmp: https://s.click.aliexpress.com/e/_dTvJRGw
Potentiometer: https://s.click.aliexpress.com/e/_A7tN0k
Arduino Pro Mini: https://s.click.aliexpress.com/e/_AmcdA0
IR LED: https://s.click.aliexpress.com/e/_AMJj6s
STEP 3: Build the Circuit!
Here you can find the schematic of the project along with pictures of my finished board. Use them as a reference when building your own.
STEP 4: Upload the Code to the Arduino!
Here you can find the code for the Arduino. Upload it with an FTDI breakout board. Make sure to use the 3.3V 8MHz setting.
You also need to download this library:
STEP 5: Success!
You did it! You just created your own Automatic Volume Adjuster for LOUD MOVIE MUSIC!
Feel free to check out my YouTube channel for more awesome projects:
http://www.youtube.com/user/greatscottlab
You can also follow me on Facebook and Twitter for news about upcoming projects and behind the scenes information:
35 Comments
TaranA3 2 years ago
BillP3 2 years ago
Bill Patton.
buddhadebd1 2 years ago
i have seen the video and all the schematics. Im in search of the initial amplifier circuit you created for the microphone for testing which doesn't seem to use an opamp. i have attached a screenshot from you video if that helps. Can you provide this circuit or a similar microphone amplifier circuit which doesn't use an opamp.
thank you. Big fan btw. Keepup the great work
MatyiHI 2 years ago
IrSender.sendSAMSUNG(0x3434E817, 32); //Vol+
IrSender.sendSAMSUNG(0x34346897, 32); //Vol-
Attached are the codes that I got from my remote when using a simple IR receiver and reading output from the Arduino serial monitor. (Left is Volume Up, Right is Down)
My question is, how do I use those remote codes in your MovieVolumeAdjust.ino file?
hardypeter305 2 years ago
Experience ,I have a few neighbours who
Would by one if they could due to advertisers volume, increasing during
Brakes.rgds Peter
Cob 2 years ago
I changed the code to use millis instead manually setting timers interrupt which makes it compatible with non-avr boards, and implemented a finite state machine to make the code more clear, here is the github repo
https://github.com/cobrce/MovieVolumeAdjust
roger.tannous 2 years ago
IrSender.sendSAMSUNG(IR_DATA_VOL_PLUS, 32);
Your code is more comprehensible and organized.
As a preliminary test, I checked if my Samsung TV will recognize the volume down command by manually alternating A1 between Vcc and GND (bypassing the mic and the amplifier). The TV did not recognize the command.
In IRremoteInt.h it says::
void sendSAMSUNG(unsigned long data, int nbits);
__attribute__ ((deprecated ("This old function sends MSB first! Please use sendSamsung().")));
So I knew why my Samsung TV did not recognize the commands, because when I took note of the commands (using an IR receiver with Arduino setup and the TV's remote control), it was clear the TV expects an LSB first format.
VOLUME UP:: Protocol=SAMSUNG Address=0x707 Command=0x7 Raw-Data=0xF8070707 32 bits LSB first
VOLUME DOWN:: Protocol=SAMSUNG Address=0x707 Command=0xB Raw-Data=0xF40B0707 32 bits LSB first
I used this one instead::
void sendSamsung(uint16_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats, bool aIsRepeat = false)
Here's the full code of the tester (it's not worth posting it on github :))
Note that I left some pin definitions and a few lines in the setup because I've tried it with the whole circuit still there, with the only difference being the A1 thingie described above::
Here's the full code of the tester (edited to include code from gist.github.com instead of posting the whole code here as @Cob suggested)::
https://gist.github.com/roger-tannous/429f848fd80ab2ba32b3a47ca297ecd3
Note that I left some pin definitions and a few lines in the setup because I've tried it with the whole circuit still there, with the only difference being the A1 thingie described above
roger.tannous 2 years ago
IrSender.enableIROut(IR_FREQUENCY);
so it was not necessary
Cob 2 years ago
I updated the code to use the new SendSamsung, I called it directly from IrSender with the parameters you provided.
And if you want to share snippets of code (not full projects) you can use gist.github.com, it supports code highlight and you just paste the code (no git/repo shenanigans)
roger.tannous 2 years ago
Will surely remember to pull again from your repo.
I just read the modification you've made and the reason I did not replace the old implementations "in-place" is the same as when you'd rather make changes, for instance, to pin definitions instead of having to go again through all the code (especially if someone else will have to do it).
In fact, we have 2 brands of TVs at home. Mine is a Samsung. The other one is a Sony (with which I'm currently struggling with the IR thingie).
So I've added a few things to the code I've shared, but it's not finalized yet. My goal is to add a button (optionally with LEDs) to toggle between these 2 brands.
The weird thing about the Sony TV (a Sony Bravia model) is that when I dumped the IR codes, the address for the volume up/down commands was 0x1, too small of a value I guess ? So I'm suspecting there was something wrong at the time I was fetching the codes from the remote control.
I also didn't take full logs, I changed the code to check only for some protocols (samsung, sony, pulse distance, and pwm) and only printed the summaries. I did that because the receiver/dumper was capturing lots of noise and reporting unknown protocol stuff when nothing was being pressed on the remote control (no filter on the IR led, etc.)
Finally, I read somewhere that some TVs expect to get the same commands (address + command, etc.) multiple times in a timely fashion, I didn't have enough time to check if the IRremote library already does that (is it the repeat argument ?)
Sorry for the very long messages!
AndreasJ11 2 years ago
your code seems to have the same problem as Scotts in my case. Somehow the volume gets lowered but never returns to normal sound. Did you rebuild the project?
Cob 2 years ago
I didn't build the project but I did simulate it with proteus.
There are two bands of volume, the loud and quiet, and they're not adjacent, i.e the volume gets lowered when it's too loud (a loud music), then the volume stays like that until it gets quiet (a quiet dialog) where it's restored. Maybe in your case the volume didn't drop this much
AndreasJ11 2 years ago
I also tried to many different settings of the potentiometers ...
Cob 2 years ago
AndreasJ11 2 years ago
I will see that tonight if it finally works in my "field test"
Cob 2 years ago
AndreasJ11 2 years ago
I rebuild the the Adjuster with the following components instead of building them on my own.
IR Sender HX-53
MAXX4466
The ohter components are like in the instruction.
Now the probelm.
Somehow it only works once the controller is booted or the potentiometer is completely lowered but then it constantly changes the volume.
The values are the look the same as in the video and i dont think i made an mistake :-)
Would be great if someone has an idea
roger.tannous 2 years ago
roger.tannous 2 years ago
1. the project uses an inverting amplifier, check that yours is of the same type.
2. Also take note of the following excerpt from your mic amplifier's page on Adafruit::
"The output will have a DC bias of VCC/2 so when its perfectly quiet, the voltage will be a steady VCC/2 volts (it is DC coupled). If the audio equipment you're using requires AC coupled audio, place a 100uF capacitor between the output pin and the input of your device."
t0bias 2 years ago