Add MCP4725 docs (#889)

* Add MCP4725 Doc

* add alterative address info

Co-authored-by: Guillermo Ruffino <glm.net@gmail.com>
This commit is contained in:
Jérémy JOURDIN 2021-02-06 16:23:23 +01:00 committed by GitHub
parent 63998c7d38
commit 5bfeb3e7fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 87 additions and 0 deletions

View File

@ -0,0 +1,86 @@
MCP4725 Output
==============
.. seo::
:description: Instructions for setting up MCP4725 outputs on the ESP.
:image: mcp4725.png
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``.
Example Usage with defaults
***************************
.. code-block:: yaml
# Set a global i2c connection
i2c:
sda: 21
scl: 22
scan: True
# 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%
Example Usage with a custom configuration
*****************************************
.. code-block:: yaml
# Set a custom i2c connection
i2c:
- id: bus_a
sda: 21
scl: 22
scan: True
- id: bus_b
sda: 23
scl: 25
scan: True
# Set the output
output:
- platform: mcp4725
id: dac_output
address: 0x61
i2c_id: bus_b
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>`__
Be careful about what converter you use, some of of them have channels labeled with `RX` and `TX`,
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`

BIN
images/mcp4725.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

View File

@ -217,6 +217,7 @@ Output Components
TLC59208F, components/output/tlc59208f, tlc59208f.jpg
MY9231/MY9291, components/output/my9231, my9231.svg
SM16716, components/output/sm16716, sm16716.svg
MCP4725, components/output/mcp4725, mcp4725.jpg
Custom Output, components/output/custom, language-cpp.svg
Template Output, components/output/template, description.svg