Improve inventory management through consistent weight tracking
A
A
Hardware Overview
How does it work?
Load Cell 6 Click is based on the MAX11270, a pin-programmable, ultra-low power 24-bit ΣΔ ADC that resolves a very high dynamic range from Analog Devices. The MAX11270 achieves excellent 130dB SNR while dissipating an ultra-low 10mW. It allows users to select a programmable gain amplifier with gain settings between 1x to 128x, unity-gain buffer, or connect signals directly to the delta-sigma sampling network. This ADC can resolve micro-volt level changes to the analog input, making it a good fit for seismic, instrumentation, and ATE applications. The MAX11270 measures differential analog inputs (S+, S-) in buffered, direct connect, or PGA. The default configuration is directly connected, with PGA and input buffers powered down. These optional buffers isolate the signal inputs from the switched capacitor sampling network, which allows the MAX11270 to be used with high-impedance sources without compromising the available
dynamic range. The ADC input range is programmable for unipolar (0 to VREF) ranges set by the reference voltage value obtained by the MAX6126, a 3V high-precision voltage reference, also routed to the E+ terminal. Load Cell 6 Click communicates with MCU through a standard SPI interface that enables high clock speeds up to 5MHz. The MAX11270 is highly configurable via the internal registers, accessed via the SPI interface. It operates in two modes: Conversion mode or Register-Access mode, selected by the command byte. Those registers include PGA gain selection, offset and gain calibration, and a scalable sample rate to optimize performance. It also offers software-selectable output data rates, up to 12.8 kps with no data latency and 64 kps continuous, to optimize data rate and noise. In addition, the Reset pin, routed to the RST pin of the mikroBUS™ socket, is used for a complete reset of all digital functions, resulting in a Power-On reset default
state, while the Data-Ready signal, labeled as RDY and routed to the INT pin of the mikroBUS™ socket, notifies the host MCU when the data is ready. The Sync Reset signal is also used, labeled as SYN, and routed to the PWM pin of the mikroBUS™ socket, which resets both the digital filter and modulator. It also has a GPIO header with two general-purpose pins from the MAX11270, which are user-configurable. Even though this board uses both mikroBUS™ power rails, this Click board™ can only be operated with a 3.3V logic voltage level (5V is used only as a voltage reference power supply). The board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. Also, this Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used as a reference for further development.
Features overview
Development board
EasyMx PRO v7 for STM32 is the seventh generation of ARM development boards specially designed for the needs of rapid development of embedded applications. It supports a wide range of 32-bit ARM microcontrollers from STMicroelectronics and a broad set of unique functions, such as a powerful onboard mikroProg programmer and In-Circuit debugger over USB-B. The development board is well organized and designed so that the end-user has all the necessary elements, such as switches, buttons, indicators, connectors, and others, in one place. With two different connectors for each port, EasyMx PRO v7 for STM32 allows you to connect accessory boards, sensors, and custom electronics
more efficiently than ever. Each part of the EasyMx PRO v7 for STM32 development board contains the components necessary for the most efficient operation of the same board. An integrated mikroProg, a fast USB 2.0 programmer with mikroICD hardware In-Circuit Debugger, offers many valuable programming/debugging options and seamless integration with the Mikroe software environment. Besides it also includes a clean and regulated power supply block for the development board. It can use a wide range of external power sources, including an external 12V power supply, 7-23V AC or 9-32V DC via DC connector/screw terminals, and a power source via the USB Type-B (USB-B) connector. Communication options such
as USB-UART, USB-HOST/DEVICE, CAN, and Ethernet are also included, including the well-established mikroBUS™ standard, one display option for the TFT board line of products, and a standard TQFP socket for the seventh-generation MCU cards. This socket covers a wide range of 32-bit ARM MCUs, like STM32 Cortex-M3 and -M4 MCUs. EasyMx PRO v7 for STM32 is an integral part of the Mikroe ecosystem for rapid development. Natively supported by Mikroe software tools, it covers many aspects of prototyping and development thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.
Microcontroller Overview
MCU Card / MCU
Type
7th Generation
Architecture
ARM Cortex-M3
MCU Memory (KB)
10
Silicon Vendor
STMicroelectronics
Pin count
100
RAM (Bytes)
100
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Schematic
Step by step
Project assembly
Track your results in real time
Application Output via UART Mode
1. Once the code example is loaded, pressing the "FLASH" button initiates the build process, and programs it on the created setup.
2. After the programming is completed, click on the Tools icon in the upper-right panel, and select the UART Terminal.
3. After opening the UART Terminal tab, first check the baud rate setting in the Options menu (default is 115200). If this parameter is correct, activate the terminal by clicking the "CONNECT" button.
4. Now terminal status changes from Disconnected to Connected in green, and the data is displayed in the Received data field.
Software Support
Library Description
This library contains API for Load Cell 6 Click driver.
Key functions:
loadcell6_get_weight
- Load Cell 6 get weight functionloadcell6_calibration
- Load Cell 6 calibration functionloadcell6_tare
- Load Cell 6 tare the scales function.
Open Source
Code example
This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.
/*!
* @file main.c
* @brief LoadCell6 Click example
*
* # Description
* This library contains API for the Load Cell 6 Click driver.
* The library initializes and defines the SPI bus drivers to read status and ADC data.
* The library also includes a function for tare, calibration and weight measurement.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initialization of SPI module and log UART.
* After driver initialization, app performs the power on
* sets tare the scale, calibrate scale and start measurements.
*
* ## Application Task
* This is an example that demonstrates the use of the Load Cell 6 click board™.
* The Load Cell 6 click board™ can be used to measure weight and
* shows the measurement of scales in grams [ g ].
* Results are being sent to the Usart Terminal where you can track their changes.
*
* @author Nenad Filipovic
*
*/
#include "board.h"
#include "log.h"
#include "loadcell6.h"
static loadcell6_t loadcell6;
static log_t logger;
static loadcell6_data_t cell_data;
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
loadcell6_cfg_t loadcell6_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.
loadcell6_cfg_setup( &loadcell6_cfg );
LOADCELL6_MAP_MIKROBUS( loadcell6_cfg, MIKROBUS_1 );
if ( SPI_MASTER_ERROR == loadcell6_init( &loadcell6, &loadcell6_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( LOADCELL6_ERROR == loadcell6_default_cfg( &loadcell6 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
Delay_ms( 1000 );
log_printf( &logger, "-------------------------\r\n");
log_printf( &logger, " Tare the scale : \r\n");
log_printf( &logger, "- - - - - - - - - - - - -\r\n");
log_printf( &logger, " >> Remove all object << \r\n");
log_printf( &logger, "- - - - - - - - - - - - -\r\n");
log_printf( &logger, " In the following 10 sec \r\n");
log_printf( &logger, " please remove all object\r\n");
log_printf( &logger, " from the scale. \r\n");
Delay_ms( 10000 );
log_printf( &logger, "-------------------------\r\n");
log_printf( &logger, " Start tare scales \r\n");
loadcell6_tare( &loadcell6, &cell_data );
Delay_ms( 500 );
log_printf( &logger, "-------------------------\r\n");
log_printf( &logger, " Tarring is complete \r\n");
log_printf( &logger, "-------------------------\r\n");
log_printf( &logger, " Calibrate Scale : \r\n");
log_printf( &logger, "- - - - - - - - - - - - -\r\n");
log_printf( &logger, " >>> Load etalon <<< \r\n");
log_printf( &logger, "- - - - - - - - - - - - -\r\n");
log_printf( &logger, " In the following 10 sec \r\n");
log_printf( &logger, "place 200g weight etalon\r\n");
log_printf( &logger, " on the scale for \r\n");
log_printf( &logger, " calibration purpose. \r\n");
Delay_ms( 10000 );
log_printf( &logger, "-------------------------\r\n");
log_printf( &logger, " Start calibration \r\n");
if ( LOADCELL6_OK == loadcell6_calibration( &loadcell6, LOADCELL6_WEIGHT_200G, &cell_data ) )
{
log_printf( &logger, "-------------------------\r\n");
log_printf( &logger, " Calibration Done \r\n");
log_printf( &logger, "- - - - - - - - - - - - -\r\n");
log_printf( &logger, " >>> Remove etalon <<< \r\n");
log_printf( &logger, "- - - - - - - - - - - - -\r\n");
log_printf( &logger, " In the following 5 sec \r\n");
log_printf( &logger, " remove 200g weight \r\n");
log_printf( &logger, " etalon on the scale. \r\n");
Delay_ms( 5000 );
}
else
{
log_printf( &logger, "-------------------------\r\n");
log_printf( &logger, " Calibration Error \r\n");
for ( ; ; );
}
log_printf( &logger, "-------------------------\r\n");
log_printf( &logger, " Start measurements : \r\n");
log_printf( &logger, "-------------------------\r\n");
}
void application_task ( void )
{
static float weight_g;
if ( LOADCELL6_OK == loadcell6_get_weight( &loadcell6, &cell_data, &weight_g ) )
{
log_printf(&logger, " Weight : %.2f g\r\n", weight_g );
}
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END