• Skip to main content
  • Skip to primary sidebar

Homemade Circuit Projects

Get free circuit help 24/7

New Projects | Privacy Policy | About Us | Contact | Disclaimer | Copyright | Videos 

Op Amp Basics | 555 Circuits | Hobby Circuits | LED Driver | For Beginners | Basic Circuits | Transistor Circuits | Voltage Regulators 

You are here: Home / Arduino Engineering Projects / Arduino RGB Flowing Sequential Light Circuit

Arduino RGB Flowing Sequential Light Circuit

Last Updated on June 1, 2019 by Swagatam

This Arduino RGB sequential light generator circuit will generate a smooth flowing red, green blue pattern over the connected RGB LED.

The LED used here is a four pin 30mA RGB LED, common anode type, meaning the common pin for this LED will need to be assigned a continuous positive for the required operations. The LEDs that are specified as common cathode require a continuous negative or ground for the RGB illuminations.

The hardware required for this project:

One Arduino UNO board.
One 220 ohm, 1/4 watt resistor
One RGB, 5mm, 30 mA LED (common anode type)
Link Wires
Soldering iron,
9V adapter AC/DC

caution electricity can be dangerous

The connection details of the proposed RGB LED sequential light circuit using Arduino can be seen in the above diagram.

The connections are pretty easy to implement, just insert the LED leads to the Arduino burg pinouts, switch the the power socket and visualize the RGB LED running the red, green, blue illuminating in a sequential manner.

The code is fully customizable as per the individual preferences and selections,

Code:

Then sketch code for this RGB LED sequential flowing light circuit can be found as given below:

/*
RGB LED color flow
Displays a [fairly] smooth
sequence of colors on an RGB LED

by Jeremy Fonte
Copyright (c) 2012 Jeremy
Fonte.  All rights reserved.
This code is released under the
MIT license:

https://opensource.org/licenses/MIT*/

int r = 0;
int g = 0;
int b = 0;

int ri = 1;
int gi = 3;
int bi = 2;

// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as
an output.
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);

digitalWrite(9, HIGH);
}

// the loop routine runs over and over again forever:
void loop() {
r = r + ri;
g = g + gi;
b = b + bi;

if(r > 255) {
r = 255;
ri = -1 * random(1, 3);
}
else if(r < 0) {
r = 0;
ri = random(1, 3);
}

if(g > 255) {
g = 255;
gi = -1 * random(1, 3);
}
else if(g < 0) {
g = 0;
gi = random(1, 3);
}

if(b > 255) {
b = 255;
bi = -1 * random(1, 3);
}
else if(b < 0) {
b = 0;
bi = random(1, 3);
}

analogWrite(8, r);
analogWrite(10, g);
analogWrite(11, b);
delay(20);
}

You'll also like:

  • 1.  Make this 7 Segment Digital Clock with Beep Alert Circuit
  • 2.  Neon Tube Driver Circuit
  • 3.  Introduction to EEPROM in Arduino
  • 4.  Mobile Phone Controlled Robot Car Using DTMF Module
  • 5.  Converting Analogue to Digital (Analogue Read Serial) – Arduino Basics
  • 6.  Introduction to I2C LCD Adapter Module

About Swagatam

Swagatam is an electronic engineer, hobbyist, inventor, schematic/PCB designer, manufacturer. He is also the founder and the author of the website: https://www.homemade-circuits.com/, where he loves sharing his innovative circuit ideas and tutorials.
If you have any circuit related queries, you may interact through comments, and get guaranteed replies from the author.



Primary Sidebar

Categories

  • 3-Phase Power (15)
  • 324 IC Circuits (19)
  • 4017 IC Circuits (52)
  • 4060 IC Circuits (27)
  • 555 IC Circuits (99)
  • 741 IC Circuits (20)
  • Arduino Engineering Projects (83)
  • Audio and Amplifier Projects (126)
  • Battery Chargers (83)
  • Car and Motorcycle (96)
  • Datasheets (78)
  • Decorative Lighting (Diwali, Christmas) (33)
  • Electronic Components (101)
  • Electronic Devices and Circuit Theory (36)
  • Electronics Tutorial (121)
  • Fish Aquarium (5)
  • Free Energy (34)
  • Fun Projects (14)
  • GSM Projects (9)
  • Health Related (22)
  • Heater Controllers (31)
  • Home Electrical Circuits (107)
  • How to Articles (20)
  • Incubator Related (6)
  • Industrial Electronics (28)
  • Infrared (IR) (40)
  • Inverter Circuits (98)
  • Laser Projects (13)
  • LED and Light Effect (98)
  • LM317/LM338 (22)
  • LM3915 IC (25)
  • Meters and Testers (69)
  • Mini Projects (150)
  • Motor Controller (69)
  • MPPT (7)
  • Oscillator Circuits (25)
  • PIR (Passive Infrared) (9)
  • Power Electronics (35)
  • Power Supply Circuits (86)
  • Radio Circuits (10)
  • Remote Control (50)
  • Security and Alarm (66)
  • Sensors and Detectors (132)
  • SG3525 IC (5)
  • Simple Circuits (75)
  • SMPS (29)
  • Solar Controllers (63)
  • Timer and Delay Relay (55)
  • TL494 IC (5)
  • Transformerless Power Supply (9)
  • Transmitter Circuits (42)
  • Ultrasonic Projects (17)
  • Water Level Controller (45)

Calculators

  • AWG to Millimeter Converter
  • Battery Back up Time Calculator
  • Capacitance Reactance Calculator
  • IC 555 Astable Calculator
  • IC 555 Monostable Calculator
  • Inductance Calculator
  • LC Resonance Calculator
  • LM317, LM338, LM396 Calculator
  • Ohm’s Law Calculator
  • Phase Angle Phase Shift Calculator
  • Power Factor (PF) Calculator
  • Reactance Calculator
  • Small Signal Transistor(BJT) and Diode Quick Datasheet
  • Transistor Astable Calculator
  • Transistor base Resistor Calculator
  • Voltage Divider Calculator
  • Wire Current Calculator
  • Zener Diode Calculator

© 2023 · Swagatam Innovations