0
\$\begingroup\$

In my project I need to interface HX711 24 bit External ADC to STM32L100RC6 MCU How can I do this ?

\$\endgroup\$
  • 4
    \$\begingroup\$ I can literally see the major effort you've put in to making this question. The answer to your question might be 5!, that's 1×2×3×4×5. \$\endgroup\$ – Harry Svensson Jul 19 '17 at 5:49
  • \$\begingroup\$ Your title does not match your question. On a practical level, the simplest approach would likely be to do a port of the usual Arduino solution, but you should consider if the lower jitter clocks that might be obtained from a hardware interface engine will (or will not) produce a more accurate output from this chip than a software approach would. \$\endgroup\$ – Chris Stratton Jul 19 '17 at 5:58
3
\$\begingroup\$

I've used this IC in several designs. It's quite simple, but a bit ad hoc: you connect DOUT and PD_SCK to 2 GPIOs of your MCU. Data comes out on DOUT when you clock PD_SCK , so you can think of it as SPI without MOSI. You don't send instructions to the HX711, you just pulse its PD_SCK to read the next measurement.

  • To read a value, you must wait for DOUT to be LOW. Then, clock PD_SCK with 24 positive-going pulses.
  • To set the internal differential amplifier's gain (128, 64, 32), you add extra pulses at the end for a total of 25, 26 and 27 pulses respectively. This is applied to the next acquisition, so you should do a dummy read in the beginning to set the initial gain.
  • DOUT is a 24-bit value with bits valid on PD_SCK falling edges.

It's really all there is to it.

Here's a capture I did recently in gain=128 mode (25 pulses).

enter image description here

It is a single acquisition part of a train of samples. I was experimenting with taking multiple samples and averaging them to reduce noise. The events on the right are the times at which the samples were measured. It's not constant because I was doing something like 6 acquisitions per measurement, at roughly 10Hz.

Below, a capture of the overall acquisition over a longer period of time. Each yellow glitch is a full sequence as the one shown in the first image. You can see I'm doing 1 measurement per second, where each measurement consists of 6 samples as 10Hz. This was just for testing the chip and my asynchronous acquisition interface in the firmware.

enter image description here

\$\endgroup\$

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