Category Archives: LEDS

Charlieplexing on the Raspberry Pi

If you suddenly find the need to control many LEDs and do not have the requisite electronics to do so, you can turn to your single board computer, the Raspberry Pi (RBPi) and use it to charlieplex the LEDs.

Charlieplexing is named after Charlie Allen, the inventor of the technique. Charlieplexing takes advantage of a feature of the GPIO pins of the RBPi, wherein they can change from outputs to inputs even when the RBPi is running a program. Simply setting a GPIO pin to be low does not allow enough current to pass through an LED or influence the other pins set as outputs and connected to the LED.

Using Charlieplexing, you can control up to six LEDs with three GPIO pins. For this, you will need three current limiting 470Ω resistors on each GPIO pin. The program charlieplexing.py defines a 3×6 array, which sets the state and direction of the three GPIO pins. The state defines whether the pin is set as digitally high or low, and the direction defines whether the pin is an output or an input.

Since LEDs are also diodes, they will light up only if their anodes are at a higher potential than their cathodes are, and not otherwise. Therefore, to light up a single LED, the program has to set the pin connected to its anode as output and drive it high. Next, the program must set the pin connected to the anode of the LED as input, while it sets the third pin as output and drive it low. Various combinations of the state and direction of the pins will drive all the LEDs on and off sequentially.

The array in the program holds the settings for each GPIO pin. A value of 0 means the pin is an output in a low state, 1 means the pin is an output in a high state, and -1 means the pin is set as an input.

In charlieplexing, it is easy to calculate how many LEDs each GPIO pin can control. The formula for this is, LEDs = n2-n, where n is the number of pins used. According to the charlieplexing formula, three GPIO pins can charlieplex 6 LEDs; four pins can control 12 LEDs, while 10 pins would allow control over a massive 90 LEDs.

Charlieplexing is good for not only lighting one LED at a time, but it is capable of lighting more at the same time also. For this, the program must run a refresh loop to keep the desired state of the LEDs in the array. While refreshing the display, the program must turn on other LEDs that need to be on, before moving on to the next. However, persistence of vision plays a large part here, and the program must be sufficiently fast to make it appear that more than one LED is on at a time.

However, there is a downside to lighting more LEDs at a time. Since more number of LEDs are now on to make it appear that more than one LED is on simultaneously, each LED is actually lit for a lower amount of time, which makes each LED glow less than at its full brightness.

Dimming LEDs with PWM Generator

nlike incandescent bulbs, dimming Light Emitting Diodes (LEDs) is not an easy task. Incandescent bulbs operate on alternating voltage supply, whereby using Triacs, one can control the effective RMS voltage applied to the bulb. Moreover, since the incandescent bulbs are resistive elements, a simple reduction is voltage is sufficient to reduce the current through it, thereby reducing its light and heat output.

LED operation is different, as they work on direct voltage. Each LED requires an optimum load current to produce light, while dropping a fixed voltage across its terminals. Therefore, it is impossible to dim the LED light output by decreasing the voltage across it or by limiting its current load.

However, an LED responds much faster, switching on and off at a much higher speed than an incandescent bulb does. This feature allows switching an LED on/off rapidly to change its light output. For instance, if the LED is repeatedly switched on for the same amount of time that it is switched off, the resultant average intensity from the LED is halved. By continuously changing the ratio of the on-to-off period, the LED can be made to traverse from zero output to its maximum light output. Engineers call this technique the Pulse Width Modulation (PWM), and this has become the de facto mechanism for dimming LEDs.

Linear Technology makes different types of PWM controllers for LEDs, and they have designed the LT3932 for dimming a string of LEDs efficiently. A monolithic, synchronous, step-down DC/DC converter, the LT3932 utilizes peak current control and fixed-frequency PWM dimming for a number of LEDs connected serially.

The user can program the LED current of the LT3932 using an analog voltage, or control its duty cycle of the pulses from the CTRL pin. A resistor divider on the FB pin of the LT3932 sets its output voltage limit.

One can use an external clock at the SYNC/SPRD pin of the LT3932 to control the switching frequency, which is programmable from 200 KHz to 2 MHz. Alternatively, an external resistor connected to the RT pin can also serve the same purpose. To reduce EMI generated by the switching frequency, the LT3932 features an optional function of frequency modulation involving spread spectrum that varies the frequency from 100 to 125%.

