OpenPLC-version1-with-LDmicro/C2/Normal-Contact/English

From Script | Spoken-Tutorial
Revision as of 18:26, 5 October 2020 by Nancyvarkey (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Visual Cue
Narration
Slide 1: Welcome to the spoken tutorial on Normal Contact.
Slide 2: Learning Objectives
  • Normal Contact
In this tutorial, we will learn about the working of Normal Contact
Slide 3: System Requirements
  • Ubuntu Linux 18.04 OS
  • LDmicro
  • 'OpenPLC version 1 Mainboard
  • 24V, 2A SMPS
  • USBasp programmer
  • Traffic Light module
  • Switchboard module
To record this tutorial I am using:
  • Ubuntu Linux 18.04 operating system
  • LDmicro
  • OpenPLC version1 Mainboard
  • 24V, 2A SMPS
  • USBasp programmer
  • Traffic Light module and
  • Switchboard module
Slide 4: Pre-requisites
  • Program OpenPLC V1 Mainboard and
  • Interface OpenPLC modules with Mainboard.

If not, please refer to the relevant tutorials from Home | spoken-tutorial.org

  • To follow this tutorial, you should know how to
    • program OpenPLC V1 Mainboard and
    • interface OpenPLC modules with the Mainboard.
  • If not, please refer to the relevant tutorials in this series on this website.
Slide 5: Prerequisites - Hardware setup

hardware-prerequisite.jpg

Connect SMPS and USBasp to the Mainboard as shown in the picture.

Keep these connections throughout this tutorial.

Open LDmicro Now let us open LDmicro.
Click ‘Instructions -> Insert Coil’ Insert a Coil from Instructions.
Rename the coil as LED. Click the OK button. Rename the Coil as LED as shown.
Place the cursor to the left of the coil

Click ‘Instruction -> Insert Contact’

Place the cursor to the left of the Coil.

Insert a Contact from Instructions.

Double-click on the contact Double-click on the Contact.
A dialog box opens.
Highlight Negated We can find a check-box called ‘Negated’ just below the name box.

If it is checked then the Contact is a Negated Contact.

If it is unchecked then the Contact is a Normal Contact.

Normal Contact will pass the signal when its state is logic 1.

Thus, we have two types of Contacts.

Highlight Source column These Contacts have three source types which are Internal Relay, Input pin, and Output pin.
Highlight unchecked Negated box

Highlight Input pin

By default, Negated is unchecked with source as ‘Input pin’.

Input pin’ represents that Contact reads an input pin of the microcontroller.

Don't change them.

Keep the default settings as it is.

We will learn about other types of Contact and sources in the later tutorials.
Rename it as ‘switch’ >> Click OK button Rename the Contact as ‘switch’ and click the OK button.
Now we will check the working of this logic.
Click ‘Simulate -> Simulation mode’ >> Click ‘Simulate -> Real-time simulation’ Let us turn on the simulation mode.

For that, click Simulate and then on Simulation mode.

Next, start real-time simulation as shown.

Highlight state of Xswitch and YLED Observe the state of Xswitch and YLED in the I/O list.

Initially, the state of Xswitch and YLED are 0.

Double-click on Xswitch The input to the Xswitch is logic 1 as it is connected to positive rail.

Change the state of Xswitch to 1 by double-clicking on it.

Highlight state of YLED We can observe that the state of the YLED has changed to 1.

That means input to YLED is logic 1.

This in turn indicates that output of Xswitch is logic 1.

Thus, when the state of a Normal Contact is 1, it passes the signal through it.

Click Simulate -> Halt Simulation >> Click Simulate -> Simulation Mode Now, turn off the simulation mode.

For that, click Simulate and then on Halt Simulation.

Then click Simulate and Simulation Mode

Now let us compile the logic.

The detailed steps on how to compile and save the logic are explained in the earlier tutorials.

Click on Settings >> Click on Microcontroller >> Select AVR ATmega16 40-PDIP

Click on Settings >> Click on MCU parameters >> Change Crystal frequency to 16 >>Click OK button

Click on Settings and select microcontroller AVR ATmega16 40-PDIP.

Adjust its parameters as shown here.

Double-click on Xswitch in I/O list >> Select PC0 >> Click OK button Assign pin PA0 to the Coil YLED.
Double-click on YLED in I/O list >> Select PA0 >> Click OK button Then assign the pin PC0 to Xswitch.
Click on Compile >> Click on Compile as >> Go to Desktop/LDmicro folder >> rename it as ‘normalcontact.hex’ >> Click on Save.

Click OK button

Compile it as ‘normalcontact.hex’.
Click on File >> Click on Save As >> Go to Desktop/LDmicro folder>> Rename it as ‘normalcontact.ld’ >> Click on Save Then save the ladder diagram as ‘normalcontact.ld’.
Now we will see the working of this logic on hardware.
Connect Mainboard to PC using USBasp

laptop-usbasp.jpg

Connect the Mainboard to your laptop using USBasp.

Turn on the power supply.

Go to terminal >> type avrdude -c usbasp -p m16 -U flash:w:normalcontact.hex >> Press ENTER Open the Terminal by pressing CTRL+ALT+T keys simultaneously.

Go to the folder where you have saved the hex file.

Type the command as shown and upload this hex file to the Mainboard.

Remove the USBasp connection from the laptop. Turn off the power supply.

Remove the USBasp connection from the laptop.

This will prevent any hardware damage.

normalcontact-NO.png Let us see the connection details now.
normalcontact-NO.png Connect GND and 5V of the Switchboard to GND and 5V of the Mainboard respectively.

Then connect NO1 of the Switchboard to PC0 of the Mainboard.

normalcontact-NO.png Connect GND pin of the red LED of Traffic Light module to GND pin of the Mainboard.

Then connect the +5V pin of the red LED to PA0 pin of the Mainboard.

Make the connections as shown in the picture.

After making all the connections properly, turn on the power supply.
We can observe the red LED is OFF initially.

It is ON whenever the NO1 is pressed.

That is the corresponding switch LED and the red LED glows simultaneously.

normalcontact-NC.png Now connect PC0 to NC1 instead of NO1 as shown in the picture.
Let me show the live demo of the output.

We can observe that the red LED glows even before the switch is pressed.

And turns OFF whenever the NC1 is pressed.

That is the corresponding switch LED and the red LED glows alternately.

normalcontact-L.png Now connect PC0 to L1 as shown in the picture.
Initially, the red LED is off.

When L1 is pressed, both L1 switch LED and the red LED turns ON.

The LED will turn OFF when we press L1 one more time as these are latch switches.

Thus, the corresponding switch LED and the red LED glows simultaneously.

This shows how a Normal Contact behaves with different types of switches.
Turn OFF the power supply.
This brings us to the end of this tutorial.

Let us summarize

Slide 5: Summary
  • Normal Contact
In this tutorial, we learnt about working of Normal Contact.
Slide 6: Evaluation

Suppose that the input to Normal Contact is logic 0 with its state as logic 1.

What will be the state/output of the Normal Coil?

Here is a self assessment question for you:

Suppose that the input to Normal Contact is logic 0 with its state as logic 1.

What will be the state of the Normal Coil ?

Slide 7: Answer

The state of the Normal Coil will be 0

The answer is the state of the Normal Coil will be 0.
Slide 8:

About Spoken Tutorial project

The video at the following link summarises the Spoken Tutorial project.

Please download and watch it.

Slide 9:

Spoken Tutorial workshops

The Spoken Tutorial Project team:
  • conducts workshops using spoken tutorials and
  • gives certificates on passing online tests.

For more details, please write to us

Slide 10:

Forum for specific questions:

* Please post your timed queries in this forum.
Slide 11:

Forum for specific questions:

Do you have any general / technical questions on OpenPLC?

Please visit the FOSSEE forum and post your question.

Slide 12:

Acknowledgement

Spoken Tutorial Project is funded by MHRD, Government of India.
Slide 13:

Thank you slide

This tutorial has been contributed by FOSSEE and Spoken Tutorial Project, IIT Bombay.

And this is Harsha Priyanka from FOSSEE team, signing off.

Thanks for watching.

Contributors and Content Editors

Nancyvarkey, Priyanka.guntaka123