Arduino UNO Adafruit Display Project

Hello everyone,

i have a project that i am nearly finished but need some help with a couple of issues (also wanted to share my project if anyone finds it interesting)

essentially, i have 13 displays that are controlled over I2C. I have 2 arduino Uno as i can have a maximum of 8 displays on 1 bus (i was given another arduino by the employers, they said this would be better rather than bit banging my way to get 13 on one bus. I’m doing this project for in my internship)

So 2 buses: 7 displays and 6 displays, data is coming from an array called data in each programme.

I will be given a text file with my real data inside soon. I need to find a way to get this data into the arrays in my code. I have had a look online but could do with someone explaining this to me so i can make sense of it all.

I need to find a way to have a Master Slave setup with my 2 arduino’s, i was thinking of just having a digital pinout going from the master to the slave and having the slave waiting for a rising edge and then iterating its ‘loop’ once using a while or if statement. What do you think about that?

#include <Wire.h>
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"
  
Adafruit_7segment segment[6];

int address[6]={112,113,114,115,116,117};  // having another file written for 7 displays 

int data[10][6] =
{
  {1,2,3,4,5,6},
  {7,8,9,10,11,12},
  {13,14,15,16,17,18},
  {19,20,21,22,23,24},
  {25,26,27,28,29,30},
  {31,32,33,34,35,36},        //arbitrary numbers used here for now 
  {37,38,39,40,41,42},
  {43,44,45,46,47,48},
  {49,50,51,52,53,54},
  {55,56,57,58,59,60}
};

void setup() 
{
  #ifndef __AVR_ATtiny85__
  Serial.begin(9600);
  #endif

  for (int i=0;i<6;i++) 
  {
    segment[i]=Adafruit_7segment();
    segment[i].setBrightness(10);
    segment[i].begin(address[i]);
  }
  
}

void loop()
{
  for (int k=0; k<10; k++){
    for (int i=0; i<6; i++)
    {
      segment[i].print(data[k][i]);
      segment[i].writeDisplay();
      delay(10);
    }
    delay(2000);   //this time delay is irrelevant, i did it for ease of viewing
  }    
}

thanks for any replies.

It's probably a bit late in the day, but if you used an Uno v4 you would get TWO I2C buses on the same board which would massively simplify all this:

hahaha

that would have been very very helpful, if only i had known such a thing existed. i bought this: http://ie.rs-online.com/web/p/processor-microcontroller-development-kits/7154081/

Yes, it is pretty new and not 'standard issue' - that is, it is Elektor that is promoting it, not Arduin.cc.

That said, you could still consider whether the additional cost (money) outweighs the additional cost (effort in coding) to do what you want. Only one device can be an I2C master so I don't envy you juggling your sketches.

Have you considered using either different I2C drivers for the displays, as you can then get 16 displays per I2C bus? Using different versions of the PCF8574 (the I2C chip that usually drives the LCDs) you can get two versions, 'A' and 'T', both of which offer different I2C address ranges (deliberately done).

I guess it depends on whether your displays have the I2C driver module soldered to the back of the display unit or whether you are adding this separately. They would the devil to unsolder and replace with a different chip driver module, probably not worth doing. But maybe replacing just 5 of them (8 existing + 5 new ones) could be an option. All down to money.

Once again, however, sometimes you need to step back and think: how would I do this knowing what I know now? 13 LCD modules with different addresses means that all that bus juggling becomes a walk in the park. It's hard to abandon what you have now but you could consider it a Proof-Of-Concept and now implement as you would really like it to be.

I'm not really helping you with your existing problem so I'll keep quiet now :blush: