📜 ⬆️ ⬇️

Serious access control system on an unserious basis

Hello! We want to tell a story about how we created the ACS (collected) almost from what was at hand. Namely, a microcontroller with a network interface, a pair of cheap Chinese readers, an rs232 tcp server, rs232 to rs485 interface converters, an Android tablet, and the turnstile itself (or rather, what remained of it after previous attempts to launch an ACS in the enterprise — this mainly mechanical part).

The article contains a lot of pictures!



Not so long ago, at one enterprise, the question arose of installing an ACS. Prior to this, the enterprise had already attempted to introduce access systems, but over time the cards were lost, the equipment went down. For some reason there was no proper maintenance. And those who, say, controlled the very access to the territory, somehow resisted innovations and, in fact, simply pressed the lock button for those who forgot or lost the pass.
')
I just want to warn you that we are never professionals in electrical engineering, so in this article you can see a lot of “pain” (especially for electronics) and not the best solutions. Constructive criticism is welcome.

Turnstile


The turnstile got us about here in this state. In fact, there is only a mechanic; the electrodes have survived the LEDs of the arrows, electromagnets with lock actuators and reed switches.



To control the internal stuffing, such a circuit was assembled - these are transistor switches with a relay. We need to control 2 green arrows with 2 red and 2 electromagnets to open the entrance or exit. Total 4 keys, two of which include a green arrow and an electromagnet, the other two include red arrows (the turnstile has a normal state, all locks are closed).





Yes, yes, I know - the ration is terrible.

Placed the finished board in the body that came in size.



Controller


So, now the illumination and locks work for us, but someone has to manage this, receive signals from the reed switch when scrolling through the turntable. To do this, we used the Ethernet module to control external circuits / loads and monitor / measure various parameters (voltage, temperature, etc.) over a local area network (LAN) Jerome , which was bought for a long time for other purposes, but just gathering dust.

A brief description of what it is:




At the time of the start of this project, we could go into the web interface and give a signal to the line where the LED could be connected, or as in our case, the transistor switch and, miracle! —The LED is lit, the transistor switch is triggered, the relay clicks.

By the way, this is how it looks like:



Lines can work, either at the entrance or at the exit.

In order to improve the module, we placed the board in the case from the RJ45 socket.



Now it was necessary to organize the connection to the pins, here we are assisted by the same case from the Rj45 socket and the connectors themselves:



As a result, in the second part of our improvised case for the module there are 2 RJ 45 connectors. Here, as if with an eye to the future, one to control the turnstile, the second to control the barrier or gate. After assembly, we get just such a box with three Rj45 connectors and one power supply for the module. It turned out compact and generally neat:



Reader


As mentioned above, the project was created from what was on hand and there was not much to choose from, so the cheap RFID reader 13.56Mhz rs232 was taken as the basis. Initially, we wanted to make a classic - there is a separate reader on each side (entrance / exit), respectively, we read the card on reader No. 1 - it means we are entering the territory, counted on reader No. 2 - it means we are leaving the territory. And here the question arose how to distinguish between readers? Maybe he has some ID? Connect read card analyze data, no, the reader transmits only the ID card. It would seem that everything. Looking for other readers? But no, this is not our way. First, we changed our mind to use two readers on each side and installed only one. This means that the system now monitors where the visitor is located on or off the site. The initial position is not on site. In this embodiment, there are both disadvantages and advantages.

Minuses:


Pros:




During operation in this mode, we are faced with a problem. Time records are kept for the employees of the customer’s company (came, left, how many were, how many were not). In addition to employees of the customer’s company, there are a large number of tenant employees for them, time accounting is not needed. And to account for time is important to take into account the direction of the transition.

