Warning: Declaration of Db::query($query) should be compatible with mysqli::query($query, $resultmode = NULL) in /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php on line 29

Deprecated: Function get_magic_quotes_runtime() is deprecated in /var/www/u1300519/data/www/acoptex.com/_lib/CacheLite/Lite.php on line 757

Deprecated: Function get_magic_quotes_runtime() is deprecated in /var/www/u1300519/data/www/acoptex.com/_lib/CacheLite/Lite.php on line 757

Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php on line 64

Warning: mysqli_fetch_array() expects parameter 2 to be int, string given in /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php on line 64

Deprecated: Function get_magic_quotes_runtime() is deprecated in /var/www/u1300519/data/www/acoptex.com/_lib/CacheLite/Lite.php on line 757

Deprecated: Function get_magic_quotes_runtime() is deprecated in /var/www/u1300519/data/www/acoptex.com/_lib/CacheLite/Lite.php on line 757

Warning: Cannot modify header information - headers already sent by (output started at /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php:0) in /var/www/u1300519/data/www/acoptex.com/_config/config.php on line 168

Warning: session_start(): Cannot start session when headers already sent in /var/www/u1300519/data/www/acoptex.com/_config/config.php on line 169

Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php on line 92

Warning: mysqli_fetch_array() expects parameter 2 to be int, string given in /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php on line 92

Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php on line 64

Warning: mysqli_fetch_array() expects parameter 2 to be int, string given in /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php on line 64
jobs.html_title
0

members

Easy Basics: Project 075h RGB LED

of Acoptex.com in UNO

Basics: Project 075h

Project name: RGB LED

Tags: Arduino Uno, RGB LED

Attachments: sketch

In this project, you needed these parts (Dear visitors. You can support our project buy clicking on the links of parts and buying them or donate us to keep this website alive. Thank you):

1.Arduino Uno R3 (you can also use the other version of Arduino)

2. Arduino IDE ( you can download it from here  )

4.Jumper cables F-M

5. Resistor 3 pcs (220 Ohm each)

6. RGB LED 1 pc

7. Breadboard 1 pc

General

We will learn how to connect RGB LED to Arduino board and use it.

Understanding the RGB LED

What are LEDs? 

LEDs are light emitting diodes. These are electronic components that convert electrical energy directly to light through the movement of electrons within the material of the diode. LEDs are important because due to their efficiency and low energy, they are beginning to replace most conventional light sources.

 

What does RGB LED mean?
 
RGB LED means red, blue and green LEDs. RGB LED products combine these three colors to produce over 16 million hues of light. Note that not all colors are possible. Some colors are “outside” the triangle formed by the RGB LEDs. Also, pigment colors such as brown or pink are difficult, or impossible, to achieve.

 

What does RGB LED mean? 

RGB LED is a combination of 3 LEDs (red, blue and green LEDs) in just one package. RGB LED products combine these three colors to produce over 16 million hues of light. Note that not all colors are possible. Some colors are “outside” the triangle formed by the RGB LEDs. Also, pigment colors such as brown or pink are difficult, or impossible, to achieve.

There are common anode RGB LEDs and common cathode RGB LEDs. See the Common cathode (-) below:

See the coomon anode (+) below:

As you can see, the 3 LEDs can share the cathode or the anode. This results in an RGB LED that has 4 pins, one for each LED, and one common cathode or one common anode. The common anode RGB LED is the most popular type.

How to create different colors?

You can create one of those three colors – red, green or blue – by activating just one LED.

For example, if you want to produce red, you activate the red LED and turn off the other two.

To produce other colors, you can combine the three colors in different intensities. To generate different colors you can use PWM to adjust the brightness of each LED.

As the LEDs are very close to each other, we can only see the final colors result rather than the three colors individually. To have an idea on how to combine the colors, take a look at the following chart. This is the simplest color mixing chart, there are more complex color charts on the web.

Signals and connections of the 

RGB LEDs have 4 pins which can be distinguished by their length. The longest one is the ground (-) or voltage (+) depending if it is a common cathode or common anode LED, respectively.

The operating voltage of the LED is 1.8V and the operating current is 10mA-20mA. The Arduino Uno board can supply 5V or 3.3V power. We will use 5V for this project, so the minimum resistance of the current limiting resistor should be (5 V to 1.8 V)/20 = 160 Om. The 220 Om is suitable and you can also choose other resistors that meet the condition. The larger the resistance is, the dimmer the LED will get.

Wiring

The following picture shows the needed connections with the Arduino Uno 

We are using the common anode RGB LED here.

Step by Step instruction

  1. Do wiring.
  2. Open Arduino IDE.
  3. Plug your Adruino Uno board into your PC and select the correct board and com port
  4. Open, verify and upload the sketch to your Adruino Uno.
  5. Open up serial monitor and set your baud to 9600 baud.
  6. The RGB LED will appear red, green, and blue first, then red, orange, yellow, green, blue, indigo, and purple.

Summary

We learnt how to connect RGB LED to Arduino board and use it. 

Libraries:

  • No libraries required

Sketch:

  • See attachment on the begining of this project


Other projects of Acoptex.com
Medium Basics: Project 083w Sipeed Maixduino board - Using PlatformIO IDE of Acoptex.com in Sipeed Maixduino 08-08-2019
Medium Basics: Project 083e Sipeed Maixduino board - Uploading MaixPy of Acoptex.com in Sipeed Maixduino 04-08-2019
Medium Basics: Project 083f Sipeed Maixduino board - Using MycroPython of Acoptex.com in Sipeed Maixduino 04-08-2019

jobs.published_at
jobs.viewed