Zbotic Logo Zbotic Logo
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

  • Shop
  • About Us
  • Contact Us
  • Reseller
  • Blogs
020 69134444
1800 209 0998
[email protected]
Help Desk
Facebook Twitter Instagram Linkedin YouTube
Zbotic Logo Zbotic Logo
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

All departments
  • 3D Print Service
  • 3D Printer
  • Batteries & Chargers
  • Development Boards
  • Drone Parts
  • EBike parts
  • Sensor Modules
  • Electronic Components
  • Electronic Modules
  • IoT and Wireless
  • Mechanical Parts and Workbench Tools
  • Motors & Drivers & Pumps & Actuators
  • DIY and Robot Kits
  • Show more
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
Return to previous page
Home Industrial Automation

PLC Programming Basics: Ladder Logic Tutorial for Arduino Users

PLC Programming Basics: Ladder Logic Tutorial for Arduino Users

April 1, 2026 /Posted by / 0

If you have mastered Arduino programming and are looking at industrial automation, understanding PLC programming is your next logical step. PLCs (Programmable Logic Controllers) are the backbone of factory automation, controlling everything from conveyor belts to bottling plants. This PLC programming tutorial for Arduino users bridges the gap between hobby electronics and industrial control, teaching you ladder logic using concepts you already know.

Table of Contents

  • What Is a PLC and Why Not Just Use Arduino?
  • Understanding Ladder Logic Diagrams
  • Basic Instructions: Contacts, Coils, and Latches
  • Timers and Counters in Ladder Logic
  • PLC vs Arduino: A Direct Comparison
  • Turning Arduino into a Mini PLC
  • PLC Programming as a Career in India
  • Frequently Asked Questions
  • Conclusion

What Is a PLC and Why Not Just Use Arduino?

A PLC is a ruggedised industrial computer designed to run continuously in harsh factory environments. While an Arduino can control a relay and read a sensor, a PLC is built for a completely different level of reliability:

  • Operating Temperature: -25°C to +70°C (vs Arduino’s 0-50°C recommendation)
  • Input Protection: Built-in isolation for 24V DC industrial sensors (Arduino needs external circuits for anything beyond 5V)
  • Power Supply: Wide input range (typically 85-264V AC or 24V DC) with surge protection
  • EMI/RFI Immunity: Designed to work near motors, VFDs, and welding equipment without errors
  • Certifications: UL, CE, and industry-specific certifications for safety-critical applications
  • MTBF: Mean Time Between Failures of 50,000-100,000+ hours

In short: Arduino is for prototyping and learning. PLCs are for production environments where downtime costs lakhs per hour.

🛒 Recommended: Arduino Mega 2560 R3 Board — With its many I/O pins, the Arduino Mega is the best Arduino for simulating PLC-style control logic before investing in industrial hardware.

Understanding Ladder Logic Diagrams

Ladder logic is the most common PLC programming language. It was designed to look like electrical relay circuits, making it intuitive for electricians who were transitioning from hardwired relay panels to programmable controllers.

A ladder diagram has two vertical power rails (left = L1/power, right = L2/neutral) with horizontal “rungs” between them. Each rung contains conditions (contacts) on the left and actions (coils) on the right:

Ladder Logic Notation:
----| |----    Normally Open (NO) contact (like digitalRead)
----|/|----    Normally Closed (NC) contact (like !digitalRead)
----( )----    Output coil (like digitalWrite)
----[TON]---   Timer On-Delay
----[CTU]---   Counter Up

Example: Start/Stop Motor Circuit

     START        STOP         MOTOR
  ----| |---------|/|----------( )----
       |                        |
  MOTOR|                        |
  ----| |------------------------

In Arduino terms, this translates to:

// Arduino equivalent of the PLC Start/Stop circuit
#define START_BTN 2
#define STOP_BTN  3
#define MOTOR     8

bool motorRunning = false;

void setup() {
    pinMode(START_BTN, INPUT_PULLUP);
    pinMode(STOP_BTN, INPUT_PULLUP);
    pinMode(MOTOR, OUTPUT);
}