The LT3932 features an external high-side transistor rated for 3.6-36 V, 2 A, and a synchronous step-down PWM LED driver for dimming an LED string. This uses an internal signal generator for controlling the analog PWM dimming in the absence of an external PWM signal. LT3932 regulates the LED current to ±1.5%, while regulating the output voltage to ±1.2%. The IC achieves a 5000:1 PWM dimming at 100 Hz, and the internal PWM achieves a 128:1 dimming ratio with a maximum duty cycle of 99.9%.

The LT3932 protects the LED string from open/shorts while offering fault indication, as it has an accurate LED current sensor with a monitor output. Along with thermal shutdown, the IC features an accurate under voltage lockout threshold and an open-drain fault reporting for open circuit and short-circuit load conditions. With its silent switcher topology, the LE3932 is well suited for several applications including automotive, industrial, and architectural lighting.

Blinkt! is Compatible with the Raspberry Pi

If you are interested in learning how to control RGB LEDs with the Raspberry Pi (RBPi) single board computer, Blinkt! provides a simple way to interface. Blinkt! is a strip of eight superbright RGB LED lights that you can connect to the RBPi without wires, so it is an easy way to start. Blinkt! Has a female connector that matches the male GPIO connector on the RBPi, and that allows the tiny LED board to sit atop the RBPi.

The RBPi can individually control each of the eight APA102 RGB LEDs on the Blinkt! board individually, so you can consider them as matrix of 1×8 pixels. The footprint of the board is tiny enough to allow it sit directly on top of the RBPi and the pair fits inside most of the Pi cases. Although the RBPi controls the eight LEDs with PWM, it does not interfere with the SBC’s PWM audio. Blinkt! comes fully assembled and is compatible with RBPi models 3, 2, B+, A+, Z, and ZW. Pimoroni, the manufacturers of Blinkt!, also provide a Python library for the users.

Combining Python programming and Blinkt! with the RBPi is a great way of understanding how RGB LEDs work and how a computer program controls their operation.

If you are using the RBPi3 for this project, it will already have the male GPIO on the board. However, the RBPiZ and RBPiZW may not have the connector, which means you may need to solder the connector to the board. You need to be careful when plugging the Blinkt! board onto the RBPi taking care to orient it in the right way. The Blinkt! board has rounded corners on one of its side, and this side should face the outside of the RBPi. Once you align the boards properly, push the Blinkt! board in and it should fit snugly on the RBPi.

To make the RBPi control the LEDs on the Blinkt!, it will need to have the right code. The best way to begin is to update the Operating System of the RBPi to the latest Raspbian. Once you have done this, and the RBPi is running, connect it up to the Internet and open the terminal on the RBPi screen.

Typing the code “curl https://get.pimoroni.com/blinkt | bash” without the quotes, should allow the RBPi to download the necessary Python libraries from the Pimoroni website. Now you can use the Python 3 IDLE code editor to use the library to write the Python program and control the LEDs.

While writing the Python program, you will need to begin by importing the Blinkt! library you had downloaded in the first step. Each LED is termed as a pixel so the parameter “set_pixel” allows you to address a specific LED, while “set_brightness” allows setting its brightness. The command “show” turns on the specific LED, and “clear” turns it off.

Even though the LEDs are numbered as 1 to 8 on the board, the program addresses them as 0 through 7. Therefore, the program can pick a light and tell it the color it needs to be, its brightness, and whether it should turn it on or off.

Connect with a New Type of Li-Fi

Many of us are stuck with slow Wi-Fi, and eagerly waiting for light-based communications to be commercialized, as Li-Fi promises to be more than 100 times faster than the Wi-Fi connections we use today.

As advertised so far, most Li-Fi systems depend on the LED bulb to transmit data using visible light. However, this implies limitations on the technology being applied to systems working outside the lab. Therefore, researchers are now using a different type of Li-Fi using infrared light instead. In early testing, this new technology has already crossed speeds of 40 gigabits per second.

