Same-day dispatch before 2 PM · Free delivery over ₹999 · GST invoices Get the appPrices incl. GST
Geekobot
Snap & SendNEWGeeko AIWhere's myOrder
Log in
Products
  • Projects
    • Component guidesHow parts work, with code you can run
    • Learning pathsFrom your first LED to your first robot
    • Workshops & eventsOnline sessions for makers and classes
    • ElectrolarkFree guided builds, simulator and certificates
    • Students & teachersStudent discount and classroom help
    • CommunityShare builds and ask other makers
    • CalculatorsOhm's law, LED resistor, 555 and 100+ more
    • Circuit builderWire parts and run the circuit, powered by Electrolark
    • Geeko AIAsk what to buy or how to wire it
    • Snap & SendPhotograph a part or list, we find it
    • Part finderAnswer a few questions, get the right part
    • Compatibility checkWill these two parts work together?
    • Compare partsSpecs side by side
    • Business & bulk ordersGST invoices, credit and volume prices
    • Request a quotationSend your list, get a quote
    • Classroom kitsPer-student kits and lab bundles
    • Gift cardsFor students, teams and events
  • Atal Tinkering Lab
BOM to cart
Geekobot

Components, kits and know-how for makers, students, engineers, labs and businesses across India.

Ask Geeko AIOrders, parts and projects, any timeEmail supportReply within 1 working dayGet the Geekobot appAdd it to your home screen, free

Follow us

Shop

  • Boards & SBCs
  • Sensors & Modules
  • IoT & Wireless
  • Drone & FPV
  • 3D Printing
  • Filaments & Resins
  • Motors & Drivers
  • Power & Batteries
  • Semiconductors
  • Passive
  • Displays & LEDs
  • Switches & Relays
  • Wires & Cables
  • Prototyping
  • Tools & Test
  • Robotics
  • STEM Kits
  • Atal Tinkering Lab
  • Mechanical Parts
  • Audio

Orders

  • Track your order
  • Help & support
  • Shipping and delivery
  • Refunds and cancellation
  • Contact us

Learn

  • Projects
  • Geeko AI project assistant
  • Learning paths
  • Guides
  • Calculators
  • Electrolark: free guided builds

Part tools

  • Part finder
  • Compare parts
  • Will it work with my board?

Institutions

  • Classroom kits
  • Atal Tinkering Lab
  • Students & teachers
  • Workshops & Events

Business

  • Business & education
  • Request a quotation
  • BOM bulk upload
  • Quick order by SKU

Company

  • About Geekobot
  • Community
  • Gift cards
  • Terms & conditions
  • Privacy policy
  • Product directory
  • Sitemap

© 2026 Geekobot, a trade name of OLatus Systems Private Limited. All rights reserved.

20, 1st Floor, Neeladri Complex, 10th Cross, Sampige Rd, 2nd Main, Malleshwaram, Bengaluru, Karnataka 560003 · GSTIN 29AACCO0462F1ZM

+91 91810 15607 · connect@geekobot.in · Monday to Saturday, 10 AM to 2 PM IST

UPI · CARDS · NETBANKING · GST INVOICES

ShopProjectsGeeko AIGuides
Compare 0 parts →
Log in

Shop by category