void loop() {
    bool startPressed = !digitalRead(START_BTN);  // NO contact
    bool stopPressed  = !digitalRead(STOP_BTN);   // NC (inverted)

    // Self-latching logic (same as ladder logic seal-in contact)
    if (startPressed || motorRunning) {
        if (!stopPressed) {   // STOP is NC, so !pressed = circuit closed
            motorRunning = true;
        } else {
            motorRunning = false;
        }
    }

    digitalWrite(MOTOR, motorRunning);
}

The beauty of ladder logic is that every rung is evaluated independently in each scan cycle, and the diagram visually represents the logic flow. An electrician can look at a ladder diagram and understand it without knowing any programming language.

Basic Instructions: Contacts, Coils, and Latches

Normally Open (NO) Contact: –| |–

Passes power when the associated bit/input is TRUE (1). Equivalent to if (digitalRead(pin) == HIGH) in Arduino.

Normally Closed (NC) Contact: –|/|–

Passes power when the associated bit/input is FALSE (0). Equivalent to if (digitalRead(pin) == LOW) in Arduino.

Output Coil: –( )–

Energises (sets to TRUE) when power flows through the rung. Equivalent to digitalWrite(pin, HIGH).

Latch (SET) and Unlatch (RESET): –(L)– and –(U)–

SET makes the output stay ON even after the input condition goes away. RESET turns it OFF. In Arduino terms, this is setting a boolean flag:

// Latch/Unlatch in Arduino
bool latchedOutput = false;

if (setCondition) latchedOutput = true;     // --(L)--
if (resetCondition) latchedOutput = false;  // --(U)--

digitalWrite(OUTPUT_PIN, latchedOutput);

Series and Parallel Logic

Contacts in series = AND logic. Contacts in parallel = OR logic:

// Series (AND) - Both conditions must be true
  ----| A |----| B |----( Y )----
  // Y = A AND B

// Parallel (OR) - Either condition activates output
  ----| A |----( Y )----
       |           |
  ----| B |--------
  // Y = A OR B

Timers and Counters in Ladder Logic

TON (Timer On-Delay)

Delays turning ON. When the input is true continuously for the preset time, the output activates. If the input goes false, the timer resets. Used for debouncing, delay-start sequences, and monitoring conditions.

// Arduino equivalent of PLC TON timer
unsigned long timerStart = 0;
bool timerRunning = false;
bool timerDone = false;
const unsigned long PRESET = 5000;  // 5 seconds

void updateTON(bool input) {
    if (input) {
        if (!timerRunning) {
            timerStart = millis();
            timerRunning = true;
        }
        if (millis() - timerStart >= PRESET) {
            timerDone = true;
        }
    } else {
        timerRunning = false;
        timerDone = false;
    }
}

TOF (Timer Off-Delay)

Output turns ON immediately when input is true, then stays ON for the preset time after the input goes false. Used for keeping cooling fans running after a motor stops.

CTU (Counter Up)

Counts rising edges on the input. When the accumulated count reaches the preset value, the done bit activates.

// Arduino equivalent of PLC CTU counter
int counterValue = 0;
bool lastInput = false;
bool counterDone = false;
const int PRESET_COUNT = 10;

void updateCTU(bool input, bool reset) {
    if (reset) {
        counterValue = 0;
        counterDone = false;
    }

    // Detect rising edge
    if (input && !lastInput) {
        counterValue++;
        if (counterValue >= PRESET_COUNT) {
            counterDone = true;
        }
    }
    lastInput = input;
}
🛒 Recommended: Arduino Uno R3 Beginners Kit — Start learning PLC logic concepts using Arduino with this complete kit including buttons, LEDs, and relay modules.

PLC vs Arduino: A Direct Comparison

Aspect PLC (e.g., Siemens S7-1200) Arduino Uno/Mega
Cost ₹15,000 – ₹50,000+ ₹400 – ₹1,500
Input Voltage 24V DC (industrial standard) 5V DC (logic level)
I/O Protection Built-in optoisolation None (needs external circuits)
Programming Ladder, FBD, ST, SFC, IL C/C++ (Arduino framework)
Scan Time 1-10 ms (deterministic) Variable (depends on code)
Communication PROFINET, Modbus, EtherNet/IP Serial, I2C, SPI (with shields)
Reliability Industrial grade (24/7 operation) Hobby grade
Safety Safety-rated models available Not safety-rated

