Why fairy led string don't fade and my single led fading correctly!?

Hi guy!

I'm on my first arduino project and I'm facing a strange result...

I connect a fairy led string like this (https://www.amazon.com/GardenDecor-Decorative-Battery-Powered-Bedroom/dp/B073B6M3WG)

My goal was to make if fade in and out symply. My code is the simpless possible and work well with a simple LED. When I change the LES for the fairy LED it only blink...

Originaly, the fairy led string was connect to a battery power supply with a switch to make it blink or fading, so it is possible to fade it.
My wirering is like this one

As you will see in my code I try the two kind of led in same time to test it.

int led = 13; // the pin that the LED is attached to
int led2 = 9;
int brightness = 0; // how bright the LED is
int fadeAmount = 1; // how many points to fade the LED by

void setup()
{
// put your setup code here, to run once:
pinMode(led,OUTPUT);
pinMode(led2,OUTPUT);
}

void loop()
{
// put your main code here, to run repeatedly:
// set the brightness of pin 9:
analogWrite(led, brightness);
analogWrite(led2, brightness);

// change the brightness for next time through the loop:
brightness = brightness + fadeAmount;

// reverse the direction of the fading at the ends of the fade:
if (brightness == 0 || brightness == 255) {
fadeAmount = -fadeAmount ;
}
// wait for 30 milliseconds to see the dimming effect
delay(20);
}

So how have you wired it up? I doubt you can get the power to drive this from the 5V pin of the Arduino the current will be too high, both for the power and the pin's current capability.

original power pack is 3 AA serial connected, so if I understand it made 4,5V.
The fairy les chain light up but flash with out fading

my connection...

Please read reply #1 and answer the question I asked.
Please post a schematic, hand draw is fine and about 1000% better than a Fritzing diagram.

Also please post the code you are using. Please read this:-
How to use this forum
To find out how to post code.

original power pack is 3 AA serial connected, so if I understand it made 4,5V.

Yes it does but it is the current capability of the Arduino that is the problem not the voltage.

You'll need a [u]driver circuit[/u] to supply the current (amps or milliamps).

If there are any "active electronics" you'll need to measure the voltage to the LED strip. There's a possibility of a step-up voltage or constant-current power supply.

How many LEDs are there, really?

100 LED STRING LIGHTS: These Best 100 LED...
...Very thin wire hosts 50 very small LED bulbs

If you don't have a multimeter to measure the voltage & current (or if you don't have any specs) you can estimate 20mA per LED (2 Amps total for 100 LEDs).

Your power supply and MOSFET should be rated for the required current, ore more. There is no harm in using a power supply rated for more current, but the voltage should be "close" the original 4.5V (if 4.5V is actually going to the LED).

As a first-pass you can use the batteries to power the LEDs, even if you're using a separate power supply for the Arduino. But if the battery supply has active electronics, dimming may not work with that.

Note pin 13 is not a PWM capable pin on most Arduinos so using that with an analogWrite call is only going to turn it on or off, just like you are seeing.

Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks... Tom... :slight_smile:

Grumpy_Mike:
Note pin 13 is not a PWM capable pin on most Arduinos so using that with an analogWrite call is only going to turn it on or off, just like you are seeing.

good to know, I change for pin #12 but without success...

Ok but we still need to know all the other stuff we have been asking.

Grumpy_Mike:
Ok but we still need to know all the other stuff we have been asking.

for the wire part I follow this exemple:

for the wire part I follow this exemple:

Then stop right now before you burn things out. Please read what I said in reply #1.

Please read what DVDdoug said about a driver in reply #4.

If you are not going to take advise why do you bother asking?