We have an 8 month old daughter who just started to crawl so I installed a baby gate at the top of our stairs to prevent falls. The problem is, making sure it's always properly closed can be difficult, especially for new parents like us. You can forget to close it because you are in a hurry or not bother closing it because "I'll just be gone for a second". And sometimes you think you closed it but it didn't latch properly. I designed the Baby SmartGate to solve these issues and increase the safety of our home!

What it does

The Baby SmartGate uses a reed switch to detect if the gate is opened or closed. Once the gate has been opened it turns on a red LED and starts a timer. If the gate hasn't been closed in the allotted time (in this case, 10 seconds) it starts a procedure to alert those nearby. For 8 seconds it starts beeping and increases the LED brightness. Then for another 8 seconds it further increases the LED brightness and beeping intensity. Finally the LED starts flashing and the buzzer is at full blast. Hopefully an adult will notice and close the gate!

When the gate is closed it briefly turns on a green LED to let the parent know it is secure and then goes back to sleep.

The idea is that the alerting will help "train" the parents to always close the gate and make it a habit. Without an alert it would be easier to become lazy with the gate, which is often what results in accidents.

How I built it

The design was fairly simple. I opened up the latching parts of the gate and found that a cylindrical reed switch fit perfectly into both sides. The magnet part of the switch fits in the swinging gate and thus doesn't require a power source. The other side of the switch connects to the Arduino 101 which has a rising edge interrupt setup on the pin. I also connected an RGB LED and active buzzer for visual and auditory alerts and a button to allow me to mute the buzzer if I need the gate opened for an extended period of time.

When the reed switch is closed I put the Arduino 101 (Curie) into a sleep state to conserve power. When the switch is opened it fires the interrupt which starts my state machine to go through the various alert levels. I also used the CurieTimerOne to create an interrupt driven PWM on the buzzer pin to simplify my beeping routines.

Challenges I ran into

There weren't many challenges with the core design but I did run into issues when trying to improve it. First the library I used for the Curie sleep and interrupts is not "official" yet and has some issues. I wanted to use PM.sleep(x) durations for my alert level timers to conserve more power but they were causing weird behavior. Also, to eliminate the need for constantly checking the state of the switch in the state machine I tried to use normal interrupts but was having issues with detaching and reattaching the Curie sleep interrupts.

I also experimented with adding the CurieBLE library to send a message to the user's phone when the gate was opened but the connection would always get lost when I put the Curie to sleep even though the Curie datasheet says BLE should be able to operate when the SoC is sleeping. The firmware for Curie seems to still be in development in this area so I dropped this idea as I wanted this to be a battery powered device and needed the sleep state to work.

Accomplishments that I'm proud of

Mainly I'm just happy that this project helped improve the safety of my home for my newborn daughter. A recent study showed that every 5 minutes a child in the US falls down the stairs and is sent to the emergency room*. If something like this could help prevent just one child from falling down the stairs it would be worth the incremental cost to existing baby gates.

What I learned

I hadn't used interrupts or state machines before in Arduino code so that was a good learning experience. Also, I'm happy to have learned just how low Curie's power consumption is while in sleep which gives me ideas for a number of future battery driven projects.

What's next for Baby SmartGate

I need to do power calculations to see how long it could last on a battery as it would not be feasible to have this plugged in. Also, I would need to find a Curie board with a smaller footprint than the Arduino 101 so I can mount it easier, preferably inside the existing gate, or the whole thing should be put in some type of enclosure for safety and aesthetics. I'd also like to get the BLE working with the sleep states and find a cheap BLE gateway it could communicate with to connect to the internet and send text messages when the gate has been opened for too long.

I'd also like to look into a simplified version of this using just a 555 CMOS timer. The core functionality of this project quite honestly does not require a microcontroller.


Built With

  • arduino-101
  • intel-curie
  • reed-switch
+ 3 more
Share this project: