Wednesday, April 24, 2019

MCP42100 - 100K with Raspberry Pi 3 model B+ - using spi

MCP42100 is a 100K variable resister controlled using spi interface. The only issue with this one is that it has a very high variation in resistance (high tolerance ) can vary from 70K to 130K

Data sheet - http://ww1.microchip.com/downloads/en/devicedoc/11195c.pdf




Python code for controlling this with SPI


import time
import spidev
import RPi.GPIO as gpio

gpio.setmode(gpio.BCM)
gpio.setup(4,gpio.OUT)

#if you need to open circuit 
#gpio.output(4, gpio.LOW) # Open circuit
#gpio.output(4, gpio.HIGH) # Closed circuit, resistor working


bus = 0 
device = 0

spi = spidev.SpiDev()
spi.open(bus, device)

spi.max_speed_hz = 500000
spi.mode = 0

# try 0 that will set resistance to the min value
res = input("value?")

x = spi.xfer2([19,res])

print(x)


AD5272 - 100K with Raspberry Pi 3 model B+ - using i2c

I am testing this AD5272 digital variable resistor and was really not easy to find any info on how to write to the registers in the ic to change resistance.

Data sheet - https://www.analog.com/media/en/technical-documentation/data-sheets/AD5272_5274.pdf

Useful link - https://stackoverflow.com/questions/46230777/operating-the-ad5272-with-python-3-and-smbus2-on-raspberry-pi-3-b


This is how it work in python,


bus.write_i2c_block_data(Address,First byte,[2nd byte up to 32])

------
import smbus

bus = smbus.SMBus(1)

# This write 0x1c and 0x03 to device with address 0x2c. This unlocks the register
bus.write_i2c_block_data(0x2c,0x1c,[0x03])

# This set the wiper to 0 - get around 30Ohms 
bus.write_i2c_block_data(0x2c,0x04,[0x00])

# This set the wiper to 1023 - get 100K 
bus.write_i2c_block_data(0x2c,0x07,[0xff])

------



I bought this model from DigiKey - AD5272BRMZ-100-RL7CT-ND 

TO solder this I bought a 10MOSP breakout board - LCQT-MSOP10 



Also bought low temperature soldering paste - Chip Quik Inc. / TS391LT 


Used the oven at home to bake it following the graph below.


Used 2.0mm GOOT Desolder Braid to remove soldering bridges