Jump to content

Changing sensor parity through MODBUS RTU on a US5-B10-RA28


JonathanS

Recommended Posts

I have a US5-B10-RA28 with a UAC-CX-01RS4 card fitted onto the back.

I have 2 sensors needing to be wired to fit the PLC Program, however the 2 sensors have a different default parity value, meaning they don't work together and only work when I set the 01RS4 card in unilogic program to either Parity = None for one sensor and Parity = Even for the other sensor. This however is not suitable for my application as I constantly have to redownload the project to the PLC changing the parity value for the module to get one sensor running.

 

So my question/ help needed is how can I change the Parity value of the sensor below, and is there a way of doing this through unilogic?

 

Thanks

Soil Moisture & Temperature Sensor User Manual-S-Soil MT-02.pdf

Link to comment
Share on other sites

  • MVP 2023

The pdf you supplied shows that the parity can be changed in the sensor.  Bottom of page 8. 

It would be possible to do UniLogic programming to change the parity, you would simply need to add some code to do a write to the sensor instead of a read.  Once the change is done, you would then change Unilogic to whatever parity you decided to use for both sensors and perhaps the code could sit in readiness for next use, or be deleted.

To me, your easiest way of doing this is to connect to the sensor by using a RS 485 port on your PC.  The parity register can then be easily accessed with a variety of modbus tools freely available online and changed to what you want.  No Unilogic programming needed at all.

cheers, Aus

Link to comment
Share on other sites

3 hours ago, Ausman said:

The pdf you supplied shows that the parity can be changed in the sensor.  Bottom of page 8. 

It would be possible to do UniLogic programming to change the parity, you would simply need to add some code to do a write to the sensor instead of a read.  Once the change is done, you would then change Unilogic to whatever parity you decided to use for both sensors and perhaps the code could sit in readiness for next use, or be deleted.

To me, your easiest way of doing this is to connect to the sensor by using a RS 485 port on your PC.  The parity register can then be easily accessed with a variety of modbus tools freely available online and changed to what you want.  No Unilogic programming needed at all.

cheers, Aus

Thanks for the reply, do you have any links to online software you have used?

Link to comment
Share on other sites

 

On 9/22/2022 at 12:25 PM, Ausman said:

The pdf you supplied shows that the parity can be changed in the sensor.  Bottom of page 8. 

It would be possible to do UniLogic programming to change the parity, you would simply need to add some code to do a write to the sensor instead of a read.  Once the change is done, you would then change Unilogic to whatever parity you decided to use for both sensors and perhaps the code could sit in readiness for next use, or be deleted.

To me, your easiest way of doing this is to connect to the sensor by using a RS 485 port on your PC.  The parity register can then be easily accessed with a variety of modbus tools freely available online and changed to what you want.  No Unilogic programming needed at all.

cheers, Aus

I have already tried changing this through Unilogic program, with the wording on page 5, i am unsure what to do with the wiring? Do I need to use the green one? I have tried using this on the program, however when i have green connected I see no values on the screen from the sensor, but when it is not connected, I see values but then don't know if the sensor is in its setting mode.

Link to comment
Share on other sites

  • MVP 2023

From manual wiring

SET, V+ (power) when boot module into the "setting mode". Not connected
or connected with the GND when boot into "mode of operation".
Module configuration parameters such as Modbus address, baud rate,
parity, communication protocol is composed of module inside the EEPROM
(power down storage device stores). The specific configuration sometimes
forget these parameters that cannot communicate with the module. In order
to prevent this problem, the module has a special mode called "mode".
When the module is based on the "mode" electric start, the module
communicates with the following parameters:
Fixed Modbus address 0
Communication configuration is 9600, N, 8,1 (9600bps, no parity bit, 8 data
bits, a stop bit)

That is if you connect green wire - sensor settings after power on  is not from EEPROM but from standard (i select it via bold)  internal settings....

You must use this setting for connect to sensor - then change EEPROM setting to needed value - than disconnect green wire - power off-on  and connect to sensor via new EEPROM programmed settings.

 

Communication protocol for Modbus-RTU
Configuration parameters in EEPROM will not because the module into the
"mode" and "will change, when the module is in communication with in the
EEPROM configuration parameter is still running mode".

Link to comment
Share on other sites

4 minutes ago, kratmel said:

