I2C on Metro Mini (pullup resistor and IS31FL3237 LED Driver)

Please tell us which board you are using.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Post Reply
User avatar
project zero
 
Posts: 78
Joined: Tue Sep 10, 2013 11:22 pm

I2C on Metro Mini (pullup resistor and IS31FL3237 LED Driver)

Post by project zero »

Hi there,

I am using the metro mini and attempting to talk to the IS31FL3237 LED Driver. It should be pretty straightforward - they have sample Arduino code, etc.

But I'm a bit concerned about whether I need a pullup resistor or not. According to the Wire Library, a pullup resistor is required, but it doesn't give much detail, and examples that it references appear to be missing.

So I have two questions:

1. Does anyone know if I should need a pullu=up resistor, particularly to talk to the IS31FL3237 LED Driver?
2. Does anyone have experience with the LED Driver? The LEDs are wired up on a nice board off the shelf, I'm really hoping comms will be quick and easy (in a perfect world).

Thanks! I have pasted the arduino sample code for the LED driver below.

Code: Select all

#include<Wire.h>
#include<avr/pgmspace.h>
#define Addr_GND 0x68
//7 bit format is 0x3F

byte PWM_Gamma64[64]=
{
  0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
  0x08,0x09,0x0b,0x0d,0x0f,0x11,0x13,0x16,
  0x1a,0x1c,0x1d,0x1f,0x22,0x25,0x28,0x2e,
  0x34,0x38,0x3c,0x40,0x44,0x48,0x4b,0x4f,
  0x55,0x5a,0x5f,0x64,0x69,0x6d,0x72,0x77,
  0x7d,0x80,0x88,0x8d,0x94,0x9a,0xa0,0xa7,
  0xac,0xb0,0xb9,0xbf,0xc6,0xcb,0xcf,0xd6,
  0xe1,0xe9,0xed,0xf1,0xf6,0xfa,0xfe,0xff
};

void setup() {
  // put your setup code here, to run once:
  Wire.begin();
  Wire.setClock(400000);//I2C 400kHz
//  pinMode(4,OUTPUT);//SDB
//  digitalWrite(4,HIGH);//SDB_HIGH
  Init_FL3237();
}

void loop() {
  // put your main code here, to run repeatedly:
   IS31FL3237_mode1();//breath mode
}

void IS_IIC_WriteByte(uint8_t Dev_Add,uint8_t Reg_Add,uint8_t Reg_Dat)
{
  Wire.beginTransmission(Dev_Add/2); 
  Wire.write(Reg_Add); // sends regaddress
  Wire.write(Reg_Dat); // sends regaddress
  Wire.endTransmission(); // stop transmitting
}

void Init_FL3237(void)
{
  uint8_t i = 0;
  for(i=0x4A;i<=0x6D;i++)
  {
    IS_IIC_WriteByte(Addr_GND,i,0xff);//turn on all LED
  }

   for(i=0x01;i<=0x48;i++)
  {
    IS_IIC_WriteByte(Addr_GND,i,0x00);//write all PWM set 0x00
  }
  
  IS_IIC_WriteByte(Addr_GND,0x49,0x00);//update PWM & congtrol registers
  IS_IIC_WriteByte(Addr_GND,0x6E,0xFF);//Global current
  IS_IIC_WriteByte(Addr_GND,0x00,0x01);//normal operation and 8bit PWM
}

void IS31FL3237_mode1(void)//white LED
{
  int8_t i = 0;
  int8_t j = 0;

  for(i=1;i<=24;i+=2)//R LED running
  {
    IS_IIC_WriteByte(Addr_GND,(i*3),0xFF);//set  PWM  
    IS_IIC_WriteByte(Addr_GND,0x49,0x00);//update PWM & congtrol registers
    delay(80);//100ms
  }
  delay(500); //keep 0.5s
  
  for(i=23;i>0;i-=2)//G LED running
  {
    IS_IIC_WriteByte(Addr_GND,(i*3-2),0xFF);//set  PWM  
    IS_IIC_WriteByte(Addr_GND,0x49,0x00);//update PWM & congtrol registers
    delay(80);//100ms
  }
  delay(500); //keep 0.5s
  
  for(i=1;i<=24;i+=2)//B LED running
  {
    IS_IIC_WriteByte(Addr_GND,(i*3+2),0xFF);//set  PWM  
    IS_IIC_WriteByte(Addr_GND,0x49,0x00);//update PWM & congtrol registers
    delay(80);//100ms
  }
  delay(500); //keep 0.5s

   for (j=63;j>=0;j--)//all LED breath falling 
  {
     for(i=1;i<=0x48;i+=2)
    {
      IS_IIC_WriteByte(Addr_GND,i,PWM_Gamma64[j]);//set all PWM 
    }
    IS_IIC_WriteByte(Addr_GND,0x49,0x00);//update PWM & congtrol registers
    delay(30);//20ms
  } 
  delay(500); //keep o 0.5s
}

User avatar
adafruit_support_carter
 
Posts: 24330
Joined: Tue Nov 29, 2016 2:45 pm

Re: I2C on Metro Mini (pullup resistor and IS31FL3237 LED Driver)

Post by adafruit_support_carter »

Pull up resistors are a requirement of the I2C bus:
https://learn.adafruit.com/working-with ... -resistors

The Metro Mini does not include those.

User avatar
project zero
 
Posts: 78
Joined: Tue Sep 10, 2013 11:22 pm

Re: I2C on Metro Mini (pullup resistor and IS31FL3237 LED Driver)

Post by project zero »

Carter, thank you very much. I will pull up SDA and SCL to 5V. Is it acceptable for me to use the 5V OUT on my Metro Mini? And secondly, what resistor size do you recommend?

Lastly, is it acceptable to set a pinout or 2 to digital High and then connect the sda and scl lines to them, with resistors?

Post Reply
Please be positive and constructive with your questions and comments.

Return to “Metro and Metro Express, Grand Central”