Howdy, folks, and welcome back to World of Motion.
Now, today example is a clock.
Yes, literally a clock.
And I hope you will have some educational value
from this solution and maybe a laugh.
And I will show you why.
So why a clock?
This example shows a clock.
And what is a clock?
Beneath all those dials and needles which
represents seconds, hours, and minutes, there is some mechanics
and there is also some electronics.
So idea here is to take these mechanics and remove it completely
and to use for each needle, server motor.
Now if you remove the mechanics, you will make your machine
lighter, faster, more productive.
And I want to show you that this is possible based on the one information,
like in a clock, and it's this oscillator,
which provides accurate time.
And I will use, in this example, a real time clock.
So what do we have?
Now I will show you what we will see in this example.
We will see first hardware configuration, PLC program,
and we will test it.
So hardware-- we will use for this example, CODESYS PLC,
around the latest version of CODESYS.
On this PLC we will have EtherCAT bus and then our EtherCAT server drives.
For ours, it is going to be integrative drive.
For minutes, we will LXM32M, and for seconds we will use LXM32 integrated.
Now, do you want to see something really funny?
Of course you do.
Now you will see CODESYS program, and on the right lower corner,
you see my clock.
Yeah, it's funny.
So I printed out the dials, and I also have some copper wire for my needles.
When we see this, we'll go now through the program.
First I have on EtherCAT all my three drives, and scaling
and everything else I will leave you.
Else what we have are virtual encoders, which we will use in the program.
I will show you what it is about.
Then we have a program which is separated in five pieces.
So first, we have the part where we run the drive,
and most important part is where read system time in high resolution.
That means in milliseconds.
Then we have part where we'll read some status and so on.
After that we are in clock data calculation.
So here we calculate how many milliseconds is there in one day,
in a current day, and because of this recording in the wintertime,
I am adding additional hour because this real [INAUDIBLE] clock
is UTC, and we are in CED time.
After that, we are feeding this information to our virtual encoders.
Now, we also have cams, which are literally a straight line.
Because what we will do now is use camming on drives based on cam profiles
where master is going to be virtual encoder,
and the slaves are going to be our drives.
Also here, we have certain blocks which help us prepare.
And then we have the procedure.
So how procedure is going?
Procedure is homing the drives to zero position.
Then we prepare all the drives to the next minute,
and then the next minute starts.
In zero second, the clock starts to run.
Now, you will see here, I loaded the program and now everything is green.
Everything is running.
And with variable start clock, we start the sequence.
So here in virtual encoder, you can see at the moment actual time
in milliseconds.
To say additional information, PLC is also synchronized with anti-P server
to actual time.
We will see how this works afterwards.
So now we will start the clock, and you will see the procedure of going to zero
and preparing for the next minute.
Now, let's switch this view.
Here you can see that clock is in fact in standstill.
Seconds are not moving.
And we can see our virtual encoder on smaller screen, that it's
around 30 seconds now, and it is moving towards the start of the next minute.
I also prepared my mobile phone, which shows actual time,
and the red dot shows actual seconds.
So you can see that it's synchronized because phone
and PLC are synchronized with the same NTP server.
When the red dot on the phone crosses upper zero position,
the clock will start to run.
And here you see.
Now, at this point, it's very hard to notice ours.
It's a little bit less hard to notice that minute dial is moving.
And now I will try to run this video a little bit
faster to make one minute less.
And if you go back two minute 6:15 from the end of this video,
you will see the difference in minutes, and also you
will see the difference, slight difference, in our needle.
So let's run this a bit faster now.
Here it is.
I think the minute needle is visible.
Let's slow it down.
That's it.
Check it out.
Thank you very much.
I hope you had fun.
Bye.