From manual wiring

SET, V+ (power) when boot module into the "setting mode". Not connected
or connected with the GND when boot into "mode of operation".
Module configuration parameters such as Modbus address, baud rate,
parity, communication protocol is composed of module inside the EEPROM
(power down storage device stores). The specific configuration sometimes
forget these parameters that cannot communicate with the module. In order
to prevent this problem, the module has a special mode called "mode".
When the module is based on the "mode" electric start, the module
communicates with the following parameters:
Fixed Modbus address 0
Communication configuration is 9600, N, 8,1 (9600bps, no parity bit, 8 data
bits, a stop bit)

That is if you connect green wire - sensor settings after power on  is not from EEPROM but from standard (i select it via bold)  internal settings....

You must use this setting for connect to sensor - then change EEPROM setting to needed value - than disconnect green wire - power off-on  and connect to sensor via new EEPROM programmed settings.

 

Communication protocol for Modbus-RTU
Configuration parameters in EEPROM will not because the module into the
"mode" and "will change, when the module is in communication with in the
EEPROM configuration parameter is still running mode".

Hi thanks for the reply,

I really struggle with the wording of the manual as posted.

So I need to:

1) power on the sensor with the green wire connected

2) Write the parity bit to 1 from unilogic to the sensor

3) disconnect the green wire

4) Power off then on sensor

5) Connect the sensor to unistream again by changing the parity bit on unilogic to match the sensor

 

Is this correct?

Link to comment
Share on other sites

12 minutes ago, kratmel said:

Yes!

This has not worked, unless i am doing it incorrectly

I have the red wire/ green wire connected to +24V and black wire connected to 0V

The Yellow and white are connected to the RS485 COM module on the back of the unistream

I power on the plug socket to power the PLC and sensor

I write the parity bit to 1 in the program via a button on the HMI.

I disconnect the green wire - (and see values on the screen which I shouldn't if I've changed the parity of the sensor)

I then download a new program to the PLC with the changed parity bit of the COM module

I then turn off the power and reconnect.

 

what is it I am doing wrong? I am very confused as to why it is not changing

Thanks again for your help

Link to comment
Share on other sites

  • MVP 2023

Two tips:

1. Try to check (read) what info you write to sensor before power-off.

2. Try to not disconnect green wire before power off...

 

I think that after starting the sensor, it has communication settings in RAM memory. If the green wire is connected, the standard setting from ROM  is recorded there. If green wire is not connected, the setting is loaded from another EEPROM memory.

Actually you write something to EEPROM memory. So this information cannot be used by the sensor immediately - it must be turned off and it will download it after restarting.

That is, it is important to follow the correct wire connect -disconnect sequence which is not specified in the manual...

  • Thanks 1
Link to comment
Share on other sites

On 9/23/2022 at 4:12 PM, kratmel said:

Two tips:

1. Try to check (read) what info you write to sensor before power-off.

2. Try to not disconnect green wire before power off...

 

I think that after starting the sensor, it has communication settings in RAM memory. If the green wire is connected, the standard setting from ROM  is recorded there. If green wire is not connected, the setting is loaded from another EEPROM memory.

Actually you write something to EEPROM memory. So this information cannot be used by the sensor immediately - it must be turned off and it will download it after restarting.

That is, it is important to follow the correct wire connect -disconnect sequence which is not specified in the manual...

What I am trying first from the MODBUS Register list is trying to read the values of Baud Rate and Modbus address, as from the table it shows this should be 1 and 3 respectively, however currently reading these addresses I am getting 0. So I feel if I understand the issue as to why i am not able to see these values on the HMI screen I can then work on setting the parity bit with the steps you've already suggested. Each Tag on the unilogic program below for the 3 addresses shown are UINT16.

Any help again would be greatly appreciated.

Screenshot 2022-09-26 145133.png

Link to comment
Share on other sites

  • MVP 2023

Ausman suggest

On 9/22/2022 at 2:25 PM, Ausman said:

To me, your easiest way of doing this is to connect to the sensor by using a RS 485 port on your PC.  The parity register can then be easily accessed with a variety of modbus tools freely available online and changed to what you want.  No Unilogic programming needed at all.

- best way - connect PC to sensor via Modbus program.

I use QModbus for this type manipulation.

If you have USB to RS485 converter on table, try to connect to sensor.

 

