mirror of
https://github.com/esphome/esphome-docs.git
synced 2025-02-18 02:03:29 +01:00
Added MCP3008 (#591)
* Added MCP3008 * PR Comment Changes * Travis Fix * format and simplified example Co-authored-by: Guillermo Ruffino <glm.net@gmail.com>
This commit is contained in:
parent
abf40a0026
commit
d57678b07a
74
components/mcp3008.rst
Normal file
74
components/mcp3008.rst
Normal file
@ -0,0 +1,74 @@
|
||||
MCP3008 I/O Expander
|
||||
====================
|
||||
|
||||
.. seo::
|
||||
:description: Instructions for setting up MCP3008 10 Bit Analog to Digital Converter in ESPHome.
|
||||
:image: mcp3008.png
|
||||
|
||||
.. note::
|
||||
|
||||
This page is incomplete and could some work. If you want to contribute, please read the
|
||||
:doc:`contributing guide </guides/contributing>`. This page is missing:
|
||||
|
||||
- An image for the front page.
|
||||
- Formal documentation of the mcp3008 sensor entry (parent, update_interval, number, etc.)
|
||||
- See Dallas sensor for reference model
|
||||
|
||||
The Microchip Technology Inc. MCP3008
|
||||
devices are successive approximation 10-bit Analogto-Digital (A/D) converters with on-board sample and
|
||||
hold circuitry. Each pin will respond with a 0-1023 result depending on the voltage it is reading
|
||||
|
||||
MCP3008
|
||||
-------
|
||||
|
||||
The MCP3008 component allows you to use MCP3008 8-Channel 10-Bit A/D Converter
|
||||
(`datasheet <http://ww1.microchip.com/downloads/en/DeviceDoc/21295d.pdf>`__,
|
||||
`Adafruit <https://www.adafruit.com/product/856>`__) in ESPHome.
|
||||
It uses the :ref:`SPI Bus <spi>` for communication.
|
||||
|
||||
Once configured, you can use any of the 8 pins as
|
||||
sensors for your projects.
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
# Example configuration entry
|
||||
mcp3008:
|
||||
cs_pin: D8
|
||||
|
||||
# Example config of sensors.
|
||||
# This is a NTCB3950 10K thermocoupler attached to pin 0
|
||||
# of the MCP3008 with a 10K resistor as a voltage divider.
|
||||
# See `resistance` and `ntc` platorms for other options
|
||||
sensor:
|
||||
- platform: mcp3008 # Attached to pin 0 of the MCP3008.
|
||||
# The result will be a reading from 0-1023
|
||||
update_interval: 1s
|
||||
id: freezer_temp_source
|
||||
number: 0 # pin number
|
||||
- platform: resistance
|
||||
id: freezer_resistance_sensor
|
||||
sensor: freezer_temp_source
|
||||
configuration: DOWNSTREAM
|
||||
resistor: 10kOhm
|
||||
- platform: ntc
|
||||
id: freezer_temp
|
||||
sensor: freezer_resistance_sensor
|
||||
calibration:
|
||||
b_constant: 3950
|
||||
reference_temperature: 25°C
|
||||
reference_resistance: 10kOhm
|
||||
name: Freezer Temperature
|
||||
|
||||
Configuration variables:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
- **id** (**Required**, :ref:`config-id`): The id to use for this MCP3008 component.
|
||||
- **cs_pin** (**Required**, int): The SPI cable select pin to use
|
||||
|
||||
See Also
|
||||
--------
|
||||
|
||||
- :ref:`spi`
|
||||
- :apiref:`mcp3008/mcp3008.h`
|
||||
- :ghedit:`Edit`
|
||||
|
BIN
images/mcp3008.png
Executable file
BIN
images/mcp3008.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 93 KiB |
@ -330,6 +330,7 @@ Misc Components
|
||||
|
||||
PCF8574 I/O Expander, components/pcf8574, pcf8574.jpg
|
||||
MCP230XX I/O Expander, components/mcp230xx, mcp230xx.svg
|
||||
MCP3008 8-Channel 10-Bit A/D Converter, components/mcp3008, mcp3008.png
|
||||
SX1509 I/O Expander, components/sx1509, sx1509.jpg
|
||||
SIM800L, components/sim800l, sim800l.jpg
|
||||
DFPlayer, components/dfplayer, dfplayer.svg
|
||||
|
Loading…
Reference in New Issue
Block a user