Overview uni-PRO LF (Luckfox)


Hardware: Controller uni-PRO LF (Luckfox) - where the connections are, terminal assignment and how to connect RS485 and RS232.


With this function block the runtime controls the hardware of the uni-PRO LF (Luckfox) itself: the display, the two relays and the temperature and humidity sensor in the device. The block replaces the pre-installed manufacturer display application and needs no additional software on the device.

The display has several pages. Use the arrows up (next page) and down (previous page) on the left edge to flip through the pages; the current page number is shown in the middle. After the last page it continues with page 1. If nobody touches the display it returns to page 1 by itself after the set time (default 60 seconds); every touch restarts the time.

Page 1 – information: at the top the heading uni-PRO with the time next to it (without seconds, the colon blinks), below it optionally the CPU temperature, then the IP addresses of the controller (up to three: LAN port, virtual IP and second port, as far as present). An address obtained by DHCP is followed by (DHCP). At the bottom is the state of the two relays. The entries are shown without labels. The blinking colon of the time shows that the runtime is running (like the LED on other controllers). If the blinking stops, Runtime steht! appears – the runtime has hung or was stopped.

Pages 2 to 9 – variables: Each page shows as many variables as set in the dialog under Variables per page (1 to 5, default 3). The display text is on the left of the row in larger type, below it the value with its suffix (for example 5 % or 10 kWh). A variable of type output has the keys - (left) and + (right): a tap changes the value by the step size and writes it to the address. If the key is held longer, the value keeps changing (repeated after half a second, faster after two seconds, with ten times the step after four seconds). A variable of type input only shows the value of the address. The value always stays between minimum and maximum. If the address has the data type bit, the display shows EIN or AUS (on/off); + switches on (1), - switches off (0), minimum, maximum and step size do not apply then.

Setting up variables: The variables have no inputs or outputs of their own on the block; they are only set in the dialog Variables on the screen pages (button ... in the properties). Per row: address (drag it in from the address window), display (the text on the left of the row), type input (display) or output (adjustable), minimum, maximum, step size, decimal places (0 to 4) and suffix. The column Page shows on which page the variable appears. The variables are distributed to pages 2 to 9 in order, so the order in the dialog (arrow keys) decides the page. At most 8 pages with 1 to 5 variables each fit, i.e. 24 with 3 variables per page. The number of variables per page is set in the toolbar of the dialog. The same address may occur several times, for example once as an output for adjusting and once as an input for feedback. Apply makes the settings take effect at once and keeps the dialog open; OK applies and closes it. If no address is entered, the display shows ---. Umlauts in display text and suffix are rewritten on the display; the degree sign ° is shown.

Relays: The relays are switched from the program via the inputs R0 and R1. Tapping the relay areas on page 1 sets output T0 or T1 for a short moment so that the program can react to it. If the parameter Relays switchable on the display is on, tapping also toggles the relay (default: off). The relays keep their state when the runtime is stopped or restarted. At start a relay whose input is connected takes over the state of the input; without a connection it stays as it is.

Network: The IP address and the way it is assigned (DHCP or static) for the LAN port are set in the Studio under Network settings of the control unit, as on the other control units. With a static address, subnet mask, gateway and DNS servers are added. The change is saved and takes effect after the control unit has been restarted; an existing connection is not interrupted by it. The Studio checks the entries and does not save anything that would make the control unit unreachable, for example a gateway outside the network or a network or broadcast address. The virtual IP address (suggestion 172.31.1.140) is an additional address on the same port that can be switched off with the check mark; it also applies with DHCP. There is no gateway or route for it. The second network port always stays on DHCP and serves as access if the LAN port was set incorrectly.

Serial interfaces: The control unit has one RS232 and one RS485/RS422 (shared connector, the function results from the wiring). The runtime sets them up at every start so that the onboard selection of Modbus master, Modbus slave, M-BUS and the Lua script (/dev/ttyONBOARD-232 and /dev/ttyONBOARD-485) find them as on the other control units. The terminal assignment and how to connect the RS485 are shown on the page Controller uni-PRO LF (Luckfox).

Reset at the display: If you hold the time at the top right of page 1 for 10 seconds (a bar shows the progress), the question Reset with YES and NO appears. With YES both network ports are set back to DHCP (the virtual IP is removed), the project is deleted from the control unit and the runtime restarts empty. NO, or no answer within 20 seconds, cancels.

Prerequisite: The runtime runs as user root on the uni-PRO LF. Display and relays must not be operated by other software at the same time – therefore the block stops the manufacturer service lyra-plc on request (the same as systemctl stop lyra-plc). This frees display and relays; the relay function of the manufacturer web interface and of OpenPLC stops as well. After a restart of the device the block stops the service again. If you never need it, disable its autostart on the device.

There is only one display: the block may occur only once in the project. On a controller without this device (for example under Windows) the block has no effect and reports this at output ER.

Setup – step by step:
  1. Insert the block and open its properties.
  2. In the dialog Variables on the screen pages enter the addresses that are to be displayed or adjusted on the device.
  3. Connect inputs R0 and R1, the outputs and other parts of the program to addresses as needed.
  4. Transfer the program to the controller. The display takes over within a few seconds.
Note: The display only knows ASCII characters. Umlauts in the display text of the variables are shown as ae, oe, ue, ss.


Inputs

R0
Relay 0
Optional. A value other than 0 energizes the relay, 0 releases it. Every change of the input value is evaluated, as well as once at start. Not connected: the relay is not switched and keeps its state.
R1
Relay 1
Optional. Like relay 0, for the second relay.

Outputs

R0
Relay 0
Actual state of the relay: 1 = energized, 0 = released. The state is read back every second – even if another program has switched the relay.
R1
Relay 1
Like relay 0, for the second relay.
T0
Touch relay 0
Short pulse (1, then 0 again) as soon as the relay 0 area on the display was tapped. Tapping does not switch the relay.
T1
Touch relay 1
Like touch relay 0, for the relay 1 area.
ER
Error code
0 = everything fine. Otherwise the sum of the values: 1 = display not available, 2 = touch not found, 4 = relay 0 not accessible, 8 = relay 1 not accessible, 16 = second block of this kind (only one possible), 32 = device not present (for example Windows). The display additionally shows a short error line.
TE
Temperature
Temperature of the sensor in the device in °C, rounded to one decimal place, updated every 10 seconds. The set correction value is already included. If the sensor delivers no value, the output keeps its last value.
FE
Humidity
Relative humidity of the sensor in the device in percent, rounded to one decimal place, updated every 10 seconds.
FL
Flash wear
Used life of the internal storage in percent, as an upper limit in steps of ten: 10 means 0 to 10 % used, 100 means 90 to 100 % or more. The worse of the two counters of the memory chip applies. The value is read at start and then every hour. From 80 on, the life of the storage is largely used up. Persistent values are deliberately written only once per hour to protect the storage.

Parameters

Variables on the screen pages
Opens the dialog in which address, display, type, minimum, maximum, step size, decimal places and suffix of the variables as well as the number of variables per page are set (see above).
Relays switchable on the display
On: Tapping the relay area on page 1 toggles the relay. Off: Tapping only sets output T0 or T1. Default: off.
Show temperature
On: The CPU temperature is shown below the heading on page 1, in degrees (for example 53.5°). This is the temperature of the processor, not that of the sensor at output TE. Default: off.
Temperature correction
Value in Kelvin that is added to the temperature of the sensor (output TE). The sensor sits inside the housing and reads too high because of the device's own heat; enter the negative value for that, for example -4.0. Range -20 to +20. Default: 0.
Back to page 1 after
Seconds without touch after which the display returns to page 1. Every touch (touching down, holding or lifting) restarts the time. 0 = the display stays on the selected page. Default: 60 s.
Stop manufacturer service
On: The pre-installed service lyra-plc (the manufacturer's display and relays) is stopped before the display starts and checked every ten seconds afterwards. Default: on.