Kiddy Clock Aka Sleep Deprivation Protection System




About: Being an engineer, I just love to understand how things work. This website is a great opportunity for me to learn new stuff !

Hi there,

Kids are great, but well young ones (mine are 3 and 6 yo) can't read a clock and when you tell them that 6:30 am a Sunday morning is a bit too soon to be woken up, they can't really grasp the idea and they are just happy to jump on your bed (fun fun fun).

But when I told my kids "hey, there is this new great thing just outside your rooms, that's like a traffic light. Red is do not go downstairs, play a bit and wait till the light goes to green", they bought it.

So, after a few hours of saved sleep, I really had to share that gizmo. As a bonus, the system can have an optional "kid out of his/her room" alert system.

Step 1: How Does It Work

The system requires two things to achieve its goal :

- a light that will be red during the "forbidden period" and green otherwise;

- optionally, something that makes an alarm sound (not too loud...) when there is a little trespasser

So, to build this you will need a "brain", I used an arduino MCU, a timing reference to know if a light has to be green or red and the light stuff. For the optional alarm feature, well, it's like all alarms : a way to detect and a way to alert (sound, light, ...).

Step 2: What Do You Need to Build That Gizmo ?

My implementation is the following :

- an arduino nano to manage the system,

- a RTC module to give a timing reference, I used a DS3231 based module,

- a RGB led for the "traffic light" (common anode)

- one 390 ohms resistor (LED current limitation),

- (option) a PIR detector,

- (option) a little passive buzzer.

Step 3: The Hardware

Here is the wiring (refer to the schematics for general view) :

DS3231 module to arduino+board :

VCC to +5V


SDA to A4

SCL to A5

Common anode RGB led to arduino+board :

Anode to current limiting resistor to +5V

Green (cathode) to D12

Red (cathode) to D13


PIR to arduino+board :


VDD to +5V


Passive buzzer to arduino+board :

- to GND

+ to D2

For the DS3231 module, you may refer to this link :

Step 4: The Software

This is not the most beautiful software I ever wrote, but it works. I just adapted the DS3231 software found on the internet.

What it does is checking if the time period is forbidden or allowed, which can be set by modifying the preset values hour_start, minute_start, hour_end and minute_end (set between 8:30 pm and 8:30 am).

If it's the allowed period, the only thing it does is lightning the led in green.

If it's not, then the LED gets red and it checks if the PIR detector sees something. If it does, it triggers an audio (not very loud...) and visual (led blinking red/green) alarm.

Please note that you have to set the clock once before using, for that you'll have to run the "setup" software (or uncomment and modify the main code). There is a serial output to check the timing and trials, you can delete all that once you're all set.

Step 5: Feedback

Well, it works fine, the kids love the visual part and have quite some fun playing with the alarm (that's a good reason to make it quiet...).

I have a few ideas for improvement (any suggestion welcomed !) :

- add a remote inhibition feature so that you can go check the kids without alarm, it could be infrared, RF or a sound activated thing (two clicks, after a long day);

- make a nicer sound (use a NE555 or a mp3 file on a SD card ?)

- make it an IOT thing (use NIST service, report alarms, set the alarm period remotely, ...).



    • Trash to Treasure

      Trash to Treasure
    • Arduino Contest 2019

      Arduino Contest 2019
    • Tape Contest

      Tape Contest



    3 years ago

    love that someone had the exact same idea as me! However I used an raspberry pi zero and Python. I am a complete novice with both but the promise of some extra sleep was enough to give it a go! I will maybe have a go at posting my first project. Great to see another take on it though good work!