Proximity sensor APDS-9960 with TinkerPie
Notices a hand a few centimetres away: touch-free switches.
| Type | Smart sensors (I2C) |
|---|---|
| Connect to | SENSOR port · 0x39 |
| Gives | 0-255 (closer = higher) |
| Simulator | Yes: a control appears under the simulated board |
How it works
The APDS-9960 shines invisible infrared light and measures how much bounces back from your hand. The closer the hand, the more light returns and the higher the number. The same chip can also sense colour, light level and simple swipe gestures.
How to wire it
Plug into any SENSOR 1-4 port (SDA, SCL, 3.3 V, GND). Each type has a fixed I2C address, so different types can share the bus.
Code
In blocks: Accessories category in TinkerPie Studio. As code:
// JavaScript
sensors.proximity()
// Arduino C++
sensors::proximity() Good to know
- Best range: a few centimetres up to about 10-15 cm.
- Uses I2C (address 0x39) and 3.3 V.
- Shiny or very dark objects reflect differently, so test with your real object.
Similar modules
- Light meter BH1750
- Temperature + humidity AHT20
- Temperature + humidity SHT31
- Motion sensor MPU6050
- Colour sensor TCS34725
- IR thermometer MLX90614
- Real-time clock DS3231
- 4-channel ADC ADS1115
More projects to try
Questions
Can I try the Proximity sensor APDS-9960 without buying one?
Yes. In TinkerPie Studio the simulator shows a control for it under the board, so you can test your program before you build it.
Can it work through glass or plastic?
Through thin, clear plastic it usually works, but reflections from the cover can confuse it. For touch-free switches, mount it behind a small window or leave it open.