P/S  I see on your display Slave ID 1.....  In settings mode (green wire connected) - Fixed modbus addres 0 used

 

 

  • Thanks 1
Link to comment
Share on other sites

  • MVP 2023

+1 to all that Kratmel has gone through with you.

My general field is HVAC.  I doubt that this is so in your instance, but I have encountered some sensors at the cheaper end of pricing that need a special program to write the value properly to EEPROM.  One of them actually started the address at something that technically wasn't allowed, so none of my normal PC modbus programs could access it in the first place. Ensure that the sensor's website doesn't have a "setting program" available for download.  In the past I found that such manufacturer's were no help at all, I have often had to figure out how to use the program myself.  Hopefully things have improved a lot.  And incidentally, the cheapies were got as trials, and once I got them working as I wanted, they have been perfectly reliable for over 7 years now, whereas some of the big name ones alongside them have failed.  Hmmmm...

cheers, Aus

  • Like 1
Link to comment
Share on other sites

  • MVP 2023
13 hours ago, Ausman said:

One of them actually started the address at something that technically wasn't allowed, so none of my normal PC modbus programs could access it in the first place. Ensure that the sensor's website doesn't have a "setting program" available for download. 

I've often wondered about this. Is it incompetence, or some misguided sense of wanting to be proprietary?

  • Upvote 1
Link to comment
Share on other sites

  • MVP 2023

Researching unique things is one of my favorite activities. Especially interesting to explore modbas with developer features...in Chinese.

I visited the website of the this sensor developers. And I even saw a video on YouTube where someone programs such a sensor using some program. However, I did not find links to the programs themselves.

Based on the problems with configuration setup described by the author, it is easier for him to buy another communication module for Unistream and connect his sensors separately to separate communication ports.

  • Like 1
Link to comment
Share on other sites

  • MVP 2023
9 hours ago, Flex727 said:

Is it incompetence, or some misguided sense of wanting to be proprietary?

All a little off topic but who cares?!  I don't really know, but I've also seen big name firms do similar things in running modbus ports in odd, non-standard ways regarding parity etc. I've mentioned this on the forum before. (side note: Have I mentioned how how one of them labels relays NC or NO according to what they do once the device is running OK/powered up.  Very confusing and gave me issues on first use.) 

The devices I mentioned arrived with the ID at 0.   Perhaps the issue here is simply translation based, with the thought that 0 is used in PLCs and elsewhere in modbus, so it must be ok to use it as an ID.  But trying to get an answer from the manufacturer as to why it's done is very hard....the general response is essentially "So what?"  I could have logged the comms b/n the special program and the sensor to trace the way of doing it without the program once I worked it all out after a few hours, but on success I didn't bother.  Made notes for the future and put it to bed.  The same method has been used on other things that have arrived the same way.

And another FYI: One thing that the sensors DID have which made things easy was more registers in use than specified.  In cruising around once I was connected, I found registers that had correctly converted values, which saved a little plc work.  No mention of this at all.  So sometimes it is worth having a little wander around registers close to those in the specs, to see what might come up.

cheers, Aus

  • Like 1
Link to comment
Share on other sites

18 hours ago, kratmel said:

Researching unique things is one of my favorite activities. Especially interesting to explore modbas with developer features...in Chinese.

I visited the website of the this sensor developers. And I even saw a video on YouTube where someone programs such a sensor using some program. However, I did not find links to the programs themselves.

Based on the problems with configuration setup described by the author, it is easier for him to buy another communication module for Unistream and connect his sensors separately to separate communication ports.

I did think of this, obviously a much easier solution and guaranteed sucess, however the supply from unitronics on parts is obscene at the moment so getting hold of another one of these for however many projects we would use 2 instead of 1 might be a great issue. Hence the reason for trying to work out if i can reprogram it.

Link to comment
Share on other sites

  • MVP 2023

The program in Kratmel's video link is Modbus Poll.  From looking at it quickly, but not understanding the spoken language (which I think is Thai), it appears that some control parameters are done at 255 & 256 which might be a way of you doing it with the PC.  I really think it's worthwhile in your case to fiddle with the sensor using a 485 system on your PC.

Have you tried grounding the green in between steps 4 & 5 already mentioned?  The manual says either leave floating or ground it, but maybe grounding is essential.

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...