# Gravity Sensor for Light Switch

Thread Starter

#### sd12105

Joined Dec 5, 2019
3
Hello AAC!

Running into some issues with my current light switch design, and realizing that, if possible, I would like to change my setup to include some sort of sensor that can detect movement. Basically, my application for this bedroom light would be to have the light turn on and off based on what direction the light is turned (up or down).

Any ideas for what type of sensor I should be looking at for this?

Thanks in advance!

#### dl324

Joined Mar 30, 2015
11,457
Welcome to AAC!

I'd probably use a tilt switch.

#### djsfantasi

Joined Apr 11, 2010
6,785
The light is turned...?

#### AlbertHall

Joined Jun 4, 2014
10,372
The light is turned...?
Yes, Four choices: turned on; turned off; turned up; turned down.

#### djsfantasi

Joined Apr 11, 2010
6,785
Yes, Four choices: turned on; turned off; turned up; turned down.
But there’s a direct relationship between off/on and up/down, correct? So the desired solution has only two states, correct?

#### AlbertHall

Joined Jun 4, 2014
10,372
But there’s a direct relationship between off/on and up/down, correct? So the desired solution has only two states, correct?
Oh, you spotted that!

#### MisterBill2

Joined Jan 23, 2018
6,967
The first post makes very little sense, and the following posts make even less sense. Why should it matter what direction a light that is off is pointing? Or do you want to use the aiming of a lamp to switch it off and on? Is it a mains powered lamp? Or some other arrangement?

Thread Starter

#### sd12105

Joined Dec 5, 2019
3
Hello All,
Thank you for your responses. "Turn" refers to the orientation of the light itself, not the switch. Think of a cube, for example, if one side is facing up, the cube glows blue; and if the cube is rotated 180 degrees to have the other side pointing up, it glows green. I'm thinking this would require a tilt switch as mentioned, but wanted to see if there are any other ideas. Thank you!

#### LesJones

Joined Jan 8, 2017
2,694
You could use a pendulum coupled to an optical encoder disk similar to the one in a "Wixey" type angle gauge. There is a picture of the pendulum at the start of this link. Yo could use a gray scale encoder disk. The number of tracks required would depend on the number of states that the light could be. For example 4 brightness levels for each of 4 colours would be 16 states so this would require 4 tracks to use 16 positions of the lamp to give the 16 states.

Les.

#### MisterBill2

Joined Jan 23, 2018
6,967
Mercury switch capsules are still around, and one of those would make a perfect tilt sensor for this application. Of course it is vital to assure that the mercury capsule does not become damaged or broken, but the only hard part would be finding a place in the lamp to mount it. A good covering of instant epoxy after connecting the leads should be adequate protection. That will give you a silent switch that does not wear.About as simple as it can get. BUT the mercury is toxic so you do need to assure that the switch capsule is never broken.
Certaily there are a few folks who will enter the panic mode upon reading my suggestion, but when the stuff is safely encased in a sealed glass capsule there is no problem.

#### BobTPH

Joined Jun 5, 2013
2,533
A ball bearing in s tube with a microswitch at one end.

Bob

#### Alec_t

Joined Sep 17, 2013
11,628
Lever-operated microswitch with a weight attached to the free end of the lever, or with the switch operated by a button protruding through the lamp base..

#### Reloadron

Joined Jan 15, 2015
5,646
Hello All,
Thank you for your responses. "Turn" refers to the orientation of the light itself, not the switch. Think of a cube, for example, if one side is facing up, the cube glows blue; and if the cube is rotated 180 degrees to have the other side pointing up, it glows green. I'm thinking this would require a tilt switch as mentioned, but wanted to see if there are any other ideas. Thank you!
If you just want a single axis then I would just use a tilt switch. Now if you wanted to get really fancy there are more ways to go about it. Thinking about a cube you could use a 3 Axis Accelerometer to cover all six sides of a cube and have the cube glow depending on which side it was placed on. Yeah, I would just use a tilt switch. They also make them mercury free in case mercury freaks you out. Personally I like mercury but to each their own.

Ron

#### MisterBill2

Joined Jan 23, 2018
6,967
If you just want a single axis then I would just use a tilt switch. Now if you wanted to get really fancy there are more ways to go about it. Thinking about a cube you could use a 3 Axis Accelerometer to cover all six sides of a cube and have the cube glow depending on which side it was placed on. Yeah, I would just use a tilt switch. They also make them mercury free in case mercury freaks you out. Personally I like mercury but to each their own.

