• 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 | Circuits for Beginners | Basic Circuits | Hobby Projects | Transistor Circuits | LED Drivers 

You are here: Home / Arduino Engineering Projects / Arduino Random RGB Light Generator Circuit

Arduino Random RGB Light Generator Circuit

Last Updated on September 5, 2019 by Swagatam

caution electricity can be dangerous

The  article discusses a simple,Arduino red, green, blue LED light effect generator circuit in a random pattern.

In one of the earlier posts we came across a similar RGB LED effect generator circuit using Arduino which was programmed to produce the effect in a flowing sequential manner, whereas here the set up can be expected to generate randomly changing RGB LED effect.

Hardware Required

What you will need for making this system:

1) An Arduino Board

2) A RGB LED

3) A 220 Ohm 1/4 watt resistor

4) A 9V AC to DC adapter Unit

Once you have acquired the above units, it's just about programming the Arduino IC with the following sample code, and subsequently integrating the LED, resistor and the power supply with the Arduino board as shown below:

Arduino Random RGB Light Generator Circuit

How to Wire Arduino with LED

The set up appears to be exactly similar to our previous RGB Arduino project, yes it is so, except the program which has been now changed for generating a random RGB LED light effect rather than the earlier sequentially flowing RGB color effect.

The LED used here is a 5mm 30 mA RGB LED, which is supposed to produce pretty high illumination, however for operating more nummer of LEDs from the same set up you may have to use transistor drivers across the pin#8, 10, 11, which may allow you you to add many RGB LEDs in parallel with the proposed random color effect.

The Code

The sample code for the above explained Arduino RGB color generator circuit is furnished below:

*
RGB LED random
color
Displays a
sequence of random 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
*/
//one variable for each of red, green, and blue
int r = 0;
int g = 0;
int b = 0;
// the setup routine runs once when you press reset:
void setup() {
// initialize
the four digital pins as outputs.
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 = random(0,
255);
g = random(0,
255);
b = random(0,
255);
analogWrite(8,
r);
analogWrite(10, g);
analogWrite(11, b);
delay(1000);
}

You'll also like:

  • 1.  Automatic Street Light Dimmer Circuit
  • 2.  Automatic LED Candle Light Circuit
  • 3.  Diwali, Christmas 220V Lamp Chaser Circuit
  • 4.  Interfacing SD Card Module for Data Logging
  • 5.  Illuminating 24 White LEDs from two 9 Volt Cells
  • 6.  Mobile Phone Controlled Robot Car Using DTMF Module

About Swagatam

I am an electronic engineer (dipIETE ), hobbyist, inventor, schematic/PCB designer, manufacturer. I am also the founder of the website: https://www.homemade-circuits.com/, where I love sharing my innovative circuit ideas and tutorials.
If you have any circuit related query, you may interact through comments, I'll be most happy to help!

Have Questions? Please Comment below to Solve your Queries! Comments must be Related to the above Topic!!

1 Comment
Newest
Oldest
Inline Feedbacks
View all comments

Primary Sidebar

Calculators

  • 3-Phase Power (15)
  • 324 IC Circuits (19)
  • 4017 IC Circuits (52)
  • 4060 IC Circuits (25)
  • 555 IC Circuits (98)
  • 741 IC Circuits (19)
  • Arduino Engineering Projects (83)
  • Audio and Amplifier Projects (114)
  • Battery Chargers (82)
  • Car and Motorcycle (94)
  • Datasheets (46)
  • Decorative Lighting (Diwali, Christmas) (33)
  • Electronic Components (100)
  • Electronic Devices and Circuit Theory (36)
  • Electronics Tutorial (116)
  • Fish Aquarium (5)
  • Free Energy (34)
  • Fun Projects (13)
  • GSM Projects (9)
  • Health Related (20)
  • Heater Controllers (29)
  • Home Electrical Circuits (102)
  • How to Articles (20)
  • Incubator Related (6)
  • Industrial Electronics (28)
  • Infrared (IR) (40)
  • Inverter Circuits (98)
  • Laser Projects (12)
  • LED and Light Effect (93)
  • LM317/LM338 (21)
  • LM3915 IC (25)
  • Meters and Testers (65)
  • Mini Projects (148)
  • Motor Controller (67)
  • MPPT (7)
  • Oscillator Circuits (26)
  • PIR (Passive Infrared) (8)
  • Power Electronics (34)
  • Power Supply Circuits (77)
  • Radio Circuits (10)
  • Remote Control (48)
  • Security and Alarm (61)
  • Sensors and Detectors (120)
  • SG3525 IC (5)
  • Simple Circuits (75)
  • SMPS (29)
  • Solar Controllers (60)
  • Timer and Delay Relay (53)
  • TL494 IC (5)
  • Transformerless Power Supply (8)
  • Transmitter Circuits (40)
  • Ultrasonic Projects (16)
  • 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

wpDiscuz