Advice for monitoring 10 async serial ports simultaneously.

Here are the details:

  • Need to monitor 10 ID-12 RFID modules in real time

  • Baud rate is 9600bps

  • Messages are short. 12 bytes total.

  • No requirement for TX

The software serial driver warns that only one port can listen at a time, meaning it's possible that I may miss a message if two devices send at the same time.

The datasheet on these modules sucks. I had an idea that if the TX pin was either open collector, or went tri-state when in reset, I'd scan the reset pins in succession. I still haven't determined what type of output it is.

Please, if you don't have a firm answer, don't guess.

Posted Apr 29, 2013, 9:14 PM UTC · edited

116
jetRink•

To clarify,

  • Is it acceptable to miss a message if two devices happen to transmit at the same time? If this is true, I think there is a slightly complicated solution.
  • Is it acceptable to miss both messages? If this is true, I think there is a simple solution.
3
hyperkineticOP•

Is it acceptable to miss a message if two devices happen to transmit at the same time?

No. I have no idea when a message will arrive.

If this is true, I think there is a slightly complicated solution.

Let's hear it!

2
jetRink•

I still don't quite know what you need, so here are my three ideas:

  1. Simple Put the ID-12s in Magnetic Emulation mode. In this mode, the data pins are open-drain and the Card Present pin is active. Put all ID-12s on the same two data lines. Use the Arduino's SPI port for communication and the Card Present lines to determine which ID-12 is active. The ID-12s may occasionally stomp on each other. Uses a lot of pins.

  2. Complicated Put the ID-12s in Magnetic Emulation mode. Multiplex the data lines. Use activity on the Card Present lines to identify the active ID-12 and generate an interrupt. Quickly switch the two multiplexers to the active ID-12. If two ID-12s talk at once, you get to choose to listen to one of them. Uses a lot of pins.

  3. Damned Complicated Get one ATtiny2313 for each ID-12. (They're about $1.20/ea.) These microcontrollers have serial and I2C just like the Arduino. Connect each ID-12 to a Tiny using serial. Connect all of the Tinys to a common I2C bus. Program each ATtiny to receive data from the ID-12 and to hold onto it until queried over I2C by the Arduino. The Arduino could poll each ATtiny periodically for new messages or the Tinys could alert the Arduino of new messages using a third line. All messages will be received. Only requires three pins.

2
crb3•

(four). Use actual UARTs to catch the packets, offloading the serial bit-banging to the silicon. The XR17C158 looks interesting: an octal UART with 64-byte FIFO per channel; that''s deep enough to hold your 12-byte packet, methinks.

2
hyperkineticOP•

The XR17C158 looks interesting

Pretty useless with a PCI interface, but the rest of their lineup looks promising.

2
hyperkineticOP•

Actually, this might be the answer. I'm looking at doing software serial in an ATtiny13A, which are $.59 each Q25, which isn't bad.

2
cybergibbons•

On 2, you should be able to service two 9600bps signals at the same time.

On 3, it would probably be cheaper to buy different modules.

1
bandman614•

ReadiNg the problem, I was definitely thinking along the lines of #3. If you can't miss a message, the solution is (relatively) expensive, but comprehensive.

1
[deleted]•

[deleted]

1
crb3•

Are there handshake pins on the RFID modules? If so, try disabling all CTS (Clear to Send) pins at init, then going round-robin, checking one RTS (Request to Send) at a time and, if found, enabling its CTS long enough to pull in the packet. These are RS232 signals; check the dox for corresponding functions on the devices.

Of course, then you have to look at the latency numbers to see if you're likely to miss any packets.

2
hyperkineticOP•

Are there handshake pins on the RFID modules?

No.

If so, try disabling all CTS (Clear to Send) pins at init, then going round-robin, checking one RTS (Request to Send) at a time and, if found, enabling its CTS long enough to pull in the packet.

I thought of doing something similar by holding all the modules in reset, and releasing each in order. I assume upon self initialization it will read the tag and spit it's packet. I have yet to test to see if this will work.

These are RS232 signals

No they're not. They're TTL async serial.

2
crb3•

These are RS232 signals

No they're not. They're TTL async serial.

Not what I meant; I should have been clearer, sorry. I meant that I was using RS232 signal names in order to describe the signal purpose, but that it was doubtful that the RFID device documentation would use those designators.

I have yet to test to see if this will work.

That probably depends on whether asserting the reset line shuts up the rf-field transmitter. If not, perhaps round-robin switching the power to the RFID modules instead will work.

1
cybergibbons•

Write your own polling software serial.

9600bps is slow. Oversample by a factor of 8. Should be possible if you are careful.

2
Kalsmunt•

For reference, the ATtiny13A has 5 pins that can be triggered to operate as external interrupts. I don't know the details of using interrupts on the Arduino. I do know it would be entirely possible to enable the 5 interrupt pins, use 4 for UART inputs and one for SPI or I2C communication and come up with your own quad UART chip for a very low price. Heck, just get a Arduino Due and skip the Tinys and have all the horsepower you will ever need.

0
Shadow703793Robots,robots,robots EVERYWHERE!•

Well, you could keep the transmission transmitting for an amount of time say 30sec. That should give you enough time to log all 10 transmissions even if all of them happen at the same time.

The second option would be to cycle through all the receivers quickly.

-1