Open IoTPlay opened 3 years ago
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,
1)
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 |
2) Default slave address is 01 Read Slave ID : FF 03 00 FF 00 01 A1 E4
3) 0x0001
4) 16 bits wide
5) 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
And an attachment from the suppliers.... 8 Channel Multifunction RS485 Module command.pdf
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?
And an attachment from the suppliers.... 8 Channel Multifunction RS485 Module command.pdf
For me works fine with RS485 converter.
Open All ports: 01 06 00 00 07 00 8B FA
Close all: 01 06 00 00 08 00 8E 0A
Close channel 1: 01 06 00 01 02 00 D9 6A
Open channel 1: 01 06 00 01 01 00 D9 9A
All can be measured with multimeter (I did with gnd and ports).
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 :
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
Where / how is the Slave address set / or if hard coded, what is it?
Starting reference?
Discrete output (coil) / input data types?
Communication. a) What baud rate does it work on. b) Data bits - 8? c) Stop bits - 1? d) Parity - none / odd / even?
What write values to use to switch relay on / off?
What I have done so far:
Connected product R413D08 to 12v DC, and using 2 wires from A+ and B- to product RS485-MINI
Connected product RS485-MINI USB to Rapsberry Pi
Check the driver sh341 s already in the latest kernel of OS Buster - checked this with command <lsmod | grep "usbserial">
Checked mounting of /dev/ttyUSB0 vie
Added my uid to dialout, for my uid to have access to the /dev/ttyUSB0
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
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!