Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Christmas lights controlled with Netduino


  • Please log in to reply
10 replies to this topic

#1 Stanislav Husár

Stanislav Husár

    Advanced Member

  • Members
  • PipPipPip
  • 99 posts

Posted 03 December 2011 - 01:48 PM

Hi, Now the christmas is coming, and I want to use Netduino to control christmas lights chain.One option is to create such chain from scrath, which would be cost-intensive.Another option is, to hack existing chain, which is what I am trying to do. The most important part of that chain is four diodes connected as AC to DC convertor, and then PCR 406J s as driver for individual lights. Cathode to positive supply, Anode to light chains and Gate to some integrated circuit with no name. How can I drive gate of the PQR 406J s with Netduino? I thought if I can place 2N222A between gate and ground, and power its base with Netduino, but I am not sure what it will do, and as the lights chain is for 220V AC, I am not going to do anything until I am sure it will work as it is expected. Will circuit at attached imageAttached File  Untitled.png   29.16KB   91 downloads(black is predefined, red is what I want to add) work, or more possibly cause damage?What circuit would work?

#2 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 03 December 2011 - 02:49 PM

Hello Stanislav.
Your circuit won't work, it is really dangerous, and probably could damage your Netduino.
Here's why...

The diode-bridge is good, but you should add a capacitor to stabilize the voltage. That capacitor should be large enough, and ranged for a high voltage (min 400V). Bear in mind that once the 220VAC is rectified, become about 310VDC = 220*sqrt(2) (well over 320V because in the EU the mains is actually 230VAC).
Working with a so high voltage is *really* dangerous, and can be hurtful.

Using a so high voltage, probably the lights can't light for a long time, being targeted for 220VAC (not 310VDC).

The thryristor is another good idea, but is a bit complex to shut off, once has been switched on. So, I wouldn't suggest it.

Another problem is that you're connecting the mains line directly to the Netduino ground. Physically is correct, and it works...but it's the worst way to connect a low voltage circuit. What if you plug your Netduino using the USB or the Ethernet?
Of sure your home safety-switch will blow. If you haven't, a big "flash" will light the Christmas!
Please don't do it!

I *strongly* suggest to find out a light strip working at low voltage (max 24V). Another option is what you pointed, about creating by yourself, maybe with leds.
In this last case, I don't think the cost would be so high. You may look for some very thin wire (dark green colored), and connect the leds in a particular way. That will allows you to drive easily (with NO danger) with Netduino, and creating lighting patterns that a commercial strip can't do.

An example?
The Mark/Nevyn led cube: search in this forum for the details...

Hope it helps.
Cheers
Biggest fault of Netduino? It runs by electricity.

#3 Stanislav Husár

Stanislav Husár

    Advanced Member

  • Members
  • PipPipPip
  • 99 posts

Posted 03 December 2011 - 03:25 PM

Hi, And if I connect 12 LEDs per colour on 12V supply, can I connect them in series, or I have to connect them in parallel because of voltage drop on LEDs ?

#4 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 03 December 2011 - 04:04 PM

The led is much versatile than a lamp, so...
...so a led has a voltage drop of 1.5-2V (depends on the kind of led).
It has a *reverse* breakdown voltage of about 5-7V (also depends).

If you want to connect the led in series, you would consider a max of 6-8 for a supply of 12V. The main advantage of the series is that the current is the same as a single led, and the wiring is simple.

BUT...if you consider to connect the led in ANTI-parallel (along with a resistor each), you may connect as many led as you want. This time the current is N-times the one required for a single led (where N is the number of leds involved).

Why *anti*-parallel?
Well, "anti-parallel" means that you connect two leds in parallel, but with their polarity opposite. Thus, when the current is flowing in a direction only one led will light. When the current is flowing reversed, the other led is lighting. When NO current is flowing, of course no led are actually lighted.
If you wire the led in such a way, you may (relatively) have the following advantages:
  • your 12V supply is enough for a large number of leds;
  • the 12V is totally safe;
  • the required energy for a strip of leds is much lesser than the equivalent number of bulbs;
  • you may consider two (or more) colors (*);
  • the anti-parallel trick allow to manage two independent pattern of leds with just two wires;
(*) the efficiency of the leds also depends on their color. If you connect them in series, you cannot control the individual brightness. In parallel you will do it, because the resistor.

Cheers
Biggest fault of Netduino? It runs by electricity.

#5 Stanislav Husár

Stanislav Husár

    Advanced Member

  • Members
  • PipPipPip
  • 99 posts

Posted 03 December 2011 - 06:33 PM

And what about this circuitry?How will I compute collector-emittor current depending on number of LEDs ? Description: LED cathodes wired to resistors and then together, and LED anodes wired together.Resistors connected to PWM of particular color, LED anodes to common ground.

Attached Files



#6 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 04 December 2011 - 06:27 AM

Stanislav, your guess is right this time.
Attached there's two solutions: for few leds, and for a longer strip.
Unless you plan to create a short strip (up to 20 leds), I suggest to choose the second circuit. That's because the heating power on the transistor will be enough to overheat it.

The BC337 is the typical small plastic transistor. It allows a max of 800mA, but it cannot be heatsink-ed, and its max power is very small. I guess even with a dozen of leds, it can be warm enough.

More likely I'd use the TIP122, which is a darlington. It allows a max of 5A, should be heatsinked, thus you may wire a very large number of leds.
To heatsink it any metallic plane could be feasible, *BUT* bear in mind that either you insulate electrically the heatsink from the transistor case, or keep the plate off from touching any other electrical point. That may blow the transistor immediately.

Cheers

Attached Files


Biggest fault of Netduino? It runs by electricity.

#7 Magpie

Magpie

    Advanced Member

  • Members
  • PipPipPip
  • 279 posts
  • LocationAustralia (south island)

Posted 04 December 2011 - 11:13 AM

Hi Here is my take Stanislav's project. If you haven't already got the lights then buy some low voltage lights. I think making them would be a bit too time consuming. I saw a 300 led string (which surely contains some strings in parrallel) with a low voltage transformer and a controller for $37. Then you could replace their controller with the Netduino, and even keep their drive circuitry. If you buy a Led string then make 100% sure it is non lethal voltage (32v Ac or 100v dc). As Mario said, there is just no need to use mains voltage for this project. As a first stage you could just get a few led strings turning on and off. So you can make some patterns. Later if you want you could add PWM. As far as using resistors I would just rely on the length of the led string for current limiting, just use the lengths and voltages of the bought ones. And also put in a fuse on the drive circuitry to protect against large currents say just a bit larger than the operational current. Merry Xmas I might even do it myself. Maybe put some IR detection into it, to try and make it into a game for the kids.
STEFF Shield High Powered Led Driver shield.

#8 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 04 December 2011 - 01:14 PM

Maybe put some IR detection into it, to try and make it into a game for the kids.

Absolutely genial!
Unfortunately I have no time, but I'd love to do it!
Congrats, Magpie for the idea!
Cheers
Biggest fault of Netduino? It runs by electricity.

#9 Magpie

Magpie

    Advanced Member

  • Members
  • PipPipPip
  • 279 posts
  • LocationAustralia (south island)

Posted 19 December 2011 - 09:00 AM

Hi Mario I was walking past the bargain bin in a big store and picked up some solar powered Christmas lights. 200 leds + the controller for 27 dollars. Well the controller was of throwaway quality but was driven by common emitter npn transistors so I copied it. So I made up the replacement controller using my netduino and some vero board. 4 channel output to 4 colours. All leds are wired in parrallel with a single pull up resistor per colour. I lost 100 leds and a transitor when I cut the led string in half and didn't realise that there was only a single pull up resistor per colour. Any way the leds are glowing nicely in random patterns. The efficiency must be appalling but I don't want to rewire the led string. I have motion detector attached as well, so I am ready to catch Santa, when somebody goes near the tree the lights will go into alarm mode. I can give more details if anybody is interested, but it's not worthy of project showcase.
STEFF Shield High Powered Led Driver shield.

#10 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 19 December 2011 - 12:54 PM

Not sure to understand, but...a solar-powered strip for the holy-NIGHT?...Moreover, unless you are Australian, here in the Boreal hemisphere there's no enough sun to power a strip of leds!...Okay, just kidding... So, did you power the strip with the AC mains? Please, post some detail about this idea... Cheers
Biggest fault of Netduino? It runs by electricity.

#11 Magpie

Magpie

    Advanced Member

  • Members
  • PipPipPip
  • 279 posts
  • LocationAustralia (south island)

Posted 19 December 2011 - 01:34 PM

Yes they were originally solar powered christmas lights, using a 1.2 volt nimh battery to store the charge. It didn't occur to me how badly this would work in the Northern Hemisphere. It was pretty close to fail in the Southern Hemisphere too. I think the reason it was cheap was because it was stupid product. I use a 12v plug pack to power the netduino and use the same 12v to one side of the leds. So they are safe. I pull the cathodes to ground using 4 x 2n2222 in common emitter configuration (like the relays we often talk about). Bom 4 x Base resistor ~300 ohm. 4 x led strings with built in pull up resistors(recycled). 4 x 2n2222 1 x 5 pin din plug and socket. Just to disconnect the lights. 1 x ir motion detector with open collector output (sparkfun) 1 x vero board. 28 x header pins to attach netduino plus 1 x netduino plus ( the only one I have) 3 x header pins for the motion detector 1 x plugpack 7-12 volt. wire, solder. Sorry about the lack of comments in the code. As soon as it was working, I stopped typing. The math stuff didn't end up being used. The references to rain in the code are because I wanted a random pattern like the sound of rain. but with lights. I like the end effect better than the standard christmas lights. ps. I should've used events for the detector.

Attached Files


STEFF Shield High Powered Led Driver shield.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.