0:03
There is a lot of noise right now about
0:05
AI writing PLC programs for you. So,
0:07
instead of guessing, I set a trap.
0:10
I gave both ChatGPT and Claude the exact
0:12
same motor control task for the Click
0:14
PLC with a classic wiring gotcha buried
0:16
in it and checked whether the logic
0:20
I fully expected to catch at least one
0:21
of them out. Neither took the bait. Both
0:24
wrote a working program and they did it
0:29
You can follow along for free. The Click
0:31
software is a free download and you can
0:33
prove the logic in a free online
0:35
simulator before it touches hardware.
0:38
Detailed information contained in this
0:40
video can be found at accautomation.ca.
0:43
A link has been put in the description
0:46
The website offers extensive links,
0:48
references, and coding samples, making
0:50
it a one-stop shop for all your
0:53
Once again, that is accautomation.ca.
1:01
I wanted a task small enough to explain,
1:03
but real enough to catch a lazy answer.
1:08
Start and stop a motor. Start push
1:09
button normally open on X1. Stop push
1:12
button wired normally closed on X2, so
1:14
it is on when not pressed. Motor
1:16
overload wired normally closed on X3 on
1:19
while the motor is healthy. Motor
1:21
contactor on Y1, green running light on
1:24
>> And one twist, when I press start, a
1:26
warning buzzer on Y3 sounds for 2
1:28
seconds first, then the motor starts.
1:31
The gotcha is that normally closed
1:33
wiring on the stop and overload. A lazy
1:35
answer uses normally closed contacts in
1:37
the ladder to match normally closed
1:38
buttons, but that is a double negative.
1:41
Those inputs are already on at rest, so
1:43
the motor would never start. That is
1:44
exactly where I expected an AI to trip.
1:50
What ChatGPT produced.
1:53
ChatGPT answered in seconds. An address
1:55
list, seven rungs, and an explanation of
1:59
>> Let me figure out the logic here.
2:02
Okay, for a Click PLC, you can do it
2:05
with an internal control relay latch and
2:09
So, start push button normally open on
2:12
X1, stop push button wired normally
2:15
closed on X2, and motor overload contact
2:19
normally closed on X3. Motor contactor
2:22
on Y1, green running lights on Y2,
2:25
warning buzzer on Y3. Run one uses X2
2:29
and X3 in series with X1 to set internal
2:33
coil C1 and resets C1 if stop or
2:37
overload opens. Run two starts a
2:40
2-second timer when C1 is on. Run three
2:44
energizes Y3 buzzer while the timer is
2:46
active, so it beeps immediately for 2
2:49
seconds. Run four turns on motor output
2:53
Y1 after the delay. Run five drives
2:56
green lamp Y2 on whenever the motor is
2:59
running. That's a safe latching
3:02
start-stop with a timed warning before
3:05
energizing the motor.
3:09
>> It used a set RST latch. One rung sets a
3:12
start request bit when start, stop, and
3:14
overload are all satisfied, and it gave
3:16
the stop and the overload their own
3:18
separate reset rungs.
3:20
Then a 2-second timer, the buzzer while
3:22
it runs, the motor when it finishes, and
3:24
the green light with the motor.
3:27
And here's the thing, so it used
3:28
normally open contacts for the stop and
3:30
overload, which is exactly right for
3:32
normally closed wiring.
3:34
It did not fall for the trap. That is a
3:40
What Claude produced.
3:42
Then I gave Claude the identical prompt.
3:55
>> Five rungs this time and a different
3:57
approach, a classic seal-in [music]
3:59
latch. It put the start button in
4:00
parallel with the C1 bit to hold it in
4:03
with the stop and overload in series, so
4:05
either one breaks the latch.
4:07
Same timer, same buzzer, same motor,
4:10
Claude also used normally open contacts
4:13
for the stop and overload. It handled
4:15
the wiring correctly, too. Also a
4:16
working program, just built in a
4:30
Both passed. Why that matters.
4:34
This is the honest headline. I designed
4:36
this task to catch an AI out on the
4:37
wiring and both of them got it right.
4:40
That is the number one mistake a
4:41
beginner would make and neither AI made
4:44
it. On a clearly specified task, today's
4:46
AI can write ladder logic that actually
4:49
That surprised me and I would rather
4:51
tell you straight than pretend
4:56
The interesting part, two valid styles.
5:00
The most useful part is not that they
5:01
passed. It is how differently they
5:03
passed. ChatGPT used set and RST.
5:07
Claude used a seal-in.
5:09
Both correct and the difference is a
5:11
real design lesson. Set dot RST gives
5:13
each stop condition its own rung. Easy
5:15
to see why the motor stopped, easy to
5:17
add another fault later.
5:19
The seal-in is the traditional starter
5:21
every electrician knows. Compact,
5:22
everything in one rung. For a simple
5:24
motor, I lean seal-in.
5:26
For a machine with lots of stop and
5:27
fault sources, set RST scales more
5:30
cleanly. Two AIs just handed us both
5:32
textbook approaches. That is a great way
5:33
to see the trade-off.
5:38
Why it worked, the prompt.
5:41
Before anyone says AI has this solved,
5:43
here is the catch. The reason both came
5:45
back correct is that I told the AI
5:46
exactly what it needed. The real
5:48
addresses that the stop and overload
5:50
were normally closed and on at rest and
5:53
I gave it what I would give a co-worker,
5:55
ask it vaguely, write me a motor
5:57
start-stop program, and you get generic
5:59
logic that does not match your wiring
6:01
and may well fall for the double
6:03
The skill that made this work was not
6:05
the AI's. It was writing a clear,
6:07
specific prompt. That is the part worth
6:14
The one thing I would still add
6:17
Both programs are correct, but I would
6:18
still change one thing on either, and it
6:22
Both run the overload through the PLC.
6:24
That is fine for control, but it should
6:26
not be the only thing stopping the motor
6:29
A motor overload should also be
6:30
hardwired into the contactor coil
6:32
circuit, so the motor drops even if the
6:34
PLC halts or an output fails.
6:37
Neither AI mentioned it because neither
6:38
AI knows how your panel is wired. That
6:47
Correct on paper is not proven, so I ran
6:49
it. The Click software has no offline
6:51
simulator, so I connected the PLC, went
6:53
online, and forced the inputs in data
6:55
view with the wiring off.
6:57
Start, buzzer 2 seconds, motor on, green
6:59
light, drop the stop, then the overload.
7:01
Each one kills the motor.
7:03
Only then would I let it near a real
7:04
motor with that overload hardwired as a
7:08
If you are enjoying this video, please
7:10
hit the like button below.
7:12
Keeping up with all the latest
7:13
automation innovations can be difficult,
7:15
so hit the subscribe button.
7:17
Remember to hit the bell beside your
7:19
subscription to receive the
7:26
So, yeah, can AI actually write PLC
7:30
Yes, I went into catch it out, and both
7:32
ChatGPT and Claude wrote correct,
7:34
working logic for a real task, each in a
7:36
different sound style.
7:38
But writing correct code for a task I
7:40
specified perfectly is not the same as
7:42
programming your machine.
7:44
It does not know your wiring. It did not
7:46
think about hardwiring the overload, and
7:48
it will never be responsible for what
7:52
The limit is no longer whether AI can
7:53
write a rung. It is that it cannot see
7:55
your machine and cannot own the outcome.
7:58
You can, and you do. Use it the way I
8:00
do. Write a clear prompt, let it draft
8:02
the logic, verify every line, test with
8:04
the outputs isolated, keep safety in
8:06
hardware, and put your name on it only
8:08
when you understand it.
8:10
The full written test, both programs and
8:12
my rules for using AI on a PLC, are on
8:14
the blog. Link in the description.
8:17
Tell me in the comments, set, RST, or
8:19
seal in, which would you have written?
8:22
New tutorials every Monday.
8:24
Subscribe and hit the bell, and I will
8:25
see you in the next one.