TOP Contributors

  1. MIKROE (2654 codes)
  2. Alcides Ramos (352 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (136749 times)
  2. FAT32 Library (69954 times)
  3. Network Ethernet Library (55942 times)
  4. USB Device Library (46267 times)
  5. Network WiFi Library (41888 times)
  6. FT800 Library (41181 times)
  7. GSM click (28986 times)
  8. PID Library (26414 times)
  9. mikroSDK (26367 times)
  10. microSD click (25377 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
mikroSDK Library

Speed Sense click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.5

mikroSDK Library: 2.0.0.0

Category: Magnetic

Downloaded: 24 times

Not followed.

License: MIT license  

Speed Sense Click is a compact add-on board that allows you to measure the speed and rotation of a spinning object. This board features the A17501, a dual output differential speed and direction sensor from Allegro Microsystems. It has a high-speed switching bandwidth of up to 40kHz for two different signals. The sensor has two independent output channels with options for high-resolution XOR speed, pulse, and direction protocol.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Speed Sense click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Speed Sense click" changes.

Do you want to report abuse regarding "Speed Sense click".

  • Information
  • Comments (0)

mikroSDK Library Blog


Speed Sense click

Speed Sense Click is a compact add-on board that allows you to measure the speed and rotation of a spinning object. This board features the A17501, a dual output differential speed and direction sensor from Allegro Microsystems. It has a high-speed switching bandwidth of up to 40kHz for two different signals. The sensor has two independent output channels with options for high-resolution XOR speed, pulse, and direction protocol.

speedsense_click.png

click Product page


Click library

  • Author : Nenad Filipovic
  • Date : Oct 2023.
  • Type : GPIO type

Software Support

We provide a library for the Speed Sense Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Library Description

This library contains API for Speed Sense Click driver.

Standard key functions :

  • speedsense_cfg_setup Config Object Initialization function.

    void speedsense_cfg_setup ( speedsense_cfg_t *cfg );
  • speedsense_init Initialization function.

    err_t speedsense_init ( speedsense_t *ctx, speedsense_cfg_t *cfg );

Example key functions :

  • speedsense_get_speed This function reads the state of the CHA pin used for speed output protocols.

    uint8_t speedsense_get_speed ( speedsense_t *ctx );
  • speedsense_get_direction This function reads the state of the CHB pin used for direction output protocols.

    uint8_t speedsense_get_direction ( speedsense_t *ctx );

Example Description

This library contains the API for the Speed Sense Click driver for the speed and direction signal state detection for every magnetic pole pair.

The demo application is composed of two sections :

Application Init

Initialization of GPIO and log UART.

void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    speedsense_cfg_t speedsense_cfg;  /**< Click config object. */

    /** 
     * 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.
    speedsense_cfg_setup( &speedsense_cfg );
    SPEEDSENSE_MAP_MIKROBUS( speedsense_cfg, MIKROBUS_1 );
    if ( DIGITAL_OUT_UNSUPPORTED_PIN == speedsense_init( &speedsense, &speedsense_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    log_info( &logger, " Application Task " );
    log_printf( &logger, "-----------------------\r\n" );
}

Application Task

This example demonstrates the use of the Speed Sense Click board. The demo application displays the direction of movement and rotation speed (rotations per minute) of the ring magnet with three pairs of rotating poles positioned in the sensor operating range.

void application_task ( void ) 
{
    uint8_t direction = 0, speed = 0;
    speed = speedsense_get_speed( &speedsense );
    direction = speedsense_get_direction( &speedsense );

    if ( start_measure & speed )
    {
        signal_duration = time_cnt - start_timer;
        start_timer = time_cnt;

        if ( SPEEDSENSE_DIR_STATE_FWD == direction )
        {
            log_printf( &logger, " Direction: Forward\r\n" );
        }
        else
        {
            log_printf( &logger, " Direction: Reverse\r\n" );
        }
        log_printf( &logger, " Speed: %.2f rpm\r\n", SPEEDSENSE_CALC_RMP / signal_duration );
        log_printf( &logger, " Duration: %lu ms\r\n", signal_duration );
        log_printf( &logger, " Time: %lu  ms\r\n", time_cnt );
        log_printf( &logger, "-----------------------\r\n" );
        start_measure = SPEEDSENSE_STOP_MEASURE;
    }
    else if ( ( !start_measure ) & ( !speed ) )
    {
        start_measure = SPEEDSENSE_START_NEW_MEASURE;
    }

    time_cnt++;
    Delay_ms ( 1 );
}

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Other Mikroe Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.SpeedSense

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. UART terminal is available in all MikroElektronika compilers.


ALSO FROM THIS AUTHOR

Gyro 5 click

0

Gyro 5 Click is a three-axis gyroscope Click board™ that can sense motion over three perpendicular axes. It is equipped with the ITG-3701, a three-axis digital gyroscope.

[Learn More]

Angle 2 click

5

Angle 2 click is a magnetic rotational sensor which relies on the ultra-fast MA700 angular sensor IC.

[Learn More]

DALI 3.3V click - Example

1

This example demonstrates use of DALI protocol for controlling leds on board. There are two DALI click cards which allow protocol communication.

[Learn More]