Arduino Mega ADK and HX711 Weighing Sensor Rain Detection System with LED Indicator
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit is designed to interface an HX711 Weighing Sensor Module with an Arduino Mega ADK (Rev3) to measure weight and control an LED based on the weight readings. The LED will light up when the weight exceeds a certain threshold.
Component List
HX711 Weighing Sensor Module
- Pins: B-, B+, A-, A+, E-, E+, VCC, CK/TX, DO/RX, GND
- Description: A precision 24-bit analog-to-digital converter (ADC) designed for weigh scales and industrial control applications.
LED: Two Pin (red)
- Pins: cathode, anode
- Description: A standard red LED used for visual indication.
Resistor
- Pins: pin1, pin2
- Description: A resistor with a resistance of 200 Ohms.
- Properties:
- Resistance: 200 Ohms
Arduino Mega ADK (Rev3)
- Pins: A8, A9, A10, A11, A12, A13, A14, A15, A0, A1, A2, A3, A4, A5, A6, A7, D21/SCL, D20/SDA, D19/RX1, D18/TX1, D17/RX2, D16/TX2, D15/RX3, D14/TX3, ICSP2 MISO, 5V, ICSP2 SCK, ICSP2 MOSI, RESET2, GND, AREF, D13 PWM, D12 PWM, D11 PWM, D10 PWM, D9 PWM, D8 PWM, RESET, 3V3, VIN, D0/RX0, D1/TX0, D2 PWM, D3 PWM, D4 PWM, D5 PWM, D6 PWM, D7 PWM, D22, D23, D24, D25, D26, D27, D28, D29, D30, D31, D32, D33, D34, D35, D36, D37, D38, D39, D40, D41, D42, D43, D44, D45, D46, D47, D48, D49, D50/MISO, D51/MOSI, D52/SCK, D53/SS, ICSP MISO, ICSP MOSI, ICSP SCK, RESET3, IOREF
- Description: A microcontroller board based on the ATmega2560, designed for complex projects.
Wiring Details
HX711 Weighing Sensor Module
- VCC connected to 5V on Arduino Mega ADK (Rev3)
- CK/TX connected to D2 PWM on Arduino Mega ADK (Rev3)
- DO/RX connected to D3 PWM on Arduino Mega ADK (Rev3)
- GND connected to GND on Arduino Mega ADK (Rev3)
LED: Two Pin (red)
- cathode connected to GND on Arduino Mega ADK (Rev3)
- anode connected to pin2 on Resistor
Resistor
- pin1 connected to D13 PWM on Arduino Mega ADK (Rev3)
- pin2 connected to anode on LED: Two Pin (red)
Code Documentation
Arduino Mega ADK (Rev3) Code
#include "HX711.h"
#define LOADCELL_DOUT_PIN 3
#define LOADCELL_SCK_PIN 2
#define LED_PIN 13
HX711 scale;
void setup() {
Serial.begin(9600);
scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
pinMode(LED_PIN, OUTPUT);
}
void loop() {
if (scale.is_ready()) {
long reading = scale.read();
Serial.print("Reading: ");
Serial.println(reading);
if (reading > YOUR_THRESHOLD_VALUE) { // Replace YOUR_THRESHOLD_VALUE with the value that indicates a raindrop
digitalWrite(LED_PIN, HIGH);
delay(60000); // Keep the LED on for 60 seconds
digitalWrite(LED_PIN, LOW);
}
} else {
Serial.println("HX711 not found.");
}
delay(500);
}
- LOADCELL_DOUT_PIN: Pin 3 on Arduino Mega ADK (Rev3)
- LOADCELL_SCK_PIN: Pin 2 on Arduino Mega ADK (Rev3)
- LED_PIN: Pin 13 on Arduino Mega ADK (Rev3)
This code initializes the HX711 Weighing Sensor Module and sets up the LED pin as an output. In the loop, it reads the weight from the sensor and lights up the LED if the weight exceeds a specified threshold. The LED remains on for 60 seconds before turning off.