We automate the machine with a microcontroller

Igor Mullin
6 min readAug 25, 2021

One day I got a call. A man told me that he has a problem with a machine for the production of plastic windows. Additionally, I was informed that it was already repaired a year ago.

This is a translation of my article in Zen. Also, do not forget to read us in other services: Instagram, telegram (RU, EN, DE). Medium, LiveJournal, YouTube.

We arrive at the place and see a machine for assembling plastic windows. When I opened the electric cabinet, I was very surprised. Photos of what I saw below

The logic was implemented on relays and timer circuits. The timers are implemented on the NE555 chip. Below I prepared a description of this chip and a classic connection diagram

The timer works very simply: The capacitor C is charged through the resistor RA. The timer setpoint depends on the nominal value of the resistor and the capacitor. When the voltage on the capacitor exceeds the voltage on the direct input of the comparator, the trigger inside the chip changes its output state and discharges the capacitor. The procedure is repeated and the output state will change. And so step by step.

I did not check the scheme, but I am sure that it was implemented as in the scheme. The resistor was variable, so that each timer could be configured individually. In fact, each timer started the machine operation cycle, and the relays on the second board provided the logic. There was also a board with output relays that switched the pneumatic valves, and they controlled all the elements of the machine with the pneumatic cylinders.

The first task was to understand how the machine should work. I was lucky, there was a machine for making windows nearby, but of a little different design. Below is a video of the full cycle of work

And then I took a video of just the beginning of the machine, before the profile was soldered

Having understood how it should work, I began to develop the design of the control system. I removed everything from the electrical cabinet. There was no desire to understand how it works. Then I connect the pneumatic valves, power transformer, buttons from the right and left button panel and lamps to the electrical terminal blocks.

The next step is to implement the security functions. I connected the emergency buttons to the power line. Pressing any of the emergency stop buttons caused the circuit to be de-energized. After checking everything in the work, it was possible to continue.

The next part is technology. I wrote a program on Arduino and connected a relay unit with 8 outputs to it. I was able to quickly check the logic of the machine operation. Also, in the previous solution, external industrial timers were additionally used. They were used to adjust the heating and gluing time. After receiving feedback from the operator that nobody has ever set them up, I used the delay time from this timers. After checking the algorithm in operation and successfully producing several windows, it became clear that the logic works.

t’s time to manufacture your own industrial controller. The description was as follows: 6 relay outputs, 2 inputs and a microcontroller. I also decided not to ignore the galvanic separation of circuit elements. I decided to use the relay board, which you have already seen above, as the basis for the input-output (I/O) block. The photo below shows similar board, just for example and explanation (RU).

You can see that the control part is well separated from the power part, the relays make a galvanic separation with the power part. The optical isolation separates the relay from the output of the microcontroller.

But we still have 2 buttons. That is, we need to connect two 24V inputs to the microcontroller. We use only 6 relays, 2 are not needed. Therefore, we will do the following: Remove the elements indicated below in orange. And we turn the optical isolation so that contact 3 is in the place of contact 2, and contact 4 is in the place of contact 1. We connect contact 4 to the power supply of the controller with a resistor (I have about 1000 pcs in stock for 2.2 KΩ, and I used it). Instead of a relay, we install two resistors of 2.2 KΩ each (I think the choice is clear ☺). Now, we will connect 2 contacts on the board with jumpers (instead of a transistor). Thus, the signal from the buttons through the resistors comes to the input of the optics. If necessary, I will tell you about the alteration step by step.

Let’s now talk about PC817. It is used very often; it contains a phototransistor and a diode. In our relay unit, all diodes are connected by an anode to the power supply. The microcontroller must supply a logical 0 to activate the PC817.

We will change contacts 4 and 1, as well as 3 and 2. We make it so that the logical 0 becomes on contacts in7 and in8 when applying 24V to the optics.

The final scheme will be as below:

Here we have Sw.1 and Sw. 2 are the inputs from the right and left buttons panel and SV1–6 are pneumatic valves. I soldered the board with the controller to the relay board. I used 6 contacts for the output and 2 for the input. We pack everything in a metal box and install it.

The result can be seen in the video below. Surprisingly, everything worked immediately and without any problems. I still haven’t had to remake my work.

And that’s all, subscribe, likes, repost… And we will soon be a small lottery ☺.

--

--

Igor Mullin

I´m a Hardware and Software Engineer and a PhD. In my professional activity I focus on such things like smart home systems and electric development.