Librem 5 proximity and ambient light sensor VNCL4040

Continuing the discussion from Librem 5 Backlight PWM frequency:

It crossed my mind. But the sensor doesn’t seem to be used yet, so maybe the control over its activation will be tightened up when it is put into use. It would probably be slightly more energy efficient if it was only activated when its input is actually required, rather than every time the screen lights up.

According to the schematic, it’s a VNCL4040 Fully Integrated Proximity and Ambient Light Sensor, so it’s a self-contained module with very little direct control over the IR emitter from the outside. You give it power and configuration data, and it gives you data about proximity or ambient light levels.

It’s the right wavelength for an IR remote (940nm) but you also need to be able to modulate the output at tens of kHz if you want to send IR remote commands. Skim reading the datasheet, it looks like it might be possible to do something like that, because it does accept some commands that affect the IR emitter, but it’s not really designed for sending IR signals so it might not come to anything. You’d have to do some experiments and see what you can hack it to achieve.

Looking more closely at mine, I notice the VNCL4040 is at a jaunty angle. It’s probably about 5 degrees off level. I wonder if that’s by design or if they are just not very accurately aligned. (I’m assuming it is supposed to be like that and it’s not a manufacturing defect.)


How did you find that out? Have you opened your phone up?

I just took a photograph of my phone in order to see the IR.

I wiped the fingerprints off the screen and then held the phone under a bright desk lamp. The sensor and its little stadium-shaped window become visible under those conditions.

I did that because, on first glance, I thought the sensor had a circular window, but after looking at the datasheet for the sensor, I realised I had only been looking at half of it.



Unblank screen on incoming calls and only enable proximity on active calls


I just realised: this sensor probably explains the random screen blanking I was experiencing while using the phone. If I put my finger over the sensor and hold it there for a few seconds, the screen fades to black. I wasn’t conscious of doing that before, but it just happened to me again and I suddenly realised where my fingers were resting and made the connection.

I was planning to eventually report the random screen blanking as a bug, but now I think it’s actually by design: that’s what the proximity sensor is for. But it’s not when it’s for, because it hasn’t been narrowed down to only work during calls yet. It would still be a bug, because that’s a confusing behaviour, but it looks like it will be changed if the merge request linked by @spaetz above comes to anything.

1 Like

Yes, accidentally covering the proximity sensor makes the screen go black. I was going to mention it months ago, but I thought it was maybe too obvious to create a forum entry. Then again, you’re right that with normal design, it should only happen when you’re on a call. I hadn’t thought of that point. :slightly_smiling_face:


Watch out also if you have set screen brightness to “automatic”. If you cover the ambient light sensor, it should dim the screen.


I haven’t, but good point.

Nothing, ever, is too obvious to create a forum entry.


Oh, so it does have that feature! That’s something I would find quite useful, but I assumed that since it wasn’t doing it by default the feature did not exist. (Apparently I didn’t look very closely at the Power settings.)

Having said that, automatic brightness seems a bit over-sensitive at the moment, so I’ll probably leave it off for now. I don’t want the brightness visibly changing just because I lean forward two centimetres. That’s really annoying. It probably needs to take the average of the ambient light level over a longer period.

1 Like

Automatic brightness off, but when I cover the sensor my screen goes blank as @amarok points out.

1 Like

Yes, that’s the expected behaviour at the moment. We’re talking about two distinct features here. The screen blanking is separate from the automatic brightness.

The screen blanking (and touch input rejection) is primarily meant for when you are holding the phone against your ear, but as we’ve seen it is easy to accidentally trigger it using your fingers. The changes mentioned in the merge request linked by spaetz above should limit the scope of when the screen blanking can occur.

That’s not the same thing as the automatic brightness feature. Automatic brightness just dims the screen slightly if you go somewhere dark and brightens it if you go somewhere light, so you don’t have to keep manually adjusting it. But you always need at least some light from the screen, even if you are deep underground in a coal mine at night with all the lights off, so it shouldn’t ever dim it to the point where it is off completely.

Edit: The forum automatically edited out my quote of the previous post. Just to be clear, this was a reply to @beltrandroid’s post immediately above.


More thoughts about proximity detection:

The current, always-on, proximity detection is actually quite useful for preventing unwanted touch input if you want to put the phone in your pocket without locking it. Given that this feature will be narrowed down to only work during phone calls and similar, it would be quite good to leave open the possibility of an app that can effectively re-enable always-on proximity detection, on demand.

I suppose the proximity sensor could also be used to avoid pocket-dialling the emergency services or repeatedly entering incorrect PINs. (Currently, pocket dialling the emergency services is not really an issue, since the emergency call feature hasn’t yet been added to the lock screen.)

(I’d comment these points on the issue tracker, but I don’t have an account.)

1 Like

I don’t think it’s a problem to create one. They let me have an account … :slight_smile: