📜 ⬆️ ⬇️

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 it is worth taking 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.


What's wrong?


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.


Automate it!


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.



Action plan


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.


About expenses



Power cord with a flat plug from the grandmother's radio or from the nearest market of radio products - 60 rubles
Power supply 12v 10w with Aliexpress or all the same radio goods - 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.


Soft products


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).


What to use?

Those who are still crying, prickly, but continue to eat cactus, I suggest to transfer at least to PlatformIO (placed on Atom or VSCode), but it is better not to use it at all, but read the course on STM32 or something more useful. And I, as bitten as a child by arduinschiki, will finish my dirty deed :)


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.


Solid products


When the software is written, it is time to start the flasher. Below is a diagram that should help sort out the device.


Expectation:



Reality:



So replace Sonoff SV with:
Arduino UNO + wiznet w5100 + Relay


Connection by pin:
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).


Achtung!
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.


Plastic products


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.


Gear modeling process

Check the radii and other characteristics of the gear, struggle with under-extrusion and slicer parameters


We continue to model


Print, try on


A little more customize and print again. The original rivets were drilled and replaced with a combination of conventional M3 screws and self-locking nuts. Do not forget to add a landing for them.



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.


Here it is in front of us, flasher with wires








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