TOP Contributors

  1. MIKROE (2664 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 (137127 times)
  2. FAT32 Library (70240 times)
  3. Network Ethernet Library (56131 times)
  4. USB Device Library (46447 times)
  5. Network WiFi Library (42103 times)
  6. FT800 Library (41410 times)
  7. GSM click (29125 times)
  8. mikroSDK (26567 times)
  9. PID Library (26510 times)
  10. microSD click (25500 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

pH click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.6

mikroSDK Library: 2.0.0.0

Category: Environmental

Downloaded: 61 times

Not followed.

License: MIT license  

pH Click is a compact add-on board that provides an opportunity for the user to read pH with the same accuracy and capabilities as with some other expensive solutions. This board features the pH EZO™, a 6th generation embedded pH circuit that offers the highest level of stability and accuracy from AtlasScientific.

No Abuse Reported

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

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

Do you want to report abuse regarding "pH click".

  • mikroSDK Library 1.0.0.0
  • Comments (0)

mikroSDK Library Blog


pH click

pH Click is a compact add-on board that provides an opportunity for the user to read pH with the same accuracy and capabilities as with some other expensive solutions. This board features the pH EZO™, a 6th generation embedded pH circuit that offers the highest level of stability and accuracy from AtlasScientific.

ph_click.png

click Product page


Click library

  • Author : Stefan Ilic
  • Date : Oct 2021.
  • Type : UART type

Software Support

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

Standard key functions :

  • ph_cfg_setup Config Object Initialization function.

    void ph_cfg_setup ( ph_cfg_t *cfg );
  • ph_init Initialization function.

    err_t ph_init ( ph_t *ctx, ph_cfg_t *cfg );
  • ph_default_cfg Click Default Configuration function.

    err_t ph_default_cfg ( ph_t *ctx );

Example key functions :

  • ph_send_cmd Send command function.

    void ph_send_cmd ( ph_t *ctx, char *p_cmd );
  • ph_get_cmd_resp Send get response function.

    void ph_get_cmd_resp ( ph_t *ctx, char *p_cmd, char *p_resp );
  • ph_switch_led Toggle LED function.

    void ph_switch_led ( ph_t *ctx, uint8_t state, char *p_resp );

Example Description

This example reads and processes data from pH clicks.

The demo application is composed of two sections :

Application Init

Initializes UART driver, performing a factory reset of the device, disabling continuous read, and performing calibration at the midpoint on the pH scale.


void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    ph_cfg_t ph_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.
    ph_cfg_setup( &ph_cfg );
    PH_MAP_MIKROBUS( ph_cfg, MIKROBUS_1 );
    if ( UART_ERROR == ph_init( &ph, &ph_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    ph_factory_rst( &ph, app_buf );
    Delay_ms ( 1000 );

    ph_cont_read( &ph, 0, app_buf );
    log_printf( &logger, "-----------------------\r\n" );
    log_printf( &logger, "   -- Initialized --   \r\n" );
    log_printf( &logger, "-----------------------\r\n" );
    log_printf( &logger, "  Place probe into pH  \r\n" );
    log_printf( &logger, " neutral substance for \r\n" );
    log_printf( &logger, " mid point calibration \r\n" );
    log_printf( &logger, "-----------------------\r\n" );
    for ( uint8_t n_cnt = 0; n_cnt < 20; n_cnt++ )
    {
        Delay_ms ( 1000 );
    }
    log_printf( &logger, " Starting calibration  \r\n" );
    log_printf( &logger, "-----------------------\r\n" );
    ph_perf_calib ( &ph, PH_CMD_CALIB_MID, 7.000, app_buf );
    Delay_ms ( 1000 );
    log_printf( &logger, " Calibration done!     \r\n" );
    log_printf( &logger, "-----------------------\r\n" );

    log_printf( &logger, " - Application  task -\r\n" );
    log_printf( &logger, "-----------------------\r\n" );
    ph_send_cmd( &ph, PH_CMD_DIS_RSP_CODES );
    Delay_ms ( 1000 );
    ph_clr_log_buf( app_buf );
}

Application Task

This example shows the capabilities of the pH Click board by performing a reading of the pH value of the substance in which the probe is submerged and displaying readings via the USART terminal.


void application_task ( void ) 
{
    ph_send_cmd ( &ph, PH_CMD_SET_SNGL_READ );
    ph_response( &ph, app_buf );
    log_printf( &logger, " pH value: %s ", app_buf );
    log_printf( &logger, "-----------------------\r\n" );
    ph_clr_log_buf( app_buf );
    Delay_ms ( 1000 );
}

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

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

2x2 Key click

0

2x2 Key click has a 4 button keypad. The click allows multiple key presses and has a debounce circuit composed of 74HC32 quad 2-input OR gate from NXP and the SN74HC14 Hex Schmitt-Trigger Inverter from Texas Instruments. 2x2 Key click is designed to use either 3.3V or 5V power supply.

[Learn More]

STSPIN233 click

5

STSPIN233 click is a complete solution for a 3-phase integrated motor driver, based on the STSPIN233, Low voltage 3-phase integrated motor driver. It is optimized for battery-powered, low voltage motor driving applications, featuring the lowest standby current available on the market (max 80 nA).

[Learn More]

Thermo 21 click

0

Thermo 21 Click is a compact add-on board that provides an accurate temperature measurement. This board features the ADT7301, a high-precision digital temperature sensor from Analog Devices. The ADT7301 houses an on-chip temperature sensor, a 13-bit A/D converter, a reference circuit, and serial interface logic functions in one package. Characterized by its high accuracy (up to ±0.5°C typical) and high resolution of 0.03125°C, this temperature sensor provides temperature data to the host controller with a configurable SPI interface. This Click board™ is appropriate for process control, environmental monitoring, domestic appliances, electronic test equipment, or other temperature measurement applications.

[Learn More]