Introduction: SMART Baby Crib #openfab #eyuboglu

Moms can relax with the smart baby bed!

Supplies

  1. Arduino UNO
  2. Buzzer
  3. OLED display
  4. Humidity sensor
  5. Blue and red LED light

Step 1: Project Presentation

This project is an Arduino-based smart baby crib system designed to improve babies’ comfort and alert parents in possible situations. It provides a simple yet effective prototype that helps parents monitor their baby’s comfort remotely. In future versions, features such as mobile notifications, temperature monitoring, or an automatic drying system can be integrated. #thankstoopenfab #openfab #eyuboglu #eyubogluegitim #eyubogluegitimkurumları #ozyeginuniversity #eyuboglu.k12.tr

Step 2: Library Installations

Arduino UNO program is installed

DHT11 Arduino Library is added

GFX.h library is added

SSD1306.h library is added

Step 3: Project Code Arduino

#include <Wire.h>

#include <Adafruit_GFX.h>

#include <Adafruit_SSD1306.h>


#define SCREEN_WIDTH 128

#define SCREEN_HEIGHT 64


Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);


const int nemSensoruPin = A0;

const int buzzerPin = 8;

const int kirmiziLedPin = 9;

const int maviLedPin = 10;


const int nemEsigi = 750;


void setup() {

pinMode(nemSensoruPin, INPUT);

pinMode(buzzerPin, OUTPUT);

pinMode(kirmiziLedPin, OUTPUT);

pinMode(maviLedPin, OUTPUT);


Serial.begin(9600);


if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {

Serial.println(F("OLED ekran bulunamadı"));

while (true);

}


display.clearDisplay();

display.setTextSize(2);

display.setTextColor(SSD1306_WHITE);

display.setCursor(0, 0);

display.println("Hazir");

display.display();

delay(1000);

}


void loop() {

int nemDegeri = analogRead(nemSensoruPin);

Serial.print("Nem Degeri: ");

Serial.println(nemDegeri);


if (nemDegeri < nemEsigi) {

// Nem var → UYARI durumu


// OLED ekranda UYAN yazısı

display.clearDisplay();

display.setTextSize(3);

display.setTextColor(SSD1306_WHITE);

display.setCursor(10, 20);

display.println("UYAN");

display.display();


// Polis sireni sesi (buzzer)

polisSireni();


// Kırmızı ve mavi ledleri sırayla yak/söndür

sirenLedleri();


} else {

// Nem yok → Her şey yolunda


digitalWrite(buzzerPin, LOW);

digitalWrite(kirmiziLedPin, LOW);

digitalWrite(maviLedPin, LOW);


display.clearDisplay();

display.setTextSize(2);

display.setTextColor(SSD1306_WHITE);

display.setCursor(0, 10);

display.println("Her sey yolunda :)");

display.display();


delay(500);

}

}


// Polis sireni sesi (buzzer) fonksiyonu

void polisSireni() {

// 2 kez yüksek ton sonra 2 kez alçak ton yap

tone(buzzerPin, 1000); // yüksek ton

delay(150);

noTone(buzzerPin);

delay(150);


tone(buzzerPin, 1000); // yüksek ton

delay(150);

noTone(buzzerPin);

delay(150);


tone(buzzerPin, 700); // alçak ton

delay(150);

noTone(buzzerPin);

delay(150);


tone(buzzerPin, 700); // alçak ton

delay(150);

noTone(buzzerPin);

delay(150);

}


// Kırmızı ve mavi LED'leri sırayla yak/söndür fonksiyonu

void sirenLedleri() {

digitalWrite(kirmiziLedPin, HIGH);

digitalWrite(maviLedPin, LOW);

delay(200);


digitalWrite(kirmiziLedPin, LOW);

digitalWrite(maviLedPin, HIGH);

delay(200);

}