Switches and micro switch advice/ help please (im new to this)


#1

I have purchased an adafruit audio fx board, and want to have a box that screams when the lid is opened, so im after a micro switch that when the lid is closed its in its of state and when the lid is opened the switch is in its on state and triggers the audio file in the adafruit. as i say im totaly new to this so any advice greatly appreciated. thanks in advance.

James.


#2

Off and on states are pretty maleable for switches. You can take a switch that’s “normally open” or “normally closed” ( normally on or normally off if you will ) and invert it simply by sticking a ! or a not before it in your code.

So, pick the switch that works best for you mechanically and fix the rest in code!

You could probably use a simple momentary tactile switch like this: https://shop.pimoroni.com/products/tactile-switches

It will technically be on when the box is closed, with the lid resting on it, and off when the box is open but that’s just details!

If you want something a bit more discrete you could look into reed switches or hall effect sensors and magnets, but they may be a little trickier to find. I’m guessing this project is for Halloween? So it’ll be dark and nobody is going to notice a tactile switch in the corner of the box while they’re fleeing in terror.


#3

Thanks for your advice, i opted for reed switches, works great! thanks again. J.