Automated Hydroponic System with Raspberry Pi and Arduino Control
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit is designed to control a system that includes stepper motors, a solenoid, a water pump, and various sensors. It utilizes two Nema 17 stepper motors for precision movement, controlled by TB6600 stepper motor drivers. A 12V power supply is regulated down to 5V using a buck converter to power the relay modules, sensors, and an Arduino Mega 2560, which serves as the main microcontroller. The circuit also includes a Raspberry Pi 4B for higher-level functions, interfacing with the Arduino via serial communication. A solenoid and water pump are controlled via relay modules, and sensor data is collected from an ultrasonic sensor, an IR sensor, a DHT11 temperature and humidity sensor, and an RTC module for timekeeping. A 7-inch WaveShare HDMI screen is powered by the Raspberry Pi for display purposes.
Component List
Motors
- Nema 17 42-STH48 Stepper Motor: A stepper motor used for precision control in applications such as CNC machines and 3D printers.
Motor Drivers
- TB6600 Stepper Motor Driver: A driver module for controlling stepper motors, capable of handling higher currents and providing microstepping capabilities.
Power Supply and Conversion
- 12V Power Supply: Provides the main voltage source for the circuit.
- Buck Converter: Steps down the voltage from 12V to 5V to power low-voltage components.
Control Modules
- Arduino Mega 2560: A microcontroller board based on the ATmega2560, with numerous digital and analog I/O pins for interfacing with various components.
- Raspberry Pi 4B: A small single-board computer that provides more processing power and connectivity options.
Sensors and Modules
- HC-SR04 Ultrasonic Sensor: Measures distance by emitting ultrasonic waves and timing their return after bouncing off objects.
- IR Sensor: Detects infrared light, often used in proximity or object detection.
- RTC DS3231: A real-time clock module for maintaining accurate time.
- DHT11 Sensor V2: Measures ambient temperature and humidity.
Actuators
- Solenoid: An electromagnetic actuator used for creating linear motion.
- Water Pump: Pumps water, typically used in applications such as irrigation or cooling systems.
Display
- 7 inch WaveShare (H): An HDMI display for visual output from the Raspberry Pi.
Relay Modules
- Relay Module 5V-30V: Used for switching higher power circuits using low voltage control signals.
Wiring Details
Nema 17 42-STH48 Stepper Motor
- A2 (black): Connected to A+ on TB6600 Stepper Motor Driver.
- A1 (green): Connected to A- on TB6600 Stepper Motor Driver.
- B2 (red): Connected to B+ on TB6600 Stepper Motor Driver.
- B1 (blue): Connected to B- on TB6600 Stepper Motor Driver.
TB6600 Stepper Motor Driver
- ENA - (ENA), DIR - (DIR), PUL - (PUL): Connected to GND on the 12V power supply.
- ENA+ (+5V), DIR+ (+5V), PUL+ (+5V): Connected to 5V on the Arduino Mega 2560.
- VCC: Connected to IN+ on the Buck Converter.
- GND: Connected to IN- on the Buck Converter.
- A+, A-, B+, B-: Connected to corresponding pins on Nema 17 Stepper Motors.
12V Power Supply
- +: Connected to IN+ on the Buck Converter and VCC on TB6600 Stepper Motor Drivers.
- -: Connected to IN- on the Buck Converter and GND on TB6600 Stepper Motor Drivers.
Buck Converter
- IN+, IN-: Connected to the 12V power supply.
- OUT+: Connected to common contact on Relay Modules.
- OUT-: Connected to V- on Relay Modules, pin1 on Solenoid, GND on Water Pump, and GND on Raspberry Pi 4B.
Relay Module 5V-30V
- Common Contact: Connected to OUT+ on the Buck Converter.
- Normally Open: Connected to pin2 on Solenoid and VCC on Water Pump.
- Normally Closed: Not connected in this circuit.
- Trigger: Controlled by D7 PWM and D12 PWM on the Arduino Mega 2560.
- V-: Connected to OUT- on the Buck Converter.
- V+: Connected to 5V on the Arduino Mega 2560.
Solenoid
- Pin1: Connected to OUT- on the Buck Converter.
- Pin2: Connected to Normally Open on Relay Module.
Water Pump
- VCC: Connected to Normally Open on Relay Module.
- GND: Connected to OUT- on the Buck Converter.
HC-SR04 Ultrasonic Sensor
- VCC: Connected to 5V on the Arduino Mega 2560.
- TRIG: Controlled by D2 PWM on the Arduino Mega 2560.
- ECHO: Connected to D3 PWM on the Arduino Mega 2560.
- GND: Connected to GND on the Arduino Mega 2560.
IR Sensor
- Out: Connected to D4 PWM on the Arduino Mega 2560.
- Gnd: Connected to GND on the Arduino Mega 2560.
- Vcc: Connected to 5V on the Arduino Mega 2560.
RTC DS3231
- VCC: Connected to 5V on the Arduino Mega 2560.
- GND: Connected to GND on the Arduino Mega 2560.
- SCL: Connected to D21/SCL on the Arduino Mega 2560.
- SDA: Connected to D20/SDA on the Arduino Mega 2560.
DHT11 Sensor V2
- GND: Connected to GND on the Arduino Mega 2560.
- DAT: Connected to D53 on the Arduino Mega 2560.
- VCC: Connected to 5V on the Arduino Mega 2560.
Raspberry Pi 4B
- GPIO14: Connected to D19/RX1 on the Arduino Mega 2560.
- GPIO15: Connected to D18/TX1 on the Arduino Mega 2560.
- GND: Connected to OUT- on the Buck Converter.
- 5V: Connected to + on the 7 inch WaveShare (H).
7 inch WaveShare (H)
- +: Connected to 5V on the Raspberry Pi 4B.
- -: Connected to GND on the Raspberry Pi 4B.
Documented Code
Arduino Mega 2560 Code (sketch.ino)
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
Note: The provided code is a template and does not contain any functional code. It needs to be populated with the logic to control the circuit as per the requirements.