I have a simple circuit, where a use tone in order to send a melody to a speaker. Then I added a 10k potentiometer, along with a BJT, in order to control the volume. This is the schematic:

enter image description here

A weird thing happens when i set the pot to the max value (move the wiper in the rightmost position). The music stops playing, and a clicking sound happens every half second.

If I move the wiper to the left, the music starts playing but from the beginning. Implying that the Arduino resetted - most probably the periodic clicking sounds were continuous resets.

Why this happens and how can I mitigate it?

EDIT: I performed further experiments, using two different 10k potentiometers, as well as one 50k one. I can confirm that this happens with ALL of them. It even happens about the same angle, when the pot is nearing its rightmost position - even in the 50k one.

  • what is the resistance between the transistor base and ground?
    – jsotola
    Sep 16 at 20:07
  • I couldn't find that information from the datasheet.... This is the datasheet by the way: datasheet.lcsc.com/lcsc/…. This is a common SMD BJT transistor though, the MMBT3904. Sep 16 at 20:54
  • 1
    it's a hint ...
    – jsotola
    Sep 16 at 21:23
  • Where does the +5v come from? Can it supply enough current to drive the speaker?
    – kiwiron
    Sep 17 at 4:50
  • Think about an ideal BJT that shortens 5V to the speaker. What happens if you try to connect the speaker directly between 5V and GND? Is the power supply still able to drive the load? (Disclaimer: This might destroy your speaker or other parts.) -- If you have access to an oscilloscope, measure the 5V while you're experimenting. Sep 17 at 8:18