Atmel 328, 5 x serial ports?

I need to be able to control a VGA Matrix.

Currently i have three button boards, when a user presses a button it sends a pre programmed message to a master board.

This master board listens to each button board, one on the hardware serial port, one using AltsoftwareSerial and one using SoftwareSerial. When it recieves a message it sends it onto the Matrix via a Max232 chip. this all works faultlessly.

However i now have to include another two button boards.

How can I get the control board to listen for incoming messages from more boards?

I have tried connecting more than one button board to the serial recieve pin but i then fail to get any input?

You might need to get an ATmega2560. 4 hardware serial ports and use one "SoftwareSerial" port. You could even expand to 6 button boards then, with an "AltSoftwareSerial" port. :slight_smile:

What do you mean by button board? You do know that a single 328 can deal with very very large (100+) buttons? and do lots of things a the same time!

Mark

The Button boards are basically eight buttons that each have a pre programmed sentance being sent to the control board. these button boards are being placed in different areas for different users to operate. upto approx 20 feet away from each other.

As i have the parts available im thinking i could create two seperate boards, one taking in three inputs and the other taking in two.these could then pass on the serial messages to the control board. not the best way im sure but i think it should work?

Do the button boards each have an Arduino board or Atmega MCU - if so, what sort?

Do the button boards need to be able to communicate with the master at the exact same time, or would it be sufficient for the master to poll each of the button boards in turn (perhaps 10 times per second)? If that is allowable you could wire all the button boards to a single serial port on the master with a few diodes and resistors to prevent confusion.

Would it be an option to use nRF24L01+ wireless transceivers?

...R

each button board has its own Atmel 328 soldered on. In hign sight i think that the master board polling the slave boards would be a better option, but ive just cnc'd the boards out so may as well use them. The button boards do not need to comunicate at the same time, they are basically remote controll devices, it would be an amazing coincidence if two operators decided to press a button at the same time.

thanks for your help so far

spriggsy:
The button boards do not need to comunicate at the same time,

If it was my problem I would experiment with wiring all the serial connections to a single port on the Atmega 328 - use hardware serial if you don't need it for anything else.

Try it with 2 button boards to start with.

The Tx from the Atmega 328 can go directly (in parallel) to each Rx on the button boards.

The Tx from the button boards is more of a challenge because they will each try to hold the line HIGH when idle. To get around this connect a diode on each of them which only allows current to flow FROM the Atmega 328. That means each of the button boards can pull the Atmega 328 Rx LOW, but they cannot make it HIGH. Use a pullup resistor (perhaps 4k7) to make the Atmega Rx HIGH when nothing is trying to pull it LOW.

From a software point of view, allocate an ID number to each button board and then get the Atmega 328 to send that number to each one in turn. All the button boards will receive all the messages from the Atmega 328 but they should ignore messages that do not have their own ID. When a message with the correct ID arrives the button board should immediately send its data. The Atmega 328 will then know which button board has sent the data, however it would be a good idea to include the ID in the reply. If there is a risk that a button board migh fail to reply you could include a timeout in the Atmega 328 code so it only waits a specified time for the reply.

I have used a wireless version of this software system successfully.

...R