An IoT Side Project: Chima-open-door

When Oursky moved into a new office in Lai Chi Kok, my colleagues discovered that there was no guide to reset the door lock left by the last tenant. Firstly, we were too cheap to replace it, and secondly, it was a great chance to implement an open door feature with some new tech (fiddling with a bit of IoT). (Ok! I admit it is a bit over-engineered! But we just love it!) I also hope no one needs to get up to open the door when the doorbell rings. Ever.

By the way, I’m Steven, a 3-year Ourskyer specializing in web and native iOS app development. Chima Open Door is one of Oursky’s many side projects — some for fun, and some that actually make money!



The screenshot of Chima Open Door on iOS


Our IoT solution

Initial considerations:

IoT side project door lock raspberry pi linux

Our IoT door look project’s architecture

Since we have Arduino in our office, one of our designers suggested using it to tackle this problem. We did a little bit of research and found the existing Arduino board in our office does not support the Skygear JS SDK. We then found a more suitable board, Raspberry Pi, as it is Linux-based. It was excellent for me, since I only have limited knowledge on embedded systems. What’s more, Raspberry Pi is Bluetooth Low Energy ready, is easier to install external hardware, and also has more technical options in the market.

Raspberry Pi IoT

Linux-based Raspberry Pi’s is compatible with Oursky’s open-source serverless platform, Skygear


Using a serverless solution for rapid product development

Chima Open Door has the main server setup on Skygear.  Skygear is Oursky’s open-source serverless platform for web, mobile and IoT apps. Chima Open Door uses the Skygear Cloud Database and Cloud Functions features. Skygear Cloud Database allows you to synchronize your data to the cloud while Skygear Cloud Functions lets you run all the code in the cloud with no server deployment. The server on Raspberry Pi is connected to a circuit that controls the door. Users can access using Bluetooth or web (Connected / online via LAN cable).

IoT side project door lock

Apple Notification Center Widget for our side project

📋Code for our iPhone app:

When the open door button on iPhone app is pressed, a Skygear record is saved to a remote server, which is hosted on Skygear. The server will log down when and which Slack account it is and open the door automatically.

Skygear Cloud Functions has been setup on Skygear server. Once a record is saved, it would trigger an after_save function, which would broadcast a message in a channel.

A node server has been setup on Raspberry Pi to listen to the message in that channel. It would then issue a request to an internal server as well as setup on the same machine. It is only accessible to the machine itself for security concern.

This Clojure server directly controls GPIO on Raspberry Pi, which connects to the external circuit that is connected with the door magnet.

A random siden note: Skygear is using AWS in America, while the door and the Raspberry Pi is in Hong Kong. Effectively, your ‘芝麻開門’ (Chima Open Door) request would travel around the world before it reaches the door.

📋Additional integrations:

Considering the app is internal-use only, we started a Slack customized command /chima-open-door to open the door since every Ourskyer has access to Slack.

Later some other Oursky colleagues got involved in this project and helped write the WatchOS app and Android app published on the internal platform. Apart from pressing the button inside the app, we also provide alternatives such as iOS 3D touch, Today extension, Android widget and even a Pebble integration because some of our developers use it.

From our team, we had:

    • Steven Chan – iOS / Skygear on Pi / Cloud Functions
    • David Ng – Android
    • Boris – Hardware / Pi / Clojure
    • Brian Chan – Pebble

📋Additional hardware considerations

We also have other considerations for building the whole system.

For the hardware design, we implemented a few circuits to protect the Raspberry Pi if there is reverse electricity flow.

The second consideration is our Bluetooth app access uses Bluetooth Low Energy (BLE). BLE is lower security and more convenient since BLE supports connections to devices without pairing them. It currently has a self-implemented 2FA-like authentication.

Additional problems

After using it for a few months, there are 2 issues waiting for our further input.

The biggest problem is a UX problem. Users at this moment have no sign to know the door is open since our Raspberry Pi is not yet connected to any external notifying device, like a bell or an LED.

Another serious problem is the exit button. The exit button is currently connected to the Raspberry Pi which means if the Pi has problems and if there is a disruption in the power connecting to the Pi, the door will be locked.

If you have any thoughts on tackling this problem, tell us! We would love to discuss and make this over-engineered project perfect.

Link to Repo / files


iOS client:

Android client:

Pebble client:


About the author:



After graduating in Computer Engineering in CUHK, Steven has joined Oursky as a software developer. He’s one of Oursky’s many Python fans.  He has 3-years of experience in web and native iOS app development. The projects he participates in include Spentable and CheckCheckCin.



Tell us what you think and subscribe to our blog for more project updates!

Follow us on Twitter to get updated.


  1. Looks cool! Is it NFC-compatible?

Leave a Reply

Your email address will not be published.


© 2017 Oursky Code Blog

Theme by Anders NorenUp ↑