According to the Li-Fi technology, a communication system first invented in 2011, data is transmitted via high-speed flickering of the LED light. The flickering is fast enough to be imperceptible to the human eye. Although lab-based speeds of Li-Fi have reached 224 gbps, real-world testing reached only 1 gbps. As this is still higher than the Wi-Fi speeds achievable today, people were excited about getting Li-Fi in their homes and offices—after all, you need only an LED bulb. However, there are certain limitations with this scheme.

LED based Li-Fi presumes the bulb is always turned on for the technology to work—it will not work in the dark. Therefore, you cannot browse while in bed in the dark. Moreover, as in regular Wi-Fi, there is only one LED bulb to distribute the signal to different devices, implying the system will slow down as more devices connect to the LED bulb.

Joanne Oh, a PhD student from the Eindhoven University of Technology in the Netherlands, wants to fix these issues with the Li-Fi concept. The researcher proposes to use infrared light instead of the visible light from an LED bulb.

Using infrared light for communication is not new, but has not been very popular or commercialized because of the need for energy-intensive movable mirrors required to beam the infrared light. On the other hand, Oh proposes a simple passive antenna that uses no moving parts to send and receive data.
Rob Lefebvre, from Engadget, explains the new concept as requiring very little power, since there are no moving parts. According to Rob, the new concept may not be only marginally speedier than the current Wi-Fi setups, while providing interference-free connections, as envisaged.

For instance, experiments using the system in the Eindhoven University have already reached download speeds of over 42 gbps over distances of 2.5 meters. Compare this with the average connection speed most people see from their Wi-Fi, approximately 17.5 mbps, and the maximum the best Wi-Fi systems can deliver, around 300 mbps. These figures are around 2000 times and 100 times slower respectively.

The new Li-Fi system feeds rays of infrared light through an optical fiber to several light antennae mounted on the ceiling, which beam the wireless data downwards through gratings. This radiates the light rays in different direction depending on their wavelengths and angles. Therefore, no power or maintenance is necessary.

As each device connecting to the system gets its own ray of light to transfer data at a slightly different wavelength, the connection does not slow down, no matter how many computers or smartphones are connected to it simultaneously.

OLED Lighting in the Auto Industry

In recent years, a number of industries have started using Organic Light-Emitting Diodes (OLEDs) in diverse ways. The automotive industry, in particular, has seen a huge potential in OLEDs. For instance, very soon Audi will be coming up with OLED taillights. At present Audi has presented prototypes of the taillights. At the LOPEC Congress, Audi provides advanced insights into the needs of the automotive industry that the deployment of OLEDs will require to meet, and the future of automotive lighting.

So far, there have been plenty of developments. At LOPEC, Audi demonstrated prototypes of their OLED taillights, which they claim have reached production stage. However, using OLEDs in vehicles has always been a challenge, although OLED lighting installations and table lamps have been around for a while, and these are in use in museums, clubs, and restaurants.

Difficulties of Using OLED in Automobiles

Major hurdles OLEDs have to cross when in use in automobiles are they have to withstand humidity, heat, cold, UV radiation, and constant vibration. All these can reduce the life span of OLEDs drastically. Audi claims to have solved this problem by encapsulating their displays hermetically, which they claim will make the displays as stable as LEDs.

Why Use OLED in Place of LEDs?

Regular LEDs act as point sources of light, and it requires substantial development work for generating an even light from them. On the other hand, OLEDs are evenly radiating sources of light, and they naturally produce a uniform illumination. Moreover, their thickness is only about a millimeter, which makes OLEDs more suitable for automotive design.

Designers find OLED appearance is high quality, both when off and on. This is because it has a simple and clean surface. As design is an important aspect of the automotive industry, it makes OLEDs ideal for such use. Most automobile owners expect a certain lifestyle from their vehicles, apart from its functional use of transportation from point A to point B.

However, for use as turn signals and brake lights, the light intensity from OLEDs is not adequate, and will have to be increased. The automotive industry is also working on using flexible OLEDs. At present many are using glass-based OLEDs, but these are rigid, and using plastic foil substrates as the base for OLED is opening up a whole new world of opportunities for the designers.

Audi is expecting LOPEC will open up a huge bandwidth of business and research institutes for them. They expect to hold discussions with specialists using this breadth of activity, and to meet other OLED manufacturers and materials developers.

What the Future Holds?

