Arduino-Based Automated Garbage Compactor with HX711 Load Sensor and Relay Control
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit is designed to control a garbage pressing mechanism using an Arduino UNO, an HX711 weighing sensor module, a load sensor, relays, a solenoid, and a limit switch. The system measures the weight of the garbage and activates a solenoid to lock the lid, then uses a linear actuator to press the garbage if the weight threshold is not met. The system is controlled by an Arduino UNO, which reads inputs from the HX711 module and the limit switch, and controls the relays to operate the solenoid and actuator.
Component List
HX711 Weighing Sensor Module
- Description: A precision 24-bit analog-to-digital converter (ADC) designed for weigh scales and industrial control applications.
- Pins: B-, B+, A-, A+, E-, E+, VCC, CK/TX, DO/RX, GND
Load Sensor - 50kg
- Description: A load cell sensor capable of measuring weights up to 50kg.
- Pins: W, R, B
Arduino UNO
- Description: A microcontroller board based on the ATmega328P, used for various embedded applications.
- Pins: SDA, AREF, GND, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, A5, A4, A3, A2, A1, A0, Vin, 5V, 3.3V, RESET, IOREF, SCL
LMA
- Description: Linear Motion Actuator.
- Pins: +, -
4 Channel Relay Module
- Description: A relay module with 4 channels, used to control high voltage devices.
- Pins: N.O. 4, COM 4, N.C. 4, N.O. 3, COM 3, N.C. 3, N.O. 2, COM 2, N.C. 2, N.O. 1, COM 1, N.C. 1, Pin 13, Pin 14, Pin 15, Pin 16, Pin 17, Pin 18, Pin 19, Pin 20, Pin 21, Pin 22, Pin 23, Pin 24, VCC+, VCC- (GND), IN 1, IN 2, IN 3, IN 4
Power Supply
- Description: Provides power to the circuit.
- Pins: +, -
Solenoid
- Description: An electromechanical device used to lock the lid.
- Pins: pin1, pin2
2 Channel Relay Module
- Description: A relay module with 2 channels, used to control high voltage devices.
- Pins: N.O. 2, COM 2, N.C. 2, N.O. 1, COM 1, N.C. 1, pin 7, pin 8, pin 9, pin 10, pin 11, pin 12, VCC+, VCC- (GND), IN 1, IN 2
Limit Switch
- Description: A switch used to detect the position of the lid.
- Pins: C, NO, NC
Wiring Details
HX711 Weighing Sensor Module
- A-: Connected to Load Sensor - 50kg (B)
- A+: Connected to Load Sensor - 50kg (W)
- E-: Connected to Load Sensor - 50kg (B)
- E+: Connected to Load Sensor - 50kg (R)
- VCC: Connected to Arduino UNO (5V), 2 Channel Relay Module (VCC+), 4 Channel Relay Module (VCC+)
- CK/TX: Connected to Arduino UNO (4)
- DO/RX: Connected to Arduino UNO (3)
- GND: Connected to Arduino UNO (GND), 4 Channel Relay Module (VCC- (GND)), Limit Switch (C)
Load Sensor - 50kg
- B: Connected to HX711 Weighing Sensor Module (A-), HX711 Weighing Sensor Module (E-)
- W: Connected to HX711 Weighing Sensor Module (A+)
- R: Connected to HX711 Weighing Sensor Module (E+)
Arduino UNO
- 5V: Connected to HX711 Weighing Sensor Module (VCC), 2 Channel Relay Module (VCC+), 4 Channel Relay Module (VCC+)
- GND: Connected to HX711 Weighing Sensor Module (GND), 2 Channel Relay Module (VCC- (GND)), 4 Channel Relay Module (VCC- (GND)), Limit Switch (C)
- 4: Connected to HX711 Weighing Sensor Module (CK/TX)
- 3: Connected to HX711 Weighing Sensor Module (DO/RX)
- 7: Connected to 2 Channel Relay Module (IN 1)
- 6: Connected to 4 Channel Relay Module (IN 2)
- 5: Connected to 4 Channel Relay Module (IN 1)
- 2: Connected to Limit Switch (NO)
LMA
- +: Connected to 4 Channel Relay Module (N.O. 1)
- -: Connected to Solenoid (pin1), Power Supply (-), 4 Channel Relay Module (N.O. 2)
4 Channel Relay Module
- VCC+: Connected to Arduino UNO (5V), HX711 Weighing Sensor Module (VCC), 2 Channel Relay Module (VCC+)
- VCC- (GND): Connected to Arduino UNO (GND), HX711 Weighing Sensor Module (GND), Limit Switch (C)
- IN 1: Connected to Arduino UNO (5)
- IN 2: Connected to Arduino UNO (6)
- N.O. 1: Connected to LMA (+)
- N.O. 2: Connected to LMA (-), Solenoid (pin1), Power Supply (-)
- COM 1: Connected to Power Supply (+), 2 Channel Relay Module (COM 1), 4 Channel Relay Module (COM 2)
Power Supply
- +: Connected to 2 Channel Relay Module (COM 1), 4 Channel Relay Module (COM 1), 4 Channel Relay Module (COM 2)
- -: Connected to Solenoid (pin1), LMA (-), 4 Channel Relay Module (N.O. 2)
Solenoid
- pin1: Connected to Power Supply (-), LMA (-), 4 Channel Relay Module (N.O. 2)
- pin2: Connected to 2 Channel Relay Module (N.O. 1)
2 Channel Relay Module
- VCC+: Connected to Arduino UNO (5V), HX711 Weighing Sensor Module (VCC), 4 Channel Relay Module (VCC+)
- VCC- (GND): Connected to Arduino UNO (GND), HX711 Weighing Sensor Module (GND), Limit Switch (C)
- IN 1: Connected to Arduino UNO (7)
- COM 1: Connected to Power Supply (+), 4 Channel Relay Module (COM 1), 4 Channel Relay Module (COM 2)
- N.O. 1: Connected to Solenoid (pin2)
Limit Switch
- C: Connected to Arduino UNO (GND), HX711 Weighing Sensor Module (GND), 4 Channel Relay Module (VCC- (GND))
- NO: Connected to Arduino UNO (2)
Documented Code
#include "HX711.h"
// Pin definitions
#define LOAD_CELL_DT 3 // Data pin for HX711
#define LOAD_CELL_SCK 4 // Clock pin for HX711
#define RELAY_SOLENOID 5 // Relay pin for solenoid
#define RELAY_ACTUATOR_1 6 // Relay 1 for linear actuator
#define RELAY_ACTUATOR_2 7 // Relay 2 for linear actuator
#define LIMIT_SWITCH_PIN 8 // Limit switch input
// Thresholds
#define WEIGHT_THRESHOLD 2000 // Weight threshold for pressing (adjust as needed)
#define PRESS_DURATION 5000 // Duration (ms) for pressing if weight not met
// HX711 instance
HX711 scale;
// Variables
bool limitSwitchState = false;
void setup() {
// Initialize serial communication
Serial.begin(9600);
// Initialize HX711
scale.begin(LOAD_CELL_DT, LOAD_CELL_SCK);
// Calibrate HX711 (replace with your calibration factor)
scale.set_scale(2280.f);
scale.tare(); // Reset scale to 0
// Initialize relays and input pin
pinMode(RELAY_SOLENOID, OUTPUT);
pinMode(RELAY_ACTUATOR_1, OUTPUT);
pinMode(RELAY_ACTUATOR_2, OUTPUT);