Skip navigation

I recently came across this "Instructable" in which the user ahmedelsayed93 has created a project to detect obstacles in front of an ultrasonic sensor using Arduino Uno board. What is so great about it you ask, the video shows the ultrasonic sensor mounted on top of a servo motor to make a Radar detector and the plot on his screen makes it look like the radar images we see in movies and weather channels .


The servo motor is controlled using an Arduino Uno which is communicating the sensor information serially to MATLAB and the data is plotted using MATLAB's built-in visualization functions.



Feel free to comment/provide suggestions to improve upon this project, I might incorporate them on my new software defined radio project that tracks airplanes.

Note: This is the final part in a three-part series about the Infineon RGB LED Shield. Part 1 covered how to get started with the RGB LED Shield and Part 2 covered a white LED lighting project.



Part 2 in this series of posts covered white lighting using the Infineon RGB LED Shield. The light was controlled with a variable resistor connected to an on-board analog-to-digital converter. This Part 3 covers color lighting with this Shield.


The Infineon RGB LED shieldInfineon RGB LED shield is a very low cost Arduino-shaped board designed for lighting applications and can operate three different sets of lights per board for a massive 100W of LED lighting – ideal for home, commercial and industrial lighting applications.


This project covers the design of a full color lamp for home use; I used it to drive LEDs with 40W of power which was ideal for splashes of color. The photo here shows it on a tripod stand. The lamp head is about 6 inches in diameter with 36 LEDs.



Here are some example photos taken with this lamp with normal incandescent room lighting on at the same time, and no white balance corrections:

A white rose in green light:



Same flower in yellow light:



Same flower in a very purple light:



These images are not subtle, especially the last one which is very extreme (I was just interested in testing the lamp); the output was set to maximum saturation although unsaturated pastel-type colors are possible with this project too.


Although the RGB LED Shield as supplied is intended for connecting to an Arduino, I used it solo. It does not need an Arduino, and can be programmed to operate standalone.


Here is a brief graphic outline of the project:



What is “Deep Color”?

Deep Color means the capability to produce billions of colors. This is important for lighting because humans can detect 10 million or more colors and studies suggest women may detect closer to 100 million (although some studies include brightness) and therefore 8-bit pulse width modulation (PWM) dimmed LED lighting (for a combined total of 24 bits for RGB) which is extremely common cannot produce seamless transitions when lights are dimmed – individual levels are discernible. One example is the neopixel-style LEDs – they are easy to drive, but have 8-bit levels per color. There are microcontrollers with 10-bit or higher PWM capability and they would be more suitable for LED lighting effects. The Infineon RGB LED Shield offers 12-bit PWM capability (total 36 bits for RGB), for 68 billion colors.


Assembling the Lamp

The LED array is an old, discontinued model manufactured by Dialight and it uses Lumiled LEDs.  There are 12 each of red, green and blue LEDs (total 36) each covered with a lens. The assembly has a metal clad PCB that needs to be connected to a heat sink.



There are more modern LEDs and arrays with higher efficiency. The efficiency is very important not just to save energy, but also to ease heatsinking requirements. The heat sink is extremely important for power LEDs; an increase in temperature affects the light output (the color will change!) and also reduces the lifetime of the LED. The LED array did not come with a heat sink; a very primitive one was machined from aluminium.  It is a simple shape and will not be as effective as commercial heat sinks. A grommet was used to protect the cable from being damaged by heat or sharp edges.



The photo below shows the side that was mated to the LED array board. A thin layer of heat sink compound was used.



Building the Test Bed

Bare wires and boards can be a dangerous thing when high voltages and currents are present. It is worth spending some time building a robust test bed with reduced risk of wires getting entangled or boards shorting against metal objects.


I used a plastic base board available from Problemchild designed for holding popular microcontroller boards. I drilled a hole in it for a rotary encoderrotary encoder, and connected it to the RGB LED Shield. The plastic base board was held at an angle using a custom plastic stand. The LED array connected to the heat sink can be seen in the foreground.



The rotary encoder (visible on the left in the photo above) is a device that has a spindle that can freely rotate with no restriction or limit. Outputs from the encoder are in the form of two logic level signals that are summarised in the diagram below as the spindle is rotated clockwise or anti-clockwise.



