element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • Product Groups
  • Store
    Store
    • Visit Your Store
    • Choose Another Store
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
Arduino
  • Products
  • More
Arduino
Blog BYOB Party #2, Re-Configuring the Infineon for regular 12V LED strips
  • Blog
  • Forum
  • Documents
  • Events
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Arduino requires membership for participation - click to join
Blog Post Actions
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: peteroakes
  • Date Created: 15 Dec 2014 2:36 AM Date Created
  • Views 271 views
  • Likes 5 likes
  • Comments 2 comments
  • iot_holidaylights
  • byob_party
Related
Recommended

BYOB Party #2, Re-Configuring the Infineon for regular 12V LED strips

peteroakes
peteroakes
15 Dec 2014

Back to Master Blog BYOB Party #1, "Bring you own Bulbs" - The Internet of Holiday Lights

 

Hi Everyone

If your taking part on this challenge, I hope like me your now in possession of your parts to begin the fun

 

The first thing I wanted to do was evaluate the Infineon with a regular 12V RGB led strip, the kind that comes from China in rolls of 5M (60LEDs / Meter)

 

Well mine was partly used (Lighting for my bench project DIY LAB Bench with Shelves pt2, the Shelves ) for the under shelve lighting but there's enough left for this project

 

So I hooked it up only to find the output was rather disappointing..Time to investigate

 

VIDEO TO GO HERE

 

So it seems the default configuration for the Infineon board allows for 300mA and up to 48V supply for driving strings of at least 6V based on the manual here http://www.infineon.com/dgdl/Infineon-Board_Manual_-_XMC1202_-_RGB_LED_Lighting_Shield_with_XMC1202_for_Arduino_-_v1_0-U…. or does it.

 

The PDF  describes the parameters as follows (The safe Parameters)

 

300mA LED Current

6 - 48V forward current (Depending on supply of course)

 

Here is the output schematic of the output stage of the Infineon (This is the green channel but there all the same)

image

The LEDs are of course the ones you will or may add

I_Peak_Green is a tap to the ADC

Put_Green goes to another ADC but does not appear to get used

 

The circuit is repeated for RED and Blue and basically works like a buck regulator, with the control being in the hands of the ARM Cortex CPU

 

The settings in the code are as follows and in summary I will provide explanations


PEAK Current Setting 0x15

The ADC has a max volts of 5V and a max digital range of 0xFFF = 1.22mV/Cnt, and this into a 200mOhm resistor amounts to about 6mA per count with a max allowed count being 0x80 (0.156mV) or 780mA max. This setting is used to measure the current flowing through the LEDS, once it is exceeded the MOSFET is turned off and the Inductor will continue the current flowing but slowly diminishing, a setting of 0x15 equates to about 120mA according to the math but the text says 300mA. They may be referring loosely to the total string current ? but the math says 120mA per string. Also note that due to latency in sensing the peak and turning off the fet will cause some overshoot

PEAK CURRENT can be set individually for each channel

Fade Rate 0x14

The fade rate is the time it takes to fade from one dimming level to another, this is not the same as changing the intensity of the separate colours, it is also an exponential scale to match the eyes response to intensity change sensitivity so going from 0-50% will be quicker than from 50  - 100 %, there is a great graph in the manual to explain this pictorially , the count is not simple to calculate on the fly so experiment and read the manual

FADE RATE is global to all channels

WALK Time 0x30

The time it takes to change from one colour to another, not to be confused with changing intensity, A single count is shown as 10.24mS per so the value of 48 should approximate 480mS

WALK TIME is global to all channels

DIM Level 0xFFF

This is the method of changing the intensity of the overall output of the LEDs without changing the colour, if a colour setting involves a very low value of a particular channel, reducing the intensity of each individual channel can result in changing the colour, using the dimming control does not have this side affect

DIMMING LEVEL is global to all channels

Off Time 0x38

