Project tutorial
Sleeping Phases Determination

Sleeping Phases Determination © GPL3+

This health kit helps to get continuously the data about quality and overall duration of the sleep and to determine the sleeping phases.

  • 1,498 views
  • 0 comments
  • 14 respects

Components and supplies

Apps and online services

About this project

This kit shows the data about room temperature, humidity, luminosity and detect motion. It continuously shows the data online via Android app, save all the data and shows the evolving graphs (for t° and humidity).

So it can give you the answers to such questions as: when do I usually wake up, for how long and why (is it the cause of increasing parameter of luminosity or maybe increased level of temperature in the room due to high level of CO2 or maybe the reason is the change of humidity during the night). As all the data is saved, you can make data analysis and improve your level of sleep.

Code

Code for arduinoArduino
#include <SoftwareSerial.h>
#include <cactus_io_AM2302.h>

#define AM2302_PIN 7

const int pinPhoto = A0;
int raw = 0;
const int inputPin = 6;
AM2302 dht(AM2302_PIN);
const int ledPin = 13;


SoftwareSerial Bluetooth(9, 8);

void setup() {
  Bluetooth.begin(9600);
  Serial.begin(9600);
  dht.begin();
  pinMode( pinPhoto, INPUT );
  pinMode(inputPin, INPUT);
  pinMode(ledPin, OUTPUT);
}

void loop() {
  int value = digitalRead(inputPin);
  dht.readHumidity();
  dht.readTemperature();
  raw = analogRead(pinPhoto);
  
  if (isnan(dht.humidity) || isnan(dht.temperature_C)) {
    return;
  }

  if (value == HIGH)
  {
    
    digitalWrite(ledPin, HIGH);
    Serial.print("wake");Serial.print("  ");Serial.print(raw); Serial.print(" "); Serial.print(dht.temperature_C); Serial.print(" "); Serial.println(dht.humidity);

    Bluetooth.print("wake"); Bluetooth.print("  "); Bluetooth.print(raw); Bluetooth.print("  "); Bluetooth.print(dht.temperature_C); Bluetooth.print("  "); Bluetooth.print(dht.humidity);Bluetooth.println("  ");
    
  }
  else
  {
    Serial.print("sleep");Serial.print(" ");Serial.print(raw); Serial.print(" "); Serial.print(dht.temperature_C); Serial.print(" "); Serial.println(dht.humidity);

     Bluetooth.print("sleep"); Bluetooth.print("  ");Bluetooth.print(raw); Bluetooth.print("  "); Bluetooth.print(dht.temperature_C); Bluetooth.print("  "); Bluetooth.print(dht.humidity);Bluetooth.println("  ");
    
    digitalWrite(ledPin, LOW);
  }

  delay(1500);
}
Code for arduino
This code will allow you to make your arduino board work and connect it with an app

Custom parts and enclosures

Sketch for the wiring
Sleeping phases bb 7dspz5mljr
Wiring of arduino and breadboard
Img 20190312 113103 atr8yqptja
Android app for sleeping phases determination

Schematics

Construction of mobile app. part 1
App1 tb9rieqkvm
Construction of mobile app. part 2
App2 txmejxdmaz
Construction of mobile app. part 3
App3 ejzgachdca
Construction of mobile app. part 4
App4 0rlho9jdrn
Construction of mobile app. part 5
App5 m77bsgs7hy
Construction of mobile app. part 6
App6 hyrw6rwszl
Working app. part 1
Screenshot 2019 03 12 10 33 42 ny0lcmtbqq
Working app. part 2
Screenshot 2019 03 12 10 33 53 5dwbq2iovf
Working app. part 3
Screenshot 2019 03 12 10 35 46 9acamdzi7m

Comments

Similar projects you might like

Health Kit: Humidity and Temperature Control

Project tutorial by Diana Khalipina

  • 5,013 views
  • 2 comments
  • 42 respects

Monitoring Health Station

Project tutorial by Diana Khalipina

  • 2,127 views
  • 1 comment
  • 22 respects

Create a People Counter Controlled by an Android App

Project tutorial by Kutluhan Aktar

  • 3,946 views
  • 2 comments
  • 7 respects

'Roger Bot' the Pet Rover

Project showcase by hannu_hell

  • 1,697 views
  • 0 comments
  • 12 respects

Make an Enhanced R2-D2 to Be Controlled by an Android App

Project tutorial by Kutluhan Aktar

  • 1,490 views
  • 0 comments
  • 2 respects

Attiny85/84 with Bluetooth

by Robin Kanattu Thomas

  • 13,086 views
  • 0 comments
  • 55 respects
Add projectSign up / Login