Skip to content

ufnalski/hx711_non_blocking_spi_g431kb

Repository files navigation

HX711 non-blocking SPI (STM32G431KB)

An STM32 HAL example of reading the Avia Semiconductor HX711 24-bit ADC for load cells / weight scales / tensometric beams.

Gain selection

AVIA Semiconductor HX711 24-Bit Analog-to-Digital Converter (ADC) for Weigh Scales: Fig.2 Data output, input and gain selection timing and control Source: HX711 Datasheet

In the example MOSI is used as CLK to produce the required number of cycles/pulses for HX711. It enables straightforward use of DMA just by calling HAL_SPI_TransmitReceive_DMA().

Missing files?

Don't worry 🙂 Just hit Alt-K to generate /Drivers/CMCIS/ and /Drivers/STM32G4xx_HAL_Driver/ based on the .ioc file. After a couple of seconds your project will be ready for building.

Before:

screenshot of the imported CubeIDE project

After:

screenshot after generating the code and building the project

Sources and inspirations

  • MOSI as CLK for HX711: My original idea, i.e. not copied from other sources. It doesn't mean that I'm the first one to do it this way - probably I'm not. I just didn't came across such a solution in other projects known to me.
  • OLED: stm32-ssd1306 (MIT license)

Call for action

Build your own home laboratory/workshop! Get inspired by ControllersTech, DroneBot Workshop, Andreas Spiess, GreatScott!, ElectroBOOM, Phil's Lab, atomic14, That Project, Paul McWhorter, and many other professional hobbyists sharing their awesome projects and tutorials! Shoutout/kudos to all of them!

Warning

Control engineering - do try this at home ❗

190+ challenges to start from: Control Engineering for Hobbyists at the Warsaw University of Technology.

Stay tuned!

About

HX711 tensometric beam and STM32 SPI DMA using HAL.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published