Detecting if an object is sitting on the table or not. (i.e. switch) - Page 1
Forum section: electronics / projects

author: Youkai
author_rank: Regular Contributor
timestamp: October 12, 2023, 03:49:11 am
content: I'm working on a project that has some servos to move parts. I don't want to trigger any actions if the object is still sitting on the table because moving the parts in that state could break it. It's an item you will hold in your hand and if you are walking around will be brushing against your leg potentially.I'm looking for a simple way to detect if the object is sitting on the table or not. My first thought was to use a switch with a little lever and mount it on the bottom so when the object is on a table it will press the switch. My concern is I don't want the switch to get tripped/broken off when holding the object.Is there a better option? Possibly some kind of light/optical thing. Maybe if I used a photo resistor I could set it up so that it's dark when sitting on the table and if any light is detected at all it reads as picked up. Any other good options?I only have "pin 1" from a Sparkfun Pro micro left available. So whatever I use has to work off that single pin. Thanks.

author: Ian.M
author_rank: Super Contributor
timestamp: October 12, 2023, 04:07:26 am
content: A single pin isn't a significant limitation as extra 'smarts' could be added as a slave MCU that signals the Pro Micro whether or not its OK to operate. If multiple sensors have reasonably unambiguous outputs, they could be combined by logic without a MCU.Other possible sensors to consider:An accelerometer could be used to detect its approximate orientation and if its in motion (though that's fuzzier as smooth, constant speed linear motion is not detectable).Temperature sensor in the grip detecting body heatSkin conductivity sensor in the gripCapacitance sensor in the gripStrain gauge(s) (or other low force sensors) could detect if its supported by the grip or resting on a surface

author: Nominal Animal
author_rank: Super Contributor
timestamp: October 12, 2023, 05:04:29 am
content: I2C or SPI accelerometer connected to a helper microcontroller, with a single open collector output to indicate no movement in the lastnseconds?Say, something like a ST LIS2HH12TR (runs at 1.71V - 3.6V) connected to an ATtiny202, with a BSS138AKAR or similar MOSFET, a couple of resistors and bypass capacitors, with the board assembled at JLCPCB. The ATtiny202 can be programmed in Arduino, and really only polls the accelerometer to decide whether movement has occurred or not, and setting the open collector output correspondingly. As these sensors typically run off 3.3V, you'll want to run the ATtiny202 at that voltage also; the BSS138AKAR (or my favourite, NX138AKR) MOSFET is used to provide an open collector output, so you can easily interface safely to the single digital pin on the Sparfun Pro Micro (ATmega32u4). This would make for a nice simple separate motion detector project as well; say, using a LED and a resistor (instead of the digital pin) to indicate "no movement".Alternatively, use a microswitch with the metal lever removed, so that only the tiny nub protrudes from the bottom.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: October 12, 2023, 05:54:54 am
content: Quote from: Youkai on October 12, 2023, 03:49:11 amYou can buy microswitches minus the levers, for low profile switch, which would work with a flat based object.Other requirements seem to be conflicting.If you can hit it on your leg, it's very mobile, so presumably it needs to operate flat when in use ?There are reflective optical sensors, and transmissive 'optical gate' type ones too.

author: Youkai
author_rank: Regular Contributor
timestamp: October 13, 2023, 12:32:36 am
content: Quote from: PCB.Wiz on October 12, 2023, 05:54:54 amI'm making the arm blaster/gun thing from Metroid Prime. Think of it like a gauntlet with lights/moving parts. The hitting your leg part would be when you are standing with your arms at your sides. The bottom of it will brush your leg/hip.There is a flat base that will be laying on the table when you aren't "holding" it. It should be perfectly dark when on a flat surface so my thinking is a photo-resistor is probably a good option. I guess alternately I could put a little button on the bottom such that it's pressed when sitting on the table. I was worried that without the lever arm getting the spacing for the mount would be somewhat finicky.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: October 13, 2023, 01:25:54 am
content: Quote from: Youkai on October 13, 2023, 12:32:36 amGlass tables could be a problem for optical light/dark sense ?There are Reflective Optical Interrupters, that might be OK. With those enough reflection would signal 'put down', but they need to wake up to test.Quote from: Youkai on October 13, 2023, 12:32:36 amThat's a zero power solution, and is easy to adjust.Resting on a soft surface like a chair, sofa, or clothing could be a challenge to any sensor.Another approach could be a vibration sensor (light gold plated spring, over an inner rod), with a some-seconds monostable/timer.