Anyone working on MCP4728 (12-Bit, Quad Digital-to-Analog Converter with EEPROM Memory) driver?

Discuss development of drivers for external hardware and components, such as LCD screens, sensors, motor drivers, etc.
Target audience: Users and developers of drivers.
Post Reply
gatorchu
Posts: 25
Joined: Sun Sep 22, 2019 3:50 pm

Anyone working on MCP4728 (12-Bit, Quad Digital-to-Analog Converter with EEPROM Memory) driver?

Post by gatorchu » Tue Nov 26, 2019 10:05 pm

Hi friends,

Is there anyone working on establishing MCP4728 (12-Bit, Quad Digital-to-Analog Converter with EEPROM Memory) driver?

I am recently working on DAC expander for my device. I found the driver for MCP4725 which has only a single channel. Now I wish to have more channels, so I found MCP4728 from the web. However, it seems no one has posted any driver related to this 4-channel DAC expander. I tried to modify the driver of MCP4725, but it seems a little difficult for a newbie like me.

Thank you in advance.

gatorchu
Posts: 25
Joined: Sun Sep 22, 2019 3:50 pm

Re: Anyone working on MCP4728 (12-Bit, Quad Digital-to-Analog Converter with EEPROM Memory) driver?

Post by gatorchu » Mon Dec 09, 2019 4:05 am

OK, maybe no one has sort of driver.

openfablab
Posts: 3
Joined: Thu Nov 10, 2016 6:04 pm

Re: Anyone working on MCP4728 (12-Bit, Quad Digital-to-Analog Converter with EEPROM Memory) driver?

Post by openfablab » Wed Jul 01, 2020 7:39 pm

gatorchu wrote:
Tue Nov 26, 2019 10:05 pm
Hi friends,

Is there anyone working on establishing MCP4728 (12-Bit, Quad Digital-to-Analog Converter with EEPROM Memory) driver?

I am recently working on DAC expander for my device. I found the driver for MCP4725 which has only a single channel. Now I wish to have more channels, so I found MCP4728 from the web. However, it seems no one has posted any driver related to this 4-channel DAC expander. I tried to modify the driver of MCP4725, but it seems a little difficult for a newbie like me.

Thank you in advance.
Hello, I just faced the same problem and adapted Adafruit_CircuitPython_MCP4728 library by Bryan Siepert to microPython. It looks like working OK. Here is it: https://github.com/openfablab/mcp4728

gatorchu
Posts: 25
Joined: Sun Sep 22, 2019 3:50 pm

Re: Anyone working on MCP4728 (12-Bit, Quad Digital-to-Analog Converter with EEPROM Memory) driver?

Post by gatorchu » Mon Nov 02, 2020 4:24 pm

Although I have it sorted out, thank you all the same!

ignis_infatuus
Posts: 3
Joined: Mon Dec 28, 2020 7:21 pm

Re: Anyone working on MCP4728 (12-Bit, Quad Digital-to-Analog Converter with EEPROM Memory) driver?

Post by ignis_infatuus » Thu Jan 14, 2021 9:28 pm

hugely appreciative openfablab, thanks!

Andre
Posts: 2
Joined: Tue Jun 01, 2021 10:26 pm

Re: Anyone working on MCP4728 (12-Bit, Quad Digital-to-Analog Converter with EEPROM Memory) driver?

Post by Andre » Tue Jun 01, 2021 11:02 pm

openfablab wrote:
Wed Jul 01, 2020 7:39 pm
gatorchu wrote:
Tue Nov 26, 2019 10:05 pm
Hi friends,

Is there anyone working on establishing MCP4728 (12-Bit, Quad Digital-to-Analog Converter with EEPROM Memory) driver?

I am recently working on DAC expander for my device. I found the driver for MCP4725 which has only a single channel. Now I wish to have more channels, so I found MCP4728 from the web. However, it seems no one has posted any driver related to this 4-channel DAC expander. I tried to modify the driver of MCP4725, but it seems a little difficult for a newbie like me.

Thank you in advance.
Hello, I just faced the same problem and adapted Adafruit_CircuitPython_MCP4728 library by Bryan Siepert to microPython. It looks like working OK. Here is it: https://github.com/openfablab/mcp4728
Hi openfablab,

I'm trying to connect a Raspberry PI PICO to a adafruit MCP4728 using your library, but I'm not being able to read any value from the DAC channels.

I've made the following code but it is not working. May I ask your help?

Many thanks!

import time
import machine
import struct
from mcp4728 import MCP4728
from mcp4728 import Channel

_MCP4728_DEFAULT_ADDRESS = 0x60
_MCP4728_CH_A_MULTI_EEPROM = 0x50
i2c_bus = 0x0


oil_sensor = machine.ADC(26)
gas_sensor = machine.ADC(27)
water_sensor = machine.ADC(28)
oil = oil_sensor.read_u16()
gas = gas_sensor.read_u16()
water = water_sensor.read_u16()
temp_sensor = machine.ADC(4)
temperature = temp_sensor.read_u16()
LED = machine.Pin(25, machine.Pin.OUT)
i2c = machine.I2C(0, scl=machine.Pin(9), sda=machine.Pin(8), freq=400000)
dac = MCP4728(i2c, 0x60)


while True:

LED(1)


print(oil, " oil integral") #oil valor lido pelo sensor em integral
to_volts = 0.5 / 10562
oil_2 = oil * to_volts #oil valor convertido para volts
print(round(oil_2,1), "oil volts")
oil_bar = 2.59 * oil_2 - 1.29 #oil valor convertido para BAR
print(round(oil_bar,1), "oil BAR")
print('_____________')
print(gas, "gas integral") #gas valor lido pelo sensor em integral
gas_2 = gas * to_volts #gas valor convertido para volts
print(round(gas_2,1), "gas volts")
gas_bar = 2.59 * gas_2 - 1.29 #gas valor convertido para BAR
print(round(gas_bar,1), "gas BAR")
print('_____________')
print(water, "water integral") #water valor lido pelo sensor em integral
water_2 = water * to_volts #water valor convertido para volts
print(round(water_2,1), "water volts")
water_bar = 2.59 * water_2 - 1.29 #water valor convertido para BAR
print(round(water_bar,1), "water BAR")
print('_____________')
to_volts_temp = 3.3 / 65535
temperature_2 = temperature * to_volts_temp
celsius_degrees = 27 - (temperature_2 - 0.706) / 0.001721
print(round(celsius_degrees,1), "C")


dac.a.value=int(round(oil_bar,0))

dac.b.value=int(round(gas_bar,0))

dac.c.value=int(round(water_bar,0))

dac.d.value=int(celsius_degrees)



print(dac.a.value, "oil")
print(dac.b.value, "gas")
print(dac.c.value, "water")
print(dac.d.value, "C")
print("__________________________________")
LED(0)
time.sleep(10)

Post Reply