If using a solderless breadboard, first solder pin headers on your Trinket board (they come included). For GEMMA you can use alligator jumpers. The parts you need are at right. You will need a resistor, nominally 1K to 10K ohms but this can vary a bit if you do not have that value, just do not make it too low or high.

Pins used:

  • GPIO #0 (Digital 0) is connected to the signal pin (+) on the piezo speaker.
  • GPIO #2 (Analog 1) is connected to the junction of the photocell and the resistor.

You can power the circuit from the USB connection or from an external supply connected to BAT (or Vout on GEMMA) as shown below (4 to 6 volts DC).

For a 3.3V Trinket or a Trinket M0, use the pin labeled '3V' instead of '5V.' For GEMMA (any variety), use the '3Vo' pin.
You should not hook a low impedance speaker in place of the piezo without additional circuitry. A speaker has a low DC resistance and may try to draw too much current from the microcontroller. A 100 ohm resistor in series may help, and it could be coupled with a 10 to 50 microfarad capacitor.

This guide was first published on Sep 19, 2013. It was last updated on Jun 20, 2024.

This page (Wiring) was last updated on Sep 19, 2013.

Text editor powered by tinymce.