2021-02-06 16:23:23 +01:00
|
|
|
MCP4725 Output
|
|
|
|
==============
|
|
|
|
|
|
|
|
.. seo::
|
|
|
|
:description: Instructions for setting up MCP4725 outputs on the ESP.
|
2021-11-16 03:19:33 +01:00
|
|
|
:image: mcp4725.jpg
|
2021-02-06 16:23:23 +01:00
|
|
|
|
|
|
|
The MCP4725 output component allows to use `12bit external DAC
|
|
|
|
<https://learn.sparkfun.com/tutorials/mcp4725-digital-to-analog-converter-hookup-guide/all>`__
|
|
|
|
in order to have analog output(s) on any board by using I2C. Devices default address is ``0x60``
|
|
|
|
and configurable alternative is ``0x61``.
|
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
2021-02-20 22:02:46 +01:00
|
|
|
# Example configuration entry
|
|
|
|
|
2021-02-06 16:23:23 +01:00
|
|
|
# Set a global i2c connection
|
|
|
|
i2c:
|
|
|
|
sda: 21
|
|
|
|
scl: 22
|
2021-07-28 23:56:11 +02:00
|
|
|
scan: true
|
2021-02-06 16:23:23 +01:00
|
|
|
|
|
|
|
# Set the output with default (address: 0x60 / global i2c)
|
|
|
|
output:
|
|
|
|
- platform: mcp4725
|
|
|
|
id: dac_output
|
|
|
|
|
|
|
|
on_...:
|
|
|
|
then:
|
|
|
|
- output.set_level:
|
|
|
|
id: dac_output
|
|
|
|
level: 100%
|
|
|
|
|
|
|
|
|
|
|
|
Configuration variables:
|
|
|
|
------------------------
|
|
|
|
|
|
|
|
- **id** (**Required**, :ref:`config-id`): The id to use for this output component.
|
|
|
|
- **address** (*Optional*, int): Manually specify the I2C address of
|
|
|
|
the DAC. Defaults to ``0x60``.
|
|
|
|
- All other options from :ref:`Output <config-output>`.
|
|
|
|
|
|
|
|
Usage with voltages higher than 3.3v
|
|
|
|
------------------------------------
|
|
|
|
|
|
|
|
In order to drive analog modules with voltages higher than 3.3v, use a `TTL bi-directionnal level
|
|
|
|
converter <https://learn.sparkfun.com/tutorials/bi-directional-logic-level-converter-hookup-guide/all>`__
|
|
|
|
|
2022-04-03 09:30:25 +02:00
|
|
|
Be careful about what converter you use, some of them have channels labeled with `RX` and `TX`,
|
2021-02-06 16:23:23 +01:00
|
|
|
in this case only `TX` channels are bi-directional (so you must use 2 `TX` channels for I2C to work).
|
|
|
|
|
|
|
|
See Also
|
|
|
|
--------
|
|
|
|
|
|
|
|
- :doc:`/components/output/esp32_dac`
|
|
|
|
- :doc:`/components/output/esp8266_pwm`
|
|
|
|
- :ghedit:`Edit`
|