📜 ⬆️ ⬇️

Arduino-compatible PLC CONTROLLINO, part 1

For the first time about a programmable logic controller called CONTROLLINO, I happened to find out a year back in 2014 in a casual correspondence with a person who picked up a PLC for home automation. I recommended some classic models to him, and he said in response, they say, he saw on Kickstarter some interesting project called CONTROLLINIO. This is an industrial PLC, which is programmed in the same way as Arduino, in its native IDE.

That guy worked as a php programmer and C ++ was not a problem for him. He had money and ideas, but there was no desire to study LAD or Codesys. As a result, he unsubscribed that he made a pre-order for CONTROLLINO and did not contact me anymore.

I do not know what and how it happened in the end, but after 3 years I had a chance to work with this device.
')


While I was creaking, I realized that there would be a lot of material. Therefore, the story about CONTROLLINO will be divided into two parts: the first will be about iron, the second about programming.

At the moment, there are 4 models of CONTROLLINO: MINI, MAXI, MAXI-AUTOMATION and MEGA. I worked with MAXI.


Brief characteristics of CONTROLLINO MAXI:


CONTROLLINO and ARDUINO


First of all, I must say that CONTROLLINO is not an Arduino in a case with terminals instead of pins, as some might think.

CONTROLLINO is a programmable logic controller, PLC. That is, the finished product used in automation, with appropriate protection of inputs and outputs. The CONTROLLINO design with the Arduino as such (that is, with the debug board based on the atmega chip) is made only by the microprocessor used.

If you disassemble the CONTROLLINO (and we analyze), then inside we will not find the arduin welded to the Chinese shields or, even worse, simply the arduin with the wires twisted on the terminals.
Compatibility is provided at the level of software CONTROLLINO MAXI can be programmed from the Arduino IDE as an Arduino MEGA 2560 board. And there and there the same processor, ATmega2560.

Many here will rightly argue that PLC standards are nice, but this PLC stands as a PLC, and from Arduin and Shields you can assemble a system much cheaper for your needs. I will not argue, I did it myself and everything worked. It looked something like the photo of the prototype of the hero of the article on the kickstarter page .



On the other hand, I know a lot of those who caught fire with the capabilities of the Arduino platform, bought them, blinked with LEDs and ... threw them on it. Having mastered the basics of programming, they suddenly realized that they needed an order of magnitude more time to deal with electronics, bring everything to mind and assemble the finished product. Suddenly it turns out that your time is really worth the money and you do not want to spend it with no visible prospects.

Hello Dima!
A classmate living in another region discovered a wonderful startup. Armed with advanced practices from the Internet, he moved out of town and built a moonshine with high productivity. And everything is good, the product turned out to be excellent (according to him, I do not understand much about it). But the process lasted 48 hours, during which you need to turn something on, something off, unscrew, twist, etc. I had to sleep in fragments for two or three hours.

Naturally, the idea arose to automate production. He turned to me for advice, I told him about the PLC and all that. And after a while, he picks me up and says that he bought a wonderful piece, called Arduino. Already blinked LEDs, in Arduin, the C language, but he has not forgotten him since the time we studied at computer scientists. It remains the case for small: buy shildov, solder something yourself and then bring the production to a new level.

But a year has passed, two, some more, and the matter has not gone beyond the LEDs. Although it may be hampered by a new hobby, beekeeping.

In my opinion, CONTROLLINO will be interesting to those arduinschikam who can not or do not want to independently make TLC PLC for home automation, and instead is ready to buy a finished product. Moreover, CONTROLLINO has everything to use in the 'smart home': 34 I / O points, several communication interfaces and the ability to control all this from the Internet.

In the end, CONTROLLINO is just beautiful.

Design






Remove the cover.



Inside the case are 3 boards. We take out the top.



We see the good old chip W5100, which provides the Ethernet.

There is also an atmega16 microprocessor. Not that I was surprised. I have already observed PLC with several microprocessors, for example, in models of the firm OWEN. But what is this processor doing here? It turned out all simple, he is responsible for downloading via USB. Just like in the original Italian Arduino MEGA 2560 board.



You, like me, most likely have a Chinese clone, and in it there is an ordinary usb / rs232 converter on the download.

The middle and bottom boards of CONTROLLINO MAXI are soldered to each other, alas.



On the bottom 'relay' board, the HF41F relays are visible at ~ 250V / 6A. The average fee can only look on one side.



We see the ATmega2560 microprocessor and the binding of the inputs and outputs.

In order to find the correspondence of the inputs and outputs of CONTROLLINO to the pins of the Arduino MEGA 2560 board, the developer drew a large circuit.



The names of the PLC terminals are marked yellow, and the names of the Arduino Mega 2560 pins are blue. For example, the R0 relay on the PLC corresponds to pin 22 of the Arduino Mega 2560.



To close the relay R0, in the sketch you need to write such instructions:

void setup() {
  pinMode(22, OUTPUT);
}
void loop() {
  digitalWrite(22, HIGH);
  }

.





12 , . , IN0 IN1, .



, . 12V, 0...13,2V. 24V, 0...26,4V. 10 .





12 , .







HF41F ~250V/6A. 6 - . , , .





(RTC) DS1307, I2C. RV-2123-C2-TA-QC-020 SPI.

, '' (Ethernet, RS-485 RTC) CONTROLLINO SPI I2C. - '' , I2C.

RTC .

, '' ATmega2560, Arduino MEGA 2560. Arduino IDE digitalWrite() , . ( - ), .

RS-485

RS-485 CONTROLLINO . SN65HVD08.



RS-485 .

Ethernet

- ! W5100 ' '. W5100 Ethernet CONTROLLINO.



, SCS 4 , , '', - .

, CONTROLLINO -, - Blynk.

X1 X2

, 26- X1 X2 .




- , - , - . , SPI I2C , R0...R9 , A0...IN1 .

, -. , A0...IN1 , - .

X1 X2 , , . , DTH22 , .

, I2C CONTROLLINO X1.



. CONTROLLINO, , CONTROLLINO ModbusRTU .



CONTROLLINO


RV-2123 SPI RTC
SN65HVD08 RS-485
HF41F

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


All Articles