Wednesday, September 30, 2020

Get closer: cell phone proximity detector

I like my pocket computer - I'm not crazy about my cellphone (they're the same thing.)

For one thing, I'm old and it still bothers me to overhear people's intimate conversations. It's not like tv that I can turn off. And often there's no telephone in sight. They're wearing a tiny headset. Who are they talking to? Are they talking to me? - an imaginary friend (I hear they're never unkind) - a voice in their head?

But the designers of cell phones have improved some irritating issues. When you are using your cell phone as a phone, it puts all the other apps to sleep so you aren't punching buttons on the desktop while you're talking. It senses when your face is near the faceplate.

The problem with my last phone is that, when I took my face away, it didn't wake up, so I couldn't enter numbers from the keyboard or use other apps to get information. I downloaded an app to disable the sleep mode while I talked on the phone. It was quite unreliable.

My new phone doesn't have that problem. When I get close, the apps go to sleep, and when I take my face away from the phone, the apps wake up.

But how does a cell phone know that your face is close? The answer is "proximeter". All cellphones have them. Usually the proximeter is an infrared LED and detector under the faceplate. You can find it if you have a sensor app like Physics Toolbox or Examobile's Sensors. Both access the proximeter so that you can see when it toggles on and off. Just waggle your finger around in front of the phone until you see the proximeter flip.

I can see the IR LED under the faceplate at the upper left of my phone. The LED constantly shines infrared light out and when an object moves close enough, it reflects the invisible light back to the detector which triggers the proximeter on.

I'll be using my proximeter later to measure periodic events like pendulum swings, so I wanted a more precise idea what to expect from it. It was pretty easy with an optical bench. Home Science Tools ( has an inexpensive one - basically a stand for a ruler and sliders that will carry lenses, a candle, screens, etc. It also has a sliding object, a metal pointer that can be used to form images with lenses and mirrors, or, in my case, a target that I could move toward and away from my phone. With the optical bench, I could measure the distance between the object and the proximeter. I also stuck a plastic pill bottle on the object for a larger target.

Here's my setup.

I used a gooseneck camera stand to position the phone over the ruler.

I made ten measurements with each target moving it toward the phone until the proximeter toggled on, and then away until it toggled off.

I could take the average of ten distances as the "true" distance and the differences between the measured distances and the averages as the amount of error in the measurements.

I found that, for the small target, I could rely on the proximeter to toggle at 5.5 cm ± 0.8 cm. To get it to toggle off, I had to back off to 6.49 cm ± 1 cm. For the large target, the proximeter would toggle on at 4.63 cm ± 1 cm and would toggle off at 6.62 cm ± 1.6 cm.

I was a little surprised that I had to bring the large target closer to get the proximeter to toggle. I assume that the smaller, metal target reflected the infrared light better than the large, white, plastic target.

The errors in the readings behaved. If I added them up, the sum was 0 which means that they were random and followed a normal (or, at least, symmetrical) distribution. So, I can reduce errors in measurements with the proximeter by taking multiple readings and averaging them.

Notice that I had to back off further than I had to approach to make the proximeter toggle. Many control systems show that kind of behavior; it's called hysteresis. If the heat in your house goes above a certain level, your air conditioner will come on, but to make it stop, the temperature has to fall considerably below that level. If the cutoff and cut-on temperatures were the same, the air conditioner would just flip off and on all day.

You can roughly determine how near and far away from your phone you have to move to trigger the proximeter by just moving your hand in front of it, but if you want to use it as a precise instrument, you need to use a set up similar to mine that allows you to make actual distance measurements.

No comments: