Show Posts
Pages: [1] 2
1  Using Arduino / Programming Questions / Re: How can I convert specific chars of an array to a int or a byte? on: March 23, 2013, 11:11:19 am
Simple and works perfect!!

Thanks a lot!
2  Using Arduino / Programming Questions / [solved] How can I convert specific chars of an array to a int or a byte? on: March 23, 2013, 10:56:33 am
Hi everyone.

I'm trying to control some lights from (at the moment) one arduino to another via i2c by sending a String like this one 01111/255255255 (the length and the position will be always the same).

The comunication works perfect and I'm able to print the array of char that I'm receiving in the serial interface of the slave but the problem is that I don't know how to convert the data(the last 3 groups of 3 numbers) to the actual value in a byte or a int.

I would like to do something like this:

Code:

char inComming[15]; //received data

String red = inComming[6]+inComming[7]+inComming[8]; // concatenate the 3 numbers in a string

byte redValue = stringTobyte(red); // convert the string to the real value on a byte

//(I know it won't be that easy)

I've been messing around with some functions like strcat or sprintf without result (probably because I'm doing something wrong).

Any help?
3  Using Arduino / LEDs and Multiplexing / Re: Lost with 50w LEDs + PWM on: January 25, 2013, 12:12:42 pm
The current does not increase with the number of LEDs in series. That is why it is called a constant current power supply. What changes is the forward voltage so...

If you've got 10 LEDs in series with a 300mA current rating and 2.5 Vf/ LED then you still need to supply 300mA to the LEDs but 10 x 2.5 + X Volt for it to work.

Yes, but in this case we have 2 rows of 8LEDs in series for each color so the current will be the double.


I have a few 10watt of these models, same thing only smaller.

To compare, I used a cree ssc p7 (12watt) the ebay ones use double
the power and give off a lot less light than anything i've seen from
Cree or SSC and even NXP (Phillips)

Because of the high wattage, a switching regulator for power, then use
PWM through an n mosfet, tie the base to gnd with a 10k resistor
and you should be good to go.

with these 10watts i have i'm just going to use power transistors, via pwm
with a 200ohm resistor on base, roughly 20ma per pin vs next to no current
on a mosfet.

I know the ebay LEDs are crap but the can be easily changed for a better ones if required almost without changing too much the main circuit.

About using a mosfet... That was the first idea but the people who commented made me learn about the advantages of using constant current supply and I think it's worth it.



I can see the point about each color drawing 500ma...
16 LED per color so with 48W total (48 LEDs), power for each color is around 16W. Using P = I*E, or I = P/E, I = 16W/32v or 500mA.


Exactly, and the supply's will give up to 700mA so I have to set a new limit.


By the way, I didn't want to multiplex but I will have to because the ethernet shield that I'm going to use will take a couple of precious PWM pins and I won't enough.

I was thinking on using the famous TLC5940 (current sinking) between the arduino and the dim pin of the PT4115 pulling up the line. Will this IC be able to PWM 15 channels without flickering?
4  Using Arduino / LEDs and Multiplexing / Re: Lost with 50w LEDs + PWM on: January 23, 2013, 08:47:58 am

rather than modifying the reference resistor, why not go with these ..? http://dx.com/p/mr16-1-1w-320-350ma-constant-current-regulated-led-driver-8-40v-input-13553


Because I don't think that the forward current is 300mA, it's suppose to be a bit less than the double.

If you look at the picture, the 50w version es almost 2 of 30w in parallel.

30w  > 10leds in serie (300mA)
50w  > 16leds in 8s2p  (? mA)

16 + 16 + 16 = 48


That's the total number of leds in the matrix , but there is only 16 per color. Each CCsupply will drive a single color of each matrix (3channels per matrix = 15 CCsupply in total) and that's why I'm calculating the maximum current for every color and not for the whole matrix.
5  Using Arduino / LEDs and Multiplexing / Re: Lost with 50w LEDs + PWM on: January 23, 2013, 08:16:32 am
Looks like that little driver would work, and certainly cheap enough.

> ...and a resistor to set the output at 550mA.
> DC Forward current (IF): 300MA

I'm missing why you want to drive the 300mA LED with 550mA.



rather than modifying the reference resistor, why not go with these ..? http://dx.com/p/mr16-1-1w-320-350ma-constant-current-regulated-led-driver-8-40v-input-13553



Because I don't think that the forward current is 300mA, it's suppose to be a bit less than the double.

If you look at the picture, the 50w version es almost 2 of 30w in parallel.

30w  > 10leds in serie (300mA)
50w  > 16leds in 8s2p  (? mA)


6  Using Arduino / LEDs and Multiplexing / Re: Lost with 50w LEDs + PWM on: January 22, 2013, 06:06:57 pm
I missed that bit. But it's a bad idea to connect LEDs in parallel - especially high power ones - because they are won't share the current evenly. The hotter ones have a lower forward voltage at a given current than the cooler ones, which causes the hotter ones to take more current, which makes them hotter...

You're right, what would you recommend then?

Is a good idea buying 15 of these?



http://dx.com/p/mr16-1-3w-650-700ma-constant-current-regulated-led-driver-8-40v-input-13557

Based on the PT4115

http://www.micro-bridge.com/data/CRpowtech/PT4115E.pdf

Code:
FEATURES
z Simple low parts count
z Wide input voltage range: 6V to 30V
z Up to 1.2A output current
z Single pin on/off and brightness control using DC
voltage or PWM
z Up to 1MHz switching frequency
z Typical 5% output current accuracy
z Inherent open-circuit LED protection
z High efficiency (up to 97%)
z High-Side Current Sense
z Hysteretic Control: No Compensatio
z Adjustable Constant LED Current
z ESOP8 package for large output power application

I would have to change the capacitor for one of 40-50v and a resistor to set the output at 550mA.
Also to step down the vin from 32v to 30v but won't be a problem using voltage regulator that can handle 10A.

The construction of the pcb looks really poor but it's also really cheap ($1,49 for more than 10).


PD: I may need some help to change the resistor to get an output of 550mA.

That's the formula in the datasheet: Iout = 100mv/Rs therefore Rs = 100mv/550

Then, to get 550mA output, Rs need to be 0,181ohm (or the closest value) . I tough there was something wrong with the units (because for me less than a ohm is weird) but the resistor that comes in the pcb is R160  (0.16ohm) so it make sense.



7  Using Arduino / LEDs and Multiplexing / Re: Lost with 50w LEDs + PWM on: January 22, 2013, 12:54:59 pm

> I don't know any other way to find the voltage safely without destroying the LEDs.

If you supply them with the correct (and less than maximum rated) current and enough voltage to turn them on then it doesn't matter what the exact voltage is... the LED will drop whatever voltage it does given the supplied current. Look into buying/making some constant-current drivers for the LEDs. That way you set the current (in your case <300ma) and the driver puts out that current... no load resistors, no guessing, and not much wasted power. Maxim makes some driver devices as does On-semi. A driver circuit will cost more but is simpler and more efficient.

This device is pretty neat but it's only for up to 25V...
http://www.onsemi.com/pub_link/Collateral/CAT4101-D.PDF

This one might work to regulate current but you'd still need the MOSFETs though. I just discovered it and you'd have to do some reading about it.
http://www.onsemi.com/pub_link/Collateral/NSI50350AS-D.PDF


I've been reading about CC and CV, and CC seems to be the best way to drive LEDs, but I would have to buy/build 15 of those and the circuit will become more complicated and less reliable and efficient. I don't think it's worth to control every spot light individually so I decided that I will join the Rs, the Gs and the Bs to finally get just 3 channels.

I would say that every single color of every LED will forward like 600mA, therefore if I join the colors of the leds, the total current would be 600mA * 5 = 3A per color.



The only way to avoid wasting power when driving large LEDs is to use a switched mode constant current regulator. You can build them yourself around a switching regulator IC, inductor and a few other components, but they can be tricky to design.

I've been watching how to build one and you're right, is tricky (and much more for me).