In about a decade from now, the world will be witnessing innovations in vehicle lighting that most can only dream about today. As it is, a vehicle’s lighting system already functions as a form of communication—hazard lights, turn signals, brake lights, for example. In the future, driverless cars will need to interact with others on the road with even greater sophistication. One of the visions Audi has is of a three-dimensional OLED display extending the entire tail of the vehicle, on the panel of the body, and integrated OLED within the windshield.

What is a QLED?

Recently, Samsung has announced their new TV technology using QLEDs to counter the OLED TVs that LG and others have put on the market. QLED stands for Quantum dot LED, and though Samsung has been using the concept of quantum dots in its TVs for quite some years now, they claim they will be bringing out several flavors of the QLED technology.

According to Samsung, QLEDs are transmissive, as LCDs are, and light goes through several layers to create an image on the surface of the screen. The company claims to be working on the ability of the QLEDs to overcome the challenges currently plaguing the OLEDs.

Although the Q part is currently demanding a premium in the price of Samsung TVs on the market, it will likely decrease in the future. According to Samsung, the QLEDs are bringing several advantages with reference to picture quality, such as higher light output and brighter colors. Samsung claims the light output in highlights is now 2,000 nits, a relative quick loss of peak luminance, and improvement of the delayed ramp-up.

Samsung compares their QLED performance with OLEDs and points out that the new quantum dots offer superior color, providing rich, fully saturated colors even for bright images. However, there is yet no independent testing to substantiate the claims of the company. Moreover, the claims cover only the high-dynamic range as against the standard dynamic range, where the OLED would be a superior performer.

While many observers claim to see better clarity and improved colors in the new TV technology, others fail to notice any difference. You can see QLEDs in Samsung TV model UE55KS9000, and in tablets such as Amazon Kindle Fire HDX 7, and HDX 8.9.

QLEDs contain quantum dots or microscopic molecules between two and 10 nanometers in diameter, which emit their own, differently colored light according to their size, when struck by photons or light particles. In the QLED TVs from Samsung, the dots are restricted to a film, and the LED backlight provides the illumination to light them up. This light then goes through other layers inside the display, which includes an LCD layer, ultimately creating the picture. As the light from the LED source passes through different layers before reaching the screen surface, the process is said to be transmissive.

The advantage of QLEDs is they can emit brighter, more vibrant, and more diverse colors—capable of making HDR content really shine—mainly due to their ability to achieve high peak brightness levels.

Compared to OLED TVs, it is more cost-effective to manufacture quantum dot TVs, which translates to better picture quality at a lower price. However, OLED displays still produce the deepest blacks, which means that OLEDs offer better contrast ratios. Therefore, while OLEDs offer true blacks, quantum dots offer great bright images.

QLED technology replaces the photoluminescent quantum dots with electroluminescent nanoparticles. Therefore, rather than coming from the LED backlight, light now comes directly to the display. Although the process is a lot similar to the light transference process within an OLED TV, within the QLED TV, individual pixels emit the light, thereby combining the best of quantum dots and OLED technology.

Multicolored LEDs Create Secondary Colors

Any student of physics knows mixing two primary color light sources produces a secondary color. For instance, mixing the primary colors red and green creates the secondary color yellow. There are three primary colors—Red, Blue, and Green. This process is easily seen in tricolor and RGB LEDs.

There is a disadvantage in this method. As two primary colors are necessary for generating a secondary color, two LEDs must remain turned on at the same time. Therefore, generating a secondary color means consuming twice the current a primary color requires. In battery powered circuits, the operating current of the LED indicator may be a significant fraction of the total current, and using the same current for generating both primary and secondary colors would be an advantage.

Using a sequencing method can generate balanced secondary colors from RGB, tricolor and bicolor LEDs, while using the operating current of a single LED. The sequencing method offers uniform intensities between the primary and secondary colors, and lower power dissipation. An added advantage of using the sequencing method with bicolor LEDs is keeping a simple pc-board layout with two pins while it produces three colors. Using the sequence method with RGB LEDs produces white light while consuming the operating current of a single LED.

The sequencing method works because it takes advantage of a property of the human eye. This is called persistence of vision, wherein images in the human eye persist for about sixty milliseconds after light from the object ceases to enter the eye. For instance, when a glowing coal is moved about in the dark, the eye sees a continuous red line.