When the peak current is reached, the fet is turned off and a counter started this is the time before the fet is turned on again and effectively determines how much ripple will be seen in the LEDs, don't make this too short as the latency between detecting the peak current and turning it off needs to be less than this parameter, 0x38 equates to about 873nS (1uS) as each count is 15.6nS

OFF TIME can be set for each channel

Intensity between 000 and 0xFFF

The intensity allows you to control the individual brightness of each RGB channel with relationship to the others allowing millions of colours to be created (4096*4096*4096), the MAX value for each channel being 0xFFF or 4096 and equates to 100% brightness for that channel but is multiplied by the Dimming value to get the LED/BULB intensity so if you set 4096 (100%) for the channel but the dimming is set to 2048 (50%) then the LED/Bulb will only be on 50%, this allows you to set a colour and change the overall intensity with out affecting the colour

 

So now we know what the settings do (I ignore the DMX ones as we don't have DMX available so their meaningless )

 

Measuring the LEDs I have, I get a current of approximately 800mA per string, this means the i_PEAK will need to be MAX or 0xFFF

the off time can be left alone or reduced a bit if you feel the need, but test first

for my initial testing to see the affects I changed the FADE and WALK times to zero for instant changes

I also changed the script to simple show white and change the intensity of each LED vs using the dimming control so I can capture the signals on my Tektronix  MDO3054MDO3054 oscilloscope for analysis and conformation of the settings

 

For your use, here is the changed sketch for the arduino

 

  // Infineon RGB_LED_Shield_Master_Tester
  // by Michelle Chia
// adjusted by Peter Oakes to test changes required for 12V 700mA/Color RGB LED Strip and ignore DMX

  // Demonstrates I2C communication with the RGB LED Shield for safe configuration. Tested at 48Vin, 6V forward voltage LED. LED current up to 350mA.
  // Modified 13 August 2014

  #define ADDRESS                    0x15EUL

  #define INTENSITY_RED              0x11U
  #define INTENSITY_GREEN            0x12U
  #define INTENSITY_BLUE     0x13U
  #define INTENSITY_RGB              0x14U
  #define CURRENT_RED                0x21U
  #define CURRENT_GREEN              0x22U
  #define CURRENT_BLUE               0x23U
  #define CURRENT_RGB                0x24U
  #define OFFTIME_RED                0x41U
  #define OFFTIME_GREEN              0x42U
  #define OFFTIME_BLUE     0x43U
  #define WALKTIME                   0x50U
  #define DIMMINGLEVEL               0x60U
  #define FADERATE                   0x61U
  #define READ_INTENSITY_RED         0x81U
  #define READ_INTENSITY_GREEN       0x82U
  #define READ_INTENSITY_BLUE        0x83U
  #define READ_CURRENT_RED           0x84U
  #define READ_CURRENT_GREEN         0x85U
  #define READ_CURRENT_BLUE          0x86U
  #define READ_OFFTIME_RED           0x87U
  #define READ_OFFTIME_GREEN         0x88U
  #define READ_OFFTIME_BLUE          0x89U
  #define READ_WALKTIME              0x8AU
  #define READ_DIMMINGLEVEL          0x8BU
  #define READ_FADERATE              0x8CU
  #define SAVEPARAMETERS             0xA0U
  #define BCCUMODID                  0x50030008U
  #define CHIPID                     0x40010004U
  #define REDINTS                    0x500300A0U // BCCU_CH5
  #define REDINT                     0x500300A4U
  #define BLUEINTS                   0x50030078U
  #define STARTWALK                  0x50030018U

  #include <Wire.h>

  unsigned int c[2] = {0};
  unsigned int d[4] = {0};
  unsigned int on = 0;
  unsigned int message = 0;
  unsigned long redcurr = 0;
  unsigned long greencurr = 0;
  unsigned long bluecurr = 0;
  unsigned long redoff = 0;
  unsigned long greenoff = 0;
  unsigned long blueoff = 0;
  unsigned long redint = 0x00;
  unsigned long greenint = 0x00;
  unsigned long blueint = 0x00;
  unsigned long fadetime = 0x00;
  unsigned long walk = 0x00;
  unsigned long brightness = 1;

void setup() {            
    Serial.begin(9600);
    Wire.begin();
    while (on != 1) // Wait for shield to respond, keep setting the values till it does
    {
      I2CWRITE2BYTES (ADDRESS, FADERATE, 0x0000); // Immediate fade
      I2CWRITE2BYTES (ADDRESS, DIMMINGLEVEL, 0x0000); // 0% brightness level
      on = I2CREAD(ADDRESS, READ_DIMMINGLEVEL); // Request for brightness level
      if (message == 1 && on == 0) // If message received and dimming level = 0%, "message" is set in the I2CREAD function
      {
        message = 0;
        on = 1; // break out of loop
      }
    }
    // now we will chane the values again and wait till there being red back
    while (redcurr != 0x15 || greencurr != 0x15 || bluecurr != 0x15 || redoff != 0x38 || greenoff != 0x39 || blueoff != 0x38 || brightness != 0)
    {
   I2CWRITE6BYTES (ADDRESS, INTENSITY_RGB, 0x0000, 0x000, 0x0000); // Off Light
  // Ensure that parameters are set up correctly. Read back and check. If wrong, write and read again.
  redcurr = I2CREAD (ADDRESS, READ_CURRENT_RED); // Read the red current intensity
  greencurr = I2CREAD (ADDRESS, READ_CURRENT_GREEN); // Read the green current intensity
  bluecurr = I2CREAD (ADDRESS, READ_CURRENT_BLUE); // Read the blue current intensity
  redoff = I2CREAD (ADDRESS, READ_OFFTIME_RED); // Read the off-time of the red channel
  greenoff = I2CREAD (ADDRESS, READ_OFFTIME_GREEN); // Read the off-time of the green channel
  blueoff = I2CREAD (ADDRESS, READ_OFFTIME_BLUE); // Read the off-time of the blue channel
  brightness = I2CREAD (ADDRESS, READ_DIMMINGLEVEL); // Read the dimming level   
  I2CWRITE2BYTES (ADDRESS, OFFTIME_RED, 0x38); // Set off-time of red channel to 0x38
  I2CWRITE2BYTES (ADDRESS, OFFTIME_GREEN, 0x39); // Set off-time of green channel to 0x39
  I2CWRITE2BYTES (ADDRESS, OFFTIME_BLUE, 0x38); // Set off-time of blue channel to 0x38
  I2CWRITE2BYTES (ADDRESS, CURRENT_RED, 0x15); // Set current intensity of red channel to 0x15
  I2CWRITE2BYTES (ADDRESS, CURRENT_GREEN, 0x15); // Set current intensity of green channel to 0x15
  I2CWRITE2BYTES (ADDRESS, CURRENT_BLUE, 0x15); // Set current intensity of blue channel to 0x15
  I2CWRITE2BYTES (ADDRESS, DIMMINGLEVEL, 0x0000); // LEDs all off as any intensity * 0 will = 0
    }

    delay(100); // OK, so were getting response from the infineon so read back values from slave and print them
    Serial.print("Red Int: ");     redint = I2CREAD (ADDRESS, READ_INTENSITY_RED); // request from shield red colour intensity
    Serial.print("Green Int: ");   greenint = I2CREAD (ADDRESS, READ_INTENSITY_GREEN); // request from shield green colour intensity
    Serial.print("Blue Int: ");    blueint = I2CREAD (ADDRESS, READ_INTENSITY_BLUE); // request from shield blue colour intensity
    Serial.print("Red Curr: ");    redcurr = I2CREAD (ADDRESS, READ_CURRENT_RED); // request from shield peak current reference of red channel
    Serial.print("Green Curr ");   greencurr = I2CREAD (ADDRESS, READ_CURRENT_GREEN); // request from shield peak current reference of green channel
    Serial.print("Blue Curr: ");   bluecurr = I2CREAD (ADDRESS, READ_CURRENT_BLUE); // request from shield peak current reference of blue channel
    Serial.print("Red PWM: ");     redoff = I2CREAD (ADDRESS, READ_OFFTIME_RED); // request from shield off-time of red channel
    Serial.print("Green PWM: ");   greenoff = I2CREAD (ADDRESS, READ_OFFTIME_GREEN); // request from shield off-time of green channel
    Serial.print("Blue PWM: ");    blueoff = I2CREAD (ADDRESS, READ_OFFTIME_BLUE); // request from shield off-time of blue channel
    Serial.print("Walk: ");        walk = I2CREAD (ADDRESS, READ_WALKTIME); // request from shield walk-time
    Serial.print("Brightness: ");  brightness = I2CREAD (ADDRESS, READ_DIMMINGLEVEL); // request from shield brightness level
    Serial.print("FadeTime: ");    fadetime = I2CREAD (ADDRESS, READ_FADERATE); // request from shield fade rate

    // now setup for test
    I2CWRITE2BYTES (ADDRESS, OFFTIME_RED, 0x38); // Set off-time of red channel to 0x38
    I2CWRITE2BYTES (ADDRESS, OFFTIME_GREEN, 0x39); // Set off-time of green channel to 0x39
    I2CWRITE2BYTES (ADDRESS, OFFTIME_BLUE, 0x38); // Set off-time of blue channel to 0x38
    I2CWRITE6BYTES (ADDRESS, CURRENT_RGB, 0x80, 0x80, 0x80); // Set current of red channel to 0x80 = 780mA
    I2CWRITE2BYTES (ADDRESS, FADERATE, 0x0000); // Fade Rate between intensities --> 0.0s
    I2CWRITE2BYTES (ADDRESS, WALKTIME, 0x0000); // walk time between colors = 0s
    I2CWRITE6BYTES (ADDRESS, INTENSITY_RGB, 0x0555, 0x0555, 0x0555); // low level White Light
    I2CWRITE2BYTES (ADDRESS, DIMMINGLEVEL, 0x0FFF); // Maximum dimming level means inensity settings are directly used
}

  // the loop routine runs over and over again forever:
  void loop() {
    // change lamp colour to red
    I2CWRITE6BYTES (ADDRESS, INTENSITY_RGB, 0x0, 0x0, 0x0); // all off
    delay(1000); // wait 1000ms
    // change lamp colour to green
    I2CWRITE6BYTES (ADDRESS, INTENSITY_RGB, 0x03ff, 0x03FF, 0x03FF); // 25%
    delay(1000);
    // change lamp colour to blue
    I2CWRITE6BYTES (ADDRESS, INTENSITY_RGB, 0x07ff, 0x07ff, 0x07ff); // Blue
    delay(1000);
    I2CWRITE6BYTES (ADDRESS, INTENSITY_RGB, 0x0bff, 0x0bff, 0x0bff); // Blue
    delay(1000);
    I2CWRITE6BYTES (ADDRESS, INTENSITY_RGB, 0x0fff, 0x0fff, 0x0fff); // Blue
    delay(1000);
  }

//INFINEON FUNCTIONS NOT INCLUDED SA THERE UN CHANGED, SEE ATTACHMENT

Attachments:
RGBLED.ino.zip
  • Sign in to reply
Parents
  • pmohan
    pmohan over 8 years ago

    Yet to recieve the package. this is good information here for us to use regarding the shield.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • pmohan
    pmohan over 8 years ago

    Yet to recieve the package. this is good information here for us to use regarding the shield.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2023 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • Facebook
  • Twitter
  • linkedin
  • YouTube