Introduction
We are going to connect and read data from MCP342x [16bit Sigma Delta] ADC.
You can see more on the ADC here
Note: MCP3428 (x = 8) was used.
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
Note:
0x68 = 1101 000
1101 = Hardcoded
000 = Adr0 and Adr1 Floating
Note: b0i2c is provided by box0-utils.
Code
import box0 from box0.driver import Mcp342x dev = box0.usb.open_supported() i2c = dev.i2c() # Adr0 and Adr1 lines are is Floating drv = Mcp342x(i2c, Mcp342x.FLOAT, Mcp342x.FLOAT) # read data print("Readed Value is: %f" % drv.read()) del drv del i2c del dev
Output:
Readed Value is: 1.459563
More code?
Mehhhh, That is high level python code only, gimme the actual code.
Here you go! libbox0/driver/mcp342x/mcp342x.c
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.