Monday, January 24, 2011

RGB LED

This weekend I started playing with a RGB LED. This LEDs have 3 separate light emitting materials. One for red (R), other for green(G) e the last for blue(B).

As you can see in the image below, there are 4 leads. This LED has a common cathode, which means that all 3 parts share the connection to GND.


From up to down, we have Blue, Green, Ground and Red.

To start experimenting, I searched for a generic datasheet, as I don't know any reference for this LED. It recommended a 20mA current and stated that the typical voltages are 2.0V (Red) and 3.2V (Green and Blue).
As I was drawing power to the breadboard from the Arduino (only for power), I did the math for the resistors.

V=R.I
(5-2)/0.02=150 Ohm
(5-3.2)/0.02=90 Ohm

There where 3 150 Ohm resistors in the anti-static bag the LED came in, but I decided to use 100 Ohm resistors for green and blue.

So, the simplest test was to light each one at a time:

Check!
Check!
Check!

Next step, how about lighting all at once?
It would be nice, but there was a problem. When I disconnected the GND from the breadboard, I accidentally let it touch the lead for the red color. Without a resistor to limit the current passing at the moment, it burned out in a second.

So what could I do with a 'limp led'? I tried to combine the green and the blue colors to see the effect, but I ended up getting a slightly lighter blue.
When I read the datasheet I noticed that the brightness (measured in candela) of the 3 colors isn't the same. It also looks like the blue color is more diffuse (spreads all around) as the green light appears more directional. I filmed it try to show what I mean, but the colors aren't very noticeable.

video

The good news is that I ordered a 100 RGB led pack on eBay, so if all goes well, I will try again soon.

One hint: I read that PWM is the way to go in order to combine colors...

P.S. The LEDs have arrived, all working and with some free resistors. Thank you giorgio11185!

Wednesday, January 12, 2011

Make: Presents

I like Collin Cunningham's videos a lot. They are fun and simple and give me motivation for my home projects.

Here's a compilation of some of his videos about the basics of electronics.

Saturday, January 8, 2011

Piezo 101

To learn how to use a Piezo Buzzer I followed this tutorial.
They say that piezos have polarity, but the one I have doesn't show what it is, or if it has any.

What is polarity?
It is best explained on Wikipedia, but basically it defines a single right way to connect a component to the circuit, depending on the direction of the current flow. Components like resistances don't have polarity, so they can be connected either way. Polarity matters for most electrical objects like diodes (LEDs are diodes) or speakers.


I couldn't find a datasheet to the exact name (PKM22EPP-40) and neither on the manufacturer (muRata) datasheets for similar components.
But after reading this I found the explanation for the reference name (not helpful...).

So I tried the program supplied using a 330K resistance so that I could test for polarity reducing the risk of burning the piezo.
It generated a very low sound either way I connected it.

With a 10K resistance, the sound is louder, but still kind of weird.
Then I tried 470 Ohm and 47 Ohm with the same results.

So I dropped the resistances, and the sound isn't much louder, but still as annoying.
And this piezo has no polarity after all.

video
(Something wrong with the processing of the video from Blogger that makes the sound out of sync...)

---------------------------------------

So for the next test I tried this example from Adafruit, and got better results. The sound is clearer, and not as annoying.

The basic difference from the previous example is the use of digitalWrite instead of analogWrite to the piezo.
But what difference does it make? Well that is [TO BE SEARCHED].