📜 ⬆️ ⬇️

MSP430 Launchpad as a signaling of the state of server hardware

Professionals working with server equipment, it is known how high the requirements are placed in front of uninterruptible power supplies and air conditioning and air exchange. He himself has repeatedly encountered situations where the failure of a system led to a fall in the data center of one of the mobile operators in the CIS countries. In one of the situations, both the main and backup power lines of the data center were de-energized, diesel generators started up automatically, but the electricians did not switch a certain switch. UPS until the last kept the load, and then more than 200 servers were de-energized. In another situation, the data center after switching off the power on the main line was switched to the backup one, the voltage of which turned out to be low. This led to the failure to start the air conditioners, which are powered bypassing the UPS. The server was disconnected from overheating, the HLR switch hung for a long time and restored its full functionality only after 2-3 days. All this led to the fact that up to a million subscribers remained without communication. I immediately answer the question: “What was the monitoring service doing?” In the first situation, she considered the work done to the end; in the second, she noticed an alarm later on one of the many monitors.

Since it was directly my responsibility to raise the server after such accidents and, to put it mildly, I got tired of hoping for a monitoring service to search for a solution other than SNMP traps. After reviewing the manuals that came with UPS and air conditioners, it was found that they all maintain dry contacts. It remains to find how to work with them. The MSP430 Launchpad from Texas Instruments came to the rescue.

For non-specialists, dry contacts work as on / off switches, making or closing contacts under certain conditions. The manufacturer may, for example, create the following conditions: general alarm (any malfunction with the equipment), lack of voltage at the input contacts, battery discharge, temperature rise. All this is described in detail in the manuals, in the same place contact diagrams are given to which you need to connect.
These switches allow you to form the criteria HIGH and LOW for the microcontroller: if the contact is open, then relative to the ground we will have HIGH on the pin of the controller, if closed, then LOW will be formed. Such conditions make it possible to control on / off other pins on the board with the help of a simple “if” operator. Without thinking twice, I decided to control the LEDs and the piezo-squeaker in order to give an audible and visual alarm signal. After 5 minutes, based on the examples that came with the Energia environment, a sketch was drawn up:

const int ledPin0 = P1_0; const int ledPin1 = P1_1; const int ledPin2 = P1_2; const int ledPin3 = P1_3; const int ledPin4 = P1_4; const int ledPin5 = P1_5; const int buttonPin0 = P2_0; const int buttonPin1 = P2_1; const int buttonPin2 = P2_2; const int buttonPin3 = P2_3; const int buttonPin4 = P2_4; const int buttonPin5 = P2_5; const int tonePin = P1_7; int buttonState0 = 0; int buttonState1 = 0; int buttonState2 = 0; int buttonState3 = 0; int buttonState4 = 0; int buttonState5 = 0; void setup() { pinMode(ledPin0, OUTPUT); pinMode(ledPin1, OUTPUT); pinMode(ledPin2, OUTPUT); pinMode(ledPin3, OUTPUT); pinMode(ledPin4, OUTPUT); pinMode(ledPin5, OUTPUT); pinMode(buttonPin0, INPUT_PULLUP); pinMode(buttonPin1, INPUT_PULLUP); pinMode(buttonPin2, INPUT_PULLUP); pinMode(buttonPin3, INPUT_PULLUP); pinMode(buttonPin4, INPUT_PULLUP); pinMode(buttonPin5, INPUT_PULLUP); } void loop() { buttonState0 = digitalRead(buttonPin0); buttonState1 = digitalRead(buttonPin1); buttonState2 = digitalRead(buttonPin2); buttonState3 = digitalRead(buttonPin3); buttonState4 = digitalRead(buttonPin4); buttonState5 = digitalRead(buttonPin5); // LED P1_0 if (buttonState0 == LOW) { digitalWrite(ledPin0, HIGH); tone(tonePin, 440, 200); } else { digitalWrite(ledPin0, LOW); } // LED P1_1 if (buttonState1 == LOW) { digitalWrite(ledPin1, HIGH); tone(tonePin, 440, 200); } else { digitalWrite(ledPin1, LOW); } // LED P1_2 if (buttonState2 == LOW) { digitalWrite(ledPin2, HIGH); tone(tonePin, 440, 200); } else { digitalWrite(ledPin2, LOW); } // LED P1_3 if (buttonState3 == LOW) { digitalWrite(ledPin3, HIGH); tone(tonePin, 440, 200); } else { digitalWrite(ledPin3, LOW); } // LED P1_4 if (buttonState4 == LOW) { digitalWrite(ledPin4, HIGH); tone(tonePin, 440, 200); } else { digitalWrite(ledPin4, LOW); } // LED P1_5 if (buttonState5 == LOW) { digitalWrite(ledPin5, HIGH); tone(tonePin, 440, 200); } else { digitalWrite(ledPin5, LOW); } } 

')
I will explain a little, in the server room there are 4 UPS and 2 industrial air conditioners. They are connected as buttonPinX, LEDs are connected as ledPinX, squeaker is connected to tonePin. Difficulties with further analysis of the sketch, I think it will not.

The alarm panels were planned to be installed in two rooms: in the office where the administrators are located, and in the monitoring center. It was a pity to use two boards for this, so I decided to parallelize the signal outputs. It was decided to make delivery of signals to the premises rather unusual - with the help of the already laid network cables through the cross-connection cabinet and the outlet from the sockets. It turned out quite convenient - 6 cables UTP cables are used for the positive contacts of the LEDs, one for the positive contact of the tweeter and the last for the ground. The cables coming from the dry contacts of the equipment did not decide to connect directly to the board, using resistors of 10k ohms each. I was also afraid that over time the LEDs could burn out, since the current consumption of the tester was 6mA, and the MSP430G2553 controller can provide up to 50mA at the output. Decided to use limiting resistors at 390 ohms. As a result, the scheme was such

image

On the right there is a loop of signal cables up to the console, in a real scheme I have 2 such plugs for 2 remotes. Numbered leads go to dry contacts of UPS and air conditioners paired with the ground. There are dry contacts on the UPS, informing about the start of battery discharge, at the same time it means that there is no input voltage either. On air conditioners to dry contacts general alarm.
The alarm system was immediately put into operation, starting from the very first day, began to report a malfunction, as there were problems with food almost daily. The plans include the inclusion of a UART for reading data on the state of pins and the formation of E-mail or SMS notification

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


All Articles