Hi I bought 3 16ch opto input cards in 2021 but I do not seem to be able to find any documentation for this old version.
The card is labelled "16-INPUTS FOR RASPBERRY PI" V3.1 and is the version where RxD jumper is in same block as ID0-2 and you can per jumper switch between 12-24V / 3-12V inputs.
My questions are about the RS485 port on the HAT:
- Which UART in the PI is the port connecting to ?
- I assume I should short jumper RxD to make it work ?
- Is the B-A side opto isolated or otherwise hardened ?
- Which voltage levels are supported and which voltage is transmitted ?
- I have 3 16ch input hats - is it correct that only one hat can have the RS485 enabled ?
- How do I configure the RS485 ? the tool does not seem to handle the old card
pi@A01:/proc $ 16inpind 2 cfg485rd
Fail to read!
Thanks and apologies if this is a repeat question.
Hi,
You have an older version of the card, here are your answers:
- The UART is port 0, depending on your OS the name could be dev/ttyAMA0 or dev/serial0.
- Yes, you need to place a jumper on the pins marked RX
- A and B are not optoisolated but transformed from TTL levels to RS-485 levels
- Please take a look to the transceiver
datasheet for all the electrical specifications
- Since is just one UART to control it, yes only one card can be used for RS485 and please place RX jumper on just one card in the stack
- For the new versions, you need to instruct the local processor to release the transceiver control, but for this version, you just need to enable the Raspberry Pi serial port. Please take a look to the master setup on this
blog for more info on using Raspberry serial port.
Thanks for information.
I had a little setback as I accidentally connected the VCC on the 485 to the 12V that drives my 485 units and this took out the 485 circuits on that hat AND the entire Rpi :-(
I now got a new Rpi and all hats apparently still works except the 485 port I used.
I'm now trying a 485 on another card and question is - should I use 120 termination on the HAT-plug or is that built in ?
I am sorry to hear you burned a Raspberry.
The 120 termination can be added or removed on the bus using the dipswitch marked TERM. I am assuming that you know you must have just two terminators at both ends of the RS485 network.
My 16ch input hat only have 20 jumpers -16 for 12/24V on each input, 3 for address and one for connecting RS485 to Pi-serial0. I don't see any dipswitches. And yes, I understand that it is a bus to be terminated in both ends with 120ohm, however many devices have auto termination or a hardware/software configurable switch. I have plenty of resistors, so it's not a big deal, I just wanted to make sure it was not terminated twice.
Please give me a picture of the top side of the card.
This is the card I manage to kill the RS485 on - hence the handwritten sticker
This is an old card. No, there is no terminator on this one and to use RS485 on this you need to place a jumper on the header marked "RX"
More questions to the old cards:
I do not know much about I2C, but is et possible for two different processes on the pi to access cards concurrently or is the setup locked to
- one process can access set of cards at a time
- one process can access one card at a time (and another process another card)
Also, should I decide to invest in newer cards, will they mix freely with the old cards ?
Will the new cards allow for satellite instances where a remote HAT is not connected directly to the rpi but indirectly through RS485 ?
Thanks
Hi,
The I2C is not quite thread-safe because it consists of multiple byte transfers per frame. You can use a semaphore to signal between threads and ensure that one of the threads finishes the communication before the next one starts it.
The new cards can mix with the old ones.
I guess you're asking if the cards can be accessed over RS484 outside the Raspberry Pi, yes, most of our cards, especially the new ones, can be accessed through RS485 using the MODBUS RTU protocol. The cards are slaves on the bus, and the master can be a Raspberry Pi, a PLC, or a computer with appropriate software and an RS485 interface.
Check on the product page if it writes MODBUS, it can be controlled remotely over RS485.
I had the feeling - it would be cool if
i2cMem8Read(dev, INPUTS16_INPORT_REG_ADD, buff, 2) etc.
were thread safe for the size of the buff.
I think I'm prepared now :-)
Thanks for competent support - it's not often it happens when you reach out for support for a product nowadays...
Claus
Thanks for the suggestion, we considered it in the past, but had no time to do it. We will revisit.