lighting design with 3 outputs[Newbie]

Hi!

I could do with some advice if you don't mind helping!

I'm very new to electronics and arduino but I'm a fast learner! I've been playing with the arduino for about a week and know the basics...

My project is to run 3 different lighting outputs and a motor of an arduino uno... The lighting is what I need advice with first of all.

My lighting will be:

  1. RGB LEDs for ambient lighting (adjustable colours - probably with a pot for now)
  2. a green laser switching on at random intervals for random lengths of time
  3. a disposable camera flash, firing at random intervals

The other big question is how do i run these 3 scenarios from one arduino?

If anyone can give me any advice (general or specific) I would be very grateful :slight_smile:

Rob

  1. is easy so I'll try this: control the RGB with three PWM pins (have current-limiting resistor of at least 150ohm). One pot controlling all three colors may be difficult so may one for each prime color, on 3 analog inputs.
  2. you may need a relay or MOSFET to switch the laser depending on it's power requirement. I suppose it's a diode laser like those found in a laser pointer. You can use one digital pin to control it.
  3. that may require some external power supply. I'm not familiar with this but I suppose you need a relay or MOSFET to control the charging and or firing the flash.

For the coding, since you have several things going on you probably won't be able to use Delay() since that freezes the entire program, so make sure you are familiar with the 'blink without delay' example so that you can use variables for the timing based off of Millis()

Yep, that example will tell you how to properly delay. I really don't like the name "blink without delay". It sounds to me like blinking rapidly with no delay in between.

Great, thanks for your help!

What would be the difference between using a relay and a MOSFET for switching on the laser? This is the laser I will be using - http://www.dealextreme.com/p/geniune-new-wish-5mw-green-laser-module-5v-10094

Also, if I need a bunch of RGB LEDs running together (10+), will I need a resistor for each of them?

dillonradio:
Great, thanks for your help!

What would be the difference between using a relay and a MOSFET for switching on the laser? This is the laser I will be using - http://www.dealextreme.com/p/geniune-new-wish-5mw-green-laser-module-5v-10094

Also, if I need a bunch of RGB LEDs running together (10+), will I need a resistor for each of them?

A relay has mechanical contacts, it makes clicking sound when making contact. It's more than you need for a small laser. I would use MOSFET, which has no mechanical part. It's just like a couple of fingers squeezing your electrical wire, making conduction impossible when you apply voltage. Also there's the opposite sense when you apply voltage you widen the wire to conduct.

Be aware of legistlation regarding photo-sensitive epilepsy.

someone commented about the laser that it does fine with as low as 4 volts, so you might be able to power it directly off a digital pin, treating it like an led without a resistor.

That is a real concern. One student collapsed in a class room due to a different reason but we canceled strobe light demonstration to an event from the same concerns. The flashing of light is at times irritating. Different people respond differently. :astonished:

I don't think there will be an epilepsy risk as I'm not going to be strobing anything... the flash will go off very infrequently....

Having said that, I cannot actually find any information about what UK legislation states in this matter....

It's worth noting that this laser WILL die at just over 5v. Watch out for this and do your best to avoid anything that might bring it too high.

AWOL what is the legislation? I looked into it and as far as i found out there was only guild-lines in the UK anyway. The US has law's about strobe lighting but i didn't think we did in the UK just guide lines.

brucethehoon:

[quote author=Big Oil link=topic=58696.msg422681#msg422681 date=1303065702]
someone commented about the laser that it does fine with as low as 4 volts, so you might be able to power it directly off a digital pin, treating it like an led without a resistor.

It's worth noting that this laser WILL die at just over 5v. Watch out for this and do your best to avoid anything that might bring it too high.
[/quote]

I think I'll run it off the digital pin as recommended... safer that way!

For info... these are the RGB LEDs I am going to use - http://uk.farnell.com/jsp/search/productdetail.jsp?id=1716734&Ntt=1716734

If you want to drop voltage applied to the laser just a bit, you could add a diode in series with the laser, which might be a diode itself. A 1N4001 or something like that could probably handle it.

liudr:
If you want to drop voltage applied to the laser just a bit, you could add a diode in series with the laser, which might be a diode itself. A 1N4001 or something like that could probably handle it.

Thanks. Is it important that the diode goes before the laser?

Not really, anything in series can swap order. Same math.

I'm currently designing my RGB LED array and I'm using this http://led.linear1.org/led.wiz to calculate what resistors I will need.

As mentioned above these are the LEDS I will be using - http://uk.farnell.com/jsp/search/productdetail.jsp?id=1716734&Ntt=1716734

So my question... When the wizard asks me for the forward voltage, the spec of the LEDs list different voltages for each colour. Using the 2.2V (Red value) gives me one answer for the type of resistor (22 ohms) and using the 3.5V figure (for Green or Blue) tells me to use 56 ohm resistors...

Or do I need 3 resistors for each LED and so 2 will be 56ohm and 1 will be 22ohm ?

I'm a bit confused, can anyone help?

Wow, you must have put 150mA for red LED, to get 22 Ohm. That's very large current. You can't use your Arduino pins to directly power that LED unless you can drop down the current to 20mA (max rating is 40mA). This means 150 Ohm. The microcontroller chip can only provide a maximal of 200mA through all its pins so you don't get to power lots of RGB LEDs from directly hooking them up to arduino pins. To use that much current (150mA), you need a transistor to drive the LED. Then your Arduino board can only provide 500mA so to run 150mA per color and a number of RGB LEDs, you need external power.

Yes I think I have realised I need to use an external power source to run all the components that I have listed in my original post.... There will be 20 LEDs at least....

Did I make a mistake in the calculator though to get 22 ohms?

Hmm, this tutorial http://www.instructables.com/id/RGB-LED-Tutorial-using-an-Arduino-RGBL/

says I need 270 ohm resistors (3 per LED) to get the current down to 20mA

Where am I going wrong with the resistor calculator? I don't want to buy 60 resistors of the wrong type!