When the human eye sees different primary colors flashed sequentially and quickly from one point, they appear to overlap in time, while the brain interprets the colors to be secondary colors, or, depending on the color components, even white.

Experiments with multiple primary-colored LEDs show that the above flash sequence should repeat every 25 milliseconds or lower, for the eye to treat the effect as a solid secondary color. In fact, the flash rate can go down to one microsecond, before the human eye can detect the degradation of the secondary color. Therefore, any clock source, say a convenient 40 Hz, should be adequate for creating secondary colors.

For the eye to properly see the mixed colors, the primary-color LEDs must be physically very close together, such as on a semiconductor chip. As an added advantage, diffused lenses are better, as this offers a wider viewing angle.

When using bicolor LEDs, the driver has to be bidirectional, as the LEDs are placed back-to-back in the chip. Moreover, currents for the three LEDs may have to be adjusted to achieve color balance between the primary and secondary colors. In addition, color balancing may be required also as LEDs have different intensities and efficiencies as the human eye sees them.

This correction can be done in one of two ways. As each LED has a current limiting resistor in series, the value of these resistors may be tweaked to achieve the necessary differentiation in individual currents. The other option is to keep the same current but tweak the duty cycle.

Dual Function LEDs & Multifunctional Displays

At the University of Illinois at Urbana-Champaign, researchers have made dual-function nanorod LEDs that could double as multifunctional displays. The researchers are also working with Dow Electronic Materials in Marlborough, Massachusetts. The LEDs are made of tiny nanorods arrayed in a thin film. They could enable new interactive functions and multitasking devices. The researchers report their advances in the February issue of the journal Science.

According to Moonsub Shim, Professor of materials science and engineering at the University, the new LEDs will enable displays to be much more interactive devices, rather than just displaying information as they do now. This might form the basis of several new and interesting designs for several types of electronic gadgets.

Three types of semiconductor materials make up the tiny nanorods, each of them less than 5 nanometers in diameter. The first type emits and absorbs visible light. The other two semiconductor materials control the amount of charge flowing through the first. This combination allows the LEDs to emit light, while sensing and responding to light falling on it.

By switching between the emitting and detecting modes very quickly, the nanorod LEDs can perform both functions with ease. In fact, they are so fast in switching—three times faster than the standard display rates—the display seems to be permanently on. Because the LEDs are simultaneously detecting and absorbing light as well, a display of such LEDs may be made to respond to light signals in different ways, simply by programming them suitably. For instance, a display could automatically adjust its brightness in response to ambient light conditions. Although a separate light level sensor does this for the present displays, the new display could do it by sensing the ambient light on each pixel.

According to Professor Shim, for someone sitting outside with a tablet, reading will be easier on the eye, as the tablet will adjust its brightness based on ambient light on individual pixels of the display. For instance, the part of the display under a shadow falling across it will be dimmer than the part directly illuminated by sunlight. This will help to maintain a steady contrast.

The researchers were able to program individual pixels adjust their brightness automatically in response to an approaching finger. This response, once integrated into interactive displays, could allow the display to respond to recognizing objects through non-touch gestures.

Writing or drawing with light would also be possible with such displays. This could form the basis of smart whiteboards, tablets, or other such surfaces, on which a laser stylus could write or draw. Moreover, the researchers have discovered the LEDs not only respond to light, they convert it to electricity as well.

They found the LEDs responding to light just as solar cells do. Therefore, apart from enhancing the interaction between users and displays, it is also possible to actually use the displays to harvest light, for instance, to charge the cellphone when it is simply sitting idle, collecting ambient light. That means there is no need of integrating a separate solar cell on the display.

Controlling RGB LEDs via the Raspberry Pi

Digital gates are great for switching LEDs on or off. Micro-controllers are even better and so are single board computers. That is because they contain several gates to control the LEDs. To top it all, you can program single board computers such as the RBPi or Raspberry Pi to control several LEDs individually to run at different on/off cycles. Additionally, multiple color LEDs are available, such as RGB LEDs, with which you can generate any combination of the basic red, green and blue colors.

Although the GPIO pins of the RBPi can switch on an LED, the pins cannot supply beyond their limit. Therefore, when driving LEDs from the GPIO pins, a current limiting resistor is necessary in series with the LED, to prevent the IO pin from being damaged. The resistance value will depend on how much current the IO pin can source or sink, and the supply voltage of the RBPi or LED.

