Unveil the possibilities that proximity detection offers and reimagine your interactions with devices and environments
A
A
Hardware Overview
How does it work?
Proximity 6 Click is based on the ADUX1020, a photometric sensor for the gesture and proximity detection, from Analog Devices. Among other sections, this IC contains a LED driver, used to drive an externally connected LED, which provides feedback for the ADUX1020 sensory sections. Therefore, the LED should be chosen so that its spectrum matches the spectral sensitivity of the on-chip light sensor. For this reason, the Click board™ is equipped with the narrow beam LED from OSRAM with its spectral response characteristic peaking at 860nm, which is a perfect choice for this application. The proximity detection consists of sending a pulse to the LED while measuring the response of the reflected light. Each data sample is constructed from the sum of a configurable number of individual pulses. There can be up to 64 such pulses. Additional intersample averaging can be applied to these values for the improved noise reduction, and the results are stored in the FIFO buffer, from where the MCU can read them via the standard I2C interface. Most of the parameters are user configurable, such as the sampling frequency, a number of pulses, averaging parameters and
more. More in-depth information about the registers can be found in the ADUX1020 datasheet. Aimed towards the low consumption market, the ADUX1020 uses a rather low voltage range, between 1.7V and 1.9V. Since the most of the MCUs use either 3.3V or 5V, the Click board™ has to be equipped with the supporting circuitry, which is used to convert the MCU signal levels to levels acceptable for the ADUX1020 IC. This supporting circuitry consists of a small LDO that provides 1.8V for the proper ADUX1020 IC operation, as well as the bidirectional I2C voltage level translator IC (PCA9306), and a single bit, dual voltage level translator IC (SN74LVC1T45), used for proper conversion of the logic voltage levels. These level shifting ICs are supplied with the referent 1.8V from the LDO from one side, and selectable VCC voltage from the other side. VCC voltage can be selected between 3.3V and 5V, by using the SMD jumper labeled as VCC SEL. This allows both 3.3V and 5V MCUs to be interfaced with the ADUX1020 IC. Proximity 6 click offers an interrupt output pin that can be used to trigger an interrupt on the host MCU. The ADUX1020 IC interrupt engine allows several interrupt sources, which can be
used to trigger a state change on the INT pin. These sources include configurable FIFO buffer threshold, two pairs of proximity detection interrupts (proximity OFF and proximity ON), sample interrupts, and even a watchdog interrupt. The INT pin itself is highly configurable. For example, it can be set to be either active HIGH or active LOW, or it can be set to output the internal clock of the ADUX1020 IC. When asserted, this pin triggers an MCU interrupt, informing it that the configured interrupt event has occurred. The MCU can then read the desired register output, not having to poll it constantly, which saves both MCU cycles and power. The INT pin is routed via the level shifting IC to the mikroBUS™ INT pin. As already mentioned, detailed information on the ADUX1020 IC registers can be found in the datasheet. However, MikroElektronika provides a library that contains functions compatible with the MikroElektronika compilers, which can be used for simplified programming of the Proximity 6 click. The library also contains an example application, which demonstrates its use. This example application can be used as a reference for custom designs.
Features overview
Development board
Nucleo-144 with STM32F413ZH MCU board offers an accessible and adaptable avenue for users to explore new ideas and construct prototypes. It allows users to tailor their experience by selecting from a range of performance and power consumption features offered by the STM32 microcontroller. With compatible boards, the
internal or external SMPS dramatically decreases power usage in Run mode. Including the ST Zio connector, expanding ARDUINO Uno V3 connectivity, and ST morpho headers facilitate easy expansion of the Nucleo open development platform. The integrated ST-LINK debugger/programmer enhances convenience by
eliminating the need for a separate probe. Moreover, the board is accompanied by comprehensive free software libraries and examples within the STM32Cube MCU Package, further enhancing its utility and value.
Microcontroller Overview
MCU Card / MCU
Architecture
ARM Cortex-M4
MCU Memory (KB)
1536
Silicon Vendor
STMicroelectronics
Pin count
144
RAM (Bytes)
327680
You complete me!
Accessories
Click Shield for Nucleo-144 comes equipped with four mikroBUS™ sockets, with one in the form of a Shuttle connector, allowing all the Click board™ devices to be interfaced with the STM32 Nucleo-144 board with no effort. This way, MIKROE allows its users to add any functionality from our ever-growing range of Click boards™, such as WiFi, GSM, GPS, Bluetooth, ZigBee, environmental sensors, LEDs, speech recognition, motor control, movement sensors, and many more. Featuring an ARM Cortex-M microcontroller, 144 pins, and Arduino™ compatibility, the STM32 Nucleo-144 board offers limitless possibilities for prototyping and creating diverse applications. These boards are controlled and powered conveniently through a USB connection to program and efficiently debug the Nucleo-144 board out of the box, with an additional USB cable connected to the USB mini port on the board. Simplify your project development with the integrated ST-Link debugger and unleash creativity using the extensive I/O options and expansion capabilities. This Click Shield also has several switches that perform functions such as selecting the logic levels of analog signals on mikroBUS™ sockets and selecting logic voltage levels of the mikroBUS™ sockets themselves. Besides, the user is offered the possibility of using any Click board™ with the help of existing bidirectional level-shifting voltage translators, regardless of whether the Click board™ operates at a 3.3V or 5V logic voltage level. Once you connect the STM32 Nucleo-144 board with our Click Shield for Nucleo-144, you can access hundreds of Click boards™, working with 3.3V or 5V logic voltage levels.
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Schematic
Step by step
Project assembly
Track your results in real time
Application Output
After loading the code example, pressing the "DEBUG" button builds and programs it on the selected setup.
After programming is completed, a header with buttons for various actions available in the IDE appears. By clicking the green "PLAY "button, we start reading the results achieved with Click board™.
Upon completion of programming, the Application Output tab is automatically opened, where the achieved result can be read. In case of an inability to perform the Debug function, check if a proper connection between the MCU used by the setup and the CODEGRIP programmer has been established. A detailed explanation of the CODEGRIP-board connection can be found in the CODEGRIP User Manual. Please find it in the RESOURCES section.
Software Support
Library Description
This library contains API for Proximity 6 Click driver.
Key functions:
proximity6_read_data
- Function reads proximity data when one or more data register is updatedproximity6_generic_write
- This function writes data to the desired registerproximity6_generic_read
- This function reads data from the desired register
Open Source
Code example
This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.
/*!
* \file
* \brief Proximity6 Click example
*
* # Description
* This application can detect the proximity of an object via sensor and can show the results
* of proximity as a graphic view, or show the position of the object.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Sets the registers in default state and configures the device to work in
* proper operating mode (Proximity Mode).
* ## Application Task
* Example can show the data register values as graphic view in desired resolution.
* Also can determine from which side the object (body) affects on the sensor and logs results on USB UART.
* Results will be shown only when one or more data registers are updated with the new value (sensor detects the change).
*
* Additional Functions :
* - void proximity6_logGraphicRes() - Function loggs on USB UART results from the data proximity registers as graphic view.
* - void proximity6_logPositionRes() - Function loggs on USB UART the position of the object which affects of the sensor.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "proximity6.h"
// ------------------------------------------------------------------ VARIABLES
static proximity6_t proximity6;
static log_t logger;
// ------------------------------------------------------- ADDITIONAL FUNCTIONS
void proximity6_log_graphic_res ( proximity6_t *ctx )
{
uint8_t count1;
uint8_t count2;
uint8_t axis_data[ 4 ];
proximity6_display_data( ctx, &axis_data[ 0 ], PROXIMITY6_RESOLUTION_300 );
for ( count1 = 0; count1 < 4; count1++ )
{
if ( axis_data[ count1 ] == 0 )
{
log_printf( &logger, "MIN\r\n" );
}
else
{
for ( count2 = 0; count2 <= axis_data[ count1 ]; count2++ )
{
if ( count2 < axis_data[ count1 ] )
{
log_printf( &logger, "|" );
}
else
{
log_printf( &logger, "|\r\n" );
}
}
}
}
log_printf( &logger, "\r\n" );
}
void proximity6_log_position_res ( proximity6_t *ctx )
{
uint8_t check_pos;
proximity6_get_position( ctx, &check_pos );
switch ( check_pos )
{
case PROXIMITY6_RIGHT_POS :
{
log_printf( &logger, "Right\r\n" );
break;
}
case PROXIMITY6_LEFT_POS :
{
log_printf( &logger, "Left\r\n" );
break;
}
case PROXIMITY6_BOTTOM_POS :
{
log_printf( &logger, "Bottom\r\n" );
break;
}
case PROXIMITY6_UP_POS :
{
log_printf( &logger, "Up\r\n" );
break;
}
default :
{
break;
}
}
Delay_ms( 200 );
}
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
proximity6_cfg_t cfg;
/**
* Logger initialization.
* Default baud rate: 115200
* Default log level: LOG_LEVEL_DEBUG
* @note If USB_UART_RX and USB_UART_TX
* are defined as HAL_PIN_NC, you will
* need to define them manually for log to work.
* See @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
// Click initialization.
proximity6_cfg_setup( &cfg );
PROXIMITY6_MAP_MIKROBUS( cfg, MIKROBUS_1 );
proximity6_init( &proximity6, &cfg );
Delay_ms( 300 );
proximity6_default_cfg( &proximity6 );
proximity6_load_settings( &proximity6 );
proximity6_set_mode( &proximity6, PROXIMITY6_PROXIMITY_MODE );
log_printf( &logger, "Proximity 6 is initialized\r\n\r\n" );
Delay_ms( 300 );
}
void application_task ( void )
{
// Task implementation.
proximity6_log_position_res( &proximity6 );
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END