In this video we write a Sequential Step based Ladder Diagram PLC program together, and then build an HMI screen using the SCADA Software Ignition to control and monitor the sequence!
A PLC or Programmable Logic Controller is the staple of industrial automation and controls, and Arduino has made one of the most affordable ways to get into the industry! This micro-PLC has Relay outputs, and programmable digital or analog input and output channels as well.
It also supports Modbus OPC communications for easy integration into SCADAs or larger controls systems, RJ45 ethernet communications and WI-FI connectivity! Additionally there are no licensing fees to use the Arduino PLC IDE where you can program in Ladder, Structured Text, FBD, SFC or using the regular Arduino IDE/C++ based language!
Ignition for Makers puts an incredibly powerful, next generation SCADA software available for makers and hobbyists and learners to start developing industrial automation and controls skills for free!
Don't forget to leave a like, subscribe to the channel, and comment what you want to see next!
Hello and welcome back to the Master
Tech. And today's video is going to be a
continuation in our introduction to
controls and automation tutorial series.
And in today's video, we're going to
write some uh pretty specific form of
PLC logic called sequences. So, one of
the most common ways that long
complicated routines get controlled to
do things in order in factories is with
sequential programming. And sequences
often involve interaction from the
operators at specific points in the
sequence. So we're going to take a look
at how to create a step and then a
function where you step through it in
order. And then we'll also add some
features to the HMI so that uh you can
see how the HMI could interplay with the
sequence. And most important thing is
because this is kind of a continuation
in a tutorial series. The concepts in
this video stand alone. So, if you just
want to see an example of sequential
logic being programmed in ladder logic
on a PLC, you're in the right place.
Keep watching. But if you want to follow
along line by line and build the same
sort of things as we go, make sure that
you have uh ignition connected to an
Arduino Opta PLC, you've already set up
the Modbus connections. So, I have it so
that the red, green, and blue buttons as
well as the user push button are already
tied to my PLC. And then I have a PLC
program where I've already set the IP
address, set it up with Modbus
connections, and created some very basic
logic, including uh adding my first four
Modbus tags. So, if you haven't been
following along with the tutorial
series, but you really want to do this
piece together, all you really need to
do is watch the previous video on the
channel. I'll try to remember to leave a
link to it below, a card to it somewhere
in the top of the screen now. But I
don't want a ton of comments on this
video that are like, "Oh, you jumped
right into it with no context or
background." So, um, please get yourself
in the same spot as me if you would like
to follow along exactly. Otherwise,
let's dive into the tutorial and the
concepts in this video. Okay. Now, I've
prepared uh a pretty simple prompt that
is going to step out a five-step
sequence, and it's basically going to
tell us what we should be trying to
program. Because a really important
thing about controls and automation is
if you just sit down to write PLC code
and you have no idea what you're trying
to code, it gets really hard uh in terms
of inputs, outputs, variables, what you
need to put on an HMI. So anytime in
controls and automation when you go to
write new PLC code, you should have a
basic vision of what you are trying to
accomplish. Bit of a tangent, but
basically step zero of our sequence will
be considered idle, and it'll just be
waiting for an operator to press the
start button on the screen. Then step
one, we're going to be activated. And
then I still have the hand switch
connected to my PLC uh from the wiring
examples that we did a few videos back.
But instead of the hand switch, you
could use the user push button on the
front of the Opta like we've been doing
lately. It's up to you. But in sequence
step two, we're going to wait for a
timer to complete so I can show you guys
the timer function block. And then in
sequence step three, we're going to
click a button on the HMI until we get
up to a set point. So I'm going to show
you how to create a set point on the HMI
screen that operators can change and
interact with. And then we will use that
in our sequence. And then step four will
be sequence completed. And it'll be
sitting there waiting for us to send it
to idle by pressing a stop button. Uh
let's dive right back in. I'll let's
dive into the programming. I'll probably
pull up this notepad if we forget what
the next step is supposed to be. I'll
try to go slow. I'll try to explain
everything as I do it. Hopefully, a lot
of this is familiar if you've been
following the series along. So, let's go
ahead and go to our program. Let's go to
project and then uh we're going to
rightclick and we're going to add a new
program in LD ladder diagram. And we
will call this ladder
sequence. And let's assign it to fast
task and hit okay. All right. So,
sequence step zero equals idle and we're
going to wait for the HMI start button
to be pressed. So, the first thing we
need to do is we need to check with an
equals block. So, EQ,
we need to check if sequence step is
equal to zero. So, we are going to need
a variable that we'll call sequence
step. And if it does equal zero, then we
just want to tie this into the output
line. So, uh, this should look familiar
from the first ladder, uh, tutorial that
we did. Okay. Now, we're also not going
to worry about making all of these
variables. Right now, I'm going to write
the sequence and then I'm going to go
and look at what variables I used and
kind of add them all at once. Uh if that
feels a little backwards, if you're more
of a person who wants to define all of
your variables and then use them or
define them as you go, um you know,
dealer's choice. But uh basically, we
have sequence step equals zero. We're
going to listen then for a uh push
button from a tag that we'll just call
HMI
start. Okay. And when the HMI start
button gets pressed, that'll be
something that we click on the ignition
screen. So then we'll go ahead and start
by resetting the HMI start push button.
Okay. So you're going to turn it on from
the HMI screen and then the code will
turn it off, but when it turns it off,
we will also add one to the sequence.
You could add one to sequence step at
this step or you could say move one to
sequence step. It doesn't really matter.
Just like any form of programming,
there's a few different ways that you
could write it. Um, what's nice about
this rung that we've built is it's sort
of good for reusability. So, we can copy
it and now we can say, all right, now
sequence step equals 1. And I'm not
looking for HMI start anymore. Now, I'm
probably looking for input 8, right? So,
I have a hand switch. If you don't have
the hand switch still hooked up from a
few tutorials ago, you could put the
user push button right here. Um, but
instead I'm going to put an HMI tag in
that is monitoring input 8. Uh, actually
I'll just Yeah, that's fine.
And then when it's made, we'll go to
step two. Um, and then we could do the
same reset, but that doesn't make a lot
of sense because this is actually going
to be looking at the hand switch. Um,
now the hand switch has on position and
off position. And I specifically want to
listen for the rising edge of the hand
switch. So let's say you had left this
on. I don't want it to automatically
blast through this step. I want it to
listen for a person to intentionally
turn the hand switch on. So to do that,
I'm not just going to use a regular
examine if closed block. Uh, this
regular normal contact. I'm going to use
positive edge of the contact. So this is
rising edge. This is as you detect that
that boolean variable transitions to a
one pulse. So it's basically a oneshot
on transition high. So this step is just
going to listen when we're in sequence
step one and only when we're in sequence
step one for the hand switch to turn on
and then it'll move a two into sequence
step. So, if we are tracking our little
notepad of instructions,
we have step zero, we're in idle and
we're waiting for the HMI start button
to be pressed. And then we have step
one. We've activated the sequence and
we're waiting for the hand switch uh to
move us to step three. Uh step two. Now,
in step two, we're going to wait for a
timer to complete. So, we haven't talked
about timers yet. There's a timer on
delay where when the conditions that
make the timer uh start begin the output
is false until a set point is met. Then
there's a timer off delay which is kind
of the opposite which is where uh when
the conditions go when the conditions to
start the timer begin the output is
immediately true but then when the
conditions that make the timer true go
away the timer will then start counting
and stay true for a period of time after
that. That's a lot of uh gobbledegook
and stuff to try to explain what ought
to be a simple concept. But um with PLC
programming, there is just a little game
within the game of knowing the nuances
going on here. Um so let's go ahead and
drop a new block that we haven't seen
before, but it's to N timer on delay.
And just to show you real quick, there's
timer off delay. So when you make
function blocks like timers that have a
few parameters to them, you have to give
them an instance name. So for this one,
we can just call it the step two uh ton,
the step two to n. Um, but the reason
you need to do that is because there's
an output tag, an input tag, a uh set
time, and then an elapse time. All of
these uh four parameters, and they need
to be stored in a variable or instance.
Okay, so for this timer, we're going to
go down to PT, and you can add
constants. So, if you know you always
want it to be 5 seconds or something
like that, um you can put a constant in
here. I'm going to want to tie it to a
variable, which I will call um I will
just call step two time. That's what
I'll call the variable. Um and that'll
be my uh my time that uh is set for the
timer. So, that's how long I want the
timer to count up for, which will be
something we'll let the user set from
the HMI screen we're about to build. Um,
and then we will make on the output of
this timer completing, we will make it
move to sequence step three. Okay. Now,
there's a few things. Oh, I have two
moves here. Okay. Um, there's a few
things we're going to change now. We
don't want the input of uh 8 anymore. We
don't need that. But there is one thing
about PLC timers that we haven't
included yet. Um, and that's that the
default time for almost every PLC is in
milliseconds.
I don't want the operator, I don't want
the user on the HMI entering a time in
milliseconds. It's not that intuitive.
It's not how people think. So, I'm going
to add uh a multiply block in here, mul.
And I'm going to drag it before the
timer if it'll let me. There we go. Um,
and I'm going to take the HMI
time SP. So, set point. HMI time set
point. If you don't like my uh tag
naming conventions, I don't know what to
tell you.
You know, that's okay. And then I'm
going to multiply it by a th00and. And
I'm going to store that in step two
time, which is the name of the variable
that we just defined. Okay. So, what
this line is doing now is saying when I
get to this step, I'm going to take the
set point that's on the HMI and I'm
going to multiply it by a th00and and
then we're going to use that value in
the timer. So, we'll enter a time in
seconds on the HMI. This will convert it
to milliseconds for us and then once the
timer finishes, it'll move us to step
three. Okay? And then, if we remember
step three, we're going to have a
counter. So, we're going to have a
target number of times a button has to
get clicked, and we're going to keep
track of how many times it's been
clicked. And then once we hit our set
point, we'll move to step four. So, this
one's a little bit different, and it'll
probably make more sense once we get to
uh the HMI where you can see the
interaction part. Um, but I'm just
choosing to sort of start in the PLC
code and then we'll move into uh the HMI
all at once. So, it's still not too bad.
We're going to say now if we equal three
and then we want to move to four when
this step finishes in the middle. What
we're actually checking for because
we'll do most of the hard work um on the
HMI for this step. So what we're going
to check for here is that we're greater
than or equals. So g a new block um and
we can delete the multiplication that
was for the previous step. And we're
going to want to check that hmi counter.
So, let's go ahead and make a new tag
called HMI counter in here. Um, and we
want to check that the live counter gets
greater than the uh HMI count. And we'll
say set point SP right there. Okay. And
uh now we need to delete this block
because what we want the output to be is
just set the output line. Okay. So very
simply, this line means when we get to
step three, wait until the HMI counter
gets above the HMI count set point and
then move uh to step four after that.
But one thing that we want to keep in
mind is that if you were to restart the
PLC or you didn't properly clear the
sequence or anything like that, how do
we guarantee that the HMI counter has
been reset to zero by the time we get to
this step? One of the easiest ways is
actually just go to the step before it
and add some branching logic. Add some
branching logic around your output
conditions. Okay. And we're going to
come down here and we're going to add a
new block to just move a zero. So come
over here and here we're going to move a
zero into HMI counter. So this is just
my way of saying I really don't care
what's happened to that variable up
until now. know I haven't need it in my
sequence up until now, but I'm about to
enter step three and I know I want that
to be a zero when I get there. So, I'm
going uh to set it equal to zero before
I get into step three. So, that's all
we're doing there. And then that's
really it for our sequence. So, step
four is sequence completed. Press HMI
stop to send to idle. That is basically
exactly what we did with line one. Since
that's exactly like the first line, we
have a really good thing to reference
here already. And we'll just go ahead
and uh say, okay, that was a coil. And
we're going to say, all right, when I
get to step four, then I want to move to
step zero. When HMI stop gets pressed,
hmi stop. And if you remember from that
first line, we also went ahead and we
reset the uh output as part of that. So,
if we go over here,
we also want to put HMI stop
in a reset. That's going to say you
wrote a one to it from the HMI. We're
going to write a zero to it from the
PLC.
All right, we did a lot of ladder here
without looking at the HMI. We need to
add a lot of variables. So, let's try to
do this carefully and methodically now.
Um, if we go into the uh resources tab
and then parameters, I'm basically going
to default to wanting every one of these
tags uh in parameters because I want to
give the HMI
as much information as we can. So, we're
going to have sequence step, that's
going to be an integer. We're going to
have HMI start, that's going to be a
boolean. We're going to have HMI input
8. That will be a boolean and we'll tie
it to my hand switch. We're going to
have
HMI. I spelled HMI wrong. Uh, we're
going to have HMI time set point.
Why I'm struggling to type today. Time
set point. That'll be an integer where
the operator enters something in
seconds. We'll have step to time.
That'll also be an integer. it'll just
be uh multiplied by a th00and
and then we're going to have hmi counter
that's going to be an integer as well
and then we'll have
you know we could also put the elapsed
time from that timer in a variable so we
could call that hmi
elapsed and we could make
yeah that could be an integer as well
that's fine uh so we can put how much
time has progressed in another variable.
So on the HMI, we could also show how
far the timer has progressed. Um I just
decided that was a good idea right now.
Then we're also going to have the HMI
count set point. So that'll be what you
need to press the button up to. And then
we want HMI
stop. Uh and I may have missed some
things, but that's what we're going to
start by making. So, let's go into
parameters and we have the user push
button, red, blue, and green from
before. No reason to delete those. Let's
just go ahead and add um and we'll add
sequence step and that can be an
integer. And then we'll add
HMI start.
Careful on spelling. That'll be a
boolean.
And then we'll add
HMI i8. And that'll be a boolean.
Now we will add
HMI
time set point integer.
Add
step
to time. That'll be an integer.
We'll add HMI counter also an integer.
We have HMI elapsed. You guessed it,
that's an integer.
We have HMI count set point integer. And
then we have HMI stop. And that's a
boolean.
Okay. One thing that we need to do
because it's the thing that interacts
with the physical world is we need to go
in here and we need to set HMI
i8 here being sorry I should have
clarified here being the main routine
that we set up uh in the previous video
where we just mapped our lights and uh
push button to the we mapped our mod bus
tags to the physical tags that actually
represent them. So here we want to set
HMI I8 equal to input 8. And we want to
go to our um programmable inputs and
make sure that I8 or whatever I have my
hand switch wired up to I8 on my
Arduino. Um so I'm just going to make a
variable called I8 that physically
represents the state of the hand switch.
And then in main I am mapping the HMI
tag that we just made to share with
ignition. And I am mapping that to the
physical hand switch.
All right. So I am naively optimistic
that this is going to compile. Let's
just go ahead and compile and see what
we missed. And it appears that it
worked. So let's go ahead and try to
download it. A warm restart's required.
That's fine. Initialize the database
with default values. That's fine. Warm
reboot. It says source code. Okay. So,
uh, if you were to throw on the little
live debug mode, which is a a cool
feature of ladder, um, and most PLC
IDEs, you can see the live value of all
of these tags come in. And so, sequence
step zero is active right now. And if I
were to uh click the HMI start button
um, or just within the code by double
uh, clicking, I can set it equal to
true. What you can't see is that the HMI
start went true and it immediately reset
itself. But what you can see is that the
sequence step is now one. So now we're
waiting for HMI uh I8 to go true. If I
set equal to a one, that one actually
won't let me force it through because
it's being overwritten in the main PLC
routine. But what I can do is boot up my
24volt power supply real quick and I can
actually trigger the hand switch. And if
I go in here and I watch HMI i8, if I
make the hand switch, it goes true.
Okay. And actually predictably, um, it
went straight to sequence step four
because our time set point is equal to
zero. So the timer finished immediately
and went to step three. And then our
counter is equal to zero. So it went
immediately to four. It's waiting for
someone to press uh, HMI stop. So if I
go ahead and I write a true to that
boolean, it'll go back to step zero. So
that's kind of as fast as you can walk
through it just on the PLC to make sure
it's working. So we added a total of 1 2
3 4 5 6 7 8 nine new tags. We need to go
into ignition. And first thing from the
gateway, if you were following along
last tutorial, we need to expand our
addresses to include those new um nine
tags. So before we went from 1 to four.
This is super easy. Now we just go from
1 to 13 and hit save. Uh the status is
connected which is great. The live
screen won't change. So we open up
designer launcher and we open our
gateway uh designer.
Open the designer. All right. So we've
got our homepage. I'm gonna I'm going to
leave the opt up there exactly like it
was from last time. I don't have a
problem with that. Um, but I am going to
add to my tags. I'm going to add a new
folder and call these sequence tags. And
then I'm going to browse devices
and go to my opta. And I'm going to go
to my unit ID. And I just added tags
uh one, two, three, four. I just added
tags five through 13. So I'm going to
store those in sequence tags. Okay. So,
I am adding all of the new tags that we
just added in the PLC to uh a the HMI.
They're all zeros. They also all came in
as shorts. Um, but if we look back at
our PLC real quick, we have sequence
step, HMI start. We have the exact order
we actually wrote on this notepad for
easy reference. Um, we have one, two,
three BS. And so, we need to change
those tag types to BS. Modbus uh holding
registers always look like 16 bit signed
ins to ignition if you don't tell it
otherwise. So um optit five was the
sequence step.
Okay. Optag six was the HMI start. And
you don't actually have to call them
exact. And this one was a boolean. You
don't have to call them exactly what
they're called in the PLC. It's just an
easier way to keep them straight.
HMI input 8 was also a boolean and was
the next tag.
And then
HMI
time set point was an integer
and the next tag was
step two
time integer. Okay. Uh the next tag HMI
counter
counter
and that's an integer. Okay. Step 11.
The next one HMI
elapsed and that is how much time has
passed. That can be an integer. The next
tag is
HMI
count set point integer. Okay. And the
last tag will be HMI
stop. And that's a boolean. Go to the
PLC. Uh, okay. HMI start needs to be
Oh, well, it is case sensitive. So, this
needs to be a capital S for HMI start.
Do you want to reassign this variable
and use it as parameter? Yes. Um, okay.
So, that should be a boolean. That
should work. Uh, this should also be a
boolean.
And then this should also be boolean.
That should work. Uh, all right. All the
addressing should still be fine. And
then I guess since we have to download
anyways, um, we can go back to our
ladder sequence really quickly. And we
can add that elapse time that I forgot
to put in here. So, um, if we go back to
resources, we just called it HMI
elapsed. Let's go to our timer block and
let's add a variable to the ET and we
called it HMI
elapsed.
Okay. Okay. And uh one thing to call out
here that you could kind of see which is
also kind of nice and maybe I did this
in the bad order. If you define all your
variables that you're going to need for
your routine before writing your
program, then they're available when you
go to add variables and you can see that
they exist and what data type they are.
So maybe I did a little bit backwards.
Uh I'm not perfect. Let's compile and
download and restart the PLC. Initialize
the database again. Okay, so with all of
our tags added, we can finally do the
fun part. Depends who you are. I enjoy
the graphical user interface, the HMI
development portion of the job. Um,
let's go ahead and add that sequence
step, right? So, to the visuals and
ignition's kind of nice. You can just
grab a device and or a tag and drag it
onto the screen. And based on what type
of tag it is, it'll show you all the
recommendations for it. So, like an
integer. By default, they have gauges,
oneshot buttons, cylindrical tanks, uh,
labels, things like that. So, we'll just
do a label for the sequence step, and
then we'll build some more cool features
into it. Um, but let's go ahead and do
little checkbox uh buttons for um start
and stop. And the text, we'll say start
for the start button. That seems like a
good thing to say. And then we'll say
stop for the stop button. So, the text
stop. Cool.
And then we'll throw what do we want to
throw? We want to throw our set points
on the screen as um as uh numerical
entries. So if we click the little
pallet over on the right uh perspective
components toolbar, we'll type in
numerical numeric entry field and drag
it onto the screen. And the value will
be what it's asking for. It'll be asking
for a tag. So let's make this one our
count set point. and we'll say value tag
path count set point and make sure to
click birectional so that people can
write to it. Okay, so this is our count
set point. So why don't we uh go back to
perspective components and add another
label that just says
count set point. So count set point and
that doesn't have to be linked to
anything. It's just telling us what this
numeric entry field is. And then we had
one other thing that uh people could
edit willy-nilly and that was a time set
point in seconds, right? And that has to
go to a different tag. That one needs to
go to HMI time SP. So time SP. And I
know some people are going to be furious
at my lack of consistency with
capitalization and camel case, snake
case, madeup case, you pick it. Um,
okay. But so that'll let us enter a time
set point. That'll let us enter a number
of times to be counted. Uh, so then the
only other thing I want to add real
quick is I want to add a button
perspective components button that is
going to button
that is going to add one to the counter.
So if you remember, we get to a step
where I also want to add indication.
Let's finish that counter first. Press
to count up. Okay. So we're going to
make a little button and when you press
it, the count goes up and then we will
show the counter right next to it in a
label.
So this is the HMI counter tag and then
on click. So button, rightclick,
configure events. We're going to do a
little script here, a little ignition
script to add one to the value um when
the button is pressed. So we go to mouse
events in configuration events,
uncclick, press the plus button, and
we're going to do a quick little script
that is going to be
uh val equal to. So the current value of
the counter is equal to system.tag
readb blocking and that's a little bit
of just ignition syntax for you. The tag
path is going to be that counter
variable. So we're going to say read the
value that the counter currently has.
And then little Jython syntax fun that
we get to play here is if we actually
want the value we say square brackets
zero do value. So this is how you get
the actual value that is in the counter
tag already. And then what we're going
to say is value equals val + one. Okay.
So we're just saying you could just say
val again is equal to val plus one. But
now we're going to do system.tag tag.
Blocking
and in that same tag path, we're going
to write value. So, we're just adding
one to the value of the counter when
that button gets pressed. And what's
cool is it'll let you it'll let you
click the button at any time. But what
you'll see is when we get to step three,
which is where it's actually checking
it, you'll see it get reset to zero
because we only care about it when we
get there. So, you're starting to see
how the HMI and the PLC work together to
create a system that the operator has
some control over, but the PLC can also
be programmed intelligently to protect
it. So, this is how we just make a
button in ignition to increment a value.
And let's see, what am I missing? When
we're in step zero, we're idle. We press
start. We should go to step one. Yeah,
we want to monitor
input 8. And actually to do that, I'll
grab one of these buttons that we made
in the previous step. This was the blue
button. Uh and I'll just drag it up
here. This is this is input eight up
here because that's kind of physically
where it is on the Arduino. And we'll
have it uh when it's true, we'll have it
go um pink. I don't care. Pick a color.
All right. So then all I have to do is
copy the path for that tag. And I have
to say, hey, here's the tag that you're
animating off of. Again, I'm assuming
you uh watched the previous video and
you know that we set this tag parameter
to tie into that color animation. Okay,
so real quick, we can check that color
animation because I have the hand switch
right here with me and we can see
whether the hand switch is on or off.
Okay, very cool. So, obviously it looks
like crap because we haven't formatted
it. We haven't uh made it stylistically
pleasant. Uh we don't animate things
whenever. But let's go into read write
mode real quick for the gateway. So
that's what these two little arrows are.
And right here in the designer, we can
toggle into uh preview mode. So now we
can interact with the things. Let's say
when we get to the countdown step, we
want 5-second countdown. And when we get
to the count up step, we want to have to
click the button three times. Okay, I'm
going to enter those. You can see right
here, I can start counting up just by
clicking it. And the counter is at
eight. What's cool is when we get to the
count up step, that should go back to
zero and we should have to start over
again. Um, one thing we didn't add, but
I want to put here is the elapsed time.
Um, and I'm going to put it in a label,
but where did it go? Oh, there it is.
Um, but you guys are going to see
something cool. Let me let me go up
here. You guys are going to see that
this value is going to come in in
milliseconds. Um, so I'm going to let it
do that this first test through and then
I'm going to show you how you can scale
it in the HMI. You could scale it in the
PLC, you can scale it in the HMI. Uh,
just kind of pick something and try to
be consistent on your project. So, we're
in step zero. I hit the start button.
Now, we're in step one, and we're
waiting for HMI. Uh, we're waiting for
input 8. So, I'm going to turn the hand
switch. And now we're in step two, and
you can see the counter counting up. And
when it hits 5,000, we go to step three.
Okay, pretty cool. And now it's waiting
for us to count up to three. So you see
this was eight. Now it's just waiting at
zero. So we click once, twice, a third
time. Now we're in step four and we
press stop and it goes back to zero.
Okay, so the sequence step is working
and that's really cool. What's not great
is it doesn't tell you anything useful.
So what we're going to do is we're going
to add a transform and we're going to
map it. Okay. So this is very common
when you uh have a numerical value that
tells you something that you would
prefer to explain with text. Some uh a
common way to refer to this is
enumeration. Um enumeration just refers
to taking a integer value or a numerical
value and it telling you more than just
a number. It's telling you a string of
text. But it's easier for PLC's to pass
a simple integer back and forth than
long strings.
So in zero, we're in idle waiting to
press start button on HMI. That's the
text that we want to display in step
zero. Oh, where' my There we go.
In step one, we are active
waiting to see input 8 transition high.
In step two, we are active waiting for
timer to complete based on time set
point. Step three, we're active
and we want to wait
for
pushes to reach
push count up set point. Uh you can call
it whatever you want if you don't like
my step names. And then step four we can
say complete press stop button on HMI to
idle sequence. And what's nice about
ignition 2 is they have a feature called
fallback which is I don't know how I got
here. And we can just basically say um
sequence step somehow
out of normal
boundaries.
And that's just basically saying you
should not have been able to get here.
Here's an error message telling you that
something bad is happening. Uh that can
come in handy a lot. So we're going to
make that label a lot wider because that
text is a lot longer. Um, and then other
than that, I think the only other thing
I want to do right off the bat is I want
to take this uh thing on the screen and
I want to make it uh in seconds. So,
what we're going to do is we're actually
going to make this um scale mode linear
and I'm going to say, okay, well, it's
showing me milliseconds, but I want
seconds. So, if the raw high is 1,000,
that means the scaled high is one. And
as long as you don't do clamp mode, uh,
then it will automatically say, okay,
even if I'm more than zero or more than
one, um, that's okay. And then we'll
make the value a float. Since now we're
dividing it by a th00and, we'd like to
see decimal precision.
Okay, so this is this should be a little
bit better now when we test through it.
Uh, because it's giving us instructions.
And we'll actually open the web page
now.
And we'll actually open the web page now
and we'll run it from here. So I'm going
to uh go ahead and hit start and waiting
to see input 8 transition high. And you
can see it's already high but we put in
that positive transition bit. Um so it
needs to see it high again. And here you
can see fractional seconds counting up
which is nice because we set the set
point in seconds. Now we need to count
up to three, two, three. And now we need
to press stop on the HMI.
Okay, we can pretty easily say let's
make the count set point 11. Let's make
this time set point uh seven. And let's
do it again. Let's press start here.
Let's flip the hand switch.
We're going to get to 7 seconds.
We are going to count up to 11 clicks.
And now we finished the sequence. We can
hit stop. And we're back to idle.
Overall, this was a challenging tutorial
to put together because where to start,
how to make it useful, how to explain
the concepts but not get bogged down the
details was all a little bit daunting. I
do hope you found it useful. I think
we're getting to the point where all of
the basics have been covered and I think
we want to build one complete uh
automation and controls project
together. So, I am looking forward to
doing that. Um, I am already sort of
fleshing out what that's going to look
like and entail. So, as always, be sure
to ask any questions that you may have
in the description below. Thank you so
much for watching. Let me know what you
want to see next time on the channel,
and keep an eye out for more controls
and automation tutorials. Thanks. We'll
see you next time. Bye.