element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • 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 Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • 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
  • Settings
Arduino
  • Products
  • More
Arduino
Documents Compare the Infineon RGB libraries that spawned from the Internet of Holiday Lights
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Arduino requires membership for participation - click to join
Actions
  • Share
  • More
  • Cancel
Engagement
  • Author Author: Jan Cumps
  • Date Created: 15 Jan 2015 4:52 PM Date Created
  • Last Updated Last Updated: 8 Oct 2021 8:12 AM
  • Views 563 views
  • Likes 6 likes
  • Comments 0 comments
Related
Recommended

Compare the Infineon RGB libraries that spawned from the Internet of Holiday Lights

The Internet of Holiday Lights RoadTest Plus has generated at least three libraries for the Infineon RGB LED Driver Board.

 

Robert Peter Oakes lib: BYOB Party #3, Infineon Library Available

ipv1 lib: [Dynamic Living-Room Lights] The Infineon RGB LED Shield -Library!

beavertank lib: IoT Christmas Ornaments - The Software, Part 1

 

I've tried Robert Peter Oakes's library, but I'd like to run all of them and check if there's something to learn out of it. It would be great to find out that the same problem is solved in more than one inventive way.

It's a working document. Feel free to join.

 

image

photo is from the Board Manual

 

peteroakes ' library

Peter published his library here: BYOB Party #3, Infineon Library Available. The library is attached as a zip file to the post.

Installation is as simple as placing his .cpp and .h in the right location.I used the libraries\Infineon subfolder of my Sketchbook location, as suggested by Peter.

(You can find your own Sketchbook location by using the File -> Preferences menu. The folder is shown under the 'Sketchbook location:' label.)

API:

The functionality is wrapped in an class called Infineon. There's one constructor that doesn't take parameters.

There's an easy to use method SETCOLOUR() that does the obvious - it sets a particular colour. The library pre-defines a number of colours.
You get yellow by calling SETCOLOUR(Yellow).

The library has lower level functions to initialize the shield and to call all the commands that are supported by its i2c interface.

You can set any RGB colour  by invoking I2CWRITE6BYTES(ADDRESS, INTENSITY_RGB, 0x..., 0x0..., 0x0...).



Example:

You'll find the RGBLED.ino example in the same blog post. The example shows object creation, shield setup and a colour show.

It explains how to set limits, rates and levels, ...

a few highlights:

 

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




  // ...
  // change lamp colour to green
  RGBLEDS.I2CWRITE6BYTES(ADDRESS, INTENSITY_RGB, 0x03ff, 0x03FF, 0x03FF); // 25%
  // ...
  RGBLEDS.SETCOLOUR( White);
  // ...

Getting started:

Easy. I followed the setup instructions and the shield worked right away with the example.

Sketch size:

 

Sketch uses 4,794 bytes (14%) of program storage space. Maximum is 32,256 bytes.

Global variables use 404 bytes (19%) of dynamic memory, leaving 1,644 bytes for local variables. Maximum is 2,048 bytes.

 

 

Tested with this minimal program that does the setup and calls the method  RGBLEDS.SETCOLOUR().

That takes care that the library's main functions are all linked in.

 

 

  #include <Wire.h>
  #include "Infineon.h"



  Infineon RGBLEDS = Infineon();

void setup() {


    Wire.begin();
    while (RGBLEDS.on != 1) // Wait for shield to respond, keep setting the values till it does
    {

      RGBLEDS.I2CWRITE2BYTES (ADDRESS, FADERATE, 0x0000); // Immediate fade
      RGBLEDS.I2CWRITE2BYTES (ADDRESS, DIMMINGLEVEL, 0x0000); // 0% brightness level
      RGBLEDS.on = RGBLEDS.I2CREAD(ADDRESS, READ_DIMMINGLEVEL); // Request for brightness level
      if (RGBLEDS.message == 1 && RGBLEDS.on == 0) // If message received and dimming level = 0%, "message" is set in the I2CREAD function
      {
        RGBLEDS.message = 0;
        RGBLEDS.on = 1; // break out of loop
      }
    }
    RGBLEDS.I2CWRITE2BYTES (ADDRESS, OFFTIME_RED, 0x38); // Set off-time of red channel to 0x38
    RGBLEDS.I2CWRITE2BYTES (ADDRESS, OFFTIME_GREEN, 0x38); // Set off-time of green channel to 0x39
    RGBLEDS.I2CWRITE2BYTES (ADDRESS, OFFTIME_BLUE, 0x38); // Set off-time of blue channel to 0x38
    RGBLEDS.I2CWRITE6BYTES (ADDRESS, CURRENT_RGB, 0x01, 0x01, 0x01); // max:  0x80 = 780mA, I need 15 for standard leds, (0x03), but dimmed down to 0x02 because that's enough as max
    RGBLEDS.I2CWRITE2BYTES (ADDRESS, FADERATE, 0x0000); // Fade Rate between intensities --> 0.0s
    RGBLEDS.I2CWRITE2BYTES (ADDRESS, WALKTIME, 0x0000); // walk time between colors = 0s
    RGBLEDS.I2CWRITE6BYTES (ADDRESS, INTENSITY_RGB, 0x0555, 0x0555, 0x0555); // low level White Light
    RGBLEDS.I2CWRITE2BYTES (ADDRESS, DIMMINGLEVEL, 0x0FFF); // Maximum dimming level means inensity settings are directly used
    RGBLEDS.SETCOLOUR( White);


}

  // the loop routine runs over and over again forever:
  void loop() {
  }

 

 

 

 

 

