Skip to main content

Building a Remote Real-Time Graphical Control System with VxWorks

·828 words·4 mins
VxWorks Embedded Systems Real-Time Control Java Applets UDP Communication GoAhead WebServer Remote Monitoring PC104 Industrial Automation
Table of Contents

Building a Remote Real-Time Graphical Control System with VxWorks

In industrial, military, and marine embedded systems, providing remote real-time monitoring and control is essential. This article presents a practical implementation of a remote graphical display and control system on VxWorks 5.5, leveraging an embedded web server and Java Applets for efficient, low-latency operation.

🖥️ Architecture Overview and Key Benefits
#

Traditional web technologies struggle with real-time performance due to full-page refresh cycles. By integrating VxWorks’ deterministic real-time capabilities with a lightweight embedded web server and client-side Java Applets, we achieve:

  • Remote accessibility via standard browsers
  • Real-time telemetry visualization
  • Low-latency bidirectional control
  • Minimal resource usage on embedded hardware

The system targets a PC104 single-board computer with a CompactFlash (CF) card as persistent storage, serving HTML and Java Applets directly from the embedded web server.

Core Components
#

Component Role
VxWorks 5.5 Real-time OS ensuring determinism and low-latency task scheduling
GoAhead WebServer Lightweight embedded web server supporting CGI, ASP, and custom APIs
Java Applet Browser-based client for real-time graphics and remote control
UDP Sockets High-performance bidirectional communication protocol
PC104 SBC Embedded hardware platform with CF storage

⚙️ Hardware and Software Stack
#

Hardware:

  • PC104 embedded board with CF card
  • Ethernet interface for network connectivity

Software:

  • VxWorks 5.5 kernel
  • GoAhead WebServer
  • Custom C/C++ tasks for data acquisition and control
  • Java Applet client (requires JRE 1.6+)

This stack balances real-time determinism on the server side with rich, responsive graphics on the client.

🛠️ Implementing the Embedded Web Server on VxWorks
#

The GoAhead WebServer was selected for its small footprint, high performance (>50 HTTP requests/sec), and seamless VxWorks integration.

Web Server Initialization Example
#

#include "webs.h"

int main(int argc, char **argv)
{
    // Initialize the web server core
    websInit();
    
    // Set document root to CF card directory
    websSetDefaultDir("/cf0/www");
    
    // Register custom URL handlers for control
    websUrlHandlerDefine("/control", NULL, controlHandler, NULL, 0);
    
    // Listen on standard HTTP port
    websListen(80);
    
    // Launch web server in a separate VxWorks task
    taskSpawn("tWebServer", 100, 0, 5000, (FUNCPTR)websRun,
              0,0,0,0,0,0,0,0,0,0);
}

Build Configuration (Tornado IDE):

  • Compile flags: -DWEBS -DUEMF -DOS="VXWORKS" -DVXWORKS -DUSER_MANAGEMENT_SUPPORT
  • Include all server source files
  • Copy HTML, .class (Applet), and assets to /www on CF card

This approach ensures the embedded target functions as a full web server without compromising real-time control.

📊 Real-Time Graphical Display with Java Applets
#

HTML alone cannot provide smooth, real-time updates. Java Applets offer a full graphical client capable of rendering dynamic telemetry data.

Applet Architecture
#

  • Auto-downloads with the web page
  • Opens a local UDP socket
  • Receives structured telemetry data
  • Renders waveforms, gauges, or 3D models using Java 2D/3D graphics

Java Applet Example
#

public class RealTimeDisplayApplet extends Applet implements Runnable {
    private DatagramSocket socket;
    private byte[] buffer = new byte[4096];
    
    public void init() {
        try {
            socket = new DatagramSocket(5000); // UDP port
            new Thread(this).start();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    
    public void run() {
        while (true) {
            try {
                DatagramPacket packet = new DatagramPacket(buffer, buffer.length);
                socket.receive(packet);
                
                // Process telemetry data
                DataProcessor.processData(buffer);
                
                // Update graphics
                repaint();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    
    public void paint(Graphics g) {
        Graphics2D g2d = (Graphics2D) g;
        // Example: render real-time waveform
        g2d.drawLine(lastX, lastY, currentX, currentY);
        // Update additional dynamic elements
    }
}

By offloading rendering to the client, network bandwidth is minimized and system responsiveness improves significantly.

🔄 Bidirectional Remote Control via UDP
#

The embedded target listens for user commands over UDP, enabling immediate execution within the real-time task context.

UDP Command Listener Example (VxWorks)
#

void udpCommandTask(void)
{
    int sock = socket(AF_INET, SOCK_DGRAM, 0);
    struct sockaddr_in addr;
    // Bind to command port 5001
    
    while (1) {
        char cmdBuffer[512];
        int len = recvfrom(sock, cmdBuffer, sizeof(cmdBuffer), 0, ...);
        
        // Parse and execute commands
        processRemoteCommand(cmdBuffer);
        
        // Return acknowledgment or telemetry updates
        sendto(sock, responseData, responseLen, 0, &clientAddr, ...);
    }
}

Commands are packaged as binary structures or JSON-like payloads and immediately acted upon by the embedded system, maintaining real-time responsiveness.

🔄 System Workflow
#

  1. User accesses http://target-ip
  2. Web server delivers HTML and Java Applet
  3. Applet initializes UDP socket
  4. VxWorks streams telemetry → Applet renders graphics
  5. User interacts with Applet UI → commands sent over UDP
  6. Target executes commands and returns status updates

✅ Advantages of This Architecture
#

  • No additional client installation beyond Java Runtime
  • Deterministic real-time performance leveraging VxWorks
  • Cross-platform browser compatibility
  • Minimal embedded resource usage
  • Easy maintenance via web page or Applet updates

🌐 Applications and Extensions 🌟
#

This architecture is well-suited for:

  • Industrial SCADA systems
  • Marine or weapons console monitoring
  • Distributed cluster control
  • Multi-channel video surveillance

While modern technologies like WebSockets, HTML5 Canvas, Node.js, or REST + MQTT exist, this method remains valuable for legacy VxWorks systems requiring determinism and minimal client footprint.

🏁 Conclusion and Future Directions
#

By combining VxWorks, GoAhead WebServer, and Java Applets, developers can implement robust, real-time, remote graphical control systems. This approach balances high-performance embedded control with rich, browser-based visualization, making it ideal for mission-critical applications in industrial and defense environments.

Reference: Building a Remote Real-Time Graphical Control System with VxWorks

Related

PCI-Based CAN Card Design and VxWorks Driver Development
·683 words·4 mins
VxWorks CAN Bus PCI Device-Drivers Embedded Systems RTOS Hardware Design C Programming
VxWorks Serial Communication Design and Implementation Guide
·558 words·3 mins
VxWorks Serial Communication Embedded Systems RTOS Device-Drivers UART BSP Real-Time
VxWorks Flight Simulator RT System: Architecture and Design
·722 words·4 mins
VxWorks Flight Simulation Real-Time Systems Embedded Systems RTOS Multiprocessor Distributed Systems