G5 Smart Digital Balance - shalan/CSCE4301-WiKi GitHub Wiki

This Project was done by:

  • Omar Radwan - 900153452

  • Ahmed Ibrahim - 900160265

  • Mohamed Tarek - 900153178

Github Repo:

https://github.com/Omarradwan7/Weight-Sensor-Using-STM32-and-HX711

Project Overview:

Our aim for this project is to read the weight from the load cell and then convert the reading using the HX711 module. After that we display the readings on Tera Term and then we transmit the readings using TTL to be displayed on the Mobile Phone.

Software Components:

  • Keil V5 - Used to run the code on STM32 microcontroller.

  • Tera Term - Displays the results using the baud rate.

  • STM32 CubeMX - configurations STM32 microcontroller pins and clocks.

Hardware Components:

  • HX711 Module - Analog to Digital Converter

  • Load Cell - Measure the weight

  • STM32 microcontroller - The microcontroller is used to provide the VCC and GND to the HX711 sensor, handing it the clock and taking the output in return.

  • USB To TTL - To transfer the data to be displayed on Tera Term.

  • Android Mobile Phone - To display data on it.

Implementation:

  • We had to experiment with the weight sensor datasheet’s Gain values, choosing the best fit that provided us with stable weight readings. From 3 options (32, 64, 128), we felt as though having 128 as our Gain enabled us to generate the most accurate/stable readings possible from the load cell. This is not to say that 128 will always be the most suitable, we are merely stating what worked well with us.

  • Delay function: A simple reusable (applicable to limitless values) delay function that produces a parametrized delay whenever needed.

  • PowerUp function: An initializing function that wakes up the HX711 module and provides it with starting pin values (zeros).

  • SetGain function: A flexible function that enables the user to quickly cycle betweeen potential gain values to determine the best suitability.

  • Initialize function: An encapsulating function that groups the previous two functions together and initializes the HX711 weight sensor.

  • GetValue function: A crucial function that serves the purpose of retrieving serialized bit values from the HX711 sensor (32 bits).

  • IsReady function: This function checks whether or not the DOUT pin of the HX711 is set to LOW (read).

  • Main function: Simply obtain the calibrated weight reading and print it.

Difficulties we faced:

  • To calibrate the load cell was a challenge for us, as it’s very sensitive even for movements. So we had to make sure that it’s very stable.

  • In the beginning we were working with a damaged load cell and its output was all corrupted values and we didn’t know that it was damaged until we bought the Arduino Nano microcontroller and tested using it.

  • To make a load cell stable we have to fix it with a glass or plastic or wood surface, preferably glass as the online sources mention. However, after we went to different stores no one was able to do the glass for us. So we used wood, which wasn’t the perfect scenario for our project for different reasons: First of all, when we added wood we have to stick the wood with wood nails which made the surface not flat which caused problems with the load cell as its sensitive to movement as well. Another problem is the weight of the wood is now taken into consideration, so we had to re-calibrate the load cell with the new weight added to it. We will be mentioning the store which helped us with the wood configurations in the references sections.

  • There were no references talking about STM32 with HX711 module, so it was very difficult for us to do the research part of the project. However, the datasheet was our main reference.

Block Diagram:

BlockDiagram

Our Setup:

  • STM32CubeMX:

STMcubemx
  • These are the full connections:

fullconnections
  • This is the load cell setup:

loadcell

Our Results:

  • This is an image of TeraTerm when we first run the project:

Openingproj
  • This is an image when we added an apple on the load cell (an apple weighs from 70-100 g):

appleonloadcell
  • Results on Tera Term:

appleweight

References:

⚠️ **GitHub.com Fallback** ⚠️