NAME

Tinkerforge::BrickletLoadCell - Measures weight with a load cell

CONSTANTS

DEVICE_IDENTIFIER

This constant is used to identify a Load Cell Bricklet.

The get_identity() subroutine and the CALLBACK_ENUMERATE callback of the IP Connection have a device_identifier parameter to specify the Brick's or Bricklet's type.

DEVICE_DISPLAY_NAME

This constant represents the display name of a Load Cell Bricklet.

CALLBACK_WEIGHT

This constant is used with the register_callback() subroutine to specify the CALLBACK_WEIGHT callback.

CALLBACK_WEIGHT_REACHED

This constant is used with the register_callback() subroutine to specify the CALLBACK_WEIGHT_REACHED callback.

FUNCTION_GET_WEIGHT

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_WEIGHT_CALLBACK_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_WEIGHT_CALLBACK_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_WEIGHT_CALLBACK_THRESHOLD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_WEIGHT_CALLBACK_THRESHOLD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_DEBOUNCE_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_DEBOUNCE_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_MOVING_AVERAGE

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_MOVING_AVERAGE

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_LED_ON

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_LED_OFF

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_IS_LED_ON

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_CALIBRATE

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_TARE

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_CONFIGURATION

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_CONFIGURATION

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_IDENTITY

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTIONS

new()

Creates an object with the unique device ID *uid* and adds it to the IP Connection *ipcon*.

get_weight()

Returns the currently measured weight.

If you want to get the weight periodically, it is recommended to use the :cb:`Weight` callback and set the period with :func:`Set Weight Callback Period`.

set_weight_callback_period()

Sets the period with which the :cb:`Weight` callback is triggered periodically. A value of 0 turns the callback off.

The :cb:`Weight` callback is only triggered if the weight has changed since the last triggering.

get_weight_callback_period()

Returns the period as set by :func:`Set Weight Callback Period`.

set_weight_callback_threshold()

Sets the thresholds for the :cb:`Weight Reached` callback.

The following options are possible:

.. csv-table:: :header: "Option", "Description" :widths: 10, 100

"'x'",    "Callback is turned off"
"'o'",    "Callback is triggered when the weight is *outside* the min and max values"
"'i'",    "Callback is triggered when the weight is *inside* the min and max values"
"'<'",    "Callback is triggered when the weight is smaller than the min value (max is ignored)"
"'>'",    "Callback is triggered when the weight is greater than the min value (max is ignored)"
get_weight_callback_threshold()

Returns the threshold as set by :func:`Set Weight Callback Threshold`.

set_debounce_period()

Sets the period with which the threshold callback

* :cb:`Weight Reached`

is triggered, if the threshold

* :func:`Set Weight Callback Threshold`

keeps being reached.

get_debounce_period()

Returns the debounce period as set by :func:`Set Debounce Period`.

set_moving_average()

Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__ for the weight value.

Setting the length to 1 will turn the averaging off. With less averaging, there is more noise on the data.

get_moving_average()

Returns the length moving average as set by :func:`Set Moving Average`.

led_on()

Turns the LED on.

led_off()

Turns the LED off.

is_led_on()

Returns *true* if the led is on, *false* otherwise.

calibrate()

To calibrate your Load Cell Bricklet you have to

* empty the scale and call this function with 0 and * add a known weight to the scale and call this function with the weight.

The calibration is saved in the EEPROM of the Bricklet and only needs to be done once.

We recommend to use the Brick Viewer for calibration, you don't need to call this function in your source code.

tare()

Sets the currently measured weight as tare weight.

set_configuration()

The measurement rate and gain are configurable.

The rate can be either 10Hz or 80Hz. A faster rate will produce more noise. It is additionally possible to add a moving average (see :func:`Set Moving Average`) to the measurements.

The gain can be 128x, 64x or 32x. It represents a measurement range of ±20mV, ±40mV and ±80mV respectively. The Load Cell Bricklet uses an excitation voltage of 5V and most load cells use an output of 2mV/V. That means the voltage range is ±15mV for most load cells (i.e. gain of 128x is best). If you don't know what all of this means you should keep it at 128x, it will most likely be correct.

The configuration is saved in the EEPROM of the Bricklet and only needs to be done once.

We recommend to use the Brick Viewer for configuration, you don't need to call this function in your source code.

get_configuration()

Returns the configuration as set by :func:`Set Configuration`.

get_identity()

Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier.

The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port). A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at position 'z'.

The device identifier numbers can be found :ref:`here <device_identifier>`. |device_identifier_constant|