I'm thinking to buy 3 of these, put a heatsinks, and adjust the output at 2 - 2.5A.



http://www.ebay.com/itm/DC-Converter-Constant-Current-3A-Voltage-2-30V-LED-Driver-Battery-Charger-LM2596-/270955376640?pt=LH_DefaultDomain_0&hash=item3f1632f000


Code:
Feature:

-Fixed turn lamps current,that can show charging or not
-Reverse Protection,add input reverse connect protection diode on it
-Output the counter-current diode to stop battery power back
-Use the special benchmark of IC, and high precision sampling resistance,is more stable

Specifications:

-Module Properties: Non-isolated step-down / Buck charge module;constant voltage module(CC CV) charging module
-Input Voltage:DC 7~35 V
-Output Voltage:DC 1.25~30 V ( adjustable, continuous output ) 
-Max output Current: 3A  (if output power more than 15w,you can plug heat sink)
-Constant Range:0-3A (adjustable)
-Turn lamps current:CC value*(0.1),CC value will change with Turn lamp current.
-The minimum voltage difference:  2V   
-Output Power:Natural cooling 15W,  25W with heat sink
-Convert Efficiency:  Max 90% (higher Output voltage, higher efficiency)
-Output Ripple:  20M Bandwidth(Just reference )  input 12 V output 5 V 3 A 60 mV (MAX)
-Full Load temperature rise:45℃
-No-load Current:   Typical 10mA 
-Load Regulation:   ± 1%
-Voltage Regulation rate:  ± 0.5%
-Dynamic response speed:  5% 200uS
-Potentiometer adjustment direction:  clockwise (increase), counterclockwise (decrease) ,Close to the input  potentiometer is voltage regulation(CV), close to the output potentiometer is current regulation(CC)
-Indicator light:RED(charging);GREEN(finish charging)
-Output Short-circuit Protection:  Yes, Constant current
-Input Reverse Protection:  YES
-Output prevent reflux: YES, output have internally series against a prevent the diodes.
-Operating temperature:  Industrial grade (-40 ℃ to +85 ℃) (ambient temperature exceeds 40 degrees, lower power use, or to enhance heat dissipation)
-Wiring way: welding, add pin can be weldinged directly in PCB
-Size: 49 x 23.4 x 11.4 mm ( L*W*H )not include potentiometer
8  Using Arduino / LEDs and Multiplexing / Re: Lost with 50w LEDs + PWM on: January 22, 2013, 07:15:44 am

The red LED needs about 10V less than the blue/green so it might need a resistor to absorb the extra volts.

10V@300mA = 33 Ohms, although it will need a large wattage.

Something like this should be enough: http://www.ebay.com/itm/271109598315


I'm trying to avoid the use of resistors to limit the current directly to the led because it's a waste of power. I prefer (if possible) to limit the current trough the MOSFET.

> The red LED needs about 10V less than the blue/green so it might need a resistor to absorb the extra volts.

Each LED needs a resistor to limit current, but yes, the red LED needs a different value from the rest.

As for taller heatsinks, look at these...

http://www.ebay.com/itm/Heat-Sink-for-20W-30W-50W-LED-/380534842067?pt=LH_DefaultDomain_2&hash=item5899a4e2d3

http://www.ebay.com/itm/20W-30W-Led-Light-Heatsink-With-FAN-Aluminium-Cooling-For-20W-30W-Led-12V-/190785568355?pt=LH_DefaultDomain_0&hash=item2c6bb4be63

The first one is perfect, tall but the base is small, it would fit. The second one there is no way I could fit it in the spot light.

Speaking about the voltage of the LEDs, I found something interesting.


Code:
30W:
Color: RGB
DC Forward Voltage (VF):  Red 22-24V, Green 32-34V, Blue 32-34V
DC Forward current (IF): 300MA
Out put Lumens: Red 400-500LM, Green 600-800LM, Blue 200-300LM
Wave Length : Red 620-625nm , Green 515-520nm, Blue 455-460nm
Beam Angel: 140 degrees
Life span: >50,000 hours


50W:
Color: RGB
DC Forward Voltage (VF):  Red 22-24V, Greed 32-34V, Blue32-34V
DC Forward current (IF): 300MA
Out put Lumens: Red 400-500LM, Green 600-800LM, Blue 200-300LM
Wave Length : Red 620-625nm , Green 515-520nm, Blue 455-460nm
Beam Angel: 160 degrees
Life span: >50,000 hours

The specs for 50w and 30w are the same but the layout of the array of LEDs is completly diferent!! (see the attachment)

In the 30w version , for every color, there is 1 row of 10 leds and in the 50w version you will see 2 rows of 8 led.

Since the 10w version is 3 led per row and the 20w is exactly doble and the voltages match, it easy to figure out the voltage for the 50w version.


Code:
10W:
Color: RGB
DC Forward Voltage (VF):  Red 6-8V, Greed 9-12V, Blue 9-12V
DC Forward current (IF): 300MA
Out put Lumens: Red 120-150LM, Green 200-300LM, Blue 70-100LM
Wave Length : Red 620-625nm , Green 515-520nm, Blue 455-460nm
Beam Angel: 140 degrees
Life span: >50,000 hours


20W:
Color: RGB
DC Forward Voltage (VF):  Red 13-15V, Greed 18-20V, Blue 18-20V
DC Forward current (IF): 600MA
Out put Lumens: Red 260-300LM, Green 400-600LM, Blue 150-200LM
Wave Length : Red 620-625nm , Green 515-520nm, Blue 455-460nm
Beam Angel: 140 degrees
Life span: >50,000 hours

If the 10w red is 6-8v and contains 3 LEDs then 7/3= 2.4v per LED. Therefore the 50w version,wich contains 8 led (in each row) will be 19.2v.

Applying the same for the other 2 colors we will have than the green and blue are 28v each.

I don't know any other way to find the voltage safely without destroying the LEDs.
9  Using Arduino / LEDs and Multiplexing / Re: Lost with 50w LEDs + PWM on: January 21, 2013, 02:52:02 pm
Ok, I understand it now. I'm not sure about the specs that I got from the seller and I guess that each LED will take much more than (330mA). I'll run my own tests to be sure and then I will decide which transistor to use.

Thanks.

PD: I found this picture and I would say that is common anode because of the colors of the clamps but, of course, it's not sure.

10  Using Arduino / LEDs and Multiplexing / Re: Lost with 50w LEDs + PWM on: January 21, 2013, 02:12:53 pm
That schematic won't work, there is nothing to pull down the mosfet gates, also the transistors reduce the mosfet gate drive.

If the LED is common anode then you can use N-channel mosfets connected in a similar way to PWM the LEDs, but connect the mosfet gates to the Arduino PWM outputs through 100 ohms resistors (no transistors). Use logic-level mosfets. Also connect a 10K resistor between each of the Arduino PWM outputs and ground.

You're right, forgot about pull down the gates. I think I fixed it.

The seller has answered, seems to be an expert about his products.

Doesn't really matter...

The day they arrive you can just connect a low voltage across them and find out which way lights them up. The only difference it will make is the type of transistor you need.

Unfortunately, it also affects the circuitry needed. Common anode LEDs needing more than 5V can be controlled form the Arduino just with a N-channel mosfet or NPN transistor. Common cathode LEDs needing more than 5V require a P-channel mosfet or PNP transistor plus a level shift circuit, unless your 36V power supply has a floating output.


I didn't know that the transistor type would change depending of if the led is common anode or cathode, I thought it would be as easy as the second schematic I made.

11  Using Arduino / LEDs and Multiplexing / Re: Lost with 50w LEDs + PWM on: January 21, 2013, 01:26:18 pm
The seller has answered, seems to be an expert about his products.

Code:


hi?dear,
but?i?don't?understand?your?question.
sorry
?
?
2013-01-22
xiangpailighting
?
發件人:?eBay Member: rexaviis
發送時間:?2013-01-21?23:33
收件人:?xiangpailighting
主題:?有關物品的細節: rexaviis 就 10W 30W 50W watt RGB Changing LED Bright Lamp High Power Chip For flood light,編號為230827659562 的物品寄出訊息
xiangpai-lighting,您好!

