Achieve your health goals with accurate weight tracking for personalized progress
A
A
Hardware Overview
How does it work?
Load Cell 5 Click is based on the AD7780, a pin programmable, low power, low drift 24-bit ΣΔ ADC from Analog Devices that includes a PGA and uses an internal clock. The AD7780 typically consumes only 330μA and simplifies this weigh scale design since most of the system building blocks are already on the chip. The AD7780 has two filter options selectable via FIL pin(low state - 16.7Hz, high state - 10Hz) and a Power-Down Mode, allowing the user to switch off the power to the bridge sensor and power down the AD7780 when not converting, increasing the battery life. Since the AD7780 provides an integrated solution for weighing scales, it interfaces directly with the load cell. The only required external components, which are also on the Click board™, are filters on the analog inputs and capacitors on the reference pins for EMC purposes. The low-level signal from the load cell is amplified by the AD7780's internal PGA programmed via the PWM pin of the mikroBUS™ socket, labeled as GN, to operate with
a gain of 128 or 1. The conversions from the AD7780 are then sent to the MCU through the SPI serial interface, where the digital information is converted to weight. This Click board™ uses the 6-wire load cell configuration, which has two sense pins, ground, power supply, and two output connections. The load cell differential SENSE lines connected to the AD7780 reference inputs create a ratiometric configuration immune to low-frequency changes in the power supply excitation voltage. Those sense pins are connected to the high and low sides of the Wheatstone bridge, where voltage can be accurately measured, regardless of the voltage drop due to the wiring resistance. The AD7780 has separate analog and digital power supply pins. The analog and digital power supplies are independent of each other to be different, or the same, potentials achieved with the AVDD SEL jumper. This feature allows selecting the AD7780 power supply between an external power supply (2.7 - 5.25V) and logic
voltage levels supplied via mikroBUS™ rails. Load Cell 5 Click communicates with MCU using a standard SPI interface with a dual-purpose DOUT/RDY line. This line can function as a regular data output pin for the SPI interface or as a data-ready pin (interrupt) labeled as RDY and routed on the INT pin of the mikroBUS socket. Also, it uses the RST pin on the mikroBUS™ socket, which performs the Hardware Reset function by putting this pin in a logic low state, and a blue diode labeled as ACTIVE is used to indicate the device's Active Operational Status. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. 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
EasyPIC v7 is the seventh generation of PIC development boards specially designed to develop embedded applications rapidly. It supports a wide range of 8-bit PIC microcontrollers from Microchip and has 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 in one place, such as switches, buttons, indicators, connectors, and others. With four different connectors for each port, EasyPIC v7 allows you to connect accessory boards, sensors, and custom electronics more efficiently than ever. Each part of
the EasyPIC v7 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 various 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 and RS-232 are also included, alongside the well-established mikroBUS™ standard, three display options (7-segment, graphical, and character-based LCD), and several different DIP sockets. These sockets cover a wide range of 8-bit PIC MCUs, from PIC10F, PIC12F, PIC16F, PIC16Enh, PIC18F, PIC18FJ, and PIC18FK families. EasyPIC v7 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
Architecture
PIC
MCU Memory (KB)
64
Silicon Vendor
Microchip
Pin count
40
RAM (Bytes)
3936
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Click board™ 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 5 Click driver.
Key functions:
loadcell5_set_power_mode
- Load Cell 5 set power mode functionloadcell5_read_adc
- Load Cell 5 reading ADC data functionloadcell5_get_weight
- Load Cell 5 get weight function
Open Source
Code example
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.
/*!
* @file main.c
* @brief LoadCell5 Click example
*
* # Description
* This library contains API for Load Cell 5 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
* The initialization of SPI module, log UART, and additional pins
* and 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 5 click board.
* The Load Cell 5 click board can be used to measure weight,
* 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 "loadcell5.h"
static loadcell5_t loadcell5;
static log_t logger;
static uint8_t status_val;
static uint32_t adc_val;
static loadcell5_data_t cell_data;
static float weight_val;
void application_init ( void ) {
log_cfg_t log_cfg; /**< Logger config object. */
loadcell5_cfg_t loadcell5_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.
loadcell5_cfg_setup( &loadcell5_cfg );
LOADCELL5_MAP_MIKROBUS( loadcell5_cfg, MIKROBUS_1 );
err_t init_flag = loadcell5_init( &loadcell5, &loadcell5_cfg );
if ( init_flag == SPI_MASTER_ERROR ) {
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
loadcell5_default_cfg ( &loadcell5 );
log_info( &logger, " Application Task " );
Delay_ms( 500 );
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");
loadcell5_tare ( &loadcell5, &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 100g 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 ( loadcell5_calibration ( &loadcell5, LOADCELL5_WEIGHT_100G, &cell_data ) == LOADCELL5_OK ) {
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 10 sec \r\n");
log_printf( &logger, " remove 100g weight \r\n");
log_printf( &logger, " etalon on the scale. \r\n");
Delay_ms( 10000 );
}
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 ) {
weight_val = loadcell5_get_weight( &loadcell5, &cell_data );
log_printf(&logger, " Weight : %.2f g\r\n", weight_val );
Delay_ms( 1000 );
}
void main ( void ) {
application_init( );
for ( ; ; ) {
application_task( );
}
}
// ------------------------------------------------------------------------ END