Flashing vintage LEDs or as we warn of "fires" on the project
Routine is a huge field for automation. If the task takes a lot of effort, requires perseverance, and repeats from time to time - this is a sure sign that you should take a couple of steps to reduce this recurring pain. And the implementation can be turned into a good techno fan.
Today I will talk about the automation of the alert system, monitoring and alerts. Under the cut Polish flasher in 1984 and no missed ignition. Code and assembly instructions are attached.
Recently I turned 8 years old. 8 years, as I work in 2GIS. On this occasion, one comrade asked: "How do you last so long?" There was no desire to try something new? "
There was. And still arises. And still try. I try myself in new roles, teams, technologies. Why not? After all, work is not only and not so much about “coming at 9:00, opening a task manager and taking on another task, at 18:00 going home,” and not even “A !!! We are again DDoS'y, let's request_limit dug it in here, and here I’m getting better IPs, and here ... Oh, how already 3 in the morning? ”. This is all wrong. Work - it's about the team, relationships, evening gatherings in the kitchen. About interesting tasks and comfortable living environment, after all. Everything kills pofigizm and routine. I don’t know how to work with the first, I didn’t notice myself, but I’ll tell you about the second.
Today we will go the beaten track: build-traffic light in the office , and another one ; and automate alerts, monitoring and alerts. But making another traffic light for the build server is gone. We have a lot of builds, branches and tests, and there is no desire to rob the traffic police warehouse for a dozen traffic lights. We will visualize the "fires"!
Standard monitoring system
Here is a typical screen that hangs in our office. 95% of the time he shows how our project is alive and what is happening to it. In parallel, there is a channel in Slack with notifications of releases and errors.
In order not to distract the whole team, a duty officer is appointed for a week, who performs the role of a release master and takes the fire upon himself if something terrible has happened. His task is to find out what happened, and either fix it himself, or find someone who fixes it.
We also use this monitor for daily meetings - we open the Kanban Board in Jira and it started.
The status of duty does not cancel work tasks. If the person responsible for the fires wandered too far into the halls of his mind, the result may be less operational than required. This prompted the idea that for complete happiness we need a weightier sounder than endless notifications from Slack.
The idea grew stronger when Avto showed a great vintage Polish flasher of 1984 in the open spaces. If there is a fire somewhere, then let this thing turn on! They promised a piece even in almost working condition. 500 rubles and I have it in my backpack. So let's add some IoT HYIPs and pinging on the Arduino.
The plan was simple and brilliant! Take the power supply for 12 volts, add Sonoff SV - esp8266 with a relay and all the necessary strapping and power from 12 volts. Reflash with something like http://wifi-iot.ru/ , we catch a flasher - profit! We have a Wi-Fi connected device with a REST API and another 1000 features.
Power cord with a flat plug from the grandmother's radio or from the nearest market of radio products - 60 rubles
Power supply unit 12v 10w from Aliexpress or all the same radio
products - 260 rubles Sonoff SV - $ 4.85 + shipping
Vintage flasher - priceless (500 rubles)
Opinion of corporate Wi-Fi
For such bold corporate Wi-Fi actions with EAP-PEAP certificates and other terrible words, said “You will not pass!”.
You could roll up your sleeves, google https://github.com/esp8266/Arduino/issues/1032 , take a fresh SDK and quickly write everything yourself. But then the technofan turns into a long digging and debugging. I will postpone this option until the release of version 2.0, improved and corrected.
Take the not so beloved olartamonov Arduino, a scattering of what has been collecting dust in the boxes for N years, and collect the monster Frankenstein. The warehouse of household parts will be enough to check the viability of MVP and throw out after debugging a beautiful and brilliant version 2.0.
The solution is clumsy: the Arduino connects to the network via Ethernet, receives IP via DHCP, listens to requests via HTTP and flashes “LED”. Anyone in the evening can build such a solution from Examples Arduino IDE (but never, hear, never use it! This is hell).
Тем, кто до сих пор плачет, колется, но продолжает есть кактус, предлагаю пересесть хотя бы на PlatformIO (ставится на Atom или VSCode), но лучше вообще этим не пользоваться, а почитать курс лекций по STM32 или ещё чего более полезного. А я, как покусанный в детстве ардуинщиками, таки доделаю своё черное дело :)
The code is laid out on github , there is no authorization, a spread API and beautiful html pages. Only MVP, only hardcore! Use at your own risk, I warned.
When the software is written, it is time to start the flasher. Below is a diagram that should help sort out the device.
So we replace Sonoff SV with:
Arduino UNO + wiznet w5100 + Relay
Connection on the pins:
DIGITAL 10 - SS
DIGITAL 11 - MOSI
DIGITAL 12 - MISO
DIGITAL 13 - SCK
GND - GND
5V - 5V
Connecting the relay is even simpler: the signal pin on the DIGITAL 4, the power wire to the flasher is caught in the gap to C (common) and NC (normally closed).
See your device documentation. Not the fact that by connecting the Ethernet board to 5 volts, you will not get a cheerful smoke when testing! In my case, everything is normal, and the module is powered by 5 volts.
Announcement on Avito stated that the flasher in almost working condition. Over the years, only one detail died in it - the gear that revolves the reflector.
We exhale, take Fusion360 in our hands, model a new one and print it on an office 3D printer.
Проверяем радиусы и прочие характеристики шестерни, боремся с недоэкструзией и параметрами слайсера
Ещё чуть-чуть подгоняем и печатаем снова. Оригинальные клёпки были высверлены и заменены на комбинацию обычных винтов M3 и самоконтрящихся гаек. Не забыли добавить под них посадочные места.
We grease gears, we replace wires, we collect back - it works!
It would be nice to print a nylon gear, but the first fine print failed, and the second sampler balance from the bestfilament was not enough.
What we are for, no matter what!
How to make the flasher turn on when something out of the ordinary happened?
Elementary! We use Grafana at work, so we just start a new Notification Channel with the WebHook type, which sends a request to turn on the flasher according to certain criteria. It turns itself off after a few seconds in order not to force the atmosphere even more.
How much time was spent on all this disgrace? A couple of evenings, if not distracted. Plus half a day of working time to set up integration with other internal systems.
The technofan was a success, the benefit to the team was brought, photos of the assembly process are given finally.