Reading data from MCP342x I2C ADC

Introduction

Read data from 16bit Sigma Delta ADC (MCP342x)
You can see more on MCP342x here

Note: MCP3428 (x = 8) was used.

Implementation

Connection

CH1+ = Signal+
CH1- = Signal-
CH2+, CH2- = Unused (Floating)
VSS = GND
VDD = 3.3V
SDA = I2C0.SDA
SCL = I2C0.SCL
Adr0 = Floating
Adr1 = Floating
CH3+, CH3- = Unused (Floating)
CH4+, CH4- = Unused (Floating)

Verify Connection

$ b0i2c scan
Slave At: 0x68
0x68 = 1101 000
   1101 = Hardcoded
   000 = Adr0 and Adr1 Floating

Note: b0i2c is provided by box0-utils.

Code

In [2]:
import box0
from box0.driver import Mcp342x 

dev = box0.usb.open_supported()
i2c = dev.i2c()
i2c.master_prepare()
drv = Mcp342x(i2c, Mcp342x.FLOAT, Mcp342x.FLOAT) # Adr0 and Adr1 lines are is Floating

# read data
print("Readed Value is: %f" % drv.read())

del drv
del i2c
del dev
Readed Value is: 1.459563

More code?

Mehhhh, That is high level python code only, gimme the actual code.
Yup! you can find the actual code that does the hard work at libbox0/driver/mcp342x/mcp342x.c