With all the various sensors out there to choose from, it is nice to be able to get one that is configured in such a way that you can evaluate its performance. MikroE Click Boards offer just that opportunity and on several development boards that Avnet distributes, MicroBUS host sockets are included. These sockets allow MikroE Click Boards to be attached and driven using the development boards processor. To review the variety of click boards that are available, please see MikoE Click Boad Catalog.

 

Of course the hardware for sensor evaluation is just one part of the problem, the other is the software that is needed to drive the sensor.  To assist with the software  needed to evaluate the various MikroE Click Boards, Avnet offers a github repository of reusable software along with demonstration programs showing how the library is utilized. In following blog, I go through the software that is available in the github repository and in subsequent blogs, I show several example programs that use the repository and discuss how you can replicate them.


The current repository at https://github.com/Avnet/clickmodules (release v1.0) contains support for the following Click Boards.  This repository can be replicated into your own project by using the command

 

git clone -b v1.0 https://github.com/Avnet/clickmodules

 

This command will retrieve release 1 of the click module repository which includes support for:

    1. Barometer Click (https://www.mikroe.com/barometer-click)

    2. FLAME Click (https://www.mikroe.com/flame-click)

    3. HEART RATE 4 Click (https://www.mikroe.com/heart-rate-4-click)

    4. LIGHTRANGER Click (https://www.mikroe.com/lightranger-click)

    5. OLED-B Click (https://www.mikroe.com/oled-b-click)

    6. RELAY Click (https://www.mikroe.com/relay-click)

    7. Temp&Hum (https://www.mikroe.com/temp-hum-click)

 

The software is written in ANSI standard C (to maximize the ability to reuse the software)  but a few C++ solutions are also provided (C++ support exits for BAROMETER, TEMP_HUM, and FLAME click boards).

 

The basic approach for all sensors is to implement a framework to create and remove sensor objects. This framework provides functions to:

  • Abstract all I/O with the sensor. When the sensor is created, the user provides functions that write to the sensor, read from the sensor, and (if necessary) initialize the sensor I/O. The currently supported sensors require a variety of I/O methods, shown in Table 1.
  • Create a sensor object, typically <xxx>_open’. This function will allocate needed memory and capture the user supplied function address(s) to be called for sensor input and output.  The function returns a pointer to a unique object that is used in subsequent sensor function calls.

 

For example, the BAROMETER sensor contains the following function:

BAROMETER* open_barometer(uint8_t (*rb)(uint8_t a), void (*wb)(uint8_t a, uint8_t v ))

The user provides a read-byte and write-byte function for the sensor. The read-byte function needs a register address to write to and returns the byte that was read. The write-byte function expects a register address and a value to write to the register.

  • Delete a sensor object, close_<xxx>’. - This function eleases allocated memory from when the sensor was opened. For example, using the BAROMETER sensor example from above:
close_barometer(BAROMETER* b) 

So when called, the function free’s the memory allocated for the BAROMETER object. It is important to note that the close function simply releases the BAROMETER object memory so if If any sensor settings need resetting when closing, the user to perform these actions separately.

Support functionality/functions are dependent on the Click board/Sensor being supported to reference the associated header file for specifics.

Table 1: Click Modules Currently Supported

Click Board Name

Sensor Utilized

Source Code Included

I/O utilized

barometer-click

LPS25Hb

barometer.c; barometer.h; barometer.hpp

I2C

Temp&Hum

HTS221

hts221.c; hts221.h; hts221.hpp

I2C

LightRanger 2

VL53L0X

All under LIGHTRANGER

I2C

FLAME Click

PT334-6B

flame.c; flame.h; flame.hpp

GPIO

HEARTRATE 4 Click [1]

MAX30101

algorithm_by_RF.c; algorithm_by_RF.h; max30102.c; max30102.h

I2C

RELAY Click

G6D Miniature Relay

relay.c; relay.h

GPIO

OLED-B Click

SSD1306

Avnet_GFX.c; Avnet_GFX.h; glcdfont.c; oledb.hpp; oledb_ssd1306.c; oledb_ssd1306.h

SPI

[1] see https://www.instructables.com/id/Pulse-Oximeter-With-Much-Improved-Precision/ for a description of the HR4 algorithm


To demonstrate the usage of the Click module library, it has been ported and used across three different hardware platforms:

Board

Click Modules Tested

AT&T Starter Kit 2

FLAME, RELAY, OLED-B, BAROMETER, TEMP&HUMI, LightRanger2, HEARTRATE4

Azure Sphere

FLAME[2], RELAY, OLED-B, BAROMETER, TEMP&HUMI, LightRanger2, HEARTRATE4

Ultra96

FLAME[2], RELAY[2], BAROMETER, TEMP&HUMI, LightRanger2, HEARTRATE4

[2] Partially implementation on this platform


Avnet has Incorporated the Click Board footprints into their evaluation boards so users can easily add a variety of sensors using publicly available platforms.  Additionally, Avnet has made available open-source software for the click-board sensors which compile with both open-source and proprietary tool chains.  Leveraging these development boards and software, you can expedite implementing/evaluating sensors in your designs while not being locked into a particular development environment or platform. Please provide feedback on how we can continue to assist in your next project.

 

In the next blog, implementing example sensor collection systems on these three platforms is discussed as well as any limitations that were encountered.