Hi, is it common anode or common cathode?

Thanks!

- rexaviis


I made a quick schematic (considering that is common anode) to have a visual reference, this is just for one the LEDs.

Is there anything wrong? Notice the resistor after PWM2, the red LED should work at less voltage than the other two so the resistor drops the input voltage in the third transistor. I prefer do this by hardware instead of setting a different PWM for the red LEDs by software, but I don't know if is the best idea.

PD: The voltages in the schematic are random, I don't know them yet.

PD2: I'm thinking to use this MOSFET (15 in total).

http://www.irf.com/product-info/datasheets/data/irfz44n.pdf

Code:
Manufacturer: IR
Manufacturer Part No: IRFZ44N
Package / Case: TO-220
RoHS: Yes
Datasheet: Click Here

Specifications
Transistor Type: MOSFET
Transistor Polarity: N Channel
Drain Source Voltage, Vds: 55V
Continuous Drain Current, Id: 49A
On Resistance, Rds(on): 17.5mohm
Rds(on) Test Voltage, Vgs: 10V
12  Using Arduino / LEDs and Multiplexing / Re: Lost with 50w LEDs + PWM on: January 21, 2013, 10:21:39 am

It should be that simple, yes...

The amperage of those LEDs isn't too bad (300mA), that should make the PWM switching easier on the PSU than low-voltage/high-current LEDs. If you want to be extra sure you could add some extra capacitors on the power lines near the LED. Get come big ceramics.

Fans will make a big difference, yes

(if the noise doesn't bother you...)


I was thinking to add the capacitors between the psu and the MOSFET, because if I put them between the MOSFET and the LED, the final wave would be shark type or even almost linear. But in the other hand I think that the wave doesn't matter as long as the average voltage is the same so probably would be better as near to the LED as possible.


At first glance that heatsink/fan looks small for 50W... think they're for 5-10W LEDs. THere are some nice big, round LED heatsinks on ebay that should work without a fan. Is there good airflow in those ceiling fixtures?

http://www.ebay.com/itm/20W-30W-High-Power-Led-Heatsink-Aluminium-Cooling-For-20-Watt-30-Watt-Led-Light-/190774600422?pt=LH_DefaultDomain_0&hash=item2c6b0d62e6

If you want 15 separate PWM channels then you'll need some sort of multiplexer since Arduino only has 6 PWM channels... or you can run all the reds together, greens together, and blues together so only need 3 PWM channels.

Does the suggestion for "NMOS transistors" really mean NMOS FETs (N-channel MOSFETS)? Look for devices with low drain-to-source resistance (Rds) otherwise you'll waste power in the FETs and may need to heatsink them too. If driving the gate with a transistor (recommended since they'll drive the MOSFET gates with sharper-edged signals that minimize heating) you won't need "logic compatible" devices.

The problem with the heatsink is that I don't have too much space for it. The spot light has 50mm diameter so would be impossible to fit a 10cm diameter heatsink but there is enough space above the light to provide good ventilation.

I will use an arduino mega which has 15PWM so I could avoid multiplexing.

Since I don't know yet if the LED is common anode or common cathode there is not much I can do to find the transistor that I need but of course it has to be high efficiency because otherwise it will waste a lot of power. The lights will be on at least 7 hours every day so I need the system to be as efficient as possible.


You should also plan for the Arduino crashing and leaving all the LEDs at 100%, eg. Add a fuse that can't handle that much power.

Fuses are cheap and might save you from killing some expensive LEDs due to a software glitch.

PS: Be sure to test it to see if it blows!



That's a very good idea, I was thinking how was the best way to reduce the maximum that the psu can supply in case of system failure and a fuse is just perfect.
13  Using Arduino / LEDs and Multiplexing / Re: Lost with 50w LEDs + PWM on: January 21, 2013, 05:39:34 am
I'm going to illuminate a room using these LEDs, (very cheap so not very reliable).

The total theoretic power will be 250w but  I don't want to put all the LEDs working at full power