ipv1 ' library

Inderpreet published his library here [Dynamic Living-Room Lights] The Infineon RGB LED Shield -Library!. The library is available on his github.

Installation is as simple as extracting that github folder's zip in the right location.I used the libraries subfolder of my Sketchbook location, as suggested by Inderpreet. That will create subdirectory infineonrgb_shield-master

(You can find your own Sketchbook location by using the File -> Preferences menu. The folder is shown under the 'Sketchbook location:' label.)

API:

The functionality is wrapped in an class called InfineonRGB. There's one constructor that doesn't take parameters.

The begin() method sets a number of parameters to a default value for the library. These values can be changed before the LEDs are activated the first time.

Here's an overview of the parameters after you called begin():

 

  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);

 

There's a method for each of the functions supported by the shield.

For the intensity, there is a function that can set the intensity of all three channels in one call, and there's also a separate function for each of the three channels.

This library also has a setColor() method that translates a given set of colours to the right RGB values.



Example:

You'll find the lamptest.ino example in your IDE under menu File -> Examples -> infineonrgb_shield-master. The example shows object creation and a colour show.

 

Warning: the example sets all three channels to full brightness at the setup. The current limits are set to 15 in the begin() method of the library - you need to check the library's source code to see that. Take care to call his library's methods to set the limits to your LED's specifications..

 

The example sets the LEDs to full brightness at startup, then runs trough a number of different colours and intensities.

a few highlights:

 

  LEDS.begin(); // Cycle and set everything to zero.
  LEDS.SetDimmingLevel(0x0FFF); // Maximum Brightness
  // ...
  // Set RED
  LEDS.SetIntensityRGB(0x0FFF, 0x0000, 0x0000);
  // You can set the colors as well to White, Silver, Gray, Black, Red, Maroon, Yellow, Olive, Lime, Green, Aqua, Teal, Blue, Navy, Fuchsia, Purple
  // ...
  LEDS.SetColor(Fuchsia);
  // ...

Getting started:

Easy. I followed the setup instructions and the example compiled right away. Just be careful with the default current limit set inside the library.

Sketch size:

 

Sketch uses 3,916 bytes (12%) of program storage space. Maximum is 32,256 bytes.

Global variables use 281 bytes (13%) of dynamic memory, leaving 1,767 bytes for local variables. Maximum is 2,048 bytes.

Tested with this minimal program that keeps the setup from the begin() method and calls the core methods.

 

#include <infineonrgb.h>
#include <Wire.h> // Include this in every new sketch.


InfineonRGB LEDS; // Create Object


void setup() {
  // put your setup code here, to run once:
  LEDS.begin(); // Cycle and set everything to zero.
  LEDS.SetDimmingLevel(0x0FFF); // Maximum Brightness
  LEDS.SetIntensityRGB(0x0FFF, 0x0000, 0x0000);
  LEDS.SetColor(Fuchsia);
}


void loop() {
}

 

 

beavertank ' library

Stephen published his library here: IoT Christmas Ornaments - The Software, Part 1. The libraryfiles are attached as a zip file to the post.

Installation is as simple as placing his .cpp and .h in the right location.I used the libraries\infineon_beavertank folder..

(You can find your own Sketchbook location by using the File -> Preferences menu. The folder is shown under the 'Sketchbook location:' label.)

API:

Setting up the library is quite similar to Peter Oakes'. The constructor doesn't make any pre-assumtions. You are expected to set up the parameters in your sketch. The API is clear and easy to understand.

There's a function for each of the shields parameters, and there are the functions to set RGB, and each of Red, Green and Blue.

The main difference between Stephen's lib and the other two is that it doesn't have predefined colours. No big deal.

 


Example:

You'll find the rgbshield_test.ino example in the same blog post. The example shows object creation, shield setup and a colour show.

It explains how to set limits, rates and levels, ...

a few highlights:

 

    while (RGB.on != 1) // Wait for shield to respond, keep setting the values till it does
    {
      RGB.setfade (0x0000); // Immediate fade
      RGB.setbrightness (0x0000); // 0% brightness level
      RGB.on = RGB.readbrightness(); // Request for brightness level
      if (RGB.message == 1 && RGB.on == 0) // If message received and dimming level = 0%, "message" is set in the I2CREAD function
      {
        RGB.message = 0;
        RGB.on = 1; // break out of loop
      }
    }

    RGB.I2CWRITE2BYTES (ADDRESS, OFFTIME_RED, 0x38); // Set off-time of red channel to 0x38 - good base value
    // ...
    RGB.I2CWRITE6BYTES (ADDRESS, CURRENT_RGB, 0x80, 0x80, 0x80); // Set current of red channel to 0x80 = 780mA - maximum safe current!
    RGB.setfade (0x002C); // Fade Rate between intensities
    RGB.setwalktime (250); // walk time between colors = (value)*0.01024 seconds = (here) 2s
    RGB.setrgb (0x0555, 0x0555, 0x0555); // low level White Light - indicates initialization is finished
    RGB.setbrightness (0x555); //Maximum brightness means intensity levels are used directly



    // ...
    //Set full green
  RGB.setrgb(0x000,0xFFF,0x000);
  //Pause until green reaches desired level
  while(gout != 0xFFF)
  {
   gout = RGB.readgreen();
  }
   // ...


    //Set half red half green
  RGB.setrgb(0x555,0x555,0x000);
    //Pause until green and red reach desired levels
  while(gout != 0x555 && rout!=0x555)
  {
   gout = RGB.readgreen();
   rout = RGB.readred();
  }

Getting started:

Easy. I followed the setup instructions and the example compiled right away.

Sketch size:

 

Sketch uses 5,846 bytes (18%) of program storage space. Maximum is 32,256 bytes.

Global variables use 404 bytes (19%) of dynamic memory, leaving 1,644 bytes for local variables. Maximum is 2,048 bytes.

 

Tested with this minimal program that does the setup and calls the methods  setXXX) and readXXX().

That takes care that the library's main functions are all linked in.

 

 

#include "rgbshield.h"
#include <Wire.h>


rgbshield RGB = rgbshield();


void setup()
{
    Wire.begin();

    while (RGB.on != 1) // Wait for shield to respond, keep setting the values till it does
    {
      RGB.setfade (0x0000); // Immediate fade
      RGB.setbrightness (0x0000); // 0% brightness level
      RGB.on = RGB.readbrightness(); // Request for brightness level
      if (RGB.message == 1 && RGB.on == 0) // If message received and dimming level = 0%, "message" is set in the I2CREAD function
      {
        RGB.message = 0;
        RGB.on = 1; // break out of loop
      }
    }

    RGB.I2CWRITE2BYTES (ADDRESS, OFFTIME_RED, 0x38); // Set off-time of red channel to 0x38 - good base value
    RGB.I2CWRITE2BYTES (ADDRESS, OFFTIME_GREEN, 0x39); // Set off-time of green channel to 0x39 - good base value
    RGB.I2CWRITE2BYTES (ADDRESS, OFFTIME_BLUE, 0x38); // Set off-time of blue channel to 0x38 - good base value
    RGB.I2CWRITE6BYTES (ADDRESS, CURRENT_RGB, 0x80, 0x80, 0x80); // Set current of red channel to 0x80 = 780mA - maximum safe current!
    RGB.setfade (0x002C); // Fade Rate between intensities
    RGB.setwalktime (250); // walk time between colors = (value)*0.01024 seconds = (here) 2s
    RGB.setrgb (0x0555, 0x0555, 0x0555); // low level White Light - indicates initialization is finished
    RGB.setbrightness (0x555); //Maximum brightness means intensity levels are used directly


  unsigned int rout = 0;
  unsigned int gout = 0;
  unsigned int bout = 0;


    //Set full green
  RGB.setrgb(0x000,0xFFF,0x000);
  RGB.setred(0x000);
  RGB.setgreen(0x000);
  RGB.setblue(0x000);
   gout = RGB.readgreen();
   rout = RGB.readred();
   bout = RGB.readblue();


}


void loop()
{


}

 

 

It's obvious from the review that all three libraries are easy to use. The differences between them are low.

All three make the start easier than the example of the Infineon Quick Start Guide.

And all allow you to use the important features of the board with a nice layer of abstraction and encapsulation.

I used the libraries to get my device running before I fully understood the shield.


That is my prefered way of learning.

I prefer having a working example that I can probe and play with, and dig into the details and principles behind it while having it on the bench. I'm quite poor at reading datasheets without having a running example.


Once you have the shield working with one of the three libraries, it's a good time to step a level down and look at the Infineon example and the explanation of the shields operation.

Next step may be to try and understand the on-board controller.

That's the end game of the board. It's there to drag you into Infineon's XMC1200 processor family and its LED driver module. Once you get to know how to use it with the Arduino, this is a great step to try and plug in a programmer and get the board working on its own.

A good starting point is shabaz 's RGB LED Shield from Infineon - Getting Started Guide.

  • infineon
  • iot_holidaylights
  • led
  • rgb
  • shield
  • Share
  • History
  • More
  • Cancel
  • Sign in to reply
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 © 2025 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

  • X
  • Facebook
  • linkedin
  • YouTube