Using a Speaker with the Photon

Hello folks,

Below is my attempt of connecting a speaker to the Photon using a transistor. I innitially connected the speaker directly to the Photon pin, but as @peekay123 and @Jack correctly pointed out, it was just a matter of time before I fried my GPIO.

Is this layout correct?


VCC: 5 Volts
Speaker: Input power: 0.7 Watt - Max: 1 Watt. Impedance: 8 Ohm
Transistor: MMBT 3904 LT1G
Firmware: Using Tone function to call the speaker.

You might want to consider using a piezo speaker that can be driven directly by the device since you are just going to be feeding it a square wave.They are very loud and use very little current,

1 Like

Hello @Awake, I initially started with a piezo buzzer.

I’m trying to future proof the design by adding a speaker that has the potential of producing higher definition sounds.

Does this make sense, or with the output of the Photon’s pins I will never be able to get a higher quality sound that the one generated by a piezo buzzer?

@sazp96, the speaker and transistor are fine though the base resistors seems a tad low (220 ohms may be a bit more conservative). As for “quality” or higher definition audio, I would not count on this circuit for that, However, it will do a better job than a buzzer but will require more work on the software side if you want to create more complex sound. :smile:

1 Like

Got it. Thanks @peekay123 and @Awake for the feedback.

The plan is to ship now making only basic sounds, and latter on work on the software to make some more complex ones. We just want to make sure we are leaving that door open :slight_smile: !

With the goal of improving the sound quality latter on, is D0 (PWM pin) the best Pin to connect the speaker circuit to?

Would it be better to connect it to a DAC or an ABC pin, or it really doesn’t matter?


Thanks for the explanation between ABC, PWM, and DAC @ScruffR!

So in this case, where I’m connecting a speaker to a photon as show in the circuit above, is it better to use a DAC pin vs PWM or it doesn’t matter?

Today I’m using tone to generate sounds, but in the future I want to write software to make more complex sounds. So, I’m trying to futureproof my PCB design.


A DAC output would be best for audio output but for such a signal you’d also need to go for an analog amplier circuit and not only a transistor (as switch) - I guess this is also the reason why @peekay123 doesn’t favour the above curcuit.

Have a Google search for “analog amplifier circuit” there you’ll find plenty.


Wow, analog circuits are way more complex than digital ones.

At this point I will just stick with the digital one. But thank you @ScruffR, @peekay123, and @Awake for the electronics lesson :slight_smile:


Heres a cheap and nasty audio amp that will amplify anything you want to output


@tezza, just a note that even though your schematic shows 6…12v it will also work at 5V. :smile:

Yep, just adjust to suit whatever you want to do.tend to the lower values of the ranges. even reduce slightly eg c4, change to 100-330uF

1 Like

Awesome!! Thanks @tezza and @peekay123!

Cool, I bought a small batch of LM386s a while back. This schematic will come in handy. :slight_smile:

Your welcome, this is just a basic circuit there are LOTS of others around.