# MCP4725 0-10v DAC outputting 5v max

Hi! This is my first post. I can usually solve stuff from internet searches, but not today.

When I send and values above 2047, the resulting output from the MCP4725 is always 5v. Sending values below 2047 results in voltages ‘around’ the desired value. For instance, sending 1024 should result in a voltage of 2.5v, I get 2.63. I get this could be from the supply voltage which is 5.22.

Here is my setup:

• Raspberry pi 4 b running raspian
• SCL,SDA,+5,GRD pins directly wired from rPi to MCP connector cable (the OUTPI2 Rev C caused rPi hard crash when connected MCP4725)
• Voltage is supplied from the GPIO pins on the rPi
• Output is measured with multimeter
• Writing to MCP4725 using SMBUS2 with Python 3

Is there something causing the limited output? Do I need to do something configure the MCP4725 to output from 5-10v?

Any help that can be provided would be greatly appreciated. I have spent a lot of time trying to figure this out.

Thank you!

Hi,
can you share the part number you are using?

Thanks

Here is a link to the part I have:

Hi,
Whats the output value when you set the DAC value to 3500.
I use this cod for testing

Thanks

Thanks for looking into this Bhaskar!

When I put through 3500 the result is a reading of 5.03v on the multi-meter. By my calcs, the voltage out should be around 8.4v.

Thanks for your code, but I am using a raspberry pi 4 b, so the code I am using is basically from another issue someone posted here:

``````from smbus2 import SMBus
import time

DELAY = 1

# Get i2C bus
bus = SMBus(1)

# 'i2cdetect -y 1' for address
DEVICE_OFFSET = 0x00

def convert_to_12bits(data):
raw_adc = (data[0] & 0x0F) * 256 + data[1]

'''
def convert(r):
return ((r[0] & 15) << 8) + r[1]
'''

def set_voltage(raw_value):
print("to_bytes: " + str(raw_value.to_bytes(2,'big')))
byte_data =[(raw_value >> 4), (raw_value & 15) << 4]
print("OUT")
print("[0] " + '{0:08b}'.format(byte_data[0]) + " | [1] " + '{0:08b}'.format(byte_data[1]))
print(int('{0:08b}'.format(byte_data[0]) + '{0:08b}'.format(byte_data[1])[:4],2))

print("<<<<<<<<<<<<<<< START >>>>>>>>>>>>>>")
set_voltage(3500)
time.sleep(DELAY)

# Read a block of 2 bytes from address 60, offset 0
print("------------------------")
print("RAW [0] " + '{0:08b}'.format(data[0]) + " | [1] " + '{0:08b}'.format(data[1]) + " | [2] " + '{0:08b}'.format(data[2]))
print("[0] " + '{0:08b}'.format(data[0]) + " | [1] " + '{0:08b}'.format(data[1]) + " | [2] " + '{0:08b}'.format(data[2])[:4])
print(int('{0:08b}'.format(data[1]) + '{0:08b}'.format(data[2])[:4],2))
print("------------------------")

print("ADC Voltage Output: %.2f V" % voltage)
``````

Here is the output:

``````<<<<<<<<<<<<<<< START >>>>>>>>>>>>>>
to_bytes: b'\r\xac'
OUT
[0] 11011010 | [1] 11000000
3500
------------------------
RAW [0] 11000000 | [1] 11011010 | [2] 11000000
[0] 11000000 | [1] 11011010 | [2] 1100
3500
------------------------
``````

I thought I might be sending the bytes to the wrong registers, but from the output, it looks ok. I can’t think of another reason the MC4725 would not be outputting the desired voltage.

please can you measure voltage across the CAP near VOUT screw terminal.
Thanks

I am not sure what the CAP is on the board, so I included a picture to show where I measured. The result is 1.58v for an input of 3500.

Thanks jeff.
looks like this board is not producing enough power.
I will recommend sending it back for repair.

https://ncd.io/contact-us/product-returns/

Thanks

This is my first experience with NCD products. Both the OUTPI2 and the MCP4725 did not work. I put in a bunch of time trying to figure it out. Since I am located in canada and fees to get this stuff across the boarder are more than the products are worth, I won’t be getting it repaired. I also won’t be getting any other NCD products, which is too bad because we are prototyping a control system that would be duplicated many, many times.

I sincerely thank you for your help! This is an issue with the product, not with the folks trying to provide support.

Jeff

Hi Jeff,
Apologies for the trouble.
Just looked at the picture you shared. measure the voltage on right side caps ( attaching the picture). It should be around 11V12V. If its 11V- 12V than i beleive the board is producing full power.

One more test you can do to see if there is any code issue.

1. Unplug the MCP4725 module
2. power down the Pi
3. plug the module back and power up the pi
4. measure voltage across VOUT and GND without running any code. it should be close to 5V.

Also can you share a picture of your setup.
Thanks

I measured across the components you showed. I get 5.05v on both after sending 3500 to the MCP4725.

I powered down the rPi and disconnected the MCP4725. I booted the rPi and waited for it to come up. I reconnected the MCP4725. The voltage between VOUT and GND was 5.04v.

Hi Jeff,
We are rebuilding your order and will ship it to you in a day or two. I will run it for few hours before letting it out for shipment.

Thanks

Thank you so much! This is quite good of you and NCD. I will give it another go when it gets here.

Did you you have a look at the program? Do you think it might be the issue somehow?

Jeff

i put together a test script

( i dont have hardware to test it)

I ran your program with both the smbus and smbus2 libraries. Same results, any values over 2048 give and output of 5v only.

I received the new MCP4725 module today. I ran your test program and everything checks out. Thank you so much for the customer focused response!!

I have a question about how you knew what value to use for the DAC channel (0x41). I don’t see this in any of the literature. Can you please explain this number so I know what it means?

Related to that, I want to use the “read_i2c_block_data” function with this module. The parameters are read_i2c_block_data(i2c_addr,register,length). This has been working for me as follows: bus.read_i2c_block_data(0x60, 0, 3). Can you shed some light on why 0 works in the read and 0x41 works in the write? I have not tried it because I thought I read somewhere that reading actually writes something the the eprom depending on the address. So, I would like to know what’s the best reading register to use so I don’t possibly cause another issue.

Again, I really appreciate you sending me a good module. I can hook this up to a control valve next week and start proving the process.

Jeff

Hi Jeff,