Inspiration

As college students, we know how challenging it is to balance a good social life, academics, and our physical and mental health and one of the most important parts of well-being that is usually neglected is sleep! That inspired us to create a product that not only tracks health and provides accurate sleep statistics so users can have a clear understanding of their sleeping habits, but also encourages them to maintain these habits over time. We were inspired by Strava and how it builds community around fitness, and we thought, what better way to promote healthy routines than by sharing progress with friends and family? For our product, we’re also ambitious to integrate physical components that collect real-time sleep data, which our website then analyzes to provide personalized insights.

What it does

bleep sleep combines three key elements: a social platform, a minimalist physical device called the Brick, and a sleep tracker.

The app works like Strava for sleep, a social space where your friends and community motivate you to build consistent, healthy bedtime habits. It features a friends feed and leaderboard to make sleep progress fun and social. Unlike anything currently out there, the app also integrates xAI to analyze biometric data collected by the Tracker and generate personalized sleep summaries and insights.

The Brick is a simple wireless button that helps start tracking sleep designed for intentionality. You press it before bed to signal “I’m done for the day,” avoiding phone use at night, while also starting sleep tracking. It also measures how long it actually takes you to fall asleep, which most other sleep trackers fail to capture. In the morning, you press it again to stop tracking. There’s also an LCD screen on the Brick that can be programmed to display custom messages.

The Tracker is our custom-built sleep tracking device that collects biometric data for analysis. We originally used a heart rate sensor, but it got fried during testing (oops), so we used a touch sensor to generate realistic data instead, just to prove the concept works. It also includes temperature and EMG sensors to pick up muscle activity and body temperature changes, which help us estimate sleep cycles and overall sleep quality. All data is sent wirelessly to the app for analysis.

How we built it

The hardware:

The hardware aspect of our project has two main components: a brick and a tracker, both powered by Arduino R4 boards with ESP32-S3 microcontrollers. These boards handle wireless communication and send data to the web server. The tracker in theory consists of four main components: a BPM sensor that tracks average heart rate and SpO₂ levels (see challenges), a temperature sensor that monitors changes in body temperature, and an EMG sensor that detects muscle activity, which can indicate when a user is falling asleep or waking up. In reality, we mimicked the functionality of the BPM sensor with a touch sensor and generated heart rate and SpO₂ data. The brick functions as a physical on/off switch, turning it on signals the user’s intention to sleep, helping to reinforce healthy sleep habits. It also serves as the time reference since when activated, it records the start time, and the tracker’s biometric data helps determine how long it took the user to fall asleep. Additionally, the brick includes a fully functional ultrasonic sensor that lights up the brick when a hand is waved over it. While the hardware systems are built and functional, the physical enclosure for these components is still under development.

The software:

The frontend is built with React and TypeScript for dynamic, reliable interfaces, powered by Vite for fast development. Upon opening the app, users are greeted with a sign-in/account creation page. Once securely authenticated, they are directed to a personalized dashboard displaying all past sleep sessions, complete with visualized data and insights. From the dashboard, users can also explore their friends’ activity feed and view the nightly leaderboard showing top sleep scores.

The backend utilizes a Django framework that acts as an API layer that sits between the hardware (Arduino) and the cloud database (PostgreSQL-TimescaleDB). The underlying database contains two tables, one for the time-series table storing the raw sensor data and one storing the analysis output after the data is analyzed by the xAI API. Each user is identified by a secure Auth Token, which is used by the hardware when it posts the biometric data to the database. We provide several endpoints to get and post data, including creating new users, adding new data, getting sleep data for a specific user, and getting all sleep data for all users.

Challenges we ran into

  • The biggest challenge we ran into was during hardware testing, namely with the BPM sensor and how it interacted with the wireless communication module and other sensors. During one of our tests, a wire accidentally disconnected and caused the voltage and ground lines to short, which burned out the sensor and made it completely unusable. We did have a spare sensor, but it was poorly soldered. Since it was late at night and the deadline was approaching, we adapted by using a touch sensor with mock data to demonstrate proof of concept. Although it didn’t have the same functionality as the BPM sensor, we quickly adjusted to the changes and developed new hardware to provide data that still supported our website’s database and overall design.
  • For software, our main challenge was storing the continuous biometric data. We decided to use TimescaleDB to do this, but ran into issues with deploying the database, as we originally used the Tigerdata Cloud service. We switched over to Neon’s Postgres database with the TimescaleDB extension and was quickly able to set up the tables we needed.

Accomplishments that we're proud of

We are really proud of successfully establishing a wireless connection between the hardware and software that updates in real time! In previous hackathons, we’d try to establish the wireless transmission of data and we always failed but this time, by working together and using all of our experience and knowledge, we now have a website that updates in real time!

What we learned

Wireless connection and connecting hardware to software!

What's next for bleep sleep

  • development of a phone app
  • better hardware/full prototyping of Tracker and Brick
  • fully implement motion-activated LCD screen on Brick and add custom messages
  • integration with other sleep trackers
  • more gamified elements (streaks, etc)
  • enhanced social features

Libraries and Tools

Arduino:

  • WiFiS3.h
  • LiquidCrystal.h
  • WiFiS3.h
  • ArduinoHttpClient.h
  • RTC.h
  • Arduino.h
  • Math.h

Frameworks/Libraries:

  • React
  • Vite
  • Chart.js
  • Axios
  • Django
  • TimescaleDB
  • xAI API
  • Token Authentication (rest_framework.authtoken)
Share this project:

Updates