The “smartest” people tried to pass by several people with their passes (apparently, based on early experience in other companies), but this was not the case. During the passage, the transition status “on the territory” changed and upon the next reading the turnstile was already opened to the exit. This introduced many into a stupor, had to explain, write ads, but there were those who understood, rotated the turnstile and read the card again and then passed. But such a regime was perceived as hostile by angry remarks that the system was not working. It is clear what consequences the passage did not lead through the checkpoint, in our case it is the gate that is open, and the people try to slip through, gaining problems for themselves at the checkpoint. The decision was not long in coming, we are filtering employees by company and those who need to keep records, walk as expected, all the rest walk freely, both locks open for them regardless of the direction of the transition. And the people began to walk in crowds on one card.

Guest Cards


Yes, there are maps for visitors in our system. This card allows the visitor to enter the territory and exit. And then the legitimate question arises: how to make it so that the cards do not go along with the visitor? After all, security is not always in place (auto inspection, smoking, toilet, etc., etc.). Naturally need a card reader, it's obvious to everyone. But initially the idea was this - the second reader remained (saved), it was assumed that he would stand by the guard and at the exit the visitor would give the card to the guard in his hands, and he would read it on the reader, thereby releasing the visitor. But, for the reasons already mentioned, we had to abandon such a regime. Began to think how to solve this puzzle. If you take a ready card reader, the price tag is very biting, even for a simple model. But we make the access control system from what is on hand - do not forget about it! They took a piece of plexiglass that was not transparent and glued together such a gutter.



The reader was attached to the bottom of the gutter. The idea is that the visitor puts the card in the slot, it flies along the chute and, flying over the reader, is read. Collected, tested - works. This is what a ready-made "card reader" looks like (in the lower right part of the window).



Naturally, everything is as it should be: the cards are folded in the tray.

And this is how it looks from the outside:



Demonstration of the card reader


The only thing at the time of video recording there is no card tray yet.

Oh yes. I almost forgot. How do we still distinguish between readers? And let's see what is inside the creation of “Celestial”.
Disassembled, nothing special. Everything! We definitely need readers who can transfer their ID. But, “this is not our way” - we thought once again, and figured out how to distinguish between readers.



See the LED with three legs? It is two-color, usually lights red, and when read it lights up green. Resolved, take the signal from this LED.

We assemble a simple circuit optocoupler + transistor. What for? About this is a long history, but this option has remained historically, did not begin to alter. This scheme also lights up the LED. as the original in the process out of order. The essence of what? Remember the jerome module? It can be configured lines as the output and the input. So we set up the necessary lines at the input, we connect the circuit to the corresponding pins and catch the incoming signal. More precisely, Jerome himself will tell us when a signal appears on the line we need. In this uncomplicated way, we distinguish readers.



So, as the whole system we have is built on TCP technology, and readers rs232. It was decided to use the rs232 / rs485 tcp server.



But bad luck - the rs232 connector is one, and there are two readers. But there are still rs485, we recall the opunks that on rs485 you can "hang" many devices. We do it our way, we buy interface converters rs232 to rs485 and connect in parallel, we read in turn - both readers work, hooray! So all is well.



The interior of the cabinet:



The tablet


Finally, the center of our entire system is an Android tablet. An application is written for him. In this article, I will not describe the application, its work and the internal structure, as it draws on a separate article. I will confine myself to photographs and video demonstration of the work. If anyone is interested in Habré, we have already published two articles ( one , two ) on this project. It describes the structural and dynamic models of access control. Separately, it is worth mentioning that a bunch of Apache Cordova , JXCore technologies (this is the node.js for mobile platforms) and, well, without them, HTML and CSS were used to develop this application. But we have cross-platform! In our case, there are two versions of the application and both are working. This is an Android version (basic) for Windows PCs. That makes it possible in case of failure of either a tablet or a PC to quickly restore the work of the access control system.



Video demonstration of the application


In general, in spite of so little practical experience in all areas that this project has affected, we managed to build an ACS that is actually implemented and works to this day on a real enterprise in real conditions. Using at the same time not the best equipment and not the best solutions, and perhaps the best in this context. Thank you for your attention we will be happy to answer questions.

Source: https://habr.com/ru/post/395765/


All Articles