What is the maximum number of serial ports that can be build using the Software serial libray. :)
Only one can be active. So the answer might be : one https://www.arduino.cc/en/Reference.SoftwareSerialListen The maximum number of ports depends on the memory that is available. I guess about 10 would be possible. Everything is held in the SoftwareSerial object, it is just a matter of defining more objects.
The Arduino Mega 2560 board has three spare hardware serial ports. The Arduino Leonardo has one spare hardware serial port. There are also chips and modules that provide serial ports.
Can you tell about your project ? In some (rare) cases, the RX or TX can be combined.
I want to get data from 7 RFID readers. For that purpose i want to use multiple serial ports.
If you have that many, you might be better looking at some hardware system for connecting them to one hardware port and polling as required.
As far as I know, the RFID readers have a low baudrate of 2400 baud, and start sending a message when a tag is recognized. The Arduino has to be able to read the (software)Serial port at all times, since at any moment the RFID reader can send a message.
The SoftwareSerial can only listen to one software serial port at a time. That means that only one RFID reader can be listen to.
You could add an Arduino to every RFID reader, for example a small Arduino Pro Mini. How the Pro Mini communicates with the main central Arduino depends on the length of the cable, a wireless module would be nice.
I thought to use two arduino mega with their 3 hardware serial ports (so i will get 6 hardware serials and i can use single software serial )and connect the mega boards with i2c will it be ok.
Yes, that will work. That single SoftwareSerial could be trouble if you have more interrupts (from the hardware serial ports). If you can avoid the SoftwareSerial completely, that would better. Select a pin that will also work with AltSoftSerial, so you could try that library as well. https://www.pjrc.com/teensy/td_libs_AltSoftSerial.html
There is a module with extra serial ports for the Arduino. If the used chip has enough buffer for the RFID, it can't miss a message. It is interfaced with SPI or I2C. The trouble is... I can't find it at te moment. [ADDED] Found this one : https://www.sparkfun.com/products/9981
Have you used I2C between Arduino boards before ? If you have not, then you need to time to get used to.
The easiest way it to have one 'main' mega board, and the other mega board is just an addition for more serial ports. Make the 'main' mega a I2C Slave and the additional mega the Master. Then the additional mega can send I2C messages at any time to the 'main' mega.
Andre_Leonardo: I thought to use two arduino mega with their 3 hardware serial ports (so i will get 6 hardware serials and i can use single software serial )and connect the mega boards with i2c will it be ok.
A Mega has four hardware serial ports, why not use them?