How does it work?
Ambient 9 Click is based on the APDS-9160-003, digital proximity, and ambient light sensing sensor from Broadcom Limited. The ambient light sensor provides a photopic response to light intensity in low light conditions or behind a darkened glass. It approximates the response of the human eye providing direct readout where the output count is proportional to the ambient light level. The proximity detection also operates well from bright sunlight to dark rooms. Additionally, the device can be put into a low-power standby mode providing a very low average power consumption.
In a proximity sensing system, the included IR LED can be pulsed with more than 100 mA of rapidly switching current. The number of LED pulses can be configured by using the pulse step, and the LED modulation frequency can be set from 60 kHz to 100 kHz in 5 steps. Proximity sensing resolution can vary from 8 to 11 bits, and the measurement rate can vary from 6.25 ms to 400 ms. This Click board™ is easy to program and read data because it does not require an overly demanding configuration. In order to read ambient or proximity data, it is only necessary to enable certain registers which can also be seen in an example code that contains easy to use functions that may be used as a reference for the further development.
Ambient 9 Click communicates with the MCU using the standard I2C 2-wire interface. Standard (100 kHz) and Fast (400 kHz) I2C communication modes are available with the device. The I2C bus lines are routed to the dual bidirectional PCA9306 voltage-level translator from Texas Instruments, which allows interfacing with both 3.3V and 5V MCUs. It also generates flexible ambient and proximity programmable interrupt signals routed on the INT pin of the mikroBUS™, which are triggered if upper or lower threshold values are crossed. It is also possible to deactivate a sensor after a certain interrupt event occurred.
This Click Board™ is designed to be operated with both 3.3V and 5V logic levels that can be selected via VCC SEL jumper. This allows for both 3.3V and 5V capable MCUs to use the I2C communication lines properly.
Specifications
Type
Optical
Applications
Can be used for display management to extend battery life and provide optimum viewing in diverse lighting conditions.
On-board modules
Ambient 9 Click is based on the APDS-9160-003, digital proximity, and ambient light sensing sensor from Broadcom Limited.
Key Features
Low power consumption, high precission, programmable interrupt, high sensitivity in low lux condition, and more.
Interface
I2C
Feature
No ClickID
Compatibility
mikroBUS™
Click board size
S (28.6 x 25.4 mm)
Input Voltage
3.3V or 5V
Pinout diagram
This table shows how the pinout on Ambient 9 Click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Onboard settings and indicators
Label | Name | Default | Description |
---|---|---|---|
LD1 | PWR | – | Power LED Indicator |
JP1 | VCC SEL | Left | Power Supply Voltage Selection 3V3/5V: Left position 3V3, Right position 5V |
Ambient 9 Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | – | – | 3.63 | V |
Peak Wavelength | – | 940 | – | nm |
Output Resolution | – | 18 | – | bit |
Operating Temperature Range | -40 | – | +85 | °C |
Software Support
We provide a library for the Ambient 9 Click on our LibStock page, as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Library Description
Library provides functions for basic reading and writing to device. There are some specific functions for enabling sesnors and reading data from previous enabled sensor.
Key functions:
void ambient9_enable_data ( uint8_t als_ps )
– Enable one of sensorsuint32_t ambient9_als_data ( void )
– Read ALS datauint16_t ambient9_proxy_data ( void )
– Read proximity data
Examples description
The application is composed of three sections :
- System Initialization – Initialization of I2C communication module, log and interrupt pin
- Application Initialization – Reads device status if it’s power on and part ID, then enables one of two sensor reading values.
- Application Task – Read one of two sleceted sensor values every 100ms.
void application_task ( ) { uint16_t proxy_data; uint32_t als_data; if ( AMBIENT9_ALS == dev_mode ) { als_data = ambient9_als_data( ); LongWordToStr( als_data, demo_txt ); mikrobus_logWrite( " - ALS data: ", _LOG_TEXT ); mikrobus_logWrite( demo_txt, _LOG_LINE ); } else if ( AMBIENT9_PROXY == dev_mode ) { proxy_data = ambient9_proxy_data( ); WordToStr( proxy_data, demo_txt ); mikrobus_logWrite( " - Proximity data: ", _LOG_TEXT ); mikrobus_logWrite( demo_txt, _LOG_LINE ); } Delay_ms( 100 ); }
The full application code, and ready to use projects can be found on our LibStock page.
Other mikroE Libraries used in the example:
- I2C
- Conversions
- UART
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.
mikroSDK
This Click board™ is supported with mikroSDK – MikroElektronika Software Development Kit. To ensure proper operation of mikroSDK compliant Click board™ demo applications, mikroSDK should be downloaded from the LibStock and installed for the compiler you are using.
For more information about mikroSDK, visit the official page.