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

Arduino-Based Temperature Monitoring System with RGB LED Feedback and I2C LCD Display

View and Edit Project In Cirkit DesignerImage of Arduino-Based Temperature Monitoring System with RGB LED Feedback and I2C LCD Display

Circuit Documentation

Summary

This circuit is designed to interface an Adafruit Proto Shield R3 with a DS18B20 temperature sensor, a WS2812 RGB LED matrix, and an LCD I2C display. The circuit is powered by a +5V supply and includes ground connections to all components. The temperature sensor's signal is connected to a digital pin on the Proto Shield for temperature readings. The LED matrix is controlled by another digital pin, and the LCD display communicates over the I2C protocol using the SCL and SDA lines. The circuit includes embedded code to control the LEDs and display temperature readings on the LCD.

Component List

Wiring Details

Adafruit Proto Shield R3

DS18B20

WS2812 RGB LED matrix 1x8

LCD I2C Display

Resistor (200 Ohms)

Documented Code

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Adafruit_NeoPixel.h>
#include <OneWire.h>
#include <DallasTemperature.h>

// Pin definitions
#define LED_GREEN 6
#define LED_RED 7
#define TEMP_SENSOR_PIN 2
#define LED_MATRIX_PIN 13

// LED matrix setup
Adafruit_NeoPixel strip = Adafruit_NeoPixel(8, LED_MATRIX_PIN, NEO_GRB + NEO_KHZ800);

// LCD setup
LiquidCrystal_I2C lcd(0x27, 16, 2);

// Temperature sensor setup
OneWire oneWire(TEMP_SENSOR_PIN);
DallasTemperature sensors(&oneWire);

// Temperature threshold for good/bad condition
const float TEMP_THRESHOLD = 25.0; // Example threshold, adjust as needed

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

  // Initialize LED pins
  pinMode(LED_GREEN, OUTPUT);
  pinMode(LED_RED, OUTPUT);

  // Initialize LED matrix
  strip.begin();
  strip.show();

  // Initialize LCD
  lcd.init();
  lcd.backlight();

  // Initialize temperature sensor
  sensors.begin();
}

void loop() {
  // Update LED matrix with random colors
  updateLEDMatrix();

  // Read temperature and display on LCD
  sensors.requestTemperatures();
  float temperatureC = sensors.getTempCByIndex(0);
  lcd.setCursor(0, 0);
  lcd.print("Temp: ");
  lcd.print(temperatureC);
  lcd.print(" C");

  // Update LEDs based on temperature
  updateLEDs(temperatureC);

  delay(500);
}

void updateLEDs(float temperature) {
  if (temperature < TEMP_THRESHOLD) {
    digitalWrite(LED_GREEN, HIGH);
    digitalWrite(LED_RED, LOW);
  } else {
    digitalWrite(LED_GREEN, LOW);
    digitalWrite(LED_RED, HIGH);
  }
}

void updateLEDMatrix() {
  for (int i = 0; i < strip.numPixels(); i++) {
    strip.setPixelColor(i, random(0, 255), random(0, 255), random(0, 255));
  }
  strip.show();
}

This code is designed to run on an Arduino or compatible microcontroller. It initializes and controls the WS2812 RGB LED matrix, reads temperature data from the DS18B20 sensor, and displays the temperature on the LCD I2C display. It also includes logic to light up green or red LEDs based on the temperature threshold.