API¶
MCP3xxx
¶
CircuitPython Library for MCP3xxx ADCs with SPI
- Author(s): ladyada, Brent Rubell
Implementation Notes¶
Hardware:
- Adafruit MCP3008 8-Channel 10-Bit ADC with SPI (Product ID: 856)
Software and Dependencies:
- Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
- Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
-
class
adafruit_mcp3xxx.mcp3xxx.
MCP3xxx
(spi_bus, cs, ref_voltage=3.3)¶ MCP3xxx Interface.
Parameters: - spi_bus (SPIDevice) – SPI bus the ADC is connected to.
- cs (DigitalInOut) – Chip Select Pin.
- ref_voltage (float) – Voltage into (Vin) the ADC.
-
read
(pin, is_differential=False)¶ SPI Interface for MCP3xxx-based ADCs reads.
Parameters:
-
reference_voltage
¶ Returns the MCP3xxx’s reference voltage.
MCP3004
¶
MCP3004 4-channel, 10-bit, analog-to-digital converter instance.
- Author(s): Brent Rubell
-
class
adafruit_mcp3xxx.mcp3004.
MCP3004
(spi_bus, cs, ref_voltage=3.3)¶ Bases:
adafruit_mcp3xxx.mcp3xxx.MCP3xxx
- MCP3004 Differential channel mapping.
- 0: CH0 = IN+, CH1 = IN-
- 1: CH1 = IN+, CH0 = IN-
- 2: CH2 = IN+, CH3 = IN-
- 3: CH3 = IN+, CH2 = IN-
MCP3008
¶
MCP3008 8-channel, 10-bit, analog-to-digital converter instance.
- Author(s): Brent Rubell
-
class
adafruit_mcp3xxx.mcp3008.
MCP3008
(spi_bus, cs, ref_voltage=3.3)¶ Bases:
adafruit_mcp3xxx.mcp3xxx.MCP3xxx
- MCP3008 Differential channel mapping.
- 0: CH0 = IN+, CH1 = IN-
- 1: CH1 = IN+, CH0 = IN-
- 2: CH2 = IN+, CH3 = IN-
- 3: CH3 = IN+, CH2 = IN-
- 4: CH4 = IN+, CH5 = IN-
- 5: CH5 = IN+, CH4 = IN-
- 6: CH6 = IN+, CH7 = IN-
- 7: CH7 = IN+, CH6 = IN-
AnalogIn
¶
AnalogIn for single-ended and differential ADC readings.
- Author(s): Brent Rubell