A baby monitor that delays notification
By: Yu-Hua Yang
Tags: Baby Products, Parenting, React Native

So when you tell people you have a newborn, one of the first questions that comes to mind is, how much sleep do you get these days.

Yes, babies don’t care it is the middle of the night or that they only slept for 3–4 hours and now needs attention. Sleeping is definitely a big problem in the beginning for parents, at least for the first 3–4 months. In America, generally the baby gets to sleep in the nursery/baby’s room instead of co-sleeping. I fully advocate this as well because, frankly if the baby knows you are next to them, they won’t hesitate to cry out for attention. I heard that now the Academy of Pediatrics is saying co-sleeping is recommended and if you buy into that, you can stop reading now.

The Product Gap

Now, if you are like me and have the baby sleep in another room, you need a baby monitor. Baby monitors are simple products that relay sound and image from the baby’s room so that you can check on them or see what is happening without being in the room. Most if not all monitors also have a threshold (usually 60 dB) so that loud noises like crying will be relayed to notify parents while low noises are muted. Simple right? Yes, if babies sleep without making any sounds at all, its great. However, my 2nd child is not one to sleep without making any sounds. Every time he turns over during sleep or whatever it is, he makes a loud cry. He only makes this cry for about 5 seconds and he is able to put himself back to sleep. But because there was a cry noise, above the 60 dB threshold, my baby monitor relays that to me loudly and wakes me up. The first few times I actually go into the room and sees I don’t need to do anything. A few times I walk in and he wakes up, those were not so good nights. Night after night, I realized that you need to let them sooth themselves and if you walk in every time there is a cry, they don’t have the opportunity to learn/practice.

I soon realized, I need a baby monitor that delays relay/notification of sound. I need one where at the onset of noise over the threshold, it waits and counts to 10 seconds. If the crying/noise is sustained, I need to be notified. If the baby soothes him/herself back to sleep, I don’t need to know.

I Google search for it online, and there isn’t one.

My solution

It must be a liability issue or maybe seen as cruel to have a delayed baby monitor. But I need one, for my particular situation. Since there isn’t one, I thought about buying a whole bunch of hardware (microphone, a Rasperry Pi, etc) to build one. I was researching prices and components when I realized, I have a full-on computer in my hand — my phone. The phone has a microphone, has a processor to execute my application, that’s really all I need. Since I know React Native, I began immediately to develop it. The result is posted on my Github here in this repo.

First on the various dependencies of the App and their purposes:

· react-native-sound-level — used to measure the decibel level of sound

· react-native-keep-awake — used to keep the app always in the foreground running

· react-native-background-timer — used to time a 10 second delay and a constant check for sound levels

· react-native-audio-player-recorder — manage connection to the Bluetooth speaker

· react-native-sound — to play a sound clip on the Bluetooth speaker to notify there has been sustained 10 seconds of crying.

One of the biggest things that tripped me up in building the app was PermissionsAndroid.

You need to make sure you explicitly request audio permissions because react-native-audio-player-recorder does not tell you you have no permissions. There are no warnings or error messages and you would be left wondering why the speaker is connected but no sound is playing.

To use this app, all you need is a phone and a bluetooth speaker. First pair the phone with the Bluetooth speaker. Then you place the phone in the baby’s room, fully silenced without vibrations. You have to keep the phone plugged in. Start the app, and that is it! If there is noise over 60 dB sustained over 10 seconds, the app will play a sound (I chose the Kick song from the movie Inception) to let you know something’s up. If the noise subsidies within 10 seconds, nothing happens.

A big caveat

I did not build a Bluetooth connection health check. This means that if the Bluetooth speaker and the phone got disconnected somehow, you won’t be notified. This could be dangerous that in the middle of the night, the baby starts screaming but the phone and the speaker is disconnected. Hopefully in that case you can still hear the crying and wake up, unless you live in a very large house or put the baby in the basement, then you can’t really use this.