One way to process the signals is to connect them to interrupt-capable input pins on the microcontroller. For more detail check out jancumps series on rotary encoders.


The photo below shows the wiring in detail. The yellow and orange wires are the two signals from the rotary encoder. The blue and green wires are connected to a push button (the rotary encoder has one built-in; the spindle can be pressed). The rotary encoder is connected to the regulated 5V supply available on the Shield board using the red and black wires.



The entire project was powered using a 48V supply (wires are visible at the top of the photo above). The white wire visible on the right side is not used; it is a temporary connection to an oscilloscope and is used to adjust the RGB LED Shield parameters which control how much current is driven through the LED array. See Part 1 and Part 2 for details on this. With the hardware complete, I was ready to start developing the software that would run on the RGB LED Shield (code will be published in a few days after some tidying up). See Part 1 for details on the compiler and development environment.


Control Method

The white LED project in Part 2 used a variable resistor to control the brightness. This worked great. However with 68 billion colors on offer, a variable resistor doesn’t cut it. Push buttons are an option but too many buttons would be awkward for wall use. A far more usable option is an optical rotary encoder. I used an encoder from Bourns that has a built-in push button too for added flexibility in designing the human-to-machine interface.


One method of adjustment could be to independently set the red, green and blue levels either using three rotary encoders or pressing a button to select the function for a single rotary encoder.


Setting RGB values is unnatural however; a better method is to set the color in terms of hue, saturation and value quantities (known as HSV); the easiest way to visualize this is to examine the diagram below (image source: Wikipedia) which shows a cut-away cylinder.


If you were to walk around the edge of the cylinder on its top face, the colors (or hues) green, yellow, orange, pink, purple and so on would be traversed. These represent one dimension of configurability that can be achieved with a rotary encoder.


A second dimension would be the color saturation; the center of the cylinder has no color and is white at the top of the cylinder, and black at the bottom. Adjusting the saturation with another rotary encoder would allow traversal from a pure hue (on that top edge of the cylinder) to pure white, which would be represented by walking to the center of the top surface of the cylinder.


A final rotary encoder could be used to set the overall brightness level and this is represented in depth of the cylinder. The lower face of the cylinder is black, i.e. all LEDs fully turned off.



It was decided to use the push button capability of the Bourns rotary encoder to select between hue, saturation and value attributes. The rotary encoder could then be turned to adjust the chosen attribute.


The hue, saturation and value (HSV) control method is ideally suited to the Infineon RGB LED Shield because it contains an on-board ARM Cortex-M0 processor with sufficient power to be able to implement the algorithm. Floating point numbers are used for the algorithm (no attempt was made to optimise it) and are finally converted into 12-bit range integers used to drive the LEDs.


68 billion is a massive number, and a method is needed to be able to rapidly home in to a desired setting. One solution is to accelerate the attribute (hue, saturation or value) adjustment based on the speed that the user rotates the shaft. A non-linear relationship is required between spindle rotation speed and the rate of change of the parameter. The diagram below indicates the feature which was implemented, along with a straight line to indicate the normal linear relationship which the rotary encoder exhibits. The diagram below has no values marked; the specific settings were adjusted based on trial-and-error until it felt natural.



The short (50-second) video below (of the Dark Side appropriately) shows the result when the rotary encoder is turned by hand.  The hue is shown being adjusted in the video (the saturation is set to maximum throughout the video). The color transition is smooth with zero perceived artefacts; any unevenness in the video is due to uneven speed in rotation of the spindle by me, or the video encoding (the video does not have 36-bits per pixel capability) or due to streaming.



The Infineon RGB LED Shield makes it extremely easy to build high power lighting projects. No additional components were needed for this project apart from the power supply, the rotary encoder and the LEDs. The user interface is important and one example method is to employ hue, saturation and value (HSV) adjustment using an optical rotary encoder. The ARM Cortex-M0 processor was ideal for implementing the HSV algorithm. (Note: The project source code will be published in a few days after tidying up).


This is the last post in the mini-series, but as next steps, the ability to be able to wirelessly control the LEDs would be worth investigating, as would enclosing the electronics in a case.

Filter Blog

By date: By tag: