Community project

Smart Sleep Alarm Mask

Photo of Smart Sleep Alarm Mask
Generated with AI

jaydudlewis-bit

Published November 3, 2026

This smart sleep alarm mask uses ambient light sensing to detect when morning arrives and gently wakes the user with gradually increasing light and vibration. Built around an Arduino Uno, the mask combines a proximity sensor and ambient light sensor to monitor sleep conditions, triggering a red LED that brightens over time while a coin motor provides gentle haptic feedback.

This guide provides a complete parts list, wiring diagram, and step-by-step assembly instructions for building the prototype on a breadboard. Firmware code handles sensor input and output control, with detailed comments explaining how the light and vibration outputs are managed to create a natural wake experience.

Wiring diagram

Loading diagram…

Gather all the parts

QtyComponent
1

Adafruit VCNL4040

Adafruit VCNL4040

1

Adafruit VEML7700

Adafruit VEML7700

1

Adafruit MAX98357A

Adafruit MAX98357A

1

8 ohm flat speaker

8 ohm flat speaker

1

8 ohm flat speaker

8 ohm flat speaker

1

Protected 500 mAh 1S LiPo

Protected 500 mAh 1S LiPo

1

AO3400A MOSFET

AO3400A MOSFET

1

100 ohm gate resistor

100 ohm gate resistor

1

100 kohm gate pulldown

100 kohm gate pulldown

1

red diffused LED

red diffused LED

1

2.2 kohm LED resistor

2.2 kohm LED resistor

1

red diffused LED

red diffused LED

1

2.2 kohm LED resistor

2.2 kohm LED resistor

1

AO3400A MOSFET

AO3400A MOSFET

1

100 ohm gate resistor

100 ohm gate resistor

1

100 kohm gate pulldown

100 kohm gate pulldown

1

amber diffused LED

amber diffused LED

1

2.2 kohm LED resistor

2.2 kohm LED resistor

1

amber diffused LED

amber diffused LED

1

2.2 kohm LED resistor

2.2 kohm LED resistor

1

3 V 10 mm coin motor

3 V 10 mm coin motor

1

AO3400A motor MOSFET

AO3400A motor MOSFET

1

100 ohm gate resistor

100 ohm gate resistor

1

100 kohm gate pulldown

100 kohm gate pulldown

1

1N5819 flyback diode

1N5819 flyback diode

1

10 ohm motor series resistor

10 ohm motor series resistor

1

Momentary snooze button

Momentary snooze button

1

470 uF 6.3 V capacitor

470 uF 6.3 V capacitor

Assemble it in 6 steps

1. Keep this prototype on the bench

Do not wear or charge the assembled mask until firmware and current measurements have been validated. The current firmware is bring-up only.

  • Never charge while wearing. This is not a fire safety device.

2. Connect the two light sensors

Connect both sensors to 3.3 V and ground. Connect SDA to D4 for data and SCL to D5 for the clock. Put the proximity board inside the cup and the ambient-light board facing the room.

3. Assemble the limited-current lights

Each LED has its own 2.2 kohm resistor from 3.3 V to its anode. Connect its cathode to its color MOSFET drain. Connect MOSFET sources to ground, gates through 100 ohms to D0 for red or D1 for amber, and each gate through 100 kohms to ground.

4. Connect the motor driver

Connect 3.3 V through the 10 ohm resistor to motor positive. Connect motor negative to the MOSFET drain and source to ground. D2 drives the gate through 100 ohms, with 100 kohms from gate to ground. Connect the diode stripe to motor positive and its other end to motor negative. Verify regulator headroom and motor starting before use.

5. Connect mono speakers in series

Connect amplifier OUT+ to speaker 1 positive, speaker 1 negative to speaker 2 positive, and speaker 2 negative to OUT-. Neither output goes to ground. Connect BCLK to D8, LRC to D9, DIN to D10 and shutdown to D7. Connect VIN to battery positive and GND to common ground. Put the capacitor across this supply with correct polarity.

  • Test away from ears at minimum volume first.

6. Connect button and battery last

Connect the button between D3 and ground. Check all wiring for shorts. Connect protected battery positive to the underside BAT+ pad and negative to BAT-. Insulate all joints and provide strain relief.

  • Never solder directly to a pouch cell. Do not compress or puncture it.

Review all connections

1. Connections between "prox" and "Arduino"

FunctionproxArduino
powerVIN3V3
groundGNDGND
dataSDAGPIO 4
dataSCLGPIO 5

2. Connections between "lux" and "Arduino"

FunctionluxArduino
powerVIN3V3
groundGNDGND
dataSDAGPIO 4
dataSCLGPIO 5

3. Connections between "amp" and "Arduino"

FunctionampArduino
powerVIN3.7V
groundGNDGND
dataBCLKGPIO 8
dataLRCGPIO 9
dataDINGPIO 10
dataSDGPIO 7
dataOUT+ → 8 ohm flat speaker +EXT

4. Connections between "spk1" and "Arduino"

Functionspk1Arduino
data- → 8 ohm flat speaker +EXT

5. Connections between "spk2" and "Arduino"

Functionspk2Arduino
data- → Adafruit MAX98357A OUT-EXT

6. Connections between "battery" and "Arduino"

FunctionbatteryArduino
power+3.7V
ground-GND
data+ → XIAO BAT+ underside padEXT
data- → XIAO BAT- underside padEXT

7. Connections between "redg" and "Arduino"

FunctionredgArduino
data1GPIO 0
data2 → AO3400A MOSFET GEXT

8. Connections between "redpd" and "Arduino"

FunctionredpdArduino
data1 → AO3400A MOSFET GEXT
ground2GND

9. Connections between "redq" and "Arduino"

FunctionredqArduino
groundSGND

10. Connections between "red0r" and "Arduino"

Functionred0rArduino
power13V3
data2 → red diffused LED AEXT

11. Connections between "red0" and "Arduino"

Functionred0Arduino
dataK → AO3400A MOSFET DEXT

12. Connections between "red1r" and "Arduino"

Functionred1rArduino
power13V3
data2 → red diffused LED AEXT

13. Connections between "red1" and "Arduino"

Functionred1Arduino
dataK → AO3400A MOSFET DEXT

14. Connections between "amberg" and "Arduino"

FunctionambergArduino
data1GPIO 1
data2 → AO3400A MOSFET GEXT

15. Connections between "amberpd" and "Arduino"

FunctionamberpdArduino
data1 → AO3400A MOSFET GEXT
ground2GND

16. Connections between "amberq" and "Arduino"

FunctionamberqArduino
groundSGND

17. Connections between "amber0r" and "Arduino"

Functionamber0rArduino
power13V3
data2 → amber diffused LED AEXT

18. Connections between "amber0" and "Arduino"

Functionamber0Arduino
dataK → AO3400A MOSFET DEXT

19. Connections between "amber1r" and "Arduino"

Functionamber1rArduino
power13V3
data2 → amber diffused LED AEXT

20. Connections between "amber1" and "Arduino"

Functionamber1Arduino
dataK → AO3400A MOSFET DEXT

21. Connections between "mg" and "Arduino"

FunctionmgArduino
data1GPIO 2
data2 → AO3400A motor MOSFET GEXT

22. Connections between "mpd" and "Arduino"

FunctionmpdArduino
data1 → AO3400A motor MOSFET GEXT
ground2GND

23. Connections between "mq" and "Arduino"

FunctionmqArduino
groundSGND

24. Connections between "mr" and "Arduino"

FunctionmrArduino
power13V3
data2 → 3 V 10 mm coin motor +EXT

25. Connections between "motor" and "Arduino"

FunctionmotorArduino
data- → AO3400A motor MOSFET DEXT

26. Connections between "diode" and "Arduino"

FunctiondiodeArduino
dataA → 3 V 10 mm coin motor -EXT
dataK → 3 V 10 mm coin motor +EXT

27. Connections between "button" and "Arduino"

FunctionbuttonArduino
data1GPIO 3
ground2GND

28. Connections between "cap" and "Arduino"

FunctioncapArduino
power+3.7V
ground-GND

Deploy the firmware

#include <Arduino.h>
// Bring-up only: outputs remain off until the full application is validated.
void setup() {
  for (int p : {0,1,2,7}) { pinMode(p, OUTPUT); digitalWrite(p, LOW); }
  pinMode(3, INPUT_PULLUP);
}
void loop() { delay(100); }

Remix this project

Make it yours in one click

Open a full copy of this project in your own Schematik workspace, diagram, code, parts, and assembly steps included. Swap the sensor, add features, or redesign the whole thing with AI. The author's original stays untouched.

Open in Schematik