Turning Arduino into a Mini PLC

While Arduino cannot replace a real PLC in production, you can use it to learn PLC concepts. Several projects turn Arduino into a PLC-like device:

OpenPLC

OpenPLC is an open-source PLC runtime that runs on Arduino Mega, Raspberry Pi, and other platforms. It supports IEC 61131-3 programming languages including Ladder Logic, Structured Text, and Function Block Diagram. Install it on an Arduino Mega and program it using the OpenPLC Editor — a free alternative to expensive PLC software.

Industrial Arduino Shields

Companies like Controllino and Industrial Shields make DIN-rail-mountable Arduino-based PLCs with:

  • 24V I/O with optoisolation
  • Relay outputs rated for mains switching
  • RS485 Modbus communication
  • DIN rail mounting for panel installation

These bridge the gap between hobby Arduino and industrial PLC, suitable for small automation projects, building management, and agricultural systems.

// OpenPLC-style scan cycle on Arduino
void setup() {
    // Initialise all I/O
    for (int i = 2; i <= 9; i++) pinMode(i, INPUT_PULLUP);
    for (int i = 22; i <= 29; i++) pinMode(i, OUTPUT);
}

void loop() {
    // 1. READ all inputs
    bool inputs[8];
    for (int i = 0; i < 8; i++) {
        inputs[i] = !digitalRead(i + 2);
    }

    // 2. EXECUTE logic (ladder logic equivalent)
    bool outputs[8] = {false};

    // Rung 1: Start/Stop with seal-in
    static bool motor = false;
    if (inputs[0] || motor) {
        if (!inputs[1]) {  // Stop button (NC)
            motor = true;
        } else {
            motor = false;
        }
    }
    outputs[0] = motor;

    // 3. WRITE all outputs
    for (int i = 0; i < 8; i++) {
        digitalWrite(i + 22, outputs[i]);
    }

    // 4. Fixed scan time (10ms)
    delay(10);
}
🛒 Recommended: Arduino Uno R3 Development Board — Affordable Arduino board to experiment with PLC-style programming using OpenPLC or custom scan-cycle code.

PLC Programming as a Career in India

PLC programming is one of the most in-demand skills in Indian manufacturing. Career opportunities include:

  • Automation Engineer: ₹4-8 LPA (entry) to ₹15-25 LPA (senior). Design and commission automated production lines.
  • SCADA/DCS Engineer: ₹5-10 LPA. Configure supervisory control systems for power plants, water treatment, and oil/gas.
  • Controls Engineer: ₹6-12 LPA. Program PLCs, HMIs, and VFDs for manufacturing plants.
  • System Integrator: ₹8-15 LPA. Design complete automation solutions combining PLCs, robots, and vision systems.

Popular PLC Brands in India

  • Siemens (S7-1200, S7-1500): Market leader, especially in automotive and pharma
  • Allen-Bradley (CompactLogix, MicroLogix): Strong in food/beverage and packaging
  • Mitsubishi (FX5U, iQ-R): Popular in Japanese and Korean factories in India
  • Delta Electronics: Cost-effective, growing rapidly in Indian SMEs
  • Schneider Electric (Modicon M340): Strong in building automation and water treatment
🛒 Recommended: Nano IO Expansion Shield — Expand Arduino Nano’s I/O with screw terminals for industrial-style wiring during PLC learning projects.

Frequently Asked Questions

Can I use Arduino instead of a PLC in a factory?

For production environments, no. Arduino lacks the electrical protection, safety certifications, and reliability required. However, for small-scale automation (home, farm, small workshop), an Arduino with proper relay modules and power supply can handle basic control tasks.

Which PLC programming language should I learn first?

Ladder Logic, as it is the most widely used in Indian industry (especially with Siemens and Allen-Bradley). Once comfortable, learn Structured Text (ST) for complex calculations and data handling. Most PLC programmers use a combination of both.

How much does PLC training cost in India?

