meta data for this page
lamaPLC: S7-1500 and UICPAL Temp.humi.sensor Modbus TCP communication
UICPAL's temperature/humidity measuring unit is a fairly cost-effective solution for controlling the air in closed spaces. The unit is also available on Aliexpress, for example, at a price well below 100 euros. The advantage is that it displays the measured values and has a Modbus communication solution. This function can be well integrated with industrial equipment, for example it can be used together with S7 PLC, the solution below describes this possibility.
A more detailed description of the UICPAL temperature / humidity meter can be found here.
Unfortunately, the unit (as far as I know) does not have a “CE” certification, which can make its application difficult in some cases.
The UICPAL unit and the S7-1500
The UICPAL unit has RTU communication, which should be connected with an ethernet/RS485 converter as a cost-effective solution. This converter is now available directly from Simatic. It is worth starting the testing with a Modbus client tester program. If UICPAL is available from here, then there will be no major problem with Simatic.
The steps for setting up communication:
- Switching on UICPAL, wiring with the ethernet/RS485 converter (A TX+, B RX-). The converter is described here. UICPAL is described here.
- Connecting the laptop to the ethernet/RS485 converter
- ethernet/RS485 converter settings:
- Setting the IP address (in the example: 192.168.178.44)
- Setting the RS485 communication parameters: 8n1, speed: 9600 baud, addr: 1
- Testing communication from the laptop. If the unit is not available, review the parameters and possibly replace the Modbus wires
- If the Modbus communication works from the laptop; disconnect.
- Uploading the PLC program, testing the PLC communication.
The S7 programm for communication
The sensor communicates slowly (9600 baud), time must be allowed for transmission. The program runs with a 2-second clock, the data is updated every 4 seconds.
It is important that the address of the sensor must also be set in the S7 program (“MB_CLIENT_DB”.MB_Unit_ID := 1;)!
The program uses Modbus TCP communication, where the address is irrelevant. This communication, however, is Modbus RTU (after the ethernet/RS485 converter), where the address must always be entered.
The SLC code contains all FBs, FCs and DBs required for the operation. The code was developed with TIA version 16. I cannot take responsibility for its use.
This code ensures communication for this equipment only. Good luck with your application! The code contains no restrictions, restrictions, 100% free!
If you need a modified or different code, find me here!
If you just want to throw me a coffee tip, you can do it here:
If you are a manufacturer and would like an example program similar to your product, you can find me here!
The S7 program can be downloaded here, it must be exported to the TIA portal, you can find a description of this here.
S7-UICPAL Modbus communication download
The program includes the following parts:
- testFB (FB): calling the program
- mbRead (DB6!): the data is read here (if the address is not DB6, the addressing must be changed in testFB at MB_DATA_PTR)
- ModbusComm (DB): Modbus communication settings, the address of the converter must be set here.
Important: mbRead cannot be an optimized DB due to direct addressing, you can find information about this setting here.
If the status stays in the 700x range and changes continuously, then communication is working (Otherwise, you can find more information about status codes here).
This page has been accessed for: Today: 1, Until now: 160