Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino Mega 2560-Based Temperature-Controlled Valve, Pump, and Fan System with SD Card Logging

View and Edit Project In Cirkit DesignerImage of Arduino Mega 2560-Based Temperature-Controlled Valve, Pump, and Fan System with SD Card Logging

Circuit Documentation

Summary

This circuit is designed to control a valve, pump, and fan based on temperature readings from multiple thermocouple amplifiers. The temperature data is logged to an SD card. Additionally, a current sensor is used to monitor the current and control the relays. The circuit is managed by an Arduino Mega 2560 microcontroller.

Component List

  1. Valve

    • Pins: GND, DCIN
    • Description: Controls the flow of a fluid or gas.
  2. 1 Channel Relay 5V

    • Pins: VCC, GND, IN, NC, COM, NO
    • Description: Used to control high voltage devices with a low voltage signal.
  3. 120V Outlet

    • Pins: AC Neutral, AC Hot, GND
    • Description: Standard electrical outlet for 120V AC devices.
  4. Pump

    • Pins: in, -VE, ground
    • Description: Used to move fluids.
  5. Power Supply

    • Pins: +, -, GND
    • Description: Provides power to the circuit.
  6. Current Sensor 5A

    • Pins: 1, 2, GND, OUT, VCC
    • Description: Measures the current flowing through the circuit.
  7. Adafruit Thermocouple Amplifier MAX31855

    • Pins: VIN, +3V3, THERMO-, GND, DO, THERMO+, CS, CLK
    • Description: Amplifies the signal from a thermocouple for temperature measurement.
  8. Arduino Mega 2560

    • Pins: IOREF, RESET, 3V3, 5V, GND, VIN, A0-A15, D0-D53, SDA, SCL, AREF
    • Description: Microcontroller used to control the circuit.
  9. Adafruit MicroSD card breakout board

    • Pins: VCC, +3V3, GND, CLK, DO, DI, CS, CD
    • Description: Used to log data to an SD card.
  10. Fan

    • Pins: +ve, grnd, -ve
    • Description: Used for cooling purposes.
  11. AC

    • Pins: +ve, grnd, -ve
    • Description: Air conditioning unit.
  12. 18650 Li-Ion Battery

    • Pins: Positive, Negative
    • Description: Rechargeable lithium-ion battery.

Wiring Details

Valve

1 Channel Relay 5V

120V Outlet

Pump

Power Supply

Current Sensor 5A

Adafruit Thermocouple Amplifier MAX31855

Arduino Mega 2560

Adafruit MicroSD card breakout board

Fan

AC

18650 Li-Ion Battery

Code Documentation

/*
 * Arduino Sketch for controlling a valve, pump, and fan based on temperature
 * readings from multiple thermocouple amplifiers. The temperature data is
 * logged to an SD card. The current sensor is also read and used to control
 * the relays.
 */

#include <SPI.h>
#include <SD.h>
#include <Adafruit_MAX31855.h>

// Pin definitions
#define RELAY1_PIN 36
#define RELAY2_PIN 37
#define RELAY3_PIN 38
#define CURRENT_SENSOR_PIN 2
#define SD_CS_PIN 53

// Thermocouple amplifier pins
#define THERMO_CS1 22
#define THERMO_CS2 23
#define THERMO_CS3 24
#define THERMO_CS4 25
#define THERMO_CS5 26
#define THERMO_CS6 27
#define THERMO_CS7 28

// Create thermocouple objects
Adafruit_MAX31855 thermocouple1(THERMO_CS1);
Adafruit_MAX31855 thermocouple2(THERMO_CS2);
Adafruit_MAX31855 thermocouple3(THERMO_CS3);
Adafruit_MAX31855 thermocouple4(THERMO_CS4);
Adafruit_MAX31855 thermocouple5(THERMO_CS5);