Case №3 – ACS

The most complex example of using IoT in our office is working with an access control and management system. ACS is an electronic module designed to control access to premises, record time of passage and events.

The controller processes information coming from a reader with a Wiegand output interface and, using a built-in relay, switches the actuator – an electromagnetic lock. It has no Internet access and no visible ability to connect to the platform. However, it has its own data exchange protocol with the control computer, thanks to which it is possible to send commands to the controller, such as reading from the controller, writing to the controller, opening / closing the lock, and others. Therefore, in this case, a non-standard approach was organized – the use of an agent.

The work on the controller protocol was implemented in C++ code and launched on the Raspberry Pi, which, in turn, was connected to the controller via RS-485 through an interface converter. The main task of the program is to connect to the platform, serialize commands and deserialize data received from the controller. Thus, with the help of a small software layer, we were able to make the device “smart”.

The device model looks like this:

The main information from the controller is events. It comes to the platform in JSON format and includes the following fields:

In the interface of an object, it looks like this:

And this is how the interface for sending commands looks like:

You can see that there is a command not only to read the event buffer, but also to write new boundaries. The buffer boundaries are stored in the controller memory – the beginning and the end. When a read command arrives at the device, these limits are read, and within these limits, the event buffer is read. The end buffer boundary is shifted automatically on the controller when new events are received. But the initial boundary of the buffer must be overwritten (indicating the final boundary after the last reading) so as not to read the same data again. But this needs to be done only after the event data has been successfully sent to the platform. It is also convenient to fix the receipt of data and then send a command to rewrite the boundaries in the machine.

This project has found its continuation in integration with our internal CRM system, in which the employee information tab always shows up-to-date information about who is or is not in the office. The time of entry / exit from the office is also displayed, the total number of hours per month is considered.

Data is collected from the platform using the RESTful API. The platform API provides the ability to work, interact and use the platform entities and their data in such external systems as web portals, mobile and web applications or, in our case, CRM systems.

There are also cases when a guest / food delivery person or someone else who needs to open the door has come to the company. In order not to use your card and thereby not transmit incorrect indications about your status, you can use the “Unlock” button on the platform. And if you need to meet a person at the door, then it is convenient to do the same from the mobile application.

Case number 4 – Smart garden

My personal story with a garden in an apartment began against the backdrop of a crazy panic of people and buying up products. Once again, when I went to the store and saw empty shelves where the potatoes should be, I decided to use the last potato found in the refrigerator for a different purpose. I planted this potato in a huge pot. With such a naive experiment, my garden on the windowsill began, which after two months already looks like this:

Since I’m not a gardener, and the garden needs even more water than the flowers, I quickly ran into the problem that I forget to water it. I will not talk about automatic irrigation systems, this is a too hackneyed topic, and it is rather difficult to organize its work qualitatively. Instead, I came up with the following ideas:

Make a push notification in the platform that the soil moisture of a plant is below the norm and it is time to organize mass watering for everyone according to their needs. Needs are easy to understand by installing one soil moisture sensor in each pot.

Make a similar notice that it is time to turn all the pots, since the plants tend to grow in the direction of the end, and the Sun is only on one side – in the window. The fact that I did not turn the potato for a long time led to the fact that it collapsed on one side. In addition, it is so huge that now it remains only to support it with a wall.
Organize the turning on and off of the ultraviolet lamp at night according to the scheduler – turn it on at 18:00, and turn it off at 6:00. I want to note right away that the dark time of the day is a loose concept depending on the time of year. But we already know that in order to change the on / off time of the lamp, it is enough to change the value in the machine and save it.
The interface will look like this:

The automaton for the first case looks like this. The transition to the state in which the notification is sent was made according to a complex condition – one of the plants has a humidity below the norm. Link between conditions – OR.

The return to the initial state occurs according to the condition – in all plants, the soil moisture is above the norm, a bunch of I.

The automaton for the second case looks as follows. The transition is carried out according to the scheduler, the return to the initial state is an unconditional transition.

And finally, the automaton for the last case:

These machines are launched at one object and work in parallel.

Leave a Reply

Your email address will not be published. Required fields are marked *