Online courses range from ₹2,000-10,000. Classroom training with hands-on hardware access costs ₹15,000-50,000 for a 1-2 week programme. Some centres offer Siemens-certified training for ₹30,000-60,000.

Can I learn PLC programming without buying a PLC?

Yes. Siemens TIA Portal has a simulation mode (PLCSIM). Allen-Bradley offers a free version of RSLogix 500 emulator. You can also use OpenPLC with Arduino to practise on real hardware at minimal cost.

What is the scan cycle and why does it matter?

The scan cycle is the PLC’s main loop: Read Inputs → Execute Program → Write Outputs → Repeat. A typical scan time is 1-10 ms. Deterministic scan time is critical in industrial applications because it guarantees that inputs are read and outputs are updated within a known timeframe.

Conclusion

PLC programming is a natural career progression for Arduino enthusiasts interested in industrial automation. The concepts transfer directly — inputs, outputs, timers, counters, and boolean logic are the same in both worlds. The difference is that PLCs add industrial-grade reliability, standardised programming languages, and safety certifications.

Start by implementing PLC-style scan cycles on Arduino, then try OpenPLC for a real ladder logic experience. When you are ready to move to industrial hardware, the skills you have built will transfer directly to Siemens, Allen-Bradley, or any other PLC platform.

Begin your automation journey with development boards and components from Zbotic’s online store.

Tags: Arduino, industrial, Ladder Logic, PLC, tutorial
Share Post
  • Facebook
  • Linkedin
  • Whatsapp
LoRaWAN Gateway Build: The Thi...
blog lorawan gateway build the things network india coverage 612506
blog logic analyser vs oscilloscope which do you need 612512
Logic Analyser vs Oscilloscope...

Related posts

Svg%3E
Read more

Compressed Air Monitor: Pressure and Leak Detection

April 1, 2026 0
Table of Contents Understanding Compressed Air Monitor Technical Fundamentals of Compressed Air Monitor Indian Market: Components and Pricing Sensor Integration... Continue reading
Svg%3E
Read more

Industrial Gas Detection: Multi-Gas Monitoring System

April 1, 2026 0
Table of Contents Understanding Industrial Gas Detection Technical Fundamentals of Industrial Gas Detection Indian Market: Components and Pricing Sensor Integration... Continue reading
Svg%3E
Read more

Cold Room Controller: Compressor and Defrost Cycle

April 1, 2026 0
Table of Contents Understanding Cold Room Controller Technical Fundamentals of Cold Room Controller Indian Market: Components and Pricing Sensor Integration... Continue reading
Svg%3E
Read more

Grain Storage Monitor: Temperature and Moisture

April 1, 2026 0
Table of Contents Understanding Grain Storage Monitor Technical Fundamentals of Grain Storage Monitor Indian Market: Components and Pricing Sensor Integration... Continue reading
Svg%3E
Read more

Poultry House Controller: Climate and Feeding Automation

April 1, 2026 0
Table of Contents Understanding Poultry House Controller Technical Fundamentals of Poultry House Controller Indian Market: Components and Pricing Sensor Integration... Continue reading

Add comment Cancel reply

Your email address will not be published. Required fields are marked

Facebook Twitter Instagram Pinterest Linkedin Youtube

Get the latest deals and more.

Download on Google Play Download on the App Store

Call us: 020 69134444 / 1800 209 0998

Monday - Saturday 09:30 AM - 06:00 PM
For Technical Supports Email: [email protected]
For Sales / Enquiries Email: [email protected]

  • My Account

    • Cart

    • Wishlist

    • Checkout

    • My Orders

    • Track Order

    • My Account

  • Information

    • FAQs

    • Blogs

    • Career

    • About Us

    • Contact Us

    • Payment Options

  • Policies

    • Privacy Policy

    • Terms & Conditions

    • GST Input Tax Credit

    • Shipping Return Policy

    • E-Waste Collection Points

    • Our Sitemap

© Zbotic.in is registered trademark of Moxie Supply Pvt Ltd – All Rights Reserved
Login
Use Phone Number
Use Email Address
Not a member yet? Register Now
Reset Password
Use Phone Number
Use Email Address
Register
Already a member? Login Now