Share:
Subscribe and receive the latest news directly in your email.

R&D&INew technologies

Internet of Things: A Case Study

The Internet of Things (IoT) is changing our environment to make it much more efficient. In the practical case we describe, we see how, through various techniques, M2M We solved an everyday problem.

Impatient version

The video shows how your phone detects your arrival home and opens the garage door. Keep reading to see how it works!

A practical case

María José and Alejandro live in a house in the suburbs. Every day when they arrive home from work, they use the garage door opener remote to park their cars. For some time now, they've had to get increasingly closer to the door to open it. This forces them to stop in the middle of the street waiting for the door to open, causing traffic congestion. After changing the batteries in the remotes and checking the door's receiver antenna, they concluded that it was an interference problem.

Describing the solution

The initial approach involved changing how the door was operated. Options included different radio frequency bands or infrared, all of which could be affected by interference or have a short range. The chosen solution was to operate the door mechanism by connecting it to the internet. This solution proved optimal for resolving the physical guidance issue while adding flexibility to incorporate logic into the system.

Hardware on the garage door

Regarding the hardware, to control the opening and closing of the door, we would need to provide a gateway between the door and the internet. Our option is to integrate a platform into the motor's circuit board that offers the following:

  • Input and output ports (using a circuit board to control optocoupled relays).
  • TCP/IP connectivity.

We opted to use a Raspberry PiThe Raspberry Pi integrates all the required functionality onto a small 85 x 56 mm board. It has a processor ARM low power consumption at 700 MHz. It is also equipped with circuitry GPIO It allows interaction with external devices by sending signals and capturing data through pins soldered to the motherboard. Another important aspect of the Raspberry Pi is its low power consumption. We'll have a device connected 24/7, but it only consumes 3.5 W/h.

For the electrical connection, circuitry with optocoupled relays was used. The relays prevent voltage spikes from passing from the motor to the Raspberry Pi motherboard, allowing us to connect 220V devices to our control board.

raspberry-y-reles

Software at the door

Our door-connected device must be equipped with an advanced operating system that provides us with high-level programming capabilities. The chosen solution, RaspbianIt is optimal because we can choose between several languages ​​and because it gives the system a task plannerwhich, as we will see later, will be very useful to us.

To allow "talking" to the door, we will use web services RESTThree services have been programmed to open and close the door (POST) and to query the status of the opening and closing limit switches (GET). We have chosen Python for this. The syntax for the services to query the opening and closing status would be as follows:

Opening sensor

http://<dirección ip de la puerta>:8000/sensorA

Closing sensor

http://<dirección ip de la puerta>:8000/sensorC

Solutions to connectivity problems

One of the problems encountered was the occasional loss of connection. The link between the device and the router is established via a USB stick and has remained stable most of the time. However, in certain cases, the connection was lost, making it impossible to manipulate the door. To prevent this, we programmed a small script that checks if the network device is enabled and, if not, reactivates it. To launch the script, we used the operating system's scheduler with the following rule:

*/5 * * * * /usr/local/bin/WiFi_Check

On the device side

A first approach would be to manually operate the door using an app that allows us to open and close it by emulating a remote control. This is a simple and feasible solution, but potentially dangerous because it requires using a smartphone while driving. However, this solution was implemented as a tool to fine-tune the operation of the services, controlling how long a press should last, how to detect the opening and closing limits, and so on.

The solution we've proposed as the definitive one fits the definition of the Internet of Things. Our aim is for the system to be autonomous enough to require only a few minor configuration steps from us, and even though this might require more effort, it should be easy to use.

The solution we've proposed as the definitive one fits the definition of the Internet of Things. Our aim is for the system to be autonomous enough to require only a few minor configuration steps from us, and even though this might require more effort, it should be easy to use.

  1. Knowing that we are coming home.
  2. Interpret that we are arriving and not that we are passing nearby
  3. Knowing that despite being the same path, we return home and do not depart from it.
  4. Determine whether we arrive by vehicle or on foot.

To know that we are reaching a specific point we have used techniques of GeofencingGeofencing, or geolocation by fences, represents a step forward in location tracking using mobile devices without sacrificing battery life. It basically consists of defining a zone along with two methods that notify users when they enter or leave it. Our application, PathActIt allows you to define up to 20 geofences or possible routes to approach a point. This way, we'll know we're close to our destination. We've fulfilled premise number 1.

Once the system detects that we are in that area, it adjusts its accuracy to provide the most precise location possible. Now the challenge becomes determining that we are next to the door. If we choose to compare our location with the door's actual position, it's possible that we might occasionally pass by our house during our journey and the door could open unintentionally. This would violate premise number 2.

To solve this, we've defined a path using three points in a specific order. By passing through them consecutively—first the first point, then the second, and finally the third—we know we're arriving at our destination, not just passing by it. This allows us to fulfill premise 2, and by following the order, we also fulfill premise 3, which tells us we're returning home and not leaving the area.

Here a new problem arises. We know that if we pass through the points in order, the gate opens. How do we tell the gate that we are in a vehicle and not on foot? The solution involves defining a time for passing through the points and, therefore, a speed that is feasible to reach in a vehicle but not on foot. This also fulfills premise 4.

The implementation has consisted of an application iOS 7 with two views, one for registering fences or zones and another for marking paths and the time it will take to travel them. The following have been applied usability rules to make the application easy to use:

  • The design aims to be simple and without redundant information.
  • The system helps the user understand, if they occur, the errors that are triggered.
  • The elements of the different views are consistent with each other, so the user doesn't have to remember how to use them, but simply use them.
  • The application helps the user avoid errors by validating fields that require it and by automatically filling in as much data as possible.
  • The relationship between the system and the real world is maintained as much as possible, applying the user's language.
  • The application tries to maintain visibility of the system status at all times: the user is informed of what is happening at any time.

In the image below, we can see the two views that make up the application's interface. By clicking "Add Zone," we add a zone to be monitored. The zone is represented by its geographic coordinates and a unique identifier. In this same view, we can see the door's status: open. Indicador puerta abierta, operating Indicador puerta operando or closed Indicador puerta cerrada. We also have a key-shaped button to emulate the remote control. When pressed, we receive audible confirmation that it is working.

vista-1

In this screenshot we have a map to add the three points we must pass through to operate the door, a button to clear the map, and a scroll bar to indicate the time in which we must reach the three points in order to operate it.

vista-2

Access to the gateway itself would have to be done through a dynamic name resolution service. If we accessed it directly using the public IP address range, we would run the risk of it changing, leaving us without access again.

Possible improvements and developments

Simultaneous access: It's possible that two people with the app running might arrive at the same time: one would open the door and the other would close it. By checking the door's status, we can leave it open even if the open command has already been given.

Historical: The web service for opening the door could be modified to keep a historical record of door entries and exits, and the data could be used later.

Security: The door can be monitored while on vacation to detect any unauthorized openings, allowing you to alert the authorities. Photos can also be sent to the device on demand to ensure everything is working properly.

Linked services: Arriving home to an open door is convenient. But even more so is having the heating or cooling on, the food hot, the entryway light on, and so on. The door could communicate with other devices, giving them commands based on sensors installed throughout the house.

In Soltel Group We transform everyday objects into connected elements, applying our experience in BLE, NFC, RFID or WiFi direct technologies.

  • Data acquisition
  • Home automation
  • E-Health
  • Smart cities
Tags:
diygeofencinggeolocationhome projectsInternet of ThingsInternet of ThingsInternet of ThingsiOSiotM2MMachine to machinemodRaspberry PiRaspberry relayREST

Other news