Davide's Blog

APDS-9930 Arduino Quick-Start Guide

This is a mobile optimized version of this page, view original page.

In this guide I will show you how to get started with Arduino and an APDS-9930 ambient light and proximity sensor.

Materials used

You need a few components to follow this tutorial (click the links to see the product pages and buy the parts).

A soldering iron, tin wire and some soldering skills are also required to solder the break-away headers to the board.

Board overview

A quick explaination of what the pins on the board are for.

APDS-9930 Breakout Board

Pin label Description
VL Optional power to the IR LED if PS jumper is disconnected. Must be 3.0 – 4.5V
GND Ground
VCC Used to power the sensor. Must be 2.4 – 3.6V.
SCL I²C clock/td>
SDA I²C data
INT External interrupt. Pulled low by the sensor on interrupt event.

Make sure you solder the headers to the breakout board and to the level shifter. Putting the headers on the breadboard while soldering might help, as long as you don’t heat them for too long.

Connecting the board

Now you need to make the connections. Plug the level shifter in the middle of the breadboard, and the module on some other lines. We need to make sure the level shifter acts as a medium between the 5V Arduino board and the 3.3V sensor, so that the Arduino can communicate with the sensor and the sensor does not blow up. 😉

Connect the 5V pin of the Arduino board to the 5V pin on the level shifter, and do the same for ground, then connect 3V and GND on the other side of the level shifter to VCC and GND on the sensor. Now use any of the pins labeled “bidirectional lines” and make the following connections, but make sure they go through the shifter!
Note: the SDA and SCL pins are only available on the r3 revision of the boards and are usually marked on the back. If they’re not available, use analog pins 4 and 5.


Arduino pin APDS-9930 pin
SDA (or A4) SDA
SCL (or A5) SCL
2 (optional) INT

Installing and using the library

Download the library from here. Download and install the Arduino IDE.

Open the Arduino IDE, open the Sketch menu, Include library, and hit Add .ZIP library. Select the zip file of the library you just downloaded. The Arduino IDE will automatically install it.

Now open the File menu, go to Examples, APDS-9930 Ambient Light and Proximity Sensor and select the AmbientLightSensor example. Connect the board to the computer using the USB cable, then in the tools menu make sure you have selected the correct board model and serial port. Click Sketch then Upload. The code will be uploaded on the board and will start running, but you won’t notice anything. To get some feedback from the booard, open Tools then Serial Monitor. Make sure the baudrate is set to 9600 bps (the same value used in the sketch). You’ll start seeing some output coming from the sensor. Point a torch to it and see how the values change 🙂

Additional resources

There are more examples bundled with the library. I’ll explain quickly what they do.

Check the the APDS9930.cpp to see all the available functions. They’re all well documented inline.

Thanks for reading, I hope you found it useful. Let me know your thoughts in the comments below! 🙂