:description:Instructions for setting up AS5600 magnetic position sensor / encoder.
:image:as5600.jpg
:keywords:AS5600 AS5600L
.._as5600-component:
Component/Hub
-------------
The ``as5600`` sensor platform you to use your AS5600 (`datasheet <https://ams.com/documents/20143/36005/AS5600_DS000365_5-00.pdf/649ee61c-8f9a-20df-9e10-43173a3eb323>`__,
`AMS <https://ams.com/en/as5600>`__) or AS5600L (`datasheet <https://ams.com/documents/20143/36005/AS5600L_DS000545_3-00.pdf/7ade6878-7a32-2294-b88d-479d50fab6de>`__,
`AMS <https://ams.com/en/as5600l>`__) 12-bit magnetic position sensor with ESPHome. Individual sensors will be added
using the :ref:`AS5600 Sensor Platform <as5600-sensor>`. To use this hub, first setup
the :ref:`I²C Bus <i2c>` and connect the sensor to the pins specified there.
which contains pictures that show it as a scale between ``0`` and ``3000``. Typically this value is seen somewhere
in the neighborhood of ``2100`` for a well positioned magnet.
- All other options from :ref:`Sensor <config-sensor>`.
-**status** (*Optional*): Information about the magnet status. Typically for diagnostic purposes.
See :ref:`Magnet Status <as5600-magnet-status>`
- All other options from :ref:`Sensor <config-sensor>`.
- All other options from :ref:`Sensor <config-sensor>`.
.._as5600-out-of-range-mode:
Out of Range Mode
*****************
-``min_max`` (default)
-``nan``
When using a range less that 360deg, there would be a range of raw values that would be considered "out of range". By default (``min_max`` mode), the AS5600
splits that range in half and reports ``0`` while in the half of the "out-of-range" range closest to the ``start_position`` and it reports
``4095`` while in the half of the "out-of-range" range closest to the ``end_position`` / end of the ``range``. Alternatively, you may set to ``nan``
mode where the sensor will publish ``NAN`` (i.e. "Unknown") when the position falls outside the narrowed range.
.._as5600-magnet-status:
Magnet Status
*************
The magnet status should report one of the following values:
-``2`` indicates that no magnet was detected.
-``4`` indicates that the magnet was detected and has good reading.
-``5`` indicates that the magnet was detected, but is too strong. Measurements may appear to be stuck if the magnet is too strong.
-``6`` indicates that the magnet was detected, but is too weak. Measurements may still be possible in this state.
.._as5600-converting-position:
Converting Position
*******************
You may desire the position to be converted from the native ``0`` thru ``4095`` to degrees, or perhaps a percentage of the allowable range.
Here are some examples to make that happen:
..figure:: images/as5600-ui-derived.jpg
:align:center
:width:80.0%
..code-block:: yaml
as5600:
id: my_as5600
sensor:
- platform: as5600
update_interval: 1s
name: Angle
unit_of_measurement: '°'
accuracy_decimals: 2
icon: mdi:rotate-right
filters:
- delta: 1
- lambda: 'return x * as5600::RAW_TO_DEGREES * id(my_as5600).get_range_scale();'