Shop all components
  • Boards & SBCs1,910 products
    • Alternative Single Board Computers
    • Arduino Ecosystem
    • FPGA & Logic Boards
    • Microcontroller & Wireless Boards
    View all
  • Sensors & Modules4,701 products
    • Biomedical & Heart Rate
    • Current, Voltage & Power
    • Force, Weight & Pressure
    • Gas, Weather & Environmental
    View all
  • IoT & Wireless2,314 products
    • RF Modules
    • RFID & NFC
    • Antennas & RF Accessories
    • Cameras & Smart Vision
    View all
  • Drone & FPV3,558 products
    • Flight Control & Navigation
    • FPV Video & Optics
    • Frames & Structural Parts
    • Motors & Propulsion
    View all
  • 3D Printing2,204 products
    • 3D Printers
    • 3D Scanners & Digitizers
    • Laser Engravers & Cutters
    • Material Management & Upgrades
    View all
  • Filaments & Resins1,472 products
    • Filaments
    • Photopolymer Resins
    View all
  • Motors & Drivers463 products
    • BLDC Motor Drivers
    • DC & Geared Motors
    • DC Motor Drivers
    • Linear Actuators & Solenoids
    View all
  • Power & Batteries557 products
    • Battery Holders & Connectors
    • Breadboard Power
    • Chargers & BMS
    • DC-DC Converters
    View all
  • Semiconductors295 products
    • Diodes & Rectifiers
    • Interface & RF Encoder ICs
    • Logic ICs (74xx)
    • Logic ICs (CD4000)
    View all
  • Passive67 products
    • Capacitors
    • Circuit Protection
    • Crystals & Oscillators
    • Inductors
    View all
  • Displays & LEDs572 products
    • 7-Segment & Dot Matrix
    • Addressable LEDs
    • Character LCDs
    • Graphic LCDs
    View all
  • Switches & Relays184 products
    • Keypads & Touch
    • Push Buttons & Tactile
    • Relay Modules
    • Relays
    View all
  • Wires & Cables233 products
    • Board-to-Wire Connectors
    • Crimp & Splice
    • Headers & Dupont
    • Heat Shrink & Sleeving
    View all
  • Prototyping101 products
    • Breadboards
    • Interface Modules
    • PCBs & Perfboards
    View all
  • Tools & Test717 products
    • Bench Power Supplies
    • Hand Tools
    • Measuring Tools
    • Meters & Testers
    View all
  • Robotics180 products
    • Humanoid & Legged Robots
    • Robot Chassis & Platforms
    • Robotic Arms & Grippers
    • Wheels & Casters
    View all
  • STEM Kits268 products
    • Arduino Learning Kits
    • Coding & IoT Kits
    • Early Coding (Ages 3-8)
    • Invention Kits
    View all
  • Atal Tinkering Lab196 products
    • Package 1: Electronics, Robotics, IoT and Sensors
    • Package 2: Rapid Prototyping Tools
    • Package 3: Mechanical, Electrical and Measurement Tools
    • Package 4: Power Supply, Accessories and Safety Equipment
    View all
  • Mechanical Parts212 products
    • Bearings
    • Brackets & Mounts
    • Couplers
    • Fasteners & Standoffs
    View all
  • Audio109 products
    • Amplifier Modules
    • Buzzers & Sirens
    • Speakers
    View all
  1. Home
  2. ›Guides
  3. ›Sensors
  4. ›I2C Proximity and Presence Sensors

Component guide · Intermediate · 3 min read

I2C Proximity and Presence Sensors

SparkFun VCNL4040 Qwiic, Vishay VCNL4200 and VCNL3030X01, RAK12017 ITR20001 and ST STHS34PF80 Human Presence Sensor

By Geekobot Learning Team · Updated 29 Oct 2026

On this page
Short answerWhat the VCNL4040, VCNL4200 and other I2C proximity and presence sensors isVCNL4040, VCNL4200 and other I2C proximity and presence sensors pinoutWiring the VCNL4040, VCNL4200 and other I2C proximity and presence sensorsExample codeSetup and tuningWhat you needAlternatives and when to choose themCommon mistakesFAQsParts and next steps
Short answer

These small sensors measure how close something is by sending infrared light and reading the reflection, over I2C. The VCNL4040 works to about 20 cm and also measures ambient light; the VCNL4200 reaches further, up to about 1.5 m. The STHS34PF80 is different: it senses body heat to detect people, even when they sit still.

Key specs at a glance

Interface
I2C, address 0x60 on VCNL4040
Supply
2.5 to 3.6V on the chips; boards often include a regulator
Range
About 20 cm (VCNL4040), up to 1.5 m (VCNL4200)
Extras
Ambient light on VCNL4040 and VCNL4200
Presence
STHS34PF80 thermal presence and motion
Connectors
Qwiic on SparkFun, WisBlock on RAK

Models in this guide

These are alternatives. Pick the one that fits your project; you only need one.

  • Option 1SparkFun Proximity Sensor Breakout – VCNL4040 (Qwiic)₹879
  • Option 2Vishay VCNL4200 High Sensitivity Long Distance Proximity & Ambient Light Sensor (ALS) Module₹389
  • Option 3Vishay VCNL3030X01-GS08 Proximity Sensor with IR Emitter & I2C, AEC-Q101, 2.5 to 3.6V₹369
  • Option 4RAKwireless IR Proximity Sensor Everlight Electronics ITR20001 RAK12017 Module – 1-5cm Detection, 3.3V₹829
  • Option 5STMicroelectronics STHS34PF80 Human Body Sensing Module – Digital Output₹929
