Embrace precise tilt sensing by integrating a tilt sensor and unlock new dimensions of control and accuracy – take the next step today!
A
A
Hardware Overview
How does it work?
Tilt Click is based on the RPI-1035, a four-directional optical tilt sensor from Rohm Semiconductor, capable of sensing a change in orientation in four different directions: forward, back, left, or right. Compared to mechanical solutions, this optical direction detector is less prone to noise caused by vibrations. Also, the RPI-1035 is less influenced by magnetic disturbances than magnetic-based direction detectors. Based on various quality features, this Click board™ is ideal in cases where it is only necessary to detect movement direction, avoiding using a much more
expensive accelerometer. The operation of the RPI-1035 is straightforward. Inside the sensor is an infrared LED, which communicates with two photosensitive receivers through a reflective surface. Between these components and the reflective surface is a cover that, depending on the movement of the component, can cover the IR sensor or the receivers. Depending on the detected direction, this sensor forwards information to the host MCU through the two mikroBUS™ lines, VO1 and VO2, routed to the PWM and INT pins of the mikroBUS™ socket. Also,
in addition to digital information, this board has two red LEDs providing visual feedback from the sensor. This Click board™ can operate with both 3.3V and 5V logic voltage levels selected via the PWR SEL jumper. This way, it is allowed for both 3.3V and 5V capable MCUs to use the communication lines properly. However, the Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used, as a reference, for further development.
Features overview
Development board
PIC18F57Q43 Curiosity Nano evaluation kit is a cutting-edge hardware platform designed to evaluate microcontrollers within the PIC18-Q43 family. Central to its design is the inclusion of the powerful PIC18F57Q43 microcontroller (MCU), offering advanced functionalities and robust performance. Key features of this evaluation kit include a yellow user LED and a responsive
mechanical user switch, providing seamless interaction and testing. The provision for a 32.768kHz crystal footprint ensures precision timing capabilities. With an onboard debugger boasting a green power and status LED, programming and debugging become intuitive and efficient. Further enhancing its utility is the Virtual serial port (CDC) and a debug GPIO channel (DGI
GPIO), offering extensive connectivity options. Powered via USB, this kit boasts an adjustable target voltage feature facilitated by the MIC5353 LDO regulator, ensuring stable operation with an output voltage ranging from 1.8V to 5.1V, with a maximum output current of 500mA, subject to ambient temperature and voltage constraints.
Microcontroller Overview
MCU Card / MCU
Architecture
PIC
MCU Memory (KB)
128
Silicon Vendor
Microchip
Pin count
48
RAM (Bytes)
8196
You complete me!
Accessories
Curiosity Nano Base for Click boards is a versatile hardware extension platform created to streamline the integration between Curiosity Nano kits and extension boards, tailored explicitly for the mikroBUS™-standardized Click boards and Xplained Pro extension boards. This innovative base board (shield) offers seamless connectivity and expansion possibilities, simplifying experimentation and development. Key features include USB power compatibility from the Curiosity Nano kit, alongside an alternative external power input option for enhanced flexibility. The onboard Li-Ion/LiPo charger and management circuit ensure smooth operation for battery-powered applications, simplifying usage and management. Moreover, the base incorporates a fixed 3.3V PSU dedicated to target and mikroBUS™ power rails, alongside a fixed 5.0V boost converter catering to 5V power rails of mikroBUS™ sockets, providing stable power delivery for various connected devices.
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Schematic
Step by step
Project assembly
Track your results in real time
Application Output via Debug Mode
1. Once the code example is loaded, pressing the "DEBUG" button initiates the build process, programs it on the created setup, and enters Debug mode.
2. After the programming is completed, a header with buttons for various actions within the IDE becomes visible. Clicking the green "PLAY" button starts reading the results achieved with the Click board™. The achieved results are displayed in the Application Output tab.
Software Support
Library Description
This library contains API for Tilt Click driver.
Key functions:
tilt_direction
- Check the tilt movement's direction function
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 Tilt Click example
*
* # Description
* This is a example which demonstrates the use of Tilt Click board.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Configuring clicks and log objects.
*
* ## Application Task
* Detect the movement's direction
* of RPI-1035 Surface Mount Type 4-Direction Detector on Tilt click board.
* Results are being sent to the Usart Terminal where you can track their changes.
* All data logs on usb uart when the movement's direction is changed.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "tilt.h"
// ------------------------------------------------------------------ VARIABLES
static tilt_t tilt;
static log_t logger;
static uint8_t tilt_direction_new;
static uint8_t tilt_direction_old;
// ------------------------------------------------------- ADDITIONAL FUNCTIONS
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
tilt_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_printf(&logger, "---- Application Init ----\r\n");
// Click initialization.
tilt_cfg_setup( &cfg );
TILT_MAP_MIKROBUS( cfg, MIKROBUS_1 );
tilt_init( &tilt, &cfg );
tilt_direction_old = 0;
log_printf(&logger, "-------------\r\n");
log_printf(&logger, " Tilt Click \r\n");
log_printf(&logger, "-------------\r\n");
Delay_ms( 100 );
}
void application_task ( void )
{
tilt_direction_new = tilt_direction( &tilt );
if ( tilt_direction_old != tilt_direction_new )
{
if ( tilt_direction_new == TILT_LEFT_DETECTION )
{
log_printf(&logger, " LEFT \r\n");
}
if ( tilt_direction_new == TILT_RIGHT_DETECTION )
{
log_printf(&logger, " RIGHT \r\n");
}
if ( tilt_direction_new == TILT_UP_DETECTION )
{
log_printf(&logger, " UP \r\n");
}
if ( tilt_direction_new == TILT_DOWN_DETECTION )
{
log_printf(&logger, " DOWN \r\n");
}
tilt_direction_old = tilt_direction_new;
log_printf(&logger, "-------------\r\n");
}
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END