Ron
OK, Ron, but I thought that the conversation was about a rather normal lamp. For a cube you will want several switches, except for the "OFF" side, which does not need a switch. Old Honeywell round thermostats all have a mercury capsule switch, the heating/cooling ones have a double-throw switch that can also be positioned to have a center off position. So there is the solution for a cube.
I have some accllerometers, Kistler brand, retired because of not being totally linear any more. But with those you need a power supply and an amplifier and two comparators, so now it is complicated and uses a fair amount of power even when switched off. PLUS the stuff takes up space. inside your cube. A glass ball with 4 colored blinking lights inside will produce many nice colors if the bulbs do not all blink at exactly the same speed. Put them in a frosted white globe and you have a really neat color light. No switch at all, plug it in and watch it.

#### Reloadron

Joined Jan 15, 2015
5,646
OK, Ron, but I thought that the conversation was about a rather normal lamp. For a cube you will want several switches, except for the "OFF" side, which does not need a switch. Old Honeywell round thermostats all have a mercury capsule switch, the heating/cooling ones have a double-throw switch that can also be positioned to have a center off position. So there is the solution for a cube.
I have some accllerometers, Kistler brand, retired because of not being totally linear any more. But with those you need a power supply and an amplifier and two comparators, so now it is complicated and uses a fair amount of power even when switched off. PLUS the stuff takes up space. inside your cube. A glass ball with 4 colored blinking lights inside will produce many nice colors if the bulbs do not all blink at exactly the same speed. Put them in a frosted white globe and you have a really neat color light. No switch at all, plug it in and watch it.
It was about simple, I just took the cube and ran with it. Yes, a normal lamp. You have to admit a six color cube would be sort of cool though.

Years ago my plant I retired from had mercury thermostats all over the place. When it was determined mercury was a health hazard all thermostats were being replaced. I retrieved a bunch of the mercury bulbs from the old thermostats. Then as temperature sensing improved with very accurate PRT systems they were going to dispose of the mercury in glass lab thermometers. I saw to their disposal. Then came the lab mercury manometers.

I also have some Endevco and B&K accelerometers but what I had in mind was some cheap ones like the ADXL337 and ADXL377 on breakout boards. Couple one of those with a cheap uP and some RGB LEDs and you could make a pretty cool cube. I was thinking frosted acrylic but I like the idea of a globe.

Anyway, pipe dreams aside I would just use a tilt switch.

Ron

#### MisterBill2

Joined Jan 23, 2018
6,967
The main problem with mercury containing devices is caused by the unknowing individuals who choose to not let the fact that they do not know what to do slow them from doing it. Natural selection would solve that problem but unfortunately their damage range extends far beyond themselves. And in much of the world the court system seems dedicated to thwarting natural selection at every turn.

#### AlbertHall

Joined Jun 4, 2014
10,372
There are plenty of small tilt switches which use a rolling ball not mercury.

#### Tonyr1084

Joined Sep 24, 2015
5,027
At first I also thought this was a regular table lamp. Since it's been cleared up that we're discussing a cube, which has six sides - but the TS said "Rotate it 180˚" makes it sound like there's only two desired results, or maybe 3. Blue side up means blue light on. Green side up means green light on. The third state would be any other position (not blue up or green up) and the lamp is off. If that is the case then you'd probably want to go with two tilt switches so that when neither is up (or down) the light is off. If you want to have six results then you'd need six tilt switches and you'd have to mount them in such a way to be sure you don't have a false triggered side or sides.
A ball bearing in s tube with a microswitch at one end.
I've seen switches that have two metal contacts at the bottom of a chamber with a steel ball to make contact when the switch is in the upright position. Tilt it a little and it shuts off. I've seen them in space heaters. If the heater tips over the heater shuts off, thus preventing the potential for a fire. Several of those switches could be connected to transistors or MOSFETS to control the lights.

#### MisterBill2

Joined Jan 23, 2018
6,967
Those heater safety switches are probably able to handle the power level, but I am certain that they are intended to "fail safe", meaning off, and that they are not meant for many operations. And the ones that I saw were not small, and as they are deep inside a space heater they were not at all protected. They were open and would be able to deliver a serious shock it touched anywhere. Adding an electronic interfacwe would produce a package bigger than I would choose for a lamp.

#### Tonyr1084

Joined Sep 24, 2015
5,027
True @MisterBill2. However, we don't have dimensions for this color cube. I automatically assumed something around 3 or 4 inches cubed. I also didn't imagine a 110 VAC supply, rather, batteries and colored LED's. Those tilt switches could be used to trigger a transistor or FET. Of course, they're meant for higher currents, so they may prove inadequate for low voltage low amperage situations. However, you may be able to find those switches in many different sizes and configurations.

If I were to build something to work on four axes, I'd take a spring out of a pen, solder it to a PCB (standing up) then solder a steel weight to the end. One end of the spring would act as either ground or power while the other end would flex with gravity and could make contact with four different contact pads internally. Again, I'm assuming enough room to put such a package.

Similar threads