Zum Hauptinhalt springen

CODESYS example: TrafficLight-Webvisu

Introduction

This tutorial demonstrates how to create a simple web visualization of traffic lights on the RevPi Connect using CODESYS WebVisu.

Prerequisites

Hardware Requirements

  • 1 RevPi Connect+
  • 1 RevPi DIO

Software Requirements

  • CODESYS Development System installed on your PC

Preparation

Hardware Setup:

Tipp: For detailed instructions about how to set up your system, refer to the Getting Started guide.

Software Setup:

note: To ensure a compatible system with suitable software, please refer the following links:

Overview

The application simulates a traffic light system with the following modes:

  1. Normal Mode:

    • Red and green lights are active for 10 seconds each.
    • Yellow light acts as a transition for 2 seconds.
  2. Night Mode:

    • Only the yellow light flashes in this mode.

The following figure provides an overview of the CODESYS device tree for the setup:

CODESYS Device Tree Overview

Adapting for RevPi Core or Compact

To adapt the project for RevPi Core or RevPi Compact:

▷ Right-click on RevPi Connect in the CODESYS device tree.

▷ Select Update device.

▷ Choose RevPi Core or RevPi Compact as the replacement and rename the device accordingly.

Deploy and Test the Application

  1. Compile and Download:

    • Ensure there are no errors in your program.
    • Download the application to the RevPi Connect.
  2. Access the Web Visualization:

    • Open a browser and navigate to your RevPi Connect’s web server:
      http://<RevPi-IP-Address>:8080/webvisu.htm
    • Example: http://192.168.168.159:8080/webvisu.htm.

    Webvisu

Adapting for RevPi Core or Compact

  1. Test the Traffic Light:
    • Verify normal mode operation with the specified durations.
    • Toggle the night mode switch and observe the yellow light flashing.

Additional Notes

  • Ensure your RevPi Connect and DIO modules are properly connected and configured in the CODESYS device tree.
  • The visualization design can be customized to include additional controls or indicators as needed.