hi please i want to change the sound volume using potentiometer and a speaker with arduino.can you help me to do the connection circuit .thx in advance
kind regards
hi please i want to change the sound volume using potentiometer and a speaker with arduino.can you help me to do the connection circuit .thx in advance
kind regards
What sort of speaker? Dynamic one can overload arduino pin if connected directly - it can have several ohm resistance (so series connected potentiometer can help limiting current, if never set to zero) - better add additional resistor in series so max. current draw from the pin will not exceed MCU limits...
ok - so take potentiometer of value between 1 and 10 kOhm [1kOhm or 2.2kOhm or 4.7kOhm or 10kOhm) and connect it (assuming center contact is connected to moving contact inside)
- one edge connector to microbit output
- another edge connector to gnd
- central (regulated) connector to speaker module's input
and do not forget to set blue potentiometer on speaker module to max volume (maybe it is set to zero so there is no sound?)
i telled you that the speaker works good so the blue knob is not set to zero yes or no.
please can you send me a circuit picture to describe connections
please i have trouble in : where i connect out pin of potentiometer?
where i connect sig pin of speaker and also vcc pin of speaker
yours trully
ok - so: set working system only with microbit and speaker module and check it.
then: disconnect only connection between microbit output and speaker module input
get potentiometer of proper value (what resistance is yours? it should be printed somewhere on the case)
potentiometer has three pins - find which one is regulated (let's call it "center pin")
connect one pin (not "center pin") to microbits output
connect another pin (not "center pin") to the ground
connect "center pin" to speaker module's input
is it clear or is it something that needs additional explanation?
yes thx i will connect out pin of potentiometer to p2 of microbit and sig pin of speaker to p1 so i make this program shared and i will try
i hope it will work
i´m eager to know
Ok - I have checked your code and now I understand...
You are trying to tune volume in your code using input from potentiometer connected to another pin...
What I am trying to propose is to reduce/regulate signal from microbit at "speaker's" input
So - only one of two: either put potentiometer between microbit and "speaker" or devise code that will scale output on microbit pin using any metric (for example - potentiometer connected to another contact or something else)
I think you are not doing what you thin you are doing:
so - you get voltage sample from P2 (from potentiometer), then write it to the output pin, then play sound disregarding pot value
check if music.playSoundEffect has variable setting volume and use pot variable to change volume
I think you are not doing what you thin you are doing:
so - you get voltage sample from P2 (from potentiometer), then write it to the output pin, then play sound disregarding pot value
check if music.playSoundEffect has variable setting volume and use pot variable to change volume