This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ADS1232

Other Parts Discussed in Thread: REF5025, ADS1232, ADS1235

Hello,

While the final layout of my board is not ready.
I decided to buy a test board (follow link)

en.aliexpress.com/.../32955526756.html a2g03.search0104.3.207.2263376bMTd8Uc & ws_ab_test = searchweb0_0 2Csearchweb201602_3_10065_10068_10547_319_5730915_317_10548_10696_453_10084_454_10083_10618_10307_538_537_536_5729815_10059_10884_10887_100031_321_322_10103%%% 2Csearchweb201603_2 2CppcSwitch_0 & algo_pvid = 1a563b4d-fe92-4379-8b5b-ce7e5db47fbe & algo_expid = 1a563b4d-fe92-4379-8b5b-32-ce7e5db47fbe

The (.c) and (.h) driver files as well as the schematic of the board are attached. And most importantly a scan of the AD values ​​passed to the serial in the file screen.jpg.

The problem is that even using the battery in power in conjunction with the REF5025 I'm seeing a big change in the last 8 bits of the AD and I believe something is wrong.

Here's the AD reading function:


// READ
void Read (void)
{
unsigned int data = 0;

while (DOUT_READ_BIT);

Num ++;

for (char count = 0; count <25; count ++)
{
SCLK (1);
date = date << 1;

if (DOUT_READ_BIT)
date = date | 0x000001;
else
data = date & 0xFFFFFE;

SCLK (0);
}

Value = data >> 1;

Sum + = Value;
}

Here are the tasks to read and the average read

/ * StartDefaultTask function * /
void StartDefaultTask (void const * argument)
{

  / * USER CODE BEGIN 5 * /
  / * Infinite loop * /
  for (;;)
  {
osDelay (5); // EVERY 5ms
Read ();
  }
  / * USER CODE END 5 * /
}

/ * StartTask02 function * /
void StartTask02 (void const * argument)
{
  / * USER CODE BEGIN StartTask02 * /
  / * Infinite loop * /
  for (;;)
  {
osDelay (500);

Avg = (float) Sum / Num;
Ad = (int) Avg;
Range = (Avg-Offset);
Weight = Range / Factor;

if (EAS_GetOffset) {
Offset = Avg;
EAS_GetOffset = 0;
}
if (EAS_GetFactor) {
Factor = (float) (Avg-Offset) / EAS_Weight;
EAS_GetFactor = 0;
}

snprintf (Vector, sizeof (Vector), "Avg:% f, AD:% x, Sum:% d, nReadings:% d, Weight:% f \ r \ n"
Avg, Ad, Sum, Num, Weight);

while (HAL_UART_Transmit_IT (& huart1, (uint8_t *) Vector, strlen (Vector)) = HAL_OK);

Num = 0;
Sum = 0;
  }
  / * USER CODE END StartTask02 * /
}

[RELATED]

e2e.ti.com/.../2754796

