How to make an app for remote controlling an elevator (part 1)

Eric SvenssonBlogs, Tutorials

Tweet about this on TwitterShare on FacebookShare on LinkedInShare on Google+
App for calling and unlocking the doors of an elevator.

App for calling and unlocking the doors of an elevator.

During a previous developers’ Hack Night, we decided to connect the office elevator to the internet and a mobile app. With the use of an Electric Imp, together with a simple electronic circuit and a simple mobile application developed with Evothings Studio in html and javascript, we could remotely both call the elevator and unlock its doors from anywhere.

Our previous office’s elevator had locked doors at each floor, and when a visitor arrived at our floor they had to ring a bell to let us know they wanted to be let inside. We had to really run down a long corridor to press a button that unlocked the doors, to not let the elevator depart to another floor with our visitor inside it. With a remote control in our pocket we could comfortably unlock the doors from anywhere.

Electric Imp introduction

Electric Imp with electronics for elevator control.

Electric Imp with electronics for elevator control.

The Electric Imp was an obvious choice of hardware for solving our problem because it could easily fit inside the elevator control panel and it was easy to set up. It is a computer having the size of an SD-card, that contains a Cortex M3 processor and a WiFi module.

Software development is made through the online Electric Imp IDE and hardware development is made easy with a breakout board. The modules and breakout boards can be purchased for example from SparkFun Electronics or DigiKey.

There are six software-configurable I/O ports on the Electric Imp. Each pin can be configured during run-time to one of several specialized functions. These functions includes UART, I2C, SPI, analog in and out, PWM and GPIO. The built-in WiFi module supports WPA2 encryption and the data passed between the user and the device goes through a TLS encrypted interface.

Connecting the Electric Imp to the Internet

The first step of getting started developing for the Electric Imp is to connect it to the internet. This is done by performing the following simple steps. Alternatively see Electric Imp’s Getting Started Guide.

  1. Download the Electric Imp app to a mobile device from the App Store or Google Play.
  2. Use the app to log in to your Electric Imp developer’s account.
  3. Specify your WiFi network name and its password.
  4. Connect the Electric Imp to a breakout board and power source.
  5. Transfer your WiFi settings to the Electric Imp by pressing a button in the app and then holding the mobile device’s screen close to the edge of the Electric Imp. The app will make the screen blink rapidly with a pattern containing your WiFi settings, which is detected by a photosensor in the Electric Imp.
  6. Make sure that your Electric Imp is blinking green, which means that the transfer of WiFi settings went through and the connection to the Electric Imp servers is OK. Otherwise try performing the BlinkUp procedure in a darker place to decrease disturbances from other light sources. Refer to the BlinkUp Troubleshooting Guide for more information.
  7. Log in to the Electric Imp IDE on a desktop computer, create a new “model” (application) and assign it to your Electric Imp device. Now you’re ready to start coding! See Part 2 of this article for more information on how to put code on the device.

Wiring up the Electric Imp to the elevator’s control panel


Electric Imp with additional electronics for elevator control.

We needed to give the Electric Imp the ability to activate the elevator control panel’s buttons. For investigating how the control panel worked we carefully removed its cover plate and looked at how the buttons were wired.

With the help of a multimeter we determined that the buttons were connected to 10V and worked much like normal light switches. We decided to connect simple relays between the buttons and the Electric Imp, with some few components in between. A relay is an electrically operated switch, allowing one circuit to close or open a secondary one.

The relays we used required a voltage of 5V but the Electric Imp’s I/O ports give a maximum of 3.6V (see its datasheet for details), and therefore we needed some extra components in between. We used a TS7805 voltage regulator to be able to connect the elevator’s 10V power supply to the relays. A rectifying diode (1N4007) in parallel with each relay protected the circuit from any reverse voltage spikes created by the relays.

The connections, numbered 1 and 2 to the left in the schematics below, was each connected to the Electric Imp’s I/O pins. Each of these were connected to the relays with a transistor. The transistors (two of them, identified as BC547) enabled the very low current flowing from the Electric Imp’s I/O pins to easily control the relays. The connections labeled Switch 1 and Switch 2 were connected to the buttons for calling the elevator and unlocking its doors.

Circuit diagram for Remote Controlled Elevator

Electronic circuit for giving power to the Electric Imp and for activating the elevator’s buttons.

Because we wanted the elevator’s control panel to still look nice and pretty after our hack, we made sure that the Electric Imp could be powered from the control panel’s 10V power source. The April Development Board that we used permits any voltage between 3 and 17V to be used, so we simply could connect the wires between the elevator’s control panel and the development board.

There are some additional components seen in the schematic. The resistor R1 of 10Ω is only for protecting the circuit from any sudden spikes from the elevator’s power supply. The capacitors C1 and C2 make extra sure that the voltage in the circuit keeps at a stable 5V. Resistors R3 and R4 reduce the current drained from the Electric Imp’s I/O ports for decreasing power consumption. Resistor R2 is making sure LED gets the correct voltage. The LED is just for show, letting us know the circuit has power by shining brightly blue.

The next step: write the code for the Electric Imp and mobile application.

In the second post on this hack will tell you how we wrote the simple code that enabled us to take control of the elevator, using Evothings Studio and the Electric Imp IDE. Stay tuned to see this last part of the story about how we hacked our office elevator while eating pizza and drinking beers!

In the meantime, Download Evothings Studio now and get started within minutes. It is fun and easy!