TOP Contributors

  1. MIKROE (2784 codes)
  2. Alcides Ramos (385 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (97 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 (139845 times)
  2. FAT32 Library (72210 times)
  3. Network Ethernet Library (57392 times)
  4. USB Device Library (47740 times)
  5. Network WiFi Library (43364 times)
  6. FT800 Library (42700 times)
  7. GSM click (29980 times)
  8. mikroSDK (28440 times)
  9. PID Library (26989 times)
  10. microSD click (26398 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

Angle 7 Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.9

mikroSDK Library: 2.0.0.0

Category: Magnetic

Downloaded: 179 times

Not followed.

License: MIT license  

Angle 7 Click is a compact add-on board that detects the absolute angular position of a permanent magnet. This board features the AS5600, a programmable Hall-based rotary magnetic position sensor with a high-resolution 12-bit analog or PWM output from ams AG.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Angle 7 Click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Angle 7 Click" changes.

Do you want to report abuse regarding "Angle 7 Click".

  • Information
  • Comments (0)

mikroSDK Library Blog


Angle 7 Click

Angle 7 Click is a compact add-on board that detects the absolute angular position of a permanent magnet. This board features the AS5600, a programmable Hall-based rotary magnetic position sensor with a high-resolution 12-bit analog or PWM output from ams AG.

angle7_click.png

Click Product page


Click library

  • Author : Stefan Filipovic
  • Date : May 2022.
  • Type : I2C type

Software Support

We provide a library for the Angle 7 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 Angle 7 Click driver.

Standard key functions :

  • angle7_cfg_setup Config Object Initialization function.

    void angle7_cfg_setup ( angle7_cfg_t *cfg );
  • angle7_init Initialization function.

    err_t angle7_init ( angle7_t *ctx, angle7_cfg_t *cfg );
  • angle7_default_cfg Click Default Configuration function.

    err_t angle7_default_cfg ( angle7_t *ctx );

Example key functions :

  • angle7_get_status This function reads the status data.

    err_t angle7_get_status ( angle7_t *ctx, uint8_t *status );
  • angle7_get_angle This function reads the calculated angle in degrees.

    err_t angle7_get_angle ( angle7_t *ctx, float *angle );
  • angle7_get_magnitude This function reads the magnitude data.

    err_t angle7_get_magnitude ( angle7_t *ctx, uint16_t *magnitude );

Example Description

This example demonstrates the use of Angle 7 Click board by reading and displaying the magnet's angular position in degrees and analog voltage output as well as the magnet's status and magnitude.

The demo application is composed of two sections :

Application Init

Initializes the driver and performs the Click default configuration.


void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    angle7_cfg_t angle7_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.
    angle7_cfg_setup( &angle7_cfg );
    ANGLE7_MAP_MIKROBUS( angle7_cfg, MIKROBUS_1 );
    if ( I2C_MASTER_ERROR == angle7_init( &angle7, &angle7_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    if ( ANGLE7_ERROR == angle7_default_cfg ( &angle7 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }

    log_info( &logger, " Application Task " );
}

Application Task

Reads the magnet's angular position in degrees and analog voltage output as well as the magnet's status and magnitude and displays the results on the USB UART approximately every 100ms.

void application_task ( void )
{
    float voltage, raw_angle, angle;
    uint16_t magnitude;
    uint8_t status;
    if ( ADC_ERROR != angle7_read_an_pin_voltage ( &angle7, &voltage ) ) 
    {
        log_printf( &logger, " AN voltage: %.3f V\r\n", voltage );
    }
    if ( ANGLE7_OK == angle7_get_angle ( &angle7, &angle ) )
    {
        log_printf ( &logger, " Angle: %.2f Degrees\r\n", angle );
    }
    if ( ANGLE7_OK == angle7_get_magnitude ( &angle7, &magnitude ) )
    {
        log_printf ( &logger, " Magnitude: %u\r\n", magnitude );
    }
    if ( ANGLE7_OK == angle7_get_status ( &angle7, &status ) )
    {
        log_printf ( &logger, " Status:" );
        if ( status & ANGLE7_STATUS_MAGNET_DETECTED )
        {
            log_printf ( &logger, " Magnet Detected \r\n Magnet Strength:" );
            if ( status & ANGLE7_STATUS_MAGNET_TOO_STRONG )
            {
                log_printf ( &logger, " Too Strong \r\n\n" );
            }
            else if ( status & ANGLE7_STATUS_MAGNET_TOO_WEAK )
            {
                log_printf ( &logger, " Too Weak \r\n\n" );
            }
            else
            {
                log_printf ( &logger, " Good \r\n\n" );
            }
        }
        else
        {
            log_printf ( &logger, " Magnet Not Detected \r\n\n" );
        }
    }
    Delay_ms ( 100 );
}

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.Angle7

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

BT-EZ click

5

The BT-EZ click is a Click board witch provide BT/BLE connectivity for any embedded application. BT-EZ click based on the CYBT-343026-01, a module from Cypress.

[Learn More]

Smart DOF Click

0

SmartDOF Click features a highly advanced integrated system-in-package (SiP) solution with three different sensors on-chip: triaxial accelerometer, magnetometer, and triaxial gyroscope are all integrated on the same die, along with the powerful 32-bit ARM® Cortex®-M0+ MCU. Thanks to the integrated MCU, the BN080 SiP provides extensive signal processing.

[Learn More]

Mic click

0

Mic click carries the SPQ0410HR5H-B surface mount silicon microphone with maximum RF protection. The click is designed to run on a 3.3V power supply. It communicates with the target microcontroller over the AN pin on the mikroBUSâ„¢ line.

[Learn More]