Using Revolution Pi Flat With IO and WebUI
Introduction
This example demonstrates configuring and using a Revolution Pi Flat controller with digital and analog I/O to build a basic control system. It includes a Web UI to read and set the I/O values, as the RevPi Flat device lacks a built-in display port.
This example explains:
- Adding a Revolution Pi Flat IO server
- Connecting data from the I/O channels to the control system
- Scaling analog values from raw input values to meaningful control system values
- General recommendations and tips
Project Overview
The project utilizes a RevPi Flat controller with several digital and analog input and output channels. The analog values are scaled from the physical I/O module value to meaningful control system values.
Wires connect the analog output AOut to the analog input AIn channel. This enables setting a value on the output and reading the value on the input channel. There is no digital input on the RevPi Flat.
The WebUI allows you to set values on the output channels and display the values read from the input channels. Note that raw analog values may differ between input and output cards. See the RevPi Flat documentation for details on this behavior.
How to Run the Example
To run the example from CDP Studio, open Welcome mode and find it under Examples. Next, in Configure mode right-click on the system project and select Run & Connect. See the Running the Example Project tutorial for more information.
The system runs on a RevPi Flat; therefore, you must go to Configure mode, select Deploy Configuration, pair the RevPi, and select the RevPi Flat as the device.
CDP Studio comes with different toolkits and which toolkit to use depends on the device operating system version and CPU type. It is, therefore, recommended to run the Toolkit Detector script to discover which toolkit has the best fit.
If the recommended toolkit is not in your tookit list, install the missing toolkit.
The initial Revolution Pi Flat setup is covered in the Revolution Pi Configuration Manual; You need to initialize the device using piCtory and set the Linux realtime configuration.
The WebUI starts after the application runs on the controller and CDP Studio will connect to the running application. In Configure mode, select the application, either in the Block Diagram or Table Editor, scroll down in the property list, find the WebURL property, paste the URL into your browser, or click on the small globe icon.
Project Description
The hardware used is a RevPi Flat. The controller has one digital output and one analog input and one analog output channel are directly on the controller.
This project uses a two-layer architecture, separating the application layer from hardware-specific elements for modularity and easier maintenance. This separation allows you to change the controller without affecting the application itself, avoiding physical dependencies or raw analog values within the application logic.
The WebUI connects to the control system in the application layer. Through the WebUI, you can set the analog output value, SetAnalogOut
, from 0 to 100 using a slider; this value is then scaled to the correct I/O module raw value, AnalogOutRaw
. The analog output is physically wired to the analog input, and the analog input I/O module reads the value, which is displayed in the WebUI as ReadAnalogIn
and AnalogRawIn
.
Similarly, you can set the digital output using a checkbox. There is no digital input, and you need to check the controller to verify that the digital output is set.
Important Concepts and Recommendations
Relation Between Physical Connectors and Logical CDP Signals
The following figure shows a simplified representation of a compact controller (left) with the physical wires. Outputs channels in , input channels in . In the CDP logic, the controller's input channels are outputs from the logical block (). E.g. the values read from the physical connections are emitted into the CDP logic as outputs.
Scaling the Analog Physical Values
Analog I/O modules measure or set values, e.g. from 0 to 10 V. These modules use raw values, such as setting 0 to represent 0 V and 10 000 for 10 V. Check the RevPi documentation for module-specific details. Converting these values to meaningful application-specific units is recommended.
For example, to set the speed in rpm, then 0 V = 0 rpm and 10 V = 100 rpm, use a Signal in your application with a value range of 0-100 and then use the scale operator to transform the sensible application value to the raw I/O value when writing to the I/O module.
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.