There are plenty of debouncing circuits on the internet, but I couldn't really find one that fitted my needs / available parts, so I came up with my own, from what I had. There's nothing special about it, and it probably already exists, I just haven't come across it yet.
Here's the schematic:
I guess it works with 5V as well, but I use this with my Raspberry Pi, which has 3.3V logic on the GPIO pins, that's why it says that on the schematic.
I went with the 330k and 100nF combo because I read that some switches can even have a 10+ ms bounce, so I really wanted to make sure this thing smoothes out everything. I don't need super fast switching, so this is fine for me. It makes both rising and falling edges very smooth. Also, it kind of inverts the switch: when it's open, the output reads high, and when you close it, it drops to 0V. But I'm good with that.
So I just wanted to know whether this is any good, or should I take a different approach? What do you think of it? Any advice maybe?
I updated the circuit a bit based on your suggestions. I realized that the 220 ohm resistors were wasting current for nothing, so I replaced them with more appropriate values. Also, I went with 100k / 150nF for faster operation. I think that the 330k / 100nF was a bit of an overkill. As you can see, that would reach 1.8V (roughly the logic threshold for the Raspberry Pi GPIOs) in about 25ms. This new circuit takes about 10ms to reach that level, therefore allowing over 10ms of bouncing, which is enough for almost all switches, and still unnoticeable for a human.
Also, I know that I the transistor is redundant, but I already built it this way, so I'm leaving it in there.