The microchip_tech_mcp3428 module

Autogenerated API documentation for microchip_tech_mcp3428

Driver for Microchip Technology MCP3428 Analog Input device Calibrated to PR33-13 from ncd.io other products will use different voltage references.

class PyExpLabSys.drivers.microchip_tech_mcp3428.I2C(device, bus)[source]

Bases: object

File based i2c. Code adapted from: https://www.raspberrypi.org/forums/viewtopic.php?t=134997

__init__(device, bus)[source]

Initialize self. See help(type(self)) for accurate signature.

write(values)[source]

Write a value to i2c port

read(number_of_bytes)[source]

Read value from i2c port

close()[source]

Close the device

class PyExpLabSys.drivers.microchip_tech_mcp3428.MCP3428(address_index=0, voltage_ref=2.048)[source]

Bases: object

Class for reading voltage from MCP3428 For some reason this chip works only partly with smbus, hence the use of file based i2c.

__init__(address_index=0, voltage_ref=2.048)[source]

Initialize self. See help(type(self)) for accurate signature.

read_sample(channel: int = 1, gain: int = 1, resolution: int = 12) → float[source]

Read a single sample

gain(gain: int = 1) → int[source]

Return the command code to set gain

resolution(resolution: int = 12) → int[source]

Return the command code to set resolution

channel(channel: int = 1) → int[source]

Return the command code to set channel