2 questions about general electronics

This is, i believe, a pretty noob question...

  1. Ive seen many show-offs and tutorials where peeps have connected arduino with eg, switches and so on.
    What im trying to figure out, those switches has 220V I\O, how do one connect arduino with them ? Shouldnt the board
    fire up like fireworks with those powers ?

  2. Another question, for led-lights (as example) how exactly do i calculate or get the info about what kind of resistor to use ?
    Say i got 9V battery and a led
    2a) how do i know how much V this led needs ?
    2b) what kind of resistor should i use ?

Resistors have color stripes that i understand are telling what kind of resistance it gives, but im not able to figure out what that "data" actually means.

What im exactly trying to accomplish is that i have a led-set bought from ikea, which has a little controller containing a scroll-wheel for change of colors and 3 buttons (power, colorfade and rapid color change presets). I would love to connect arduino to that so i could control the lights with my phone.

THanks for any tips and advice!

  1. I guess must be using a relay for switching, Id have to see the examples you are referring to.

  2. There are many LED calculators on line, here`s the first one that google lists
    http://led.linear1.org/1led.wiz

If you want to learn how to work it out, heres a tutorial on LEDs
Scroll down the page to see the 9 volt battery example.
http://www.ladyada.net/learn/arduino/LEDs.html

  1. Do not directly connect an Arduino board to line voltage (110 or 220 Volt AC). As you correctly suspects, it will be fried. It is also (more importantly) a shock hazard. If you still want to use an Arduino to switch 220V on/off, use a switching device such as a mechanical or solid state relay or a triac. It is good practice to also add an isolation device between the low power device and the 220V side, such as an opto-isolated diode or triac. You need to research this a lot more before you should attempt to experiment with 220V.

2)You can use an online calculator such as http://ledcalc.com/. You need to know the voltage drop across the LED (check datasheet of LED, else assume 2V) and the target current (this determines brightness of LED). I think something like 20mA is plenty for an LED, anything between 5 - 20 mA should be visible.

The colour coding on resistors can be found online (e.g. http://www.elexp.com/t_resist.htm) or in an electronics textbook. I can't remember the coding so I use my multimeter to measure resistance.

danelk:
2a) how do i know how much V this led needs ?

The voltage is closely related to the energy of the photons produced - thus voltage increases from IR-red-orange-yellow-green-blue-white-violet-UV. White LEDs are blue LEDs really, BTW(*). You can calculate the energy in electron-volts of a photon from its wavelength thus:

eV = 1240 / wavelength(nm)

Thus for red light of 740nm, energy is 1.67eV, so deep red LED should be around 1.7V. Blue light of 400nm is 3.1eV per photon, so blue LEDs are somewhat over 3V

Of course each type of LED has its own peculiarities and inefficiencies, so this is only a rough guide.

(*) There is a blob of fluorescent plastic above the LED die to convert a proportion of the light to yellowish light.

I have no idea what MarkT was trying to say, but with Leds you design according
to the current through it rather than the voltage acrross it.

Typically, you simply set the current using a series resistor, according to Ohm's
Law, or I = Vdrop/R.

a. I comes out of the spec sheet, typically 5-40 mA range or so.

b. the spec sheet also indicates the approx Vled, ie V across the Led in
normal operation. This will be typ 1-2V.

c. then Iled = (Vin - Vled)/R, eg (9V - 2V)/1000ohms = 7mA, when using a 9VDC
source, like a battery or wallwart.

Also, as indicated, never connect 220V to ANY electronics board. Rather, get
a 220V wallwart that outputs 7-9VDC.

with Leds you design according
to the current through it rather than the voltage acrross it.

You need to know the voltage across the LED when the required current is flowing. This is found in the data sheet for the LED.

In the absence of a data sheet assume 20mA maximum and the voltages Mark said.

Resistor Colour Code

With my aging eyesight, I measure one in a strip
http://www.tinwizard.co.uk/Projects/Strip3.jpg
and write the value several times on both sides of the strip.

Some resistors have 5 stripes, 3 digits, multiplier and tolerance. Often I find it easier to test with a multimeter especially in artificial light!

Woha many answers, me like!

  1. Anyhow, yep the colour system is a little helpfull, but still, not quite sure with the resistors at all...

say i have a 1.5v battery and a 9v and a car battery (12v) each of those would require different resistor.. right ? this leads to the question, how do i know which resistor is preferred ?
I guess trial and error will lead to massive fried leds haha :wink:

  1. i think i may have switched som values... the led-light set (im interested in controlling) probably allready uses anything between 0-9V but i have not measured it yet.
    if im correct everything between 0 and 5 are pretty much ok with arduino (tho both analog AND digital ?) or correct me ... :smiley:
    the set that im talking about is this one: LED-belysning för hela hemmet - IKEA
    Not sure if swedish will tell you anything but i hope some of you guys have similar set and know more about it

your ikea "DIODER" contains an "electronic transformer" ( at least as described in the German page ).
This probably does not supply a defined voltage, but rather the proper current required for the leds.

The resistor method to limit the led current is rather appropriate for small signal leds of typically 20 mA max.
If it's about 3W or more, it's not the best design to simply supply a sufficient voltage and then burn the extra power in a resistor. Such LED drivers are usually constant current sources.

with Leds you design according
to the current through it rather than the voltage acrross it.

Reply:
You need to know the voltage across the LED when the required current is flowing. This is found in the data sheet for the LED.

In the absence of a data sheet assume 20mA maximum and the voltages Mark said.

My analysis was correct, you just have to read as far as items b and c.

Thus for red light of 740nm, energy is 1.67eV, so deep red LED should be around 1.7V. Blue light of 400nm is 3.1eV per photon, so blue LEDs are somewhat over 3V

I have no idea how MT got from 1.67eV to 1.7V and 3.1eV to 3V.

oric_dan(333):

Thus for red light of 740nm, energy is 1.67eV, so deep red LED should be around 1.7V. Blue light of 400nm is 3.1eV per photon, so blue LEDs are somewhat over 3V

I have no idea how MT got from 1.67eV to 1.7V and 3.1eV to 3V.

Well I just assumed devices aren't 100% quantum-efficient, so you'll need a bit more voltage than the theoretical quantum minimum.

[ digression:
Actually thinking about it its not necessarily the case, thermal energy can be involved too (for instance the bandgap of silicon is 1.1V or so, but diodes conduct at around 0.7V at room temperature - 0.4V is due to the fact that only the most energetic electrons jump the barrier (like evaporation)

It turns out you can actually use an LED as a fridge (not a practical one, but actually acting as a heat-pump: LED converts heat into light – Physics World )

Long page on Leds on wikipedia. Useful section named "Colors and
materials".