3

I know similar question has already been discussed here but I could not get clear answer. Here is the thing: I have one master device - Mega2560, and multiple (about 9 but could be expandedin future) I2C perfiferals - displays, that can have one of two possible I2C IDs - limitation by the manufacturer. As I can't connect and talk to them from a single I2C bus I chose to attach each two of them to a Mini-Pro's I2C pins and connect the 5 Mini-Pros to the master. The question is am I going to the right direction, and which connection would do the trick? I2C is obviously out of question, so the remaining are UART and SPI. UART would require some external hardware to cope with multiple outputs from the slaves, SPI would require additional pins from the master for chip select signal. Data rates are not high - min 10-20 kbps. I think the SPI offers better solution, but I'm no expert, what do you think?

Cheers!

Stefan

  • What distances are you wanting to communicate over? – Majenko Aug 9 '17 at 13:29
  • very short - the modules are within 40cm of each other, actually they will be combined in a common box with single front panel. – Chefo Aug 10 '17 at 7:22
0

SPI afaik is not good over bigger distances (> 1 meter). If you need many CS signals you always can use a multiplexer (like 74HC595N). I am not sure if it is 'normal' to have many SPI devices connected to one Arduino though.

Other solutions: I2C, but I don't have much experience with them. I heard about I2C expanders (MCP23017) that maybe are useful.

Also RF might be a possibility, also depending on the distance and most important speed (and latency).

In case for the Mega, it has 4 UARTs so that could maybe be used to spread the load.

  • 2
    I2C is not better over long distances. It is not designed even really to go through wires but be just between chips on a PCB. – Majenko Aug 9 '17 at 13:49
  • @Majenko ... I removed the part about distance, thanks. – Michel Keijzers Aug 9 '17 at 13:51
  • 1
    I would use i2c to drive them but unfortunately the OLED displays have hardcoded duplicated IDs I cannot connect them to a common i2c bus. – Chefo Aug 10 '17 at 7:26
3

Thanks all for your answers.

I did some more research with the new info you provided and found my perfect solution: TCA9548A. That's a 1-to-8 port i2c multiplexer that will allow the master MEGA2560 to control up to 8 independent i2c buses, where I can connect my displays. The chip is dirt cheap here - 2 euro only, and it is available in the store.

Thanks again guys!

  • Please add this as comment or update to your question. Since it is not an answer, I had to flag it like that. – Michel Keijzers Aug 10 '17 at 8:52
  • 1
    @MichelKeijzers For the distances involved I was going to suggest an I2C switch as one possible solution. This answer is an answer to the question - and there is nothing wrong with a user answering their own question. – Majenko Aug 10 '17 at 10:37
  • @Majenko ... true ... I see it adds more than only a thank you. I retracted my flag (even upvoted it). – Michel Keijzers Aug 10 '17 at 10:40
0

I would suggest using 485 communication though it will increase the hardware but you will be able to add upto 32 devices and also have greater communication distance. You can use MAX485 IC or you can directly use TTL to 485 Module

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.