Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Product R413D08, USB to RS485/RS232 - documentation? #1

Open
IoTPlay opened this issue Dec 9, 2020 · 3 comments
Open

Product R413D08, USB to RS485/RS232 - documentation? #1

IoTPlay opened this issue Dec 9, 2020 · 3 comments

Comments

@IoTPlay
Copy link

IoTPlay commented Dec 9, 2020

On the product I bought, R413D08, USB to RS485/RS232, I have put in several hours now, and the lack of documentation is shocking.

Questions for this product :

  1. As it has 8 outputs for controlling relays, how do I read the state of each of the relays? IN which function code (FC) will I find the info?
    FC1 Read Coil
    FC2 Read Discrete Input
    FC3 Read Holding Registers
    FC4 Read Input Registers

  2. Where / how is the Slave address set / or if hard coded, what is it?

  3. Starting reference?

  4. Discrete output (coil) / input data types?

  5. Communication. a) What baud rate does it work on. b) Data bits - 8? c) Stop bits - 1? d) Parity - none / odd / even?

  6. What write values to use to switch relay on / off?


What I have done so far:

  1. Connected product R413D08 to 12v DC, and using 2 wires from A+ and B- to product RS485-MINI
  2. Connected product RS485-MINI USB to Rapsberry Pi
  3. Check the driver sh341 s already in the latest kernel of OS Buster - checked this with command <lsmod | grep "usbserial">
  4. Checked mounting of /dev/ttyUSB0 vie
  5. Added my uid to dialout, for my uid to have access to the /dev/ttyUSB0
    5. sudo raspi-config / 5 Interfacing Options / a6 Serial / enable.
  6. Installed ModBus testing software to be run from ssh, with commands:
    a) wget https://www.modbusdriver.com/downloads/modpoll.tgz
    b) tar xzf modpoll.tgz && rm modpoll.tgz
    c) export PATH=$PWD/modpoll/linux_arm-eabihf:$PATH
  7. Tested the above config, (but I really need the answers to above questions to try get it to work)
    modpoll -m rtu -a 1 -b 9600 -d 8 /dev/ttyUSB0

Above command gives the following:

modpoll 3.9 - FieldTalk(tm) Modbus(R) Master Simulator
Copyright (c) 2002-2020 proconX Pty Ltd
Visit https://www.modbusdriver.com for Modbus libraries and tools.

Protocol configuration: Modbus RTU, FC3
Slave configuration...: address = 1, start reference = 1, count = 1
Communication.........: /dev/ttyUSB0, 9600, 8, 1, even, t/o 1.00 s, poll rate 1000 ms
Data type.............: 16-bit register, output (holding) register table

-- Polling slave...
Reply time-out!

@IoTPlay
Copy link
Author

IoTPlay commented Dec 14, 2020

8 Channel Multifunction RS485 Module command.pdf
For the record, this is what I received via email from Luloff Rautenbach, based on my questions ....


On Fri, 11 Dec 2020 at 10:13, Support support@robotics.org.za wrote:
Dear Client,

Bytes Number 1 2 3 4 5 6 7 8
MODBUS Definitions Slave ID Function Address Data CRC Check
Function Device Address Function Starting register address Register length CRC Check
Read Channel 1 State 0x00-0x2F 0x03 0x0001 0x0001  
Read Channel 2 State 0x00-0x2F 0x03 0x0002 0x0001  
Read 2 consecutive channels status 0x00-0x2F 0x03 0x0001-0x0003 0x0002  
Read 3 consecutive channels status 0x00-0x2F 0x03 0x0001-0x0002 0x0003  
Read all 8 channels status 0x00-0x2F 0x03 0x0001 0x0008  

Default slave address is 01
Read Slave ID : FF 03 00 FF 00 01 A1 E4

0x0001

16 bits wide

9600 Band ,8 Data bits,None Parity,1 Stop Bit

6)Relay state0x0001 open; 0x0000 close

Attached a PDF version of the documentation that was contained in the rar files.

Opening a .rar file applications.

Linux:  unar file.rar (command line)Windows: WinRARMAC OS: The Unarchiver app

@IoTPlay
Copy link
Author

IoTPlay commented Dec 14, 2020

And an attachment from the suppliers....
8 Channel Multifunction RS485 Module command.pdf

@IoTPlay IoTPlay changed the title Product R413D08, USB to RS485/RS232 - documentation = bad (0) state ! Product R413D08, USB to RS485/RS232 - documentation? Dec 14, 2020
@Knaldgas
Copy link

I've found some documentation at Banggood but it is difficult to understand.

I understand that it is possible to read port levels. Is it also possible to detect a pulse? I.e. is it possible to set up the port so each read returns if the port has changed since last read?
For instance a 10ms pulse is difficult to catch by only reading current states.

If not, is the source available so I can add that functionality myself?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants