I'd use a laser sensor myself, not unlike I use on automated preses.
It just detects something is not where it should be and stops.
And if it can "see" that everything is in the right place, it carries on.
The base being wider than the neck, it would be implemented opposite of my use...