I wouldn't run eBay LEDs at anything like their full power. The numbers they give are for perfect laboratory conditions using huge, active heatsinks. Under any real conditions they're going to get HOT if you try and run them at the quoted power.

Aim for 50-60% of those numbers and you'll be a lot happier/safer. 150W of LED is still an awful lot of light.


I know and that's why I need to know if enabling PWM will be as easy as BJTransistor + MOSFET, also there is not too much space inside of a ceiling spot light and I will have problems to dissipate 50w per led. Hope that running the LEDs at <55% plus a bunch of these fans the temperature won't raise too much.



Anyway before installing them, I will run some tests to see what could I expect in every single situation so I'll be sure that I won't blow up something or set my house on fire.
14  Using Arduino / LEDs and Multiplexing / Re: Lost with 50w LEDs + PWM on: January 19, 2013, 06:11:34 pm
I didn't want to make a long post but I'm happy to share what's on my mind.

I'm going to illuminate a room using these LEDs, (very cheap so not very reliable).

http://www.ebay.com/itm/50W-High-Power-LED-Chip-Full-Color-LED-RGB-Light-Lamp-Bright-Light-/160898806371?pt=LH_DefaultDomain_0&hash=item257650f263

Each one of them (5 in total) will be inside of a ceiling spotlight (plus the heatsink that I'll try to make it as big as possible).

I want to control every channel of every led individually, this will make 15 channels in total.

Off course I will use an arduino to control the LEDs and enable some modes such as:

- Presence detection
- Ambient light detection.
- Gentle light increasing activated by time. (I think that 250w of LEDs will be enough to wake me up in the morning).
-  Whatever else.

Everything can be controlled by software, I don't know yet how to but probably from the browser.

The total theoretic power will be 250w but  I don't want to put all the LEDs working at full power so I'll define the maximum brightness that I want to have in the room and set the maximum that the user can input, so there is no way you can put the LEDs working at full power. For example, a 100% set by the user will be a x% (0<x<100) of the maximum power available. I think is gonna be around 40-60% but I don't know it yet.

This will reduce the power consumption and the heat and increase the reliability because it is suppose to last for years (I really doubt it).

As I said, I couldn't find the datasheet, but I just find something similar (see the attachment).

The 50w LEDs is an array of 16Red 16Green and 16B. In the poor datasheet of above you can find the specs for every single led .I just multiplied the power dissipation of every single led and the result is almost 50w so I think that we have something that we can use.  

My problem is to know how is the best way to get them working with PWM, dc42 and macegr gave me good hints.

The psu that I will use is NES-350-36 (right side in the specs table), stepping down more or less the voltage depending of the channel (R,G or B).
15  Using Arduino / LEDs and Multiplexing / Re: Lost with 50w LEDs + PWM on: January 19, 2013, 04:01:12 pm
Use some nice big NMOS transistors, and the slowest PWM you can bear. Might need to drive the gates higher than 5V to avoid heating.

I'll take it on consideration, thanks!

As those LEDs have only 4 connections, they are either common anode or common cathode. You need to determine which. The connection on the left is probably the common one. To determine the polarity, connect your power supply between that connection and one of the others through a 10K series resistor and see if there is a faint glow from it. If necessary, do it is a dim light and reduce the resistor to 1K.

I suggest you drive them through a mosfet+BJT constant current circuit, because your power supply gives very little spare voltage so a series resistor won't give good current regulation. The details of the mosfet+BJT circuit depend on whether the led is common anode or common cathode.

I completely forgot to check if they are common anode or common cathode (I said I was a noob).

I don't have the LEDs yet, I just wanted to get ready before them arrive.

After a long time of searching I'm still unable to find the datasheet. I finally got to the manufacturer's website but there is not anything similiar to a RGB led so I give up. I'm just ask to the seller, I know it's a long shot but, why not to try it?.

Meanwhile I'm ordering the psu and  I'll test the LED when I got it. I just wanted to know if what I want to do can be done by the way I was thinking of.

I'll post the results as soon as I got it.

Thanks!
Pages: [1] 2