0
\$\begingroup\$

I'm making a digital weight scale with Arduino and CS5532. My problem is to calibrate adc with the offset signal and a known weight signal that is not full scale point. The CS5532 allows me to manually write on calibration registers, but i don't understand the relationship between the gain register value and scale maximum capacity. In the calibration phase, I ask the user to enter the following values:

  • Maximum Capacity (ex. 3000 kg)
  • Division (ex. 20 or 10, 1, 0.1)
  • Sample Known Weight (that is not full scale)

With Maximum Capacity and Sample Known Weight i compute the difference in percentage to calculate the adc value relative to the Maximum Capacity but i don't understand how to valorize the gain register value.

The gain register is a 32-bit register and its meaning is represented by the sum:

D = sum, 0 to 29, bit(i) * 2^(-24 + i)

ex.

00001000000000000000000000000

(bit(0) * 2^(-24 + 0) + bit(1) * 2^(-24 + 1) + ..)

If I run cs5532 system gain calibration (cs5532 native function), gain register value is automatically calculated but this function assumes full scale signal is applied and in my case I don't have the full scale signal.

How to valorize gain register without full scale signal?

To calibrate the adc cs5532, I must supply the converter’s calibration signals which represent ground and full scale, and in this case, i could use the system calibration (cs5532 native function) that compute gain and offset register automatically. I have a sample weight and i dont have the full scale signal. So I have to manually write the gain register and i dont understand the relationship between input signal and the gain register value. So, how can i compute the gain register value given input adc value computed by sample weight in percentage?

CS5532 Datasheet: https://www.mouser.com/datasheet/2/76/CS5532-34-BS_F3-44768.pdf

CS5532 Application Note: https://pdf.dzsc.com/88889/28154.pdf

\$\endgroup\$
8
  • \$\begingroup\$ What’s stopping you from applying your own scaling? \$\endgroup\$
    – Kartman
    Commented Dec 14, 2022 at 10:34
  • \$\begingroup\$ I don't understand the relationship between the gain register value and scale maximum capacity. how do i have to valorize the gain register value relative maximum capacity? the gain register value spans from 0 to (64 - 2^-24) \$\endgroup\$ Commented Dec 14, 2022 at 11:03
  • \$\begingroup\$ The gain register is multiplied times the input to get the output, correct? If you know the maximum input and you have the maximum output value you want, then you would divide one by the other to get the gain value. \$\endgroup\$ Commented Dec 14, 2022 at 14:07
  • \$\begingroup\$ The input value in the ADC is the voltage in mV and my output is a 24 bit data in two's complement format. When i go to divide (adc value) / (input-mV), this is not correspond to the gain register value format that is a number spans from 0 to (64 - 2^-24) \$\endgroup\$ Commented Dec 14, 2022 at 14:38
  • \$\begingroup\$ Use the digital value being input to the gain register in your calculation, not the analog voltage. For example, if the digital value is 1, and the output you want is 8, set the gain to 8 using the formula you posted. \$\endgroup\$ Commented Dec 14, 2022 at 15:42

1 Answer 1

1
\$\begingroup\$

Set the gain to 1. Put the known weight on the scale and read out it's value from the ADC. Take the weight off and read out the ADC with nothing. Subtract those two values to get the weight of the known object in ADC counts. Divide that by the weight in kilograms to get the ADC counts per kilogram.

Take (2^24- weight of nothing) and divide by the desired maximum weight to get the desired ADC counts per kilogram. Divide the desired by the actual to get the gain value. Calculate the register value using the formula you posted above.

\$\endgroup\$
3
  • \$\begingroup\$ Thanks for your answer, Why do you use 2 ^ 16? Maybe 24? Adc Resolution? \$\endgroup\$ Commented Dec 15, 2022 at 16:18
  • \$\begingroup\$ @CarmineZagaria I misread that it was a 16 bit ADC, but looks like it is 24, so use that value instead. \$\endgroup\$ Commented Dec 15, 2022 at 21:50
  • \$\begingroup\$ Once the value of the gain has been calculated, How can I use this value to compute binary value? Because that is a strange sum, from bit 0 to 29 with pow from 2^-29 to 2^5. \$\endgroup\$ Commented Dec 17, 2022 at 9:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.