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

Arduino UNO and Sim800l GSM-Based Temperature Monitoring System with DS18B20 Sensors

View and Edit Project In Cirkit DesignerImage of Arduino UNO and Sim800l GSM-Based Temperature Monitoring System with DS18B20 Sensors

Circuit Documentation

Summary

This circuit is designed to read temperature data from three DS18B20 temperature sensors and send the data via text message using the Sim800l GSM module. The circuit is controlled by an Arduino UNO microcontroller, which interfaces with the sensors and the GSM module. A rocker switch and a 12V battery are used to power the circuit.

Component List

  1. Arduino UNO

    • Description: Microcontroller board based on the ATmega328P.
    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
  2. Sim800l

    • Description: GSM/GPRS module for sending and receiving SMS and data.
    • Pins: NET, RST, VCC, RXD, TXD, GND
  3. DS18B20

    • Description: Digital temperature sensor.
    • Pins: signal, GND, vcc
  4. Rocker Switch

    • Description: Switch to control the power supply.
    • Pins: output, input
  5. Battery 12V

    • Description: 12V power supply.
    • Pins: +, -

Wiring Details

Arduino UNO

Sim800l

DS18B20 (First Sensor)

DS18B20 (Second Sensor)

DS18B20 (Third Sensor)

Rocker Switch

Battery 12V

Code Documentation

/*
 * This Arduino Sketch reads data from three DS18B20 temperature sensors
 * and sends the data via text message using the Sim800l GSM module.
 */

#include <OneWire.h>
#include <DallasTemperature.h>
#include <SoftwareSerial.h>

// Pin configuration for DS18B20 sensors
#define ONE_WIRE_BUS_A0 A0
#define ONE_WIRE_BUS_A1 A1
#define ONE_WIRE_BUS_A2 A2

// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWireA0(ONE_WIRE_BUS_A0);
OneWire oneWireA1(ONE_WIRE_BUS_A1);
OneWire oneWireA2(ONE_WIRE_BUS_A2);

// Pass our oneWire reference to Dallas Temperature sensor
DallasTemperature sensorsA0(&oneWireA0);
DallasTemperature sensorsA1(&oneWireA1);
DallasTemperature sensorsA2(&oneWireA2);

// Pin configuration for GSM module
SoftwareSerial gsmSerial(10, 11);  // RX, TX for GSM module

void setup() {
  // Start serial communication
  Serial.begin(9600);
  gsmSerial.begin(9600);

  // Start up the library for sensors
  sensorsA0.begin();
  sensorsA1.begin();
  sensorsA2.begin();

  // Send SMS to confirm system startup
  sendSMS("System started. Temperature monitoring enabled.");
}

void loop() {
  // Request temperature readings from all sensors
  sensorsA0.requestTemperatures();
  sensorsA1.requestTemperatures();
  sensorsA2.requestTemperatures();

  // Fetch temperature readings
  float tempA0 = sensorsA0.getTempCByIndex(0);
  float tempA1 = sensorsA1.getTempCByIndex(0);
  float tempA2 = sensorsA2.getTempCByIndex(0);

  // Print temperature readings to serial monitor
  Serial.print("Sensor A0: "); Serial.print(tempA0); Serial.println(" °C");
  Serial.print("Sensor A1: "); Serial.print(tempA1); Serial.println(" °C");
  Serial.print("Sensor A2: "); Serial.print(tempA2); Serial.println(" °C");

  // Send temperature readings via SMS
  String message = "Temp A0: " + String(tempA0) + " °C\n" +
                   "Temp A1: " + String(tempA1) + " °C\n" +
                   "Temp A2: " + String(tempA2) + " °C";
  sendSMS(message);

  // Wait for 10 minutes before next reading
  delay(600000);
}

// Function to send SMS using GSM module
void sendSMS(String message) {
  gsmSerial.println("AT+CMGF=1");    // Set SMS mode to text
  delay(1000);
  gsmSerial.println("AT+CMGS=\"+918454044438\"");  // Replace with predefined contact
  delay(1000);
  gsmSerial.print(message);
  delay(1000);
  gsmSerial.write(26);  // Send CTRL+Z to indicate the end of the message
  delay(5000);
}

This code initializes the DS18B20 sensors and the Sim800l GSM module, reads temperature data from the sensors, and sends the data via SMS at regular intervals. The sendSMS function is used to send text messages using the GSM module.