Is this a good way to debounce a switch?
In your design, assuming you're using a common small signal NPN BJT (2n2222, BC547, 2n3904…), you're wasting about 20-30mA of current when the switch is closed. That is, about 10-15mA through the upper 220Ω resistor and 10-15 through the lower one.
In addition, driving the base of the transistor with 10mA or more in this situation makes no sense: using a 10KΩ base resistor and thus reducing base current makes the circuit behave almost in the same way.
That said, I would just avoid using the transistor, something like this should work:







simulate this circuit &ndash; Schematic created using CircuitLab

I kept your values for R1 and C1, so the cutoff frequency of the circuit is similar to yours. I.e., the GPIO pin will not 'see' changes of the switch above about 5Hz (well, simplistic and not completely exact: see Wikipedia - Low Pass Filters for detailed info).

R2 is used as pull-down resistor: it is useful because it clearly pulls the pin to ground when the switch is open. Its value isn't critical, something between 10 and 150KΩ should be ok.