PI-92IntermediatePremium

Pico Sleep Tracker: How Many Times Did You Turn Last Night? (MPU-6050 + OLED)

An MPU-6050 under your pillow watches the pillow's tilt all night. If the sensor shakes and comes back to the same posture it counts a move; if it settles at a new tilt it counts a turn. Events are logged hour by hour, and in the morning the OLED screen shows an hourly bar chart of the night and a sleep score from 0 to 100. One button starts the night, flips the report pages and ends the night when you hold it. The screen switches itself off while you sleep.

0.0(0)
Pico Sleep Tracker: How Many Times Did You Turn Last Night? (MPU-6050 + OLED)
If you have ever woken up tired and wondered how the night went, this project is for you: a small motion sensor under your pillow counts how many times you turn and stir while you sleep. When you wake up, the screen shows the night hour by hour and a sleep score out of 100. Along the way you learn to smooth acceleration data, catch motion with a threshold and work out the angle between two postures.

Source Code

Premium Content

The source code, block version and FAQ of this project are open to Premium members.

  • All Project Code
  • Block version
  • Frequently Asked Questions