01

What the VCNL4040, VCNL4200 and other I2C proximity and presence sensors is

The VCNL4040 and similar I2C proximity sensors combine an IR proximity sensor and ambient light sensor, used for short-range presence, phone-style screen-off and touchless buttons.

Use a VCNL4040 for touchless buttons, paper-present detection or wake-on-approach. The raw value rises as an object gets closer; it is not calibrated in millimetres, so record values for your own target and set thresholds.

The STHS34PF80 suits occupancy sensing in rooms and on desks because it sees a still person, unlike a PIR. The RAK12017 module brings a reflective IR sensor to the RAK WisBlock system.

02

VCNL4040, VCNL4200 and other I2C proximity and presence sensors pinout

The pins on the VCNL4040, VCNL4200 and other I2C proximity and presence sensors and what each one does.

PinFunction
VCC3.3V (or 5V on boards with a regulator)
GNDGround
SDAI2C data
SCLI2C clock
INTOptional interrupt output
PinFunction
VCC
3.3V (or 5V on boards with a regulator)
GND
Ground
SDA
I2C data
SCL
I2C clock
INT
Optional interrupt output
03

Wiring the VCNL4040, VCNL4200 and other I2C proximity and presence sensors

Keep a clear window in front of the sensor. A cover glass can reflect IR and give a false reading unless it has a gasket around the sensor.

VCNL4040, VCNL4200 and other I2C proximity and presence sensors pinConnectionNote
VCC3.3VCheck the board
GNDGNDCommon ground
SDAESP32 GPIO21A4 on Uno via level-safe board
SCLESP32 GPIO22A5 on Uno
VCC
Connection:
3.3V
Note:
Check the board
GND
Connection:
GND
Note:
Common ground
SDA
Connection:
ESP32 GPIO21
Note:
A4 on Uno via level-safe board
SCL
Connection:
ESP32 GPIO22
Note:
A5 on Uno
04

Example code

Uses the Adafruit VCNL4040 library. Tune the 1000 threshold for your target and distance.

Read proximity and light from a VCNL4040 (ESP32) · Arduino C++Verify & upload in Electrolark
#include <Wire.h>
#include <Adafruit_VCNL4040.h>

Adafruit_VCNL4040 vcnl;

void setup() {
  Serial.begin(115200);
  Wire.begin(21, 22);
  if (!vcnl.begin()) {
    Serial.println("VCNL4040 not found");
    while (1) delay(10);
  }
}

void loop() {
  uint16_t prox = vcnl.getProximity();
  uint16_t lux = vcnl.getLux();
  Serial.print("Proximity: "); Serial.print(prox);
  Serial.print("  Light: "); Serial.print(lux); Serial.println(" lux");
  if (prox > 1000) Serial.println("Hand detected");
  delay(200);
}
05

Setup and tuning

Wiring

VCC 3.3 V (breakouts accept 5 V), GND, SDA and SCL.

Library

use the Adafruit VCNL4040 or SparkFun library.

Range

proximity works best up to about 20 cm.

Cover glass

use IR-transparent covers and avoid crosstalk with a gasket.

Thresholds

set proximity thresholds and interrupts for low power.

06

What you need

Shop this list8 of 8 found in our store · ₹3,901

  • SparkFun Proximity Sensor Breakout – VCNL4040 (Qwiic): the part this guide coversSparkFun Proximity Sensor Breakout – VCNL4040 (Qwiic)₹879
  • Vishay VCNL4200 High Sensitivity Long Distance Proximity & Ambient Light Sensor (ALS) Module: another version this guide coversVishay VCNL4200 High Sensitivity Long Distance Proximity & Ambient Light Sensor (ALS) Module₹389
  • Vishay VCNL3030X01-GS08 Proximity Sensor with IR Emitter & I2C, AEC-Q101, 2.5 to 3.6V: another version this guide coversVishay VCNL3030X01-GS08 Proximity Sensor with IR Emitter & I2C, AEC-Q101, 2.5 to 3.6V₹369
  • RAKwireless IR Proximity Sensor Everlight Electronics ITR20001 RAK12017 Module – 1-5cm Detection, 3.3V: another version this guide coversRAKwireless IR Proximity Sensor Everlight Electronics ITR20001 RAK12017 Module – 1-5cm Detection, 3.3V₹829
  • STMicroelectronics STHS34PF80 Human Body Sensing Module – Digital Output: another version this guide coversSTMicroelectronics STHS34PF80 Human Body Sensing Module – Digital Output₹929
  • ESP32-WROOM-32 38-pin development board: for Wi-Fi logging and dashboardsESP32-WROOM-32 38-Pin Development Board₹389
  • Dupont jumper wires: for the connectionsDupont Jumper Wires (40 pcs)₹49Closest match, check the specs
  • Solderless breadboard: to build without solderingSolderless Breadboard₹68
