Thursday, July 9, 2020
Home Raspberry Pi Sensors LED modules for Raspberry PI, Arduino

# LED modules for Raspberry PI, Arduino

Everything you need to know about LEDs to get started.

One of the downsides of ordering your kits from China is poor labelling. The set came with a picture sheet of low quality, half-written in Chinese, with an English translation made by Google. This makes the modules harder to recognize, especially when some can look similar to others. To make things little more confusing, only 1 out of 3 kits I have received was labelled at all. It took me a little while to spot the difference between the boards and figure out how they work.

## LED

This is the baseline module with a one colour LED – mine are green. If you pay attention to the picture, you will see that there are 3 pins coming out from the PCB. This is when my confusion started. You don’t need to be a genius to google a few things out and see that there are 2 pins needed for a LED: Voltage and ground.

We have an SMD resistor present,  labeled as 103 = 10*10Ω  – pretty heavy resistor. I poked the board around to check what’s up with this. Conclusions are as follows:

Further testing got more answers in regards to the 2 modules I have. Despite being very similar in appearance, modules are not the same. Investigating LED itself in a close up reveals the difference. One (with 3 small connections inside) is a 2 pin RGB LED, the other one (with only one connection inside) is a normal LED.

Applying changeable voltage to the RGB LED from my multi-meter caused the light to turn automatically and oscillate between Red Green & Blue. To control the colors of this one, we would need a  PWM timer. Something we will discuss next time.

As you can see, it is totally possible to connect this LED bypassing the resistor.  Something to bear in mind!, Initially presence of the resistor made me feel pretty relaxed about connecting this directly to my board. Mistakes could have been made, but I took some time off and decided to learn basics before I will play more with components.
Although this PCB is labeled, looking at the LED itself you can recognize the cathode.  Asymmetric construction of two elements inside allows us to recognize it – it’s the pin connected to a thinner semiconductor fragment.

## BI-coloured LED

This one is less confusing, 2 colour LEDs are practically two LEDs fused together. You can see this in the design of the LED. Although dimmed, is symmetrical inside, so rule from above about recognizing cathode won’t apply, but also there is no need for that.

The middle pin is the ground, and pins 1 and 3 are anodes. (if your LED has common cathode, there are LEDs with common anode as well). Depending on the direction of the current, you’ll get different colours. The design of the board is also counter intuitive, with the ground pin being shifted to the left.  On board, we have present SMD LED (red) and 102 resistor (1000Ω) . LED itself is capable of displaying 3 colours, as you can drive current from both anodes together to get the 3rd state.

Let’s have a look at the diagram, sadly the schematic has no dedicated symbol for bicolour LED, but the symbol used, reflects the design well enough. My first thought was when I looked at the PCB, if I can run the current both ways, shouldn’t this have 2 resistors: one on each anode?

Despite having a resistor on board, the LED isn’t protected.  If the voltage is too low to meet the Forward Voltage of the DA2  current is led to L1, limited by R2 and opposite anode becomes the ground.  If the voltage meets the correct value, the LED emits light. This means you should be using a resistor on each anode to limit the current.

## RGB LED (Red & Green)

Finally, we get a break here. These are well labeled, and PCB is put together in a coherent manner. The basic design is simple, we get common cathode and 3 anodes to drive the current in. (LEDs with common anodes are also available). Each corresponds to specific colour value Red, Green, Blue. My modules share common cathode,  (marked as GND).  Both designs require you to regulate the resistors linked to the each RGB channel, so unless you aim for a specific colour a potentiometer would be a great touch.

The SMD design has no resistors on it, and the traditional design comes with 1000Ω on each channel. You should use a resistor with the SMD design.

## Usage

LEDs are one of the more forgiving components in terms of voltage,  given correctly added resistor, you would be able to connect up to 12V to a single LED. It is the current that matters. Before we get to that – let’s talk about voltage.

Forward voltage is a value in Volts required to pass through the LED – remember the LED is still a diode, and as one has diode’s characteristic.

Voltage drop is a value in Volts that represent the loss of potential, in optimal conditions, using the correct resistor.

These values vary per LED type, the semiconductor used, LED size and colour. Forward Voltage can range between 1.7V to over 4V, and the Voltage drop can range from 1.6V to over 4V as well. These values are provided in data sheets and are taken under correct conditions and with the correct current being used.

This matters greatly once you start to connect multiple LEDs together: A quick note here, don’t try to connect LEDs directly in a parallel circuit. It is unlikely that any given LEDs even from the same batch have the same Voltage dropping value, leading to an uneven current split. While you may get away with splitting 20mA across 2 LEDs without causing any damage, the situation where the current needed is bigger can cause one side of the circuit to be overloaded. Use a resistor for each string in a parallel configuration.

## Current – know your enemy!

LEDs are very sensitive to current. Although higher than suggested current won’t kill a LED instantly, it will cripple its lifespan. Ideally, you should aim for 10-20mA of current per LED. This leads us to a very important element in the LED circuit – resistor.

The resistor can be placed before or after the LED, and it will be still in line with Kirchhoff Law. Adding a resistor to the circuit is crucial to reduce the current hitting the LED, which can cause LED overheating and damage. To calculate the correct resistance we follow the equation:

R = (Vs -Vled)/Iled

Calculating current for simple LED is straightforward, if you are planning on daisy chain LED, and link them in parallel strings you may want to refer to more sophisticated calculators. Take the results and diagrams with a grain of salt, as not all wizard-made solutions will be 100% correct, especially when you are using the battery as a source power, or dozens of LEDs. The value of resistance should be rounded up to the nearest resistor available, so for 190 Ohms, the closest available is 220 Ohms.

### Power dissipation

The last thing to remember, when working with LEDs and resistors, is the ability to dissipate the heat.  Good old Ohm comes to the rescue again.

Knowing the LED voltage drop, we know the total Voltage drop of the load: if you are using 6V supply and your LED needs 2V, your total V = 4V. We also know the current of the LED needed: let’s say it is 0.5mA. Using these values with the equation from above will give us 8 Ohms. What rating of the resistor should be applied?

P=V×I

Our example gives us P= 4V* 0.5A= 2W,  therefore our resistor should be able to handle more than 2W of Power. Aim for the next up available from a manufacturer.

This sums up all the LED modules I have received in the packages. With no datasheets available, some testing and multi-meter action are required, but I’m pretty sure I can use similar values to most common components with their datasheets available.

### PayPal

Nothing says "Thank you" better than keeping my coffee jar topped up!

### Patreon

Support me on Patreon and get an early access to tutorial files and videos.

### Bitcoin (BTC)

Use this QR to keep me caffeinated in style with crypto-currency

### How to use Raspberry PI as WOL (wake on lan) server

0
While you could wake up your PC from a mobile directly, having a dedicated server capable of doing so is the best solution. The reason is simple. You can hook up as many devices as you wish with a single endpoint. This is why Raspberry Pi is perfect for this.

### Free wireless doorbell (Amazon Dash button hack)

0
The most terrifying situation I can imagine* is missing a parcel

### Raspberry Pi NAS: (NAS-pi) Modding like a boss #part2

0
Plex and RAID1 NAS drive build log

### MagPi – auto-downloader

0
Grab each edition of Mag Pi as soon as possible!

### How to boot Raspberry Pi 4 from USB

0
How to set up and boot Raspberry Pi 4 from USB drive - headless guide.

### Raspberry Pi Zero, Raspberry Pi 3A+ WiFi without keyboard or cables

0
Getting Raspberry Pi boards connected in seconds

### Everything you need to start using JSON

0
It's JSON not Jason, just saying!

### How to use Join App in NodeRED

0
The day finally comes where Join app is almost everywhere!

### Driving LCD with Arduino and Raspberry Pi

0
Displaying things on an LCD screen is as easy as going through a cup of jellybeans while writing this tutorial!