Measuring Voltages with an ADC3 click and Flip&Click


#1

Hey everyone!

I have a problem with my ADC3 Click I bought at Mikroelektronika. I try to measure two voltages using the mcp3428.py-library.
the programm looks something like that:

# setup for measuring the first channel
mcp = mcp3428.MCP3428(I2C1, addr = 0x68)
mcp.set(cmode = 1, ch = 0, pga = 1, sps = 2)
# getting the raw data
value1 = mcp.get_raw_data()
# then there are some calculations I skip
# change the channel:
mcp.set(cmode = 1, ch = 1, pga = 1, sps = 2)
# get the data from the second channel
value2 = mcp.get_raw_data()
# then the same calculations I skiped before

The problem is that the first measurement is correct compared to a multimeter I connect to the pins. But the second measurement is 1V lower than the value showed at the multimeter.

So my question after reading the lib and the datasheet of the mcp3428 is if I got something wrong with writing the status byte or do I have to use another instance for the second channel?
Can anybody help?
Thanks in advance for your help!

Max







#2

Hi Max,
it could be a timing issue where the reading from the ADC is done before the conversion is complete.
The right way to address this would require checking the RDY bit status. This bit is contained in the configuration byte that the MCP3428 provides as output after the two conversion bytes.

However, the current library version does not read this configuration byte… we will consider adding this feature in a future update.
Until then, try putting a sleep(70) between set and get_raw_data calls (15 sps corresponds to one sample every ~70ms)

``mcp.set(cmode = 1, ch = 1, pga = 1, sps = 2)
sleep(70)
value2 = mcp.get_raw_data()

<br></span><br><br>

#3

Hey Andrea,
thanks for your comment.
I read the values 10 times and average them. I aded a 1s sleep after the .set() and another sleep(100) in every loop. I still have the same problem… Even when I change the values in the loop between 70,80,90 the same problem appears…
do you have another idea what could be the problem? :#


#4

Ok, I found the problem. My seccond voltage reaches the max. voltage. that was the problem.