~~NOCACHE~~ ====== lamaPLC: S7-1500 and UICPAL Temp.humi.sensor Modbus TCP communication ====== {{ :hw:uicpal_sensor_1.png?200|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 [[com:basic_modbus|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 [[hw:temp_humi_sensor|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. {{ :com:s7_humi_proj_2.png?700 |S7-1500 and UICPAL Temp.humi.sensor Modbus TCP communication}} ===== The UICPAL unit and the S7-1500 ===== {{ :com:s7_humi_proj_1.png |The UICPAL unit and the S7-1500 communication}} 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 [[hw:waveshare|described here]]. UICPAL is [[hw:temp_humi_sensor|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 ===== {{ :com:s7_humi_proj_3.png |S7-1500 and UICPAL Temp.humi.sensor Modbus TCP communication: FB status on TIA-Portal}} 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 [[com:basic_modbus#tcp|Modbus TCP]] communication, where the address is irrelevant. This communication, however, is [[com:basic_modbus#rtu|Modbus RTU]] (after the ethernet/RS485 converter), where the address must always be entered. {{ :com:s7_humi_proj_4.png |S7-1500 and UICPAL Temp.humi.sensor Modbus TCP communication: DB status on TIA-Portal}} 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, [[:impressum|find me here]]! \\ \\ If you just want to throw me a coffee tip, you can do it here: \\ \\ [[https://www.paypal.com/donate/?hosted_button_id=WGETFWQ9M6C2A|{{ :sol:donate.png |Donate}}]] \\ \\ If you are a manufacturer and would like an example program similar to your product, you can [[:impressum|find me here]]! \\ The S7 program can be downloaded here, it must be exported to the TIA portal, you can find a [[simatic:tia_knowhow#import|description of this here]]. {{ :download:modbus_uicpal.scl |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 [[simatic:tia_knowhow#kill_opt|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 [[simatic:errorcodes|status codes here]]). \\ \\ {{tag>bus communication s7 simatic s7_1500 s7_1200 scl uicpal temperature humidity modbus example download tia_portal}} \\ This page has been accessed for: Today: {{counter|today}}, Until now: {{counter|total}}