Load Cell

by T_rent1998 in Circuits > Arduino

113 Views, 2 Favorites, 0 Comments

Load Cell

Lab2_3.jpg

Build a strain-gage load cell out of basic electronic components.


Important Information

Strain Gage - Sensor used to measure strain (deformation) in an object. It works by converting the mechanical deformation of a material into a change in electrical resistance.

Wheatstone Bridge - An electrical circuit used to precisely measure strain from electrical resistance. It consists of four resistors in a diamond shape.

Supplies

  1. 1 - ESP32 microcontroller with USB cable.
  2. 1 - HX711
  3. 1 - Cyanoacrylate (CA) bonding adhesive or glue
  4. 1 - breadboard
  5. 2 - 320 ohm resistors
  6. 2 - 350 ohm strain-gages
  7. 8 - male-to-female wires
  8. 4 - female-to-female wires

ESP32 Microcontroller

  1. Download the latest version of Arduino IDE (https://www.arduino.cc/en/software)
  2. Download the drivers related to the hardware
  3. CP2102 driver
  4. Esp32 Board by Expressif Systems
  5. HX711 Arduino Library
  6. Plug your arduino into your computer and test the connection.
  7. After plugging in, open Arduino IDE app and select your board: DOIT ESP32 DEVKIT V1
  8. Under File, hover over ‘Examples’, then ‘01.Basics’, and click Blink and run it.

Wiring & Strain-gage

Lab2_2.jpg
Lab2_4.jpg
Lab2_1.jpg
  1. Using glue, attach the 2 strain-gages to the surface you are testing.
  2. Set up your bread board and plug 4 male end wires into it (17a, 24a, 18j, 25j).
  3. For the male end wires, depending on which you’re using, you may need to wire strip the ends that will connect to the strain-gage. Solder the bare ends of wire to the strain-gage wires, 17a/18j to the two inside wires and 24a/25j to the two outside wires (see image).
  4. Place the two resistors in between the wires (17e/18f, 24e/25f).
  5. Wire the HX711 and ESP32 using 4 female-to-female wires:
  6. D21 of ESP32 to DT of HX711
  7. D22 of ESP32 to SCK of HX711
  8. VIN of ESP32 to VCC of HX711
  9. GND of ESP32 to GND of HX711
  10. Wire the HX711 to the strain-gage wiring on the breadboard using 4 male-to-female wires
  11. On HX711, E+/E- and A-/A+ will be pairs that are place on opposite corners
  12. Example: E+ -> 18i, E- -> 24b, A- -> 25i, A+ -> 17b
  13. Note: They need to be on opposite corners and inside of the strain-gage wiring.

Run Code

Screenshot 2024-12-12 124504.png
  1. Run code below
  2. Go to tools, click Serial Monitor (ctrl + shift + m), set the baud to 4800 and view results. 


#include "HX711.h"

const int LOADCELL_DOUT_PIN = 21; // Data output pin for reading weight data

const int LOADCELL_SCK_PIN = 22; // Clock pin for communication with HX711


HX711 scale;


float calibration_factor = -1000;


void setup() {

 serial.begin(4800);


 delay(10000); // Waits for 10 seconds for debugging and stabilization


 scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);

}


void loop() {

 serial.print("Reading: ");

 serial.print(scale.get_units(2), 10);

 serial.print(" lbs");

 serial.print(" calibration_factor: ");

 serial.println(calibration_factor);

 serial.print('Raw: ');

 serial.print(scale.read());

 serial.println();

 scale.power_down();

 delay(500);

 scale.power_up();

}