The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Tinkerforge::BrickletBarometer - Measures air pressure and altitude changes

CONSTANTS

DEVICE_IDENTIFIER

This constant is used to identify a Barometer 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 Barometer Bricklet.

CALLBACK_AIR_PRESSURE

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

CALLBACK_ALTITUDE

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

CALLBACK_AIR_PRESSURE_REACHED

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

CALLBACK_ALTITUDE_REACHED

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

FUNCTION_GET_AIR_PRESSURE

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

FUNCTION_GET_ALTITUDE

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

FUNCTION_SET_AIR_PRESSURE_CALLBACK_PERIOD

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

FUNCTION_GET_AIR_PRESSURE_CALLBACK_PERIOD

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

FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD

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

FUNCTION_GET_ALTITUDE_CALLBACK_PERIOD

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

FUNCTION_SET_AIR_PRESSURE_CALLBACK_THRESHOLD

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

FUNCTION_GET_AIR_PRESSURE_CALLBACK_THRESHOLD

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

FUNCTION_SET_ALTITUDE_CALLBACK_THRESHOLD

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

FUNCTION_GET_ALTITUDE_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_REFERENCE_AIR_PRESSURE

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

FUNCTION_GET_CHIP_TEMPERATURE

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

FUNCTION_GET_REFERENCE_AIR_PRESSURE

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

FUNCTION_SET_AVERAGING

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

FUNCTION_GET_AVERAGING

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_air_pressure()

Returns the air pressure of the air pressure sensor. The value has a range of 10000 to 1200000 and is given in mbar/1000, i.e. a value of 1001092 means that an air pressure of 1001.092 mbar is measured.

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

get_altitude()

Returns the relative altitude of the air pressure sensor. The value is given in cm and is calculated based on the difference between the current air pressure and the reference air pressure that can be set with :func:`Set Reference Air Pressure`.

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

set_air_pressure_callback_period()

Sets the period in ms with which the :cb:`Air Pressure` callback is triggered periodically. A value of 0 turns the callback off.

The :cb:`Air Pressure` callback is only triggered if the air pressure has changed since the last triggering.

The default value is 0.

get_air_pressure_callback_period()

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

set_altitude_callback_period()

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

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

The default value is 0.

get_altitude_callback_period()

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

set_air_pressure_callback_threshold()

Sets the thresholds for the :cb:`Air Pressure 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 air pressure is *outside* the min and max values"
 "'i'",    "Callback is triggered when the air pressure is *inside* the min and max values"
 "'<'",    "Callback is triggered when the air pressure is smaller than the min value (max is ignored)"
 "'>'",    "Callback is triggered when the air pressure is greater than the min value (max is ignored)"

The default value is ('x', 0, 0).

get_air_pressure_callback_threshold()

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

set_altitude_callback_threshold()

Sets the thresholds for the :cb:`Altitude 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 altitude is *outside* the min and max values"
 "'i'",    "Callback is triggered when the altitude is *inside* the min and max values"
 "'<'",    "Callback is triggered when the altitude is smaller than the min value (max is ignored)"
 "'>'",    "Callback is triggered when the altitude is greater than the min value (max is ignored)"

The default value is ('x', 0, 0).

get_altitude_callback_threshold()

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

set_debounce_period()

Sets the period in ms with which the threshold callbacks

* :cb:`Air Pressure Reached`, * :cb:`Altitude Reached`

are triggered, if the thresholds

* :func:`Set Air Pressure Callback Threshold`, * :func:`Set Altitude Callback Threshold`

keep being reached.

The default value is 100.

get_debounce_period()

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

set_reference_air_pressure()

Sets the reference air pressure in mbar/1000 for the altitude calculation. Valid values are between 10000 and 1200000. Setting the reference to the current air pressure results in a calculated altitude of 0cm. Passing 0 is a shortcut for passing the current air pressure as reference.

Well known reference values are the Q codes `QNH <https://en.wikipedia.org/wiki/QNH>`__ and `QFE <https://en.wikipedia.org/wiki/Mean_sea_level_pressure#Mean_sea_level_pressure>`__ used in aviation.

The default value is 1013.25mbar.

get_chip_temperature()

Returns the temperature of the air pressure sensor. The value has a range of -4000 to 8500 and is given in °C/100, i.e. a value of 2007 means that a temperature of 20.07 °C is measured.

This temperature is used internally for temperature compensation of the air pressure measurement. It is not as accurate as the temperature measured by the :ref:`temperature_bricklet` or the :ref:`temperature_ir_bricklet`.

get_reference_air_pressure()

Returns the reference air pressure as set by :func:`Set Reference Air Pressure`.

set_averaging()

Sets the different averaging parameters. It is possible to set the length of a normal averaging for the temperature and pressure, as well as an additional length of a `moving average <https://en.wikipedia.org/wiki/Moving_average>`__ for the pressure. The moving average is calculated from the normal averages. There is no moving average for the temperature.

The maximum length for the pressure average is 10, for the temperature average is 255 and for the moving average is 25.

Setting the all three parameters to 0 will turn the averaging completely off. If the averaging is off, there is lots of noise on the data, but the data is without delay. Thus we recommend to turn the averaging off if the Barometer Bricklet data is to be used for sensor fusion with other sensors.

The default values are 10 for the normal averages and 25 for the moving average.

.. versionadded:: 2.0.1$nbsp;(Plugin)

get_averaging()

Returns the averaging configuration as set by :func:`Set Averaging`.

.. versionadded:: 2.0.1$nbsp;(Plugin)

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' or 'd'.

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