Arduino RGB LED Control for the Spinning Night Light

Posted July 27th, 2010 by Natalia and filed in Arduino, Project

When looking at the parts list for the Arduino RGB LED spinning night light you must have noticed that current limiting resistors of different values were used for the Red and the Green/Blue pins of the RGB LED. That is due to them having different forward voltage ratings. You can find complete specs for the LED in the datasheet (when buying an electronic component you will have the option to download its datasheet, or the relevant information will be provided by the vendor).

We use Ohm’s Law to calculate current limiting resistor values:

Forward voltage ratings:

RED: 2.1V
GREEN: 3.3V
BLUE: 3.3V

Current:

I = 20mA

Supply voltage:

V = 5V

Ohm’s Law:

I = V/R => R = V/I

So for Red:

(5 – 2.1)/0.02 => R = 145 Ohm

For Green/Blue:

(5 – 3.3)/0.02 => R = 85 Ohm

color fading for the RGB LED night lightAs for the Arduino sketch, I chose to have the lamp fade between two colors, aqua (#00FFFF) and magenta (#FF00FF). For that I kept the Blue value at 255 and varied the Green and Red values between 0-255 to achieve the desired colors, as shown in the diagram:
(You can pick your favorite colors, cycle through the entire spectrum, or go psychedelic and show random colors with random delays)

// fade from aqua to magenta
for (int i = 0; i < 256; i++) {
  analogWrite(RED, i);
  analogWrite(GREEN, 255-i);
  analogWrite(BLUE, 255);
  delay(50);
}

// fade from magenta to aqua
for (int i = 0; i < 256; i++) {
  analogWrite(RED, 255-i);
  analogWrite(GREEN, i);
  analogWrite(BLUE, 255);
  delay(50);
}

My TGIMBOEJ Exchange

Posted March 22nd, 2010 by Natalia and filed in Components

TGIMBOEJTGIMBOEJ, The Great Internet Migratory Box Of Electronics Junk is a progressive lending repository of electronic components. An open collaborative project, TGIMBOEJ can be seen as a cross between P2P file sharing and a flea market, an internet meme in physical form. It arrives full of wonderful (and possibly useless) components, but you will surely find some treasures to keep. You will be inspired to look through your own stuff and find more “electronic junk” that can be donated to the box before it is passed on again. And on and on and on. There are several incarnations of TGIMBOEJ being passed around the US and some parts of the world.
Continue Reading »

Basic Hobby Electronics Vocabulary Part 3 of 4 (I-R)

Posted January 18th, 2010 by Natalia and filed in Beginner

Insulator: A material that has high electrical resistance and is therefore a poor conductor of electricity.

Integrated Circuit (IC): A type of digital circuit in which transistors, diodes, resistors and capacitors are constructed on a semiconductor base.

Light Emitting Diode (LED): A type of diode that generates light when current flows through it.

Ohm’s Law: The relationship between voltage, current and resistance.

Ohm (Ω): The unit of measure for resistance.

Printed Circuit Board (PCB): A board in which components are connected using a thin coat of conductive material “printed” on the board instead of wires. It is used for mounting electrical components.

Resistance: The electrical friction between an electric current and the material it is flowing through that causes electricity to be dissipated as heat.

Resistor: An electrical component used to introduce resistance into a circuit.