Blink Leds with Soft PLC on Raspberry Pi

Blink Leds with Soft PLC on Raspberry Pi

Controlling blinking LEDs using Soft PLC on Raspberry Pi has never been easier!

Connection Diagram and Setup

To set up the blinking LEDs project on your Raspberry Pi using Soft PLC, you will need the following materials:

  1. Breadboard
  2. LEDs (2 pieces)
  3. Push Buttons (2 pieces)
  4. 220 Ohm Resistors (2 pieces for the LEDs)
  5. 10k Ohm Resistors (2 pieces for the buttons)
  6. Jumper Wires
    • LED Connections:
      • Connect the anode of one LED to GPIO pin 38 and the anode of the other LED to GPIO pin 40.
      • Connect the cathode of each LED through a 330 Ohm resistor to the ground (GND).
    • Button Connections:
      • Connect one end of the Run button to GPIO pin 35 and the other end through a 10k Ohm resistor to the ground (GND).
      • Connect one end of the Stop button to GPIO pin 36 and the other end through a 10k Ohm resistor to the ground (GND).
    • Power Connections:
      • Connect the positive power rail of the breadboard to the 5V pin on the Raspberry Pi.
      • Connect the negative power rail of the breadboard to the GND pin on the Raspberry Pi.

    Programing

    Controlling LEDs via GPIO pins on Raspberry Pi using Soft PLC is a straightforward process. Here’s our step-by-step guide:

    1. GPIO Definitions and Configuration

    After successfully installing Soft PLC on your Raspberry Pi, define the GPIO pins necessary for controlling LEDs in your project. This step involves initial setup via the Config.txt file.

    Example Config.txt setup:

    Digital Inputs:35;36;
    Digital Outputs:38;40;
    1. Starting Soft PLC

    Once you’ve edited the Config.txt file, navigate to the directory containing Soft PLC and start the PLC with the following command:

    Bash
    sudo dotnet SoftPLC.dll
    1. Simple Program to Blink LEDs Every 1 Second

    Create a basic program that blinks LEDs at 1-second intervals. When the Run button is pressed, LEDs start blinking; pressing the Stop button halts the operation.

    1. Uploading the Project to Soft PLC

    After ensuring correct settings, configure PLC connection settings in the Settings section and upload your project to Soft PLC by clicking “Load to PLC” button.

     

    Subscribe
    Notify of
    guest

    0 Comments
    Oldest
    Newest Most Voted
    Inline Feedbacks
    View all comments