Peter -
It is becoming clearer I think. If you look at the notes I have on the schematic, perhaps you can critique my logic and see if I am understanding the process.
You will see that I am trying to not just copy your layout, but to clearly understand what the reasons are. I have changed it to reflect a parallel circuit with the LED and resistor on one branch and the buzzer on another. Hope that is not a problem.
This is my logic:
From your schematic, it seems that the only purpose of the D4 output pin is to "close the gate" of the transistor. Simply provide a path from IO pin to transistor base, and then to ground.
The LED and resistor need to be within one circuit (or branch) ... and the buzzer can be on another branch ... correct? That would mean that the total current for the circuit would be 20mA (LED) + 25mA (buzzer) ... 45mA total. Looking at the spec sheet for the 2N2222 transistor, the "gain" is a factor of mA input and voltage. I see the gain as somewhere between 50 and 75.
Rather than try to supply the current and voltage from the IO pin D4, I want to create a path from VIN (or the 5VDC power) on the MKR1000 ... through the "collector" to the "emitter" and then to ground. I chose the VIN because that is coming directly from the regulated power supply and would not be limited by the MKR1000 5VDC output. Correct?
Two images attached for review.
Thanks so much.
Jim
Test2 NPN with buzzer.fzz (49.4 KB)