07

Alternatives and when to choose them

  • ✓APDS9960 gesture sensor: proximity plus gestures and colour.
  • ✓Sharp IR distance sensors: analog distance.
  • ✓Mini PIR motion sensors: motion only.
08

Common mistakes to avoid

  • !Cover glass crosstalk.
  • !Expecting cm distance.
  • !No thresholds for low power.
  • !Dark targets at long range.
09

Frequently asked questions

How far can the VCNL4040 detect objects?

Up to about 20 cm, depending on the object's reflectivity.

Why does it detect something with nothing there?

Light leaks through the cover glass; add a gasket.

Can it measure distance in cm?

No. It gives relative proximity counts, not an exact distance.

Does it also measure light?

Yes. It also has an ambient light sensor for lux readings.

Can I use interrupts?

Yes. Set proximity thresholds and connect the INT pin to an interrupt.

Parts for this guide

  • SparkFun Proximity Sensor Breakout – VCNL4040 (Qwiic)
    ₹879View
  • Vishay VCNL4200 High Sensitivity Long Distance Proximity & Ambient Light Sensor (ALS) Module
    ₹389View
  • Vishay VCNL3030X01-GS08 Proximity Sensor with IR Emitter & I2C, AEC-Q101, 2.5 to 3.6V
    ₹369View
  • RAKwireless IR Proximity Sensor Everlight Electronics ITR20001 RAK12017 Module – 1-5cm Detection, 3.3V
    ₹829View
  • STMicroelectronics STHS34PF80 Human Body Sensing Module – Digital Output
    ₹929View
  • ESP32-WROOM-32 38-Pin Development Board
    ₹389View
  • Dupont Jumper Wires (40 pcs)
    ₹49View
  • Solderless Breadboard
    ₹68View
Shop Proximity & Inductive/Capacitive Sensors

Keep learning

Component guideIntermediateAPDS-9960 Gesture, Proximity and Colour SensorThe APDS-9960 from Broadcom senses hand gestures (up, down, left, right), proximity, ambient light and RGB colour in one small module.3 min read · SensorsComponent guideBeginnerSharp IR Distance SensorsSharp IR distance sensors measure distance by triangulation and output an analog voltage that falls as the distance grows.3 min read · SensorsComponent guideBeginnerMini PIR Motion Sensor ModulesMini PIR modules detect a person moving and set an output pin high, with no adjustment needed on most.5 min read · Sensors

Sources

  • Vishay VCNL4040 and VCNL4200 data sheets
  • ST STHS34PF80 data sheet
  • Adafruit VCNL4040 library

Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.

On this page
Short answerWhat the VCNL4040, VCNL4200 and other I2C proximity and presence sensors isVCNL4040, VCNL4200 and other I2C proximity and presence sensors pinoutWiring the VCNL4040, VCNL4200 and other I2C proximity and presence sensorsExample codeSetup and tuningWhat you needAlternatives and when to choose themCommon mistakesFAQsParts and next steps
Need a hand?Ask Geeko AI which part fits your project, or talk to the Geekobot team.Ask Geeko AIHelp & support

Parts for this guide3 items · ₹1,336

SparkFun Proximity Sensor Breakout – VCNL4040 (Qwiic) · ESP32-WROOM-32 38-Pin Development Board · Solderless Breadboard

Run itChange the inputs and watch the output

Proximity counts rise as a hand comes closer (up to about 20 cm). Above 1000 means a hand is near.

Serial monitor115200 baud
Proximity: 73  Light: 250 lux

A simulation of the sketch above, so you know what to expect. Real readings vary with your parts and wiring.

Ask the Community

Ask a question