TOP Contributors

  1. MIKROE (2663 codes)
  2. Alcides Ramos (358 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 (137101 times)
  2. FAT32 Library (70236 times)
  3. Network Ethernet Library (56126 times)
  4. USB Device Library (46434 times)
  5. Network WiFi Library (42077 times)
  6. FT800 Library (41389 times)
  7. GSM click (29116 times)
  8. mikroSDK (26562 times)
  9. PID Library (26501 times)
  10. microSD click (25487 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: 29 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

WiFi 5 Click

1

WiFi 5 click™ is a mikroBUS™ add-on board with Gainspan’s GS1500M ultra low-power Wi-Fi module with a PCB trace antenna (external IPX antenna connector also available). WiFi 5 click communicates with the target MCU through the mikroBUS™ UART interface (TX, RX)..

[Learn More]

9DOF click

0

9DOF click carries ST’s LSM9DS1 inertial measurement module that combines a 3D accelerometer, a 3D gyroscope and a 3D magnetometer into a single device outputting so called nine degrees of freedom data...

[Learn More]

LTE Cat.1-EU click

0

LTE Cat.1-EU click is a Click board™ based on Thales Cinterion® ELS61 wireless module that delivers highly efficient Cat 1 LTE connectivity for M2M IoT solutions offering seamless fall back to 2G and 3G networks. The best in class solution enables M2M optimized speeds of 10Mbit/s download and 5Mbit/s uplink making it ideal for the vast number of M2M and industrial IoT applications that are not dependent on speed but that requires the longevity of LTE networks, while still providing 3G and 2G connectivity to ensure complete population and geographic coverage as LTE rolls out.

[Learn More]