3 LED Crossfade with PWM and Arduino

3 LED Crossfade with PWM and Arduino (2)

This ones quite simple, just mix/ crossfade 3 separate LEDs using Phase Width Modulation (PWM) and Arduino.

You will need 3 LEDs, I’m using a 5mm Red, Green and Blue so I can make the full light colour spectrum (When all combined they make white light). If you look at an LED you will see one pin is slightly longer of the 2, this is the positive (+) terminal, the shorter being negative. Make sure you get the LED the right way round.

3 LED Crossfade with PWM and Arduino (2)

You will also need 3 220 Ohm resistors to ensure that the LEDs dont get too much voltage/current. these have the following colour code: Red, Red, Brown, Gold. If you use a higher value such as 1 Kiloohm (1ooo Ohms) the LEDs will appear dim as they won’t get enough power. Unlike the LED it doesn’t matter which way round you use the resistors. I generally would recommend getting a kit of different types of resistors like this one here as its useful in the long run.

You will also need some jumper wires and you also need to have an Arduino board and know how to upload a sketch.

So a quick look at this basic circuit:

The Arduino board supplies the power to the LED via the digital PWM pins, meaning for this we don’t need to use the 5v pin. By using the chip and PWM to regulate the power, basically its a fancy way of saying we’re blinking the LED, we can effectively alter the brightness of the LED. So alot of the hardwork and potential coding we would need to do is taken care of for us.

I connect each digital pin (9,10 & 11) to an LED – I’ve used corresponding coloured wiring for this, e.g. red wire, red LED. I’ve placed a resistor between the wire and the LED to ensure that it doesn’t get too much juice. I then connect the negative pin of each LED to the negative rail on the breadboard and then that goes to the GND pin on the Arduino board completing the circuit.

Here’s my final circuit below, I’ve added a few labels to show you where thigns are connected and the +/- for the LEDs I’ve also added a few lines so you see where things line up.


Read more: 3 LED Crossfade with PWM and Arduino

Leave a Comment

Your email address will not be published. Required fields are marked *