Best method of detecting peg in hole I’ve got a large wall with 1” holes scattered about. I’ve got some wooden pegs that fit perfectly into these holes. Now I’m thinking of creating a light installation based on the pegs, but i’m Struggling to find a way of detecting when a peg has been inserted into any hole.

What’s the best method of detecting them? I was thinking a stop switch that’s just placed on the edge of the hole to the peg activates it, but i’m Not sure how well that can be detected or if it would bend with use
We can't tell you the "best" method.  It depends on too many details we don't have.

Here are some options:


A reed switch at the bottom of the hole and a magnet on the peg.
A photo sensor at the back of the hole -- the peg blocks the light.
As you suggest, a switch at the side of hole.
Use contrasting colors on the wall and the pegs and detect the pegs using a camera and some sort of image processing (not an Arduino solution)


I think you are going to need to build some prototypes and experiment to find the best option for you.