Go Down

Topic: Best way to tell if a lid is open. (Read 1 time) previous topic - next topic

tk26


I need to notify my arduino when I open the lid of a box, wondering what is the best way to go about this?

I was thinking maybe some type of magnet setup but it would probably be much simpler to just have a button on the box that the lid presses on when it is closed. Any suggestions on the type of button I will need (what it's called)?

Osgeld

Quote
but it would probably be much simpler to just have a button on the box that the lid presses on when it is closed.


thats my vote

Quote
Any suggestions on the type of button I will need (what it's called)?

snap action switch
leaver switch
microswitch
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL

Lavan

Certainly using the micro switch/leaver switch is the simplest way.  In case if you don't want to use mechanical approach, you can do this with IR proximity sensor as well.

Chagrin

http://arduino.cc/playground/Learning/LEDSensor
http://www.thebox.myzen.co.uk/Workshop/LED_Sensing.html

Would be the cheapest route.

twinturbo

Alarm boxes use a standard little push switch ( liek on the arduino board) with a spring attached . the spring makes sure the switch closes correctly without having to have very tight tollerance.

Rob

pYro_65

If the lid is a swing style ( doesn't detach completely ) and object doesn't move too much, a mercury switch would be suitable.

Far-seeker



I need to notify my arduino when I open the lid of a box, wondering what is the best way to go about this?

I was thinking maybe some type of magnet setup but it would probably be much simpler to just have a button on the box that the lid presses on when it is closed. Any suggestions on the type of button I will need (what it's called)?



In terms of the code, using a magnet and a reed switch would be identical to a push button. The hardware might be a little more expensive but again not really more complicated to install or use.  There is one slight advantage a magnet and reed switch have over a push button is it would be less likely to give a false closed reading, since it's more probable for the button to accidently be pushed while the lid is open than to have another magnet be waved near the reed switch.  Even then it might not be a worthwhile difference, depending upon if limiting these kind of false readings is important in your project.

tk26


Certainly using the micro switch/leaver switch is the simplest way.  In case if you don't want to use mechanical approach, you can do this with IR proximity sensor as well.


I'll check that out, thanks.


http://arduino.cc/playground/Learning/LEDSensor
http://www.thebox.myzen.co.uk/Workshop/LED_Sensing.html

Would be the cheapest route.


That is pretty cool, wasn't aware that was possible. Will take a look at that too.


If the lid is a swing style ( doesn't detach completely ) and object doesn't move too much, a mercury switch would be suitable.


Yeah it's a hinged lid, never heard of a mercury switch, I'll look it up.

Thanks for the suggestions everyone.


dc42

Hall sensors are inexpensive now, so I'd use a Hall sensor and a magnet. Caution: some of them such as the US1881 turn on when they see a N pole and off when they see a S pole. This sort (bipolar) is ideal for rev counters, but not what you want for a proximity sensor (you need a unipolar one such as http://uk.rs-online.com/web/p/hall-effect-sensor-ics/7384743/).
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

RPCoyle

I've used a simple contact micro switch. with the pin as input, make sure you add a 10K pull down to ground and make the logic to trigger on the switch going HIGH. That means having a switch that you can wire as normally open. works fine and uses a little  less current.

michinyon

Mercury switches are probably illegal now.

Far-seeker


Mercury switches are probably illegal now.


I can't speak for everywhere (this is an international forum), but I know they are still legal in the USA and I don't know of any serious effort to change that.

beige

Most people use the ball bearing tilt switches these days, similar in effect to the mercury ones, but you can sell em worldwide.

joebert

Not knowing anything about the box, I'll say security door/window contacts. Surface mount, with adhesive backing.

retrolefty

These days I would say the best method is to use a 3 terminal hall-effect electronic switch and a permanent magnet. These are very small and easy to hide into the box and easy to adjust the magnet spacing to make how high the lid has to move before indication. Very simple to interface with the arduino, just enable the internal pull-up for an input pin and wire it to the sensor's output pin, then just wire ground and +5vdc to the sensor. 95 cents at SparkFun:  https://www.sparkfun.com/products/9312

How could anything be better or easier?

Lefty

Go Up