Skip to content

AdemAboueb7/SafeChild

Repository files navigation

SafeChild

SafeChild is a smart-nursery solution that combines a Flutter mobile application, Firebase backend services, and ESP32-based connected hardware (smart plush, baby-cry gateway) to keep parents informed about their child's environment in real time.

The app monitors temperature, humidity, gas levels, ambient light, motion, and baby-cry detection (TinyML on the ESP32), then sends prioritised alerts and notifications to caregivers.


Features

  • Real-time sensor monitoring (BME280 environmental sensor, MQ-2 gas sensor, LDR ambient light, motion).
  • Baby-cry detection running on-device (TFLite/ONNX model on ESP32).
  • Cloud sync and push notifications via Firebase Auth, Firestore, and FCM.
  • Bluetooth Low Energy (BLE) pairing flow to provision Wi-Fi credentials to the device without exposing them.
  • MQTT-based local communication between the cry-detection node and the gateway.
  • Internationalisation (FR / EN / AR) via flutter_localizations.
  • Beautiful Material 3 UI with Google Fonts and adaptive launcher icons.

Repository layout

SafeChild/
├── lib/                       # Flutter application source code
│   ├── core/services/         # Firebase, MQTT, BLE services
│   ├── features/              # Feature-based screens (login, pairing, settings, ...)
│   └── l10n/                  # Localisations (fr, en, ar)
├── assets/                    # Images and other Flutter assets
├── android/ ios/ web/         # Flutter platform projects
├── linux/ macos/ windows/     # Flutter desktop projects
├── functions/                 # Firebase Cloud Functions (Node.js)
├── hardware/                  # ESP32 firmware (Arduino IDE)
│   ├── 2emeCartebabycry/      # Smart-plush firmware (sensors + Firebase)
│   └── BabyCryGateway/        # MQTT gateway firmware
├── safechild_pairing/         # Standalone pairing sketch (BLE provisioning)
├── docs/                      # Project documentation
└── test/                      # Flutter unit / widget tests

Tech stack

Layer Tooling
Mobile Flutter ^3.11, Dart, Material 3, google_fonts
Auth & data firebase_core, firebase_auth, cloud_firestore, firebase_messaging
Local notifs flutter_local_notifications
Connectivity flutter_blue_plus, connectivity_plus, wifi_scan
Backend Firebase Cloud Functions (Node.js)
Hardware ESP32 + Arduino IDE, BME280, MQ-2, LDR, servos, MQTT (PubSubClient)
ML TensorFlow Lite / ONNX cry-detection model

Prerequisites

  • Flutter SDK ^3.11.0 (flutter --version)
  • Dart SDK (bundled with Flutter)
  • Android Studio / Xcode for mobile builds
  • Node.js 18+ and Firebase CLI (npm i -g firebase-tools) for Cloud Functions
  • Arduino IDE 2.x with the ESP32 board package, plus libraries:
    • Firebase ESP Client (mobizt)
    • PubSubClient
    • ArduinoJson
    • Adafruit BME280
    • ESP32Servo

Getting started

1. Mobile app

git clone https://github.com/<your-user>/SafeChild.git
cd SafeChild
flutter pub get

You also need to provide your own Firebase configuration (these files are gitignored):

  • android/app/google-services.json
  • ios/Runner/GoogleService-Info.plist
  • serviceAccount.json (server-side admin operations only — never commit it)

Then run:

flutter run

2. Firebase Cloud Functions

cd functions
npm install
firebase deploy --only functions

3. Hardware (ESP32)

  1. Open hardware/2emeCartebabycry/2emeCartebabycry.ino in Arduino IDE.
  2. Select the ESP32 board and the correct serial port.
  3. Update mqtt_server (line 36) to the IP of your MQTT broker on the local LAN.
  4. Wi-Fi credentials are provisioned over BLE at first boot (via the app's pairing screen) — no need to hard-code them.
  5. Upload the sketch.
  6. Repeat with hardware/BabyCryGateway/BabyCryGateway.ino for the gateway node.

Security notes

  • serviceAccount.json, google-services.json, GoogleService-Info.plist, and .firebaserc are gitignored. They contain identifiers / private keys specific to your Firebase project.
  • The Firebase Web API key embedded in 2emeCartebabycry.ino is safe to ship (it identifies the project, not a secret), provided your Firestore Security Rules are properly configured.
  • Wi-Fi credentials are sent over BLE during pairing and stored in the ESP32's NVS — they are never written to source code.

License

This project is provided for educational and demonstration purposes as part of a graduation project. Choose a license (MIT, Apache-2.0, ...) that matches your use-case before publishing further.


Author

Adem Aboueb — ESPRIT, 2026

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors