How can I wire blinking leds so that they can blink randomly ,giving that twinkling look?

I know where to get blinking flashing leds, but i dont know how to wire them. Im trying to get that sparkly/twinkle effect like those Christmas ads in stores

I think the answer depends on how many LEDs you want to drive in this manner.

If you just want to drive a handful of LEDs this way, say less than 5 LEDs,  I think that will be easier than trying to drive a large string, of say 30 to 100 of them.

Actually let me first address some easy, off-the-shelf, solutions that you can probably just buy, for less work-money than would be involved in building one.

LED candles
These produce sort of a slow, time-varying, "twinkling" kind of  light.  At the time of this writing LED candles can be found in packages of 2 or 3 for a price of 1 USD, at stores like this:
http://www.dollartree.com/Flameless-LED-Tealight-Candles-3-ct-Packs/p321570/index.pro
That store is a popular chain in the Former US, so if you also live in the FUS, there is probably a DollarTree(r) in or near the town you live in.
The main advantage of these LED candles is they are cheap.   If desired, you could wire up some large number of them, in parallel, and power them with something other than the coin cells they come with.

Twinkling LED Fairy Lights
If you want a big string of like, 100 or so, twinkling lights, I think this might be a good solution:
http://www.ebay.com/itm/New-White-Color-10M-100-Led-String-Fairy-Light-Christmas-Tree-Wedding-Party-110V-/320946990143
and that link is to one of the Hong Kong retailers on eBay.  I actually bought one of those, and it has a single button, for selecting 1 of 8 different modes of blinking.

On the little controller box itself, these are described as, "1) Combination; 2) In Waves; 3) Sequential; 4) Slo Glo;
5)Chasing/Flash; 6) Slow Fade; 7)Twinkle Flash; and 8) Steady On"

DIY Methods

Building your own flickering LEDs will take more work.  I can think of, broadly, two different ways to do this:  Analog and Digital via microcontroller.

If you like microcontrollers, e.g. Arduino(r), then you should probably just look up some script or sketch someone else has written to do this.
https://www.instructables.com/pages/search/search.jsp?q=arduino+twinkling+leds

For the analog approach I suggest wiring up a NPN transistor as a voltage-to-current converter, by connecting the emitter of the transistor through a resistor R to ground.  Then the LED, or a series string of LEDs, gets connected between the collector of the transistor and Vcc.

Then you put the control signal, the source of "flicker", as a voltage on the base of the transistor, and the current through the LEDs is approximately,
I = (Vbase - O.6V)/R

But what do you use for the flickering control signal?  One answer to that is an audio signal, like canned music. 

Coincidentally, that is often what the makers of the LED candles use: cheap little music/melody ICs.  For example, this instructable,
https://www.instructables.com/id/How-to-Listen-to-Light/
shows a method for actually listening to the flickering signal in those LED candles.

Anyway, I am guessing that probably the easiest/best method, for what you have in mind, is to just go out and buy LEDs that flicker, because they're out there, via the sources I linked to above, and others.

The analog circuit I described kind of quickly. So if you are actually interested in that one, reply saying you want to know more about that,  and I'll draw you a picture(circuit diagram) of it. BTW,  that trick is probably only good for driving maybe 2 or 3 LEDs per transistor.

Hi Jack,

That was a great post. I'm in a similar situation and I was wondering if you could give me some more info.

I got some LED strings which supposedly had a twinkle effect, but when they arrived it was more like a strobe light effect.

I already got an Arduino UNO and a relay so I would be able to turn the lights on and off remotely, but now I'm thinking that I could create the desired twinkling effect using the Arduino too.

My limited understanding is that the lights (which are mains power in my case) are powered via a bridge rectifier to DC, and there are effectively two channels of live and one ground wire.

I didn't know anything about this stuff when I started the project; if I had, I might have gone with one of those fibre optic setups that has LEDs reflected off of a rotating disk into the fibers to create a twinkling effect. However, I want to use the stuff I already bought, so I understand the effect will be pretty limited with only 2 groups to control.

I'm interested in how controlling these groups would actually work and what the easiest way to do that might be.

You mentioned that one can only control a few LEDs per PNP transistor. How might I go about controlling a whole string? Mains voltage is 220-230v here.

I was thinking a possible solution would be to control two PNP transistors (for the two channels) via the UNO's PWM pins, and then use the transistors to control a solid state relay, but I have no idea if that would work or how rapidly that type of relay can be switched. I was surprised by how loud normal relays are when I was testing mine, it's fine for on and off but it will be annoying to hear all the time when the lights are on.

Another, possibly simpler solution would be to piggy-back on the existing controllers. Watching one of bigclive's videos on YouTube, it seems like the effects are generated from the DC pulses themselves, using whatever the polling rate is (50hz?) as a timer. There seems to be a little controller in there on a perpendicular board but it's potted with epoxy so I can't get at it. If you think this would be a viable solution I can take some pictures of the board as I'm not really sure what I'm looking at (apart from the rectifier, controller and a few capacitors).

I've really been struggling to find info relevant to my specific case so I'd be super thankful if you would help me out.

Thanks,

Jimmy

I think the short answer to this question, of how to do longer strings of LEDs, is: SCRs or TRIACs

https://en.wikipedia.org/wiki/Silicon_controlled_r...

The longer answer lies in the text below this line.

The 100-LED, 8-function, lights, with single-button control box, that I mentioned in an earlier reply here, those lights use a single SCR to control each series string. For example, 4 SCRs controlling 4 strings of 25 LEDs each.

I found a data sheet for this 8-function SCR driver IC, sort of. Actually what I found is a data sheet for an IC with the same pins, as an IC I found inside one of these 8-function fairy lights gizmos. The name of this IC is "M80056B"

http://www.alldatasheet.com/datasheet-pdf/pdf/1236...

And you should look at this data sheet, because it has a circuit diagram, that sort of explains how the thing works.

Curiously, the numbers I have seen actually printed on the light-string gizmos I have, are "SGS-803" and "G-803", and those numbers do not resemble "M80056B"

Searching, via Google(r), for images connected to the words like "xmas light controller", I found mention of an IC called, "SH-803", but I did not find any data sheets, just some pictures of circuit diagrams.

http://www.seekic.com/circuit_diagram/Control_Circ...


http://www.next.gr/light-laser-led/Lighting/Eight-...


I can also attach some pictures of a circuit diagram I made from one of these gizmos I took apart.

Also I should note the number of LEDs and resistors I found in each string. The gizmo I took apart had 100 white LEDs, divided into 4 strings of 25 each. Moreover, I think each string of 25 LEDs has 18 Kohm of resistors. Also that 18K is actually distrubed across 6, 3K resistors, and the reason for that, I assume, is to distribute the heat those resistors produce, so all the resistor heat does not go to one spot, which it would if each string had a single 18K resistor.

The subject of these resistors and heat, reminds me of a page I should link to. That guy, Big Clive, you mentioned, coincidentally or not, he wrote a page describing some horrible things he did to one of these 8-function light gizmos.

http://www.bigclive.com/noflash.htm


Essentially he decided to say, "fuck this", to the controller circuit, and he shorted across the SCRs, or just replaced the controller board with bridge rectifier, and the page linked above has pictures of this.

Which reminds me of something else, and that something else is the question of whether or not the controller board is doing something smart to regulate current to the LEDs.

I mean there is the possiblity it could be.

When I first bought one of these gizmos, via eBay via someone selling them out of China or Hong Kong, I was amazed that the thing they sold me was, claimed to be, compatable with 110 VAC or 220 VAC mains, and basically I was wondering, "How does that work?"

And that is a question I have still not answered.

For a while I was speculating that the controller was doing some sensing of the magnitude of the line voltage, and using this to adjust the timing for turning on the SCRs, essentially "dimming" its blinky signals in response to how much line voltage it sees.

https://en.wikipedia.org/wiki/Dimmer#Solid-state_d...

But it might be something more simple than that. E.g. the things are made to work with 220 VAC mains, and they'll also work with 110 VAC mains, like in my country, the former United States, except that they will just be a lot dimmer.


Moreover, I never notice the fact that they're dimmer, because I wasn't expecting them to be all that bright, because, you know, they're made to be used at night, or in a dark room, etc.

Come to think of it, maybe Big Clive could have just used a single diode, instead of a full wave rectifier, for his lights mod, that way they'd only be on for half the time, and perhaps this reduced power (and reduced brightness) would prevent his resistors from burning.


Final note, I do not have much experience working with microcontrollers, although that is something I have been meaning to learn more about, and you know, get more experienced with, so I am not going to comment on your Arduino plans except to say that SCRs do not work with PWM per se.

The way SCRs work, is via phase control. You turn them on periodically, at a time corresponding to a specific place (time) in the AC wave form. Then you rely on the fact that the line voltage periodically goes to zero to turn the SCR off.

That's kind of an important point to note regarding SCRs. They are intended to work with a voltage source that periodically turns itself off; e.g. the usual sinusoidal AC waveform, otherwise the SCRs won't turn off, and bad things can happen when a SCR gets stuck in the "on" state.

8-function-scr-light-controller--04.jpg8-function-scr-light-controller--03.jpg8-function-scr-light-controller--02.jpg8-function-scr-light-controller--01.jpg