ADS1232.zip

  • Hi Erisson,

    You have not shown what the pin settings are for the ADS1232. It is important to know the SPEED and GAIN settings you are using. It is not clear what the actual noise is for the measurement or what you are actually attempting to measure (such as the input source and voltage). I would start by simplifying your processing as much as possible by looking just at the raw code being returned and determining the noise then comparing to the noise tables in the ADS1232 datasheet.

    Are you using the same input load cell as was discussed in the earlier thread? In that discussion I mentioned a few things such as using the same voltage for the excitation as the reference so that the measurement is ratiometric. You should also have similar filtering for the analog inputs and the reference. In the schematic there is no reference filtering. I would suggest that at the very least a 0.1uF cap be placed close to the reference pins of the ADS1232.

    Using the 2.5V reference may seem like a good idea, but the ratiometric measurement will be much better for removing common noise and drift. Also the LSB size will be much smaller when using the 2.5V reference and the result will appear to have more noise.

    As far as the data is concerned, actual converted data will show a lot more than just attempting to average in case there is a mistake in calculation. It is not clear if the averaging portion is actually working. It also appears you have a macro set for determining the state of DOUT/DRDY. However, the last bit read from the device could be a high or a low so you need to force the DOUT/DRDY high when polling the pin. This is accomplished by sending a 25th clock.

    If the last 8 bits is toggling, this may be correct depending on which reference you are using. If you are using the 2.5V reference the number of noise-free bits will be worse than what is shown in the datasheet tables. In addition, you will see the noise of the excitation source. That is the reason for making the measurement ratiometric.

    I'm also confused by your code as in two places you have infinite loops and I see no way of breaking from those loops. Make sure your code is working as intended by using a logic analyzer or oscilloscope to verify timing and the state of the DOUT/DRDY pin.

    Best regards,
    Bob B
  • ADS1232_02.zip

    Thanks Bob for the attention.

    I need to know if it is possible with ads1232 to measure objects in [Kg] and [g] or even more accurately [0.5g] for example. Or maybe it would be the case to use another component. Could you suggest another?

     The big problem I see is that when I set an offset I notice a fluctuation in the [ADC-OFFSET] values, which looks a lot like a sine-wave signal over a large span of time. I do not know if it's really a problem or if it's a feature of components that use DELTA-SIGMA, can you tell me that? If it is, I'll probably have issues with other components as well.

    I'm using:

    GAIN = 128

    SPS = 80

    ADC = 5V (SPX3819)

    VREF = 2.5V (REF5025)

    VDD = 3.3V

    I'm using the same load cell.

    But the same error happens with other load cells.

    On the PCB board that is being developed it will have the same voltage for excitation and reference, but on this test board I am using the REF5025 for 2.5V.

    There is no filter in the reference, however I am using a battery to power the AD and the reference, the result should not improve significantly?

    I believe the average is not working, but I do not know how to improve that reading. Any idea?

    I do not know what the noise would look like if I'm using the battery.

    In the code I'm using RTOS (FREE-RTOS), the tasks work concurrently, in fact, concurrently and their structure is loop infinite, this allows the use of FOR and WHILE without interruption of the firmware through timeslice.

    Below are the MACROS:

    [code]

    #define A0 (x) ((x)? (HAL_GPIO_WritePin (AD1232_A0_GPIO_Port, ADS1232_A0_Pin, GPIO_PIN_SET)):

    (HAL_GPIO_WritePin (ADS1232_A0_GPIO_Port, ADS1232_A0_Pin, GPIO_PIN_RESET)));

    #define SCLK (x) ((x)? (HAL_GPIO_WritePin (ADS1232_SCK_GPIO_Port, ADS1232_SCK_Pin, GPIO_PIN_SET)):

    (HAL_GPIO_WritePin (ADS1232_SCK_GPIO_Port, ADS1232_SCK_Pin, GPIO_PIN_RESET)));

    #define SPEED (x) ((x)? (HAL_GPIO_WritePin (ADS1232_SPEED_GPIO_Port, ADS1232_SPEED_Pin, GPIO_PIN_SET)):

    (HAL_GPIO_WritePin (ADS1232_SPEED_GPIO_Port, ADS1232_SPEED_Pin, GPIO_PIN_RESET));

    #define PDOWN (x) ((x)? (HAL_GPIO_WritePin (ADS1232_PDOWN_GPIO_Port, ADS1232_PDOWN_Pin, GPIO_PIN_SET)):

    (HAL_GPIO_WritePin (ADS1232_PDOWN_GPIO_Port, ADS1232_PDOWN_Pin, GPIO_PIN_RESET)));

    #define GAIN_1 (x) ((x)? (HAL_GPIO_WritePin (ADS1232_GAIN1_GPIO_Port, ADS1232_GAIN1_Pin, GPIO_PIN_SET)):

    (HAL_GPIO_WritePin (ADS1232_GAIN1_GPIO_Port, ADS1232_GAIN1_Pin, GPIO_PIN_RESET)));

    #define GAIN_0 (x) ((x)? (HAL_GPIO_WritePin (ADS1232_GAIN0_GPIO_Port, ADS1232_GAIN0_Pin, GPIO_PIN_SET)):

    (HAL_GPIO_WritePin (ADS1232_GAIN0_GPIO_Port, ADS1232_GAIN0_Pin, GPIO_PIN_RESET)));

    #define DOUT_READ_BIT HAL_GPIO_ReadPin (ADS1232_DOUT_GPIO_Port, ADS1232_DOUT

    [/code]

  • Hi Erisson,

    The ADS1232 was designed specifically for load cells. The ADC does not convert to weight as it measures a voltage. The degree of resolution will depend on the maximum weight of the scale divided by the total noise-free resolution of the ADS1232. The noise-free resolution is based on peak to peak noise of your system. Unshielded cables can act as antenna to pick up noise.

    If you see what appears to be a sine wave in your data then most likely you are picking up power line-cycle frequency from lights, etc.. This should reduce if you use 10sps instead of 80sps as the SINC filter of the ADS1232 digital filter will notch 50/60 Hz. You can verify this by using the raw data and plotting it as a time domain plot.

    Best regards,
    Bob B
  • Hi Bob,

    10 samples require at least 100ms to do the next reading which seems to me a bit slow. I need to have the weights averaged in less than 1 minute. What component do you suggest for this type of weighing.
  • Hi Erisson,

    I'm sorry for my delayed response as we have had a holiday period in the USA. The ADS1232 was designed to operate with little to no averaging. The ADS1232 is an oversampling device with an internal digital SINC filter. The digital filter will notch at power line-cycle frequencies at 10sps and will not at 80sps. If you are experiencing power line-cycle noise and are attempting to operate at 80sps, 50/60 Hz is within the passband of the converter. You will be gaining this noise and passing it through to the result. It is extremely important that any external noise source be reduced as much as possible prior to the gain stage. How this is accomplished depends on the noise source, so much investigation is required to determine the source of the noise.

    So it is possible to average many times in an attempt to improve the result, but this will not necessarily mean you will have success. You could use the ADS1235 which has a faster conversion rate, but I doubt that it will be any improvement unless the noise is eliminated first. The ADS1232 is used successfully in millions of scales, but there are not shortcuts to achieving performance.

    Best regards,
    Bob B