The RBPi has a 40-pin GPIO header among which, you can control several pins through software. The most common use of external circuits and LEDs with GPIO pins is to indicate status visually. For example, you may be controlling a remote circuit with software, and an LED nearby can indicate its status. The LED lights up to indicate the remote circuit is powered.

It is a good thing that human eyes have something called the persistence of vision. When we see something, its image persists in our eyes for a brief time. Therefore, we can see flashing lights only when they are flashing relatively slowly. Beyond a certain speed, our eyes cannot make out the individual flashes and the flashing light looks as if it is steadily lit. Using a technique called PWM or Pulse-Width Modulation, and controlling the on time of a GPIO pin through software, we can make an RBPi drive an LED such that it looks as if the LED is breathing. Doing the same with an RGB LED, the RBPi can cycle the lights to produce any color in the rainbow.

You can build a simple RGB LED board with a single bright RGB LED, three current limiting resisters and a four-pin connector on a prototype PCB. RGB LEDs have four pins and come in two configurations, common cathode and common anode. In the common cathode configuration, the package combines the cathodes of all the three LEDs into a single pin with the anodes individually available. For the common anode configuration, all the three anodes are combined into one pin, while the cathodes are individually accessible.

To drive an RGB LED you will need to connect its individual anodes or cathodes to three GPIO pins through current limiting resistors. If you use a common anode RGB LED, you will have to connect its common anode to a supply voltage. For a common cathode RGB LED, you will need to ground its common cathode. Now, you can switch on an individual LED of the combination by switching on the corresponding IO pin. See this tutorial for writing simple Python scripts for controlling the LEDs via the RBPi.

Quadriplegics Can Control Exoskeletons with Their Brain

Artificial limbs help people who have lost a part of their arms or legs to regain partial functionality of their extremities. However, for those who have lost control of a major part of their bodies and thus rendered quadriplegic, artificial limbs are not of much use. For addressing such and other whole-body disabilities, exoskeletons are showing great promise.

Scientists working at the Technische Universitat Berlin and Korea University are creating such lower-limb exoskeletons. The control system here is completely hands-free. Rather, it is a brain-to-computer interface, which controls the exoskeleton, by decoding and making use of signals from the wearer’s brain. According to the researchers, volunteers who were given the exoskeleton to use took only a few minutes for learning to operate the system. Therefore, substantially paralyzed people may hope to walk again with the help of this exoskeleton.

Research on such exoskeleton systems is not new and several types are in development and in limited production in many parts of the world. However, most achieve controls by detecting subtle movements in the upper body of the wearer. However, the difference in the KU/TU Berlin unit is the control is entirely dependent on brain signals. Therefore, this is useable even by a completely paralyzed person.

The human brain generates different signals when the person stares at a specific LED. These signals are detected and interpreted to be used for controlling the hands-free exoskeleton. An EEG brain control interface connects wirelessly to the main computer of the control system.

In actual practice, the wearer stares at any one of five flashing LEDs. This initiates waves in the wearer’s brain and an electroencephalogram or EEG worn as a cap reads the signals. Because each LED flashes at a different rate, focusing on any one at a time produces a specific signal pattern in the brain of the user corresponding to a desired mode of movement. The computer system interprets the readings of these signals sent to it from the EEG cap and converts them to system instructions for operating the exoskeleton.

As this method of control does not require detection of movement from any other body part, it is eminently suitable for even those who have lost the capacity for voluntary body control, except for eye movements. Ordinarily, such people would not be able to use or control a standard exoskeleton. According to the researchers, their system has a much better signal-to noise ratio.

The brain generates signals depending on external signals it receives from its surroundings. This acts like noise to the actual control signal desired for movement. By concentrating on a flashing LED, the researchers are effectively separating the user’s brain control signals from being cluttered with external stimuli. The result is a more accurate exoskeleton operation than what a conventional hard-wired system could have achieved.

Exoskeleton systems are notorious for creating loss of electrical noise, especially affecting the EEG signals. However, the frequency of the flickering LED acts as a filter to separate the EEG signal effectively. This exoskeleton system helps people with high spinal cord injuries or those with motor neuron disease who face difficulties in communicating or using their limbs.