<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>YourITronics &#187; LED</title>
	<atom:link href="http://www.youritronics.com/category/led/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.youritronics.com</link>
	<description>DIY, Electronics, IT, Gadgets</description>
	<lastBuildDate>Fri, 16 Dec 2011 19:22:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>TPS54232 constant current source</title>
		<link>http://www.youritronics.com/tps54232-constant-current-source/</link>
		<comments>http://www.youritronics.com/tps54232-constant-current-source/#comments</comments>
		<pubDate>Fri, 15 Oct 2010 18:55:03 +0000</pubDate>
		<dc:creator>Florin</dc:creator>
				<category><![CDATA[DIY]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[LED]]></category>
		<category><![CDATA[Personal Projects]]></category>
		<category><![CDATA[constant current]]></category>
		<category><![CDATA[Power]]></category>
		<category><![CDATA[TPS54232]]></category>

		<guid isPermaLink="false">http://www.youritronics.com/?p=3391</guid>
		<description><![CDATA[In this article I continue my project where I needed a constant current source. In the previous article I talked about the first approach the LM317 constant current source which didn&#8217;t worked out that well but could of been improved as suggested by some of my readers in the comments. So I decided to use [...]]]></description>
			<content:encoded><![CDATA[<p>In this article I continue my project where I needed a <strong>constant current source</strong>. In the previous article I talked about the first approach the <a href="http://www.youritronics.com/lm317-constant-current-source/">LM317 constant current source</a> which didn&#8217;t worked out that well but could of been improved as suggested by some of my readers in the comments. So I decided to use a dc-dc converter and turn it into a constant current source. Since I&#8217;m using the <a href="http://focus.ti.com/lit/ds/symlink/tps54232.pdf">TPS54232</a> in another project and I have it around I decided to use it. This technique can also be applied to other dc-dc converters with a bit of reading on the subject.</p>
<p>I&#8217;ve started by reading <a title="TPS54160 60-V, Step-Down LED Driver Design Guide" href="http://focus.ti.com/lit/an/slva374/slva374.pdf">SLVA374</a> app report from TI which is a Step-Down LED Driver Design Guide based on the <strong>TPS54160</strong> dc-dc converter, normally used as a buck voltage regulator. The schematic from the app report can be easily adapted to our device with a few changes like adding a sense resistor and an output capacitor:</p>
<p><a href="http://www.youritronics.com/wp-content/uploads/2010/10/TPS24232-constant-current-source-schematic.png"><img class="alignnone size-medium wp-image-3402" title="TPS24232 constant current source schematic" src="http://www.youritronics.com/wp-content/uploads/2010/10/TPS24232-constant-current-source-schematic-300x123.png" alt="TPS24232 constant current source schematic" width="300" height="123" /></a><a href="http://www.youritronics.com/wp-content/uploads/2010/10/TPS24232-constant-current-source-board.png"><img class="alignnone size-medium wp-image-3401" title="TPS24232 constant current source board" src="http://www.youritronics.com/wp-content/uploads/2010/10/TPS24232-constant-current-source-board-300x135.png" alt="TPS24232 constant current source board" width="270" height="122" /></a></p>
<p>If you remember from my last post I needed 1.12 A to power the two led packs that I&#8217;ve  build connected in parallel. We have a simple equation that we use to find out the feedback resistor value: <strong>R=Vref/Io </strong>In our case Vref is 0.8V taken from TPS54232 datasheet, Io is our desired current of 1.12 A. Doing the math we get the R value = 0.71 ohms. This is not a standard value, but we can use two 1.5 ohms resistors in parallel(R1 and R2) to get 0.75 ohms which is pretty close. With 0.75 ohms feedback resistor I have 1.06A at the output which divided by 56(the number of white LED&#8217;s) means 18.9 mA for each white led.</p>
<p>We must consider the <strong>power dissipation for this resistor</strong> and we can calculate it : <strong>Pdis = Vref^2/R</strong> In our case we have Pdis = 0.8^2/0.75 = 0.85W. The only 1.5 ohms resistors that I could find locally were 5 W so I had to work with a bigger package. The EN pin is used to enable and adjust the Undervoltage Lockout but I&#8217;m not going to use that feature since my input voltage is always gonna be high enough not to cause any problems. The resistors are placed on the pcb anyways so you could use those pads and soldere the necessary resistors.</p>
<p>We also must consider the <strong>power dissipation in the low side diode</strong>. During the converter on time, the output current is provided by the internal switching FET. During the off time, the output current flows through the catch diode. The average power in the diode is given by: <strong>Pdiode = (1-Voled/Vin) * Vfd * Io , </strong>where: Vfd is the led forward voltage, Voled is the supplied output voltage and is approximated by: Voled = Nled * VLed + Vref where : Nled = number of LEDs, Vled = forward voltage drop of each LED. In my case Pdiode = (1-(4.2/12))*0.75*1.06=0.51W so I used a 2A 40V schottky diode part number CDBA240-G.</p>
<p>You would also have to consider the inductor and the input and output capacitors, but you can read all about that in the datasheet of the <strong>TPS54232</strong> or in the app report mentioned above. After I had all of my circuit figured out, I routed the board and etched it using my <a title="diy photo etching technique for pcb" href="http://www.youritronics.com/diy-printed-circuit-board-using-photo-etching-method/">photo etching technique</a>. For such a small board its not worth taking out the solder paste so I soldered it using the soldering iron, as you can see its a mix of through hole and surface mount parts but they fit together quite nice.</p>
<p><a href="http://www.youritronics.com/wp-content/uploads/2010/10/DSC08303-Large.jpg"><img class="alignnone size-large wp-image-3406" title="TPS54232 LED constant current source " src="http://www.youritronics.com/wp-content/uploads/2010/10/DSC08303-Large-1024x768.jpg" alt="TPS54232 LED constant current source pcb assembled" width="342" height="242" /></a><img class="alignnone size-large wp-image-3407" title="TPS54232 constant current source pcb" src="http://www.youritronics.com/wp-content/uploads/2010/10/DSC08304-Large-1024x768.jpg" alt="TPS54232 constant current source pcb back side" width="333" height="242" /></p>
<p>The solder drops that you can see on the back of the board are a sort of DIY thermal vias. I&#8217;m not sure how efficient they are but I gave them a try with this board, probably because I had too much time available <img src='http://www.youritronics.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> . First when I designed the board I included a area of copper in the top layer right beside the resistors. Next I drilled some 0.7 mm holes and I placed 0.7 copper wire in the wholes securing it by soldering on both sides. The trick is to make the solder joint as small as possible so it doesn&#8217;t spaces your component from the board. As I&#8217;ve said I don&#8217;t know their efficiency but I think they work, I can feel the heat transferring from one side to the other faster. If you like them you can try them.</p>
<p>The testing went smooth, the LED&#8217;s light up perfectly, no problems at all. During the testing I noticed one bug though: if the input wires are not firmly attached or secured and there is an imperfect contact the converter will tend to output less current than the programmed 1.02A. I&#8217;m not sure why this is happening, it might have something to do with the Undervoltage Lockout feature that I skipped on but I&#8217;m not sure. Anyway its not that much of a problem since once in place the power source will have the cables firmly attached so no worries. That&#8217;s why I used the cable connectors on the PCB in the first place, I knew it would save me some trouble later.</p>
<p><a href="http://www.youritronics.com/wp-content/uploads/2010/10/DSC08314-Large.jpg"><img class="alignnone size-large wp-image-3395" title="56 white LED " src="http://www.youritronics.com/wp-content/uploads/2010/10/DSC08314-Large-1024x768.jpg" alt="56 white LED " width="645" height="484" /></a></p>
<p>Now I had one last thing to do. Since this circuit is going to be operated in the outdoors the corrosion would set in pretty quickly so I improvised once again. I had this idea for quite a long time but never actually tried it. So I used my Bison universal hobby glue, which is transparent, and covered the copper traces on the PCB in glue. After it hardened, it looks like you could dip these board into water and nothing would happen to them. Well, except from the terminals which stick out of the PCB <img src='http://www.youritronics.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> . Nonetheless I think these boards will run no problems even after a few years. If you&#8217;re wondering where the bubbles come from, they form when the glue dries out <img src='http://www.youritronics.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> .</p>
<p><a href="http://www.youritronics.com/wp-content/uploads/2010/10/DSC08310-Large.jpg"><img class="alignnone size-medium wp-image-3393" title="TPS54232 constant current source covered in glue" src="http://www.youritronics.com/wp-content/uploads/2010/10/DSC08310-Large-300x225.jpg" alt="TPS54232 constant current source covered in glue" width="300" height="225" /></a><a href="http://www.youritronics.com/wp-content/uploads/2010/10/DSC08309-Large.jpg"><img class="alignnone size-medium wp-image-3392" title="white led packs pcb's covered in glue" src="http://www.youritronics.com/wp-content/uploads/2010/10/DSC08309-Large-300x225.jpg" alt="white led packs pcb's covered in glue" width="300" height="225" /></a></p>
<p>I&#8217;m pretty happy how this project ended up and I feel like I know more about LED&#8217;s and ways to power them. I&#8217;ll definitely need to experiment more with some high power LED&#8217;s, maybe use them to light my workbench. As for the efficiency of this circuit I don&#8217;t know if I&#8217;m calculating the right way because I&#8217;m using the equations from page 16 of TPS54232 datasheet, and those are clearly stated to be used only under continuous conduction mode. Since the circuit has been modified to act as a constant current source I&#8217;m not sure the same equations apply. But I did the math anyway and I got an efficiency of 75.36% and according to the same equation if I would connect the two led packs in series I would get an efficiency of 79.01%. Once again I&#8217;m not sure these calculations are correct and I ask the readers to comment on these.</p>
<p>There is more that you can do to improve the efficiency of this circuit. It turns out you can reduce the power losses in the current sense resistor by lowering the voltage across the resistor. The solution is to inject a bias voltage, but I&#8217;m not going to try this solution since I&#8217;m already happy with my design. You can read more about it in <a title="Extending Battery Life With the TPS61040 White Light LED Driver" href="http://focus.ti.com/lit/an/slea004/slea004.pdf">SLEA004</a> app report from TI.</p>
<p>Downloads:</p>
<ul>
<li><a href="http://www.youritronics.com/wp-content/uploads/2010/10/TPS54232-constant-current-source1.zip">TPS54232 constant current source Eagle files</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.youritronics.com/tps54232-constant-current-source/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>LM317 constant current source</title>
		<link>http://www.youritronics.com/lm317-constant-current-source/</link>
		<comments>http://www.youritronics.com/lm317-constant-current-source/#comments</comments>
		<pubDate>Sat, 02 Oct 2010 09:53:00 +0000</pubDate>
		<dc:creator>Florin</dc:creator>
				<category><![CDATA[DIY]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[LED]]></category>
		<category><![CDATA[Personal Projects]]></category>
		<category><![CDATA[LM317]]></category>
		<category><![CDATA[Power]]></category>
		<category><![CDATA[White]]></category>

		<guid isPermaLink="false">http://www.youritronics.com/?p=3355</guid>
		<description><![CDATA[Recently a friend of mine asked my help about replacing some 12V light bulbs with LED&#8217;s for longer battery life. After doing some searches the cheapest solution was to use a bunch of 5 mm white LED&#8217;s powered from a constant current source. A constant current source is not cheap to buy and since were [...]]]></description>
			<content:encoded><![CDATA[<p>Recently a friend of mine asked my help about replacing some 12V light bulbs with LED&#8217;s for longer battery life. After doing some searches the cheapest solution was to use a bunch of 5 mm white LED&#8217;s powered from a constant current source. A constant current source is not cheap to buy and since were in the spirit of making why not make that also. But where to start ? there are voltage regulators that you can turn into constant current sources, dc-dc converters that you can turn into constant current sources or you can choose a specialized circuit designed exactly for powering LED&#8217;s. Obviously the first option is the cheapest and simplest to implement but it comes with its drawbacks.</p>
<p>Anyway, I had everything needed on hand so I proceeded and designed a PCB in Eagle. I used two <a title="LM317 voltage regulator" href="http://www.national.com/ds/LM/LM117.pdf">LM317</a> voltage regulators because I want to power two sets of LED&#8217;s. Each set of LED&#8217;s is composed of 28 LED&#8217;s tied in parallel. I&#8217;m gonna set the current on each LED to 20 mA so that is 560mA for each set of LED&#8217;s. I wanted to spread all that load on two LM317 so I used two.</p>
<p><a href="http://www.youritronics.com/wp-content/uploads/2010/10/28-LEDs-in-parallel.png"><img class="alignnone size-medium wp-image-3359" title="28 LEDs in parallel" src="http://www.youritronics.com/wp-content/uploads/2010/10/28-LEDs-in-parallel-300x120.png" alt="28 x 5mm white LEDs wired in parallel " width="300" height="120" /></a><a href="http://www.youritronics.com/wp-content/uploads/2010/10/Dual-LM317-constant-current-source.png"><img class="alignnone size-medium wp-image-3360" title="Dual LM317 constant current source schematic" src="http://www.youritronics.com/wp-content/uploads/2010/10/Dual-LM317-constant-current-source-300x105.png" alt="Dual LM317 constant current source schematic" width="315" height="120" /></a></p>
<p>The PCB were easy to route and ended up like this:</p>
<p><a href="http://www.youritronics.com/wp-content/uploads/2010/10/28-LEDs-in-parallel-PCB.png"><img class="alignnone size-medium wp-image-3358" title="28 x white LEDs in parallel PCB" src="http://www.youritronics.com/wp-content/uploads/2010/10/28-LEDs-in-parallel-PCB-300x149.png" alt="28 x white LEDs in parallel PCB" width="300" height="149" /></a><a href="http://www.youritronics.com/wp-content/uploads/2010/10/LM317-constant-current-source-PCB.png"><img class="alignnone size-medium wp-image-3361" title="Dual LM317 constant current source PCB" src="http://www.youritronics.com/wp-content/uploads/2010/10/LM317-constant-current-source-PCB-300x292.png" alt="Dual LM317 constant current source PCB" width="151" height="148" /></a></p>
<p>Kind of small and nice looking. The LED pack could of been smaller but since LED&#8217;s don&#8217;t spread light on a wide angle I decided to spread the LED&#8217;s a bit to spread the light. The LM317 board was designed so that it would fit perfectly under a heatsink I had around. Actually the heatsink is from an old video card I had in my junk box; its nice to reuse these things, its like recycling.</p>
<p><a href="http://www.youritronics.com/wp-content/uploads/2010/10/DSC08294-Large.jpg"><img class="alignnone size-medium wp-image-3373" title="old video card ripped out of heatsink" src="http://www.youritronics.com/wp-content/uploads/2010/10/DSC08294-Large-300x225.jpg" alt="old video card ripped out of heatsink" width="300" height="225" /></a></p>
<p>I proceeded and used my <a href="http://www.youritronics.com/diy-printed-circuit-board-using-photo-etching-method/">DIY photo etching method</a> but something went wrong and I messed up all of the PCB&#8217;s, they ended up looking like this:</p>
<p><a href="http://www.youritronics.com/wp-content/uploads/2010/10/DSC08295-Large.jpg"><img class="alignnone size-medium wp-image-3374" title="messed up PCB" src="http://www.youritronics.com/wp-content/uploads/2010/10/DSC08295-Large-300x225.jpg" alt="messed up PCB" width="300" height="225" /></a></p>
<p>The thing is I stopped using ferric chloride a while ago. Instead I turned to ammonium persulfate which comes as a white powder that you need to dissolve in watter. The watter stays clear, it doesn&#8217;t smell and it doesn&#8217;t stain (not checked yet). It only catches a blueish color after you&#8217;ve used it and copper accumulates in it. The only disadvantage for using ammonium persulfate is that it etches slower than ferric chloride, other than that is great. The problem with mine is that it was mixed with water more than 6 months ago and it turns out it doesn&#8217;t last that long when mixed with water, so keep it as powder and only mix it when you need it. Unfortunately I couldn&#8217;t get more of it locally so I had to return to the good old ferric chloride. I did all the process again and the boards came out great this time.</p>
<p>The assembled LED packs look like this:</p>
<p><a href="http://www.youritronics.com/wp-content/uploads/2010/10/DSC08281-Large.jpg"><img class="alignnone size-medium wp-image-3366" title="Assembled 28 led packs" src="http://www.youritronics.com/wp-content/uploads/2010/10/DSC08281-Large-300x225.jpg" alt="Assembled 28 led packs" width="300" height="225" /></a><a href="http://www.youritronics.com/wp-content/uploads/2010/10/DSC08286-Large.jpg"><img class="alignnone size-medium wp-image-3367" title="Assembled 28 led packs back" src="http://www.youritronics.com/wp-content/uploads/2010/10/DSC08286-Large-300x225.jpg" alt="Assembled 28 led packs back" width="300" height="225" /></a></p>
<p>and the assembled LM317 board look like this:</p>
<p><a href="http://www.youritronics.com/wp-content/uploads/2010/10/DSC08293-Large.jpg"><img class="alignnone size-medium wp-image-3372" title="dual LM317 constant current source assembled" src="http://www.youritronics.com/wp-content/uploads/2010/10/DSC08293-Large-300x225.jpg" alt="dual LM317 constant current source assembled" width="300" height="225" /></a><a href="http://www.youritronics.com/wp-content/uploads/2010/10/DSC08287-Large.jpg"><img class="alignnone size-medium wp-image-3368" title="dual LM317 constant current source assembled" src="http://www.youritronics.com/wp-content/uploads/2010/10/DSC08287-Large-300x225.jpg" alt="dual LM317 constant current source assembled" width="300" height="225" /></a></p>
<p>Notice how I designed the board to fit just over the raised part of the heatsink? its the little things that count <img src='http://www.youritronics.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  (and I&#8217;m not referring to the heatsink as you will read next). The LM317 pair was mounted on the back so that it sits firmly attached to the heatsink transferring all that heat.</p>
<p>here&#8217;s a photo between the heatsink and the pcb:</p>
<p><a href="http://www.youritronics.com/wp-content/uploads/2010/10/DSC08292-Large.jpg"><img class="alignnone size-medium wp-image-3371" title="LM317 constant current source - between heatsink and pcb" src="http://www.youritronics.com/wp-content/uploads/2010/10/DSC08292-Large-300x225.jpg" alt="LM317 constant current source - between heatsink and pcb" width="300" height="225" /></a><a href="http://www.youritronics.com/wp-content/uploads/2010/10/DSC08291-Large.jpg"><img class="alignnone size-medium wp-image-3370" title="LM317 constant current source - between heatsink and pcb" src="http://www.youritronics.com/wp-content/uploads/2010/10/DSC08291-Large-300x225.jpg" alt="LM317 constant current source - between heatsink and pcb" width="300" height="225" /></a></p>
<p>I was pretty happy with the overall result until I actually run it. The heatsink got very hot pretty fast and it was clear it was not dissipating enough heat. With 12 V in, LED Vf of 3.4V , 560mA and an ambient temperature of 28 degrees C, the heatsink reached almost 80 degrees C. It turns out The LM317 is not very efficient in this setup and together with the sense resistor has to dissipate allot of heat. And a simple calculation would of shown this from the beginning if I paid attention to it.  (Vin-Vf.Led-Vadj)xIo =&gt; (12V-3.4V-1.25V)x0.56A= 4.116 W for each regulator, double that and the heatsink is just too small to dissipate that kind of heat. Not to mention the poor efficiency of the circuit. Its the little things that count , I would of done that calculation earlier I wouldn&#8217;t of made that circuit just to realize that is not good for my setup.</p>
<p>At this point I knew this option is not good and I had to find something else to power the LED&#8217;s. I could use a specialized circuit like the <a title="LM3406 1.5A Constant Current Buck Regulator for Driving High Power LEDs" href="http://www.national.com/ds/LM/LM3406.pdf">LM3406</a> which would give me the best efficiency but I would have to wait for delivery and get some more parts, or I could use a dc-dc converter modified as constant current source which would give me decent efficiency and I could build it with parts that I already have. I decided to go with the dc-dc converter modified as constant current source. I already have the <a href="http://focus.ti.com/lit/ds/symlink/tps54232.pdf">TPS54232</a> from another project of mine; the TPS54232 is a 2A, 28V, 1MHz, step down SWIFT™ dc-dc converter. Now its time to design a new PCB for the new power source but more about this in the <a href="http://www.youritronics.com/tps54232-constant-current-source/">next article.</a></p>
<p>Downloads:</p>
<ul>
<li><a href="http://www.youritronics.com/wp-content/uploads/2010/10/LM317-constant-current-source.zip">LM317 constant current source design files</a></li>
<li><a href="http://www.youritronics.com/wp-content/uploads/2010/10/28-LED-pack-PCB.zip">28 LED pack design files</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.youritronics.com/lm317-constant-current-source/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Happy new year 2010 POV</title>
		<link>http://www.youritronics.com/happy-new-year-2010-pov/</link>
		<comments>http://www.youritronics.com/happy-new-year-2010-pov/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 23:39:51 +0000</pubDate>
		<dc:creator>Florin</dc:creator>
				<category><![CDATA[DIY]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[LED]]></category>
		<category><![CDATA[ATtiny26]]></category>
		<category><![CDATA[Display]]></category>
		<category><![CDATA[POV]]></category>

		<guid isPermaLink="false">http://www.youritronics.com/?p=3156</guid>
		<description><![CDATA[I would like to wish my readers a Happy New Year and may all your wishes come true. As you may have experienced, during the holidays,  hobbyists get some free time and they like spending it building stuff. In this case the author, Infernoz, build this 8 LED POV display, which seems like a fun [...]]]></description>
			<content:encoded><![CDATA[<a href="http://www.youritronics.com/happy-new-year-2010-pov/"><img src="http://img.youtube.com/vi/8h52IbpyK9w/default.jpg" width="130" height="97" border=0></a>
<p>I would like to wish my readers a Happy New Year and may all your wishes come true. As you may have experienced, during the holidays,  hobbyists get some free time and they like spending it building stuff. In this case the author, Infernoz, build this 8 LED POV display, which seems like a fun way of wishing a happy new year. The device is based on the Attiny26 from ATMEL and from the video we can see it works quite nice, but unfortunately I was unable to locate any source code posted on the project page, but this is not that bad as you can find POV source code from others projects(<a href="http://www.youritronics.com/silent-ceiling-pov-display/">POV1</a> <a href="http://www.youritronics.com/wearable-pov-unit/">POV2</a> <a href="http://www.youritronics.com/simple-handheld-pov/">POV3</a>) if you&#8217;re interested in building one.</p>
<p><strong>Happy new year 2010 POV: </strong><a href="http://www.elektronika.ba/728/new-years-pov-project/">[via]</a><strong><br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.youritronics.com/happy-new-year-2010-pov/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Bicycle Tail Light</title>
		<link>http://www.youritronics.com/bicycle-tail-light/</link>
		<comments>http://www.youritronics.com/bicycle-tail-light/#comments</comments>
		<pubDate>Thu, 27 Aug 2009 10:42:06 +0000</pubDate>
		<dc:creator>Andrei</dc:creator>
				<category><![CDATA[DIY]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[LED]]></category>
		<category><![CDATA[Microcontroller]]></category>
		<category><![CDATA[Bicycle]]></category>
		<category><![CDATA[Light]]></category>
		<category><![CDATA[LM3410]]></category>

		<guid isPermaLink="false">http://www.youritronics.com/?p=2982</guid>
		<description><![CDATA[You want to learn more about DC to DC boost converters? Here is a good and practical application of such converters, an LED tail light for your bicycle. Why do you need a boost converter for that you might ask, when you can simply have a battery power up some LEDs. Well, this way you [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.youritronics.com/wp-content/uploads/2009/08/Bicycle-tail-light.jpg"><img class="alignnone size-medium wp-image-2983" src="http://www.youritronics.com/wp-content/uploads/2009/08/Bicycle-tail-light-300x225.jpg" alt="Bicycle tail light" width="300" height="225" /></a></p>
<p>You want to learn more about DC to DC boost converters? Here is a good and practical application of such converters, an LED tail light for your <a href="http://www.youritronics.com/bike-led-lighting-system/">bicycle</a>. Why do you need a boost converter for that you might ask, when you can simply have a battery power up some LEDs. Well, this way you greatly increase efficiency, you increase the number of LEDs you can drive and thus increase the perceived power of light. And yes, you will learn about them.</p>
<p>This project makes use of the National Semiconductor LM3410 chip. This chip provides a current regulation rather than a voltage regulation and makes it suitable when working with LEDs. This current regulation is done by switching a NMOS gate at constant frequency of 525Khz ( you can also chose 1.6Mhz) and varying the duty cycle, the so called pulse width modulation. Given a constant frequency varying the pulse width results in varying the mean value in time. The regulation is done by providing a feedback current that causes a voltage drop on a resistor which in turn is fed into a comparator.</p>
<p>The output of this comparator goes to the PWM comparator where it faces the output of the amplifier that reads the switched current through an inductor. The result will be a PWM signal attacking the NMOS gate and thus providing a steady mean output current value. The current sensing amplifier also provides an output for switched current limiting. Some nice features of LM3410 makes things easier, it&#8217;s internally compensated,  has a very low stand-by current, has dimming possibilities and thermal shutdown.</p>
<p>As the author states in his article you have to be careful when choosing components. Since the operation frequency is pretty high the diodes through which the inductor discharges must be high speed or you risk blowing the chip. Taking things a step forward he added a PIC12F683 microcontroller to provide some light effects selected by a pressing a button.</p>
<p>If we look closer at this project we can see it can be further developed, using the dimming possibility of LM3410 you can also turn it into a stop light. Whenever you break light intensity goes higher. Another development is to adapt it to be used with a dynamo. Have fun.</p>
<p><strong>Bicycle Tail Light:</strong> <a href="http://projects.dimension-x.net/archives/211">[Link]</a><strong><br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.youritronics.com/bicycle-tail-light/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pong on blue matrix + arduino</title>
		<link>http://www.youritronics.com/pong-on-blue-matrix-arduino/</link>
		<comments>http://www.youritronics.com/pong-on-blue-matrix-arduino/#comments</comments>
		<pubDate>Sat, 15 Aug 2009 12:41:47 +0000</pubDate>
		<dc:creator>Florin</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[LED]]></category>

		<guid isPermaLink="false">http://www.youritronics.com/?p=2875</guid>
		<description><![CDATA[Bruno dropped an email to let us know about his project, a pong game controlled by an arduino and displayed on a 8&#215;8 blue dot matrix.]]></description>
			<content:encoded><![CDATA[<a href="http://www.youritronics.com/pong-on-blue-matrix-arduino/"><img src="http://img.youtube.com/vi/lvAlKH5SzYk/default.jpg" width="130" height="97" border=0></a>
<p>Bruno dropped an email to let us know about his project, a <a href="http://blog.bsoares.com.br/arduino/ping-pong-with-8x8-led-matrix-on-arduino">pong game</a> controlled by an arduino and displayed on a 8&#215;8 blue dot matrix.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.youritronics.com/pong-on-blue-matrix-arduino/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silent Ceiling POV Display</title>
		<link>http://www.youritronics.com/silent-ceiling-pov-display/</link>
		<comments>http://www.youritronics.com/silent-ceiling-pov-display/#comments</comments>
		<pubDate>Sat, 25 Jul 2009 21:58:17 +0000</pubDate>
		<dc:creator>Tiberiu</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[LED]]></category>
		<category><![CDATA[Microcontroller]]></category>
		<category><![CDATA[74HC595]]></category>
		<category><![CDATA[LED Display]]></category>
		<category><![CDATA[POV]]></category>

		<guid isPermaLink="false">http://www.youritronics.com/?p=2716</guid>
		<description><![CDATA[A persistence of vision (POV) display is a device that creates an apparently still image using rotating LEDs with great speed. The human eye is not able to distinguish every image individually, so the picture formed appears as a solid image. The POV phenomenon is not a new discovery and a lot of POV display [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.youritronics.com/wp-content/uploads/2009/07/silent_ceiling_pov_display.jpg"><img class="alignnone size-medium wp-image-2717" src="http://www.youritronics.com/wp-content/uploads/2009/07/silent_ceiling_pov_display-300x168.jpg" alt="Silent Ceiling POV Display" width="300" height="168" /></a></p>
<p>A persistence of vision (POV) display is a device that creates an apparently still image using rotating LEDs with great speed. The human eye is not able to distinguish every image individually, so the picture formed appears as a solid image. The POV phenomenon is not a new discovery and a lot of <a title="POV" href="http://www.youritronics.com/tag/pov/">POV</a> display projects have been made. However, this one right here has two different attributes that differentiate it from other POV displays: it is located on a fan placed on a ceiling and it&#8217;s silent.</p>
<p>This project uses a fan with 5 propeller blades and every blade has 32 LEDs mounted on it (that means a total of 160). These LEDs are connected to an Atmel microcontroller on an Arduino board. The POV display also uses 74HC595 8-bit serial-in, parallel-out shift registers that convert serial-in data into parallel-out data. The microcontroller generates the sequence in which the LEDs are lit, thus creating the image.</p>
<p>The location of the display makes it pretty cool and the fact that it&#8217;s attached to this kind of fan makes the whole device completely silent, which is quite different from most POV displays out there that are rather noisy. Having a thing like this blinking in your living room might seem like a good idea if you want to impress a guest audience, but other than that I can&#8217;t find a reason for actually using it.</p>
<p><strong>Silent Ceiling POV Display: </strong><a href="http://www.elektronika.ba/668/ceiling-fan-pov-display/">[Link]</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.youritronics.com/silent-ceiling-pov-display/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>New TV-B-Gone Case Style</title>
		<link>http://www.youritronics.com/new-tv-b-gone-case-style/</link>
		<comments>http://www.youritronics.com/new-tv-b-gone-case-style/#comments</comments>
		<pubDate>Sat, 18 Jul 2009 18:34:20 +0000</pubDate>
		<dc:creator>Tiberiu</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Gadgets]]></category>
		<category><![CDATA[LED]]></category>
		<category><![CDATA[Microcontroller]]></category>
		<category><![CDATA[adafruit]]></category>
		<category><![CDATA[TV]]></category>

		<guid isPermaLink="false">http://www.youritronics.com/?p=2698</guid>
		<description><![CDATA[Have you ever found yourself in a situation where you wanted to talk about something important or just simply wanted some peace and quiet while enjoying your drink and a damn TV wouldn&#8217;t shut up? Chances are you have. But from now on, you can use this little gadget to silence those TV sets that [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.youritronics.com/wp-content/uploads/2009/07/tv_disabler.jpg"></a><a href="http://www.youritronics.com/wp-content/uploads/2009/07/tv_disabler1.jpg"><img class="alignnone size-medium wp-image-2700" src="http://www.youritronics.com/wp-content/uploads/2009/07/tv_disabler1-300x199.jpg" alt="TV Disabler" width="300" height="199" /></a></p>
<p>Have you ever found yourself in a situation where you wanted to talk about something important or just simply wanted some peace and quiet while enjoying your drink and a damn TV wouldn&#8217;t shut up? Chances are you have. But from now on, you can use this little gadget to silence those TV sets that bother you with loud, uninteresting stuff. You can carry it in your pocket and you can surely have a laugh using it.</p>
<p>Humorously named TV-B-Gone, this TV Disabler can make some annoying situations quite entertaining. The TV-B-Gone can turn off most of the TV sets available, while having about the same size as a universal remote control. It is a nifty little kit made by Adafruit and it is available for purchase for $19.50. It possesses an Atmel ATTINY85V-10-PU programmed microcontroller, 4 IR LEDs used as emitters and a double AAA battery holder (you can find a complete parts list in the link).</p>
<p>The TV Disabler must be pointed at the TV you wish to quiet down. It has a single button that must be pressed and then it starts to transmit its signal using codes that are stored in its memory for all major TV brands. It takes about 2 minutes to send all the codes, but most TV sets will turn off. The TV Disabler also has a green LED that starts glowing once the device is transmitting.</p>
<p>Since the original kit from Adafruit doesn&#8217;t have a case, you can make one like the one in the picture above. This project uses a modified Miniature General Purpose ABS Box 1551 Series from Maplin Electronics Ltd. You will have to make 2 holes, one for the button, and the other for the LED. Putting it all inside the box may be tricky, but once you get it right you will have the <strong>TV-B-Gone</strong> ready and waiting. And you can say goodbye to those noisy TVs disturbing you.</p>
<p>don&#8217;t forget to check youritronics custom version of <a href="http://www.youritronics.com/super-tv-b-gone/">tv-b-gone</a>.</p>
<p><strong>New TV-B-Gone Case Style</strong><strong>: </strong><a href="http://www.justblair.co.uk/a-bit-of-fun-tv-b-gone.html">[Link]</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.youritronics.com/new-tv-b-gone-case-style/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twinkling LED Heart of Love</title>
		<link>http://www.youritronics.com/twinkling-led-heart-of-love/</link>
		<comments>http://www.youritronics.com/twinkling-led-heart-of-love/#comments</comments>
		<pubDate>Fri, 03 Jul 2009 10:05:24 +0000</pubDate>
		<dc:creator>Tiberiu</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[LED]]></category>
		<category><![CDATA[Microcontroller]]></category>
		<category><![CDATA[love]]></category>

		<guid isPermaLink="false">http://www.youritronics.com/?p=2617</guid>
		<description><![CDATA[&#8220;Love is a smoke raised with the fume of sighs, Being purged, a fire sparkling in lovers&#8217; eyes, Being vexed, a sea nourished with lovers&#8217; tears. What is it else? A madness most discreet, A choking gall and a preserving sweet.&#8221; (William Shakespeare) When in love it can be important to find the right gifts [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.youritronics.com/wp-content/uploads/2009/07/twinkling_led_heart_of_love.jpg"><img class="alignnone size-medium wp-image-2618" src="http://www.youritronics.com/wp-content/uploads/2009/07/twinkling_led_heart_of_love-300x225.jpg" alt="Twinkling LED Heart of Love" width="300" height="225" /></a></p>
<p>&#8220;Love is a smoke raised with the fume of sighs,</p>
<p>Being purged, a fire sparkling in lovers&#8217; eyes,</p>
<p>Being vexed, a sea nourished with lovers&#8217; tears.</p>
<p>What is it else? A madness most discreet,</p>
<p>A choking gall and a preserving sweet.&#8221; (William Shakespeare)</p>
<p>When in love it can be important to find the right gifts for the right occasions. You know, the kind of thing that would bring a big smile to her face (followed by a wet kiss). It can be difficult to even remember to buy a present, let alone come up with something that will be appreciated. But fear not! I have found the solution to the problem and next Valentine&#8217;s Day you will be ready to really impress your sweetheart.</p>
<p>The Twinkling LED Heart of Love is a wonderful DIY project that will melt her heart and turn the next 14th of February into an unforgettable event. The Heart of Love is based on an Atmel AVR <strong>ATmega168</strong> microcontroller coupled with 20 red LEDs that&#8230; blink randomly! The heart itself can be made of cardboard and, although red is the usual color for love-related objects, you can show your creativity and paint it something meaningful to you and your damsel. Like orange, if you&#8217;re both Netherlands soccer fans. Or black, if you&#8217;re black metal fans (pentagram is optional). Originality is usually appreciated, so go for it!</p>
<p>Tips and tricks: your Heart of Love is awesome and will surely knock her socks off, but don&#8217;t start explaining how it&#8217;s made, how the microcontroller works and so on, because she might start yawning and eventually fall asleep.</p>
<p>As for me&#8230; I think I&#8217;ll settle for a big bouquet of red roses, thank you very much.</p>
<p><strong>Twinkling LED Heart of Love: </strong><a href="http://www.nerdkits.com/videos/ledheart/">[Link]</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.youritronics.com/twinkling-led-heart-of-love/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>TMP275 digital sensor thermometer</title>
		<link>http://www.youritronics.com/tmp275-digital-sensor-thermometer/</link>
		<comments>http://www.youritronics.com/tmp275-digital-sensor-thermometer/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 18:00:52 +0000</pubDate>
		<dc:creator>Florin</dc:creator>
				<category><![CDATA[DIY]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[LED]]></category>
		<category><![CDATA[Microcontroller]]></category>
		<category><![CDATA[Personal Projects]]></category>
		<category><![CDATA[ATmega8]]></category>
		<category><![CDATA[DIgital]]></category>
		<category><![CDATA[Sensor]]></category>
		<category><![CDATA[temperature]]></category>
		<category><![CDATA[TMP275]]></category>

		<guid isPermaLink="false">http://www.youritronics.com/?p=1885</guid>
		<description><![CDATA[I recently ordered some samples from TI, which included the TMP275 digital sensor. The sensor has some nice features which I quote from it&#8217;s datasheet: The TMP275 is a 0.5°C accurate, Two-Wire, serial output temperature sensor available in an MSOP-8 or an SO-8 package. The TMP275 is capable of reading temperatures with a resolution of [...]]]></description>
			<content:encoded><![CDATA[<p>I recently ordered some samples from TI, which included the <a title="TMP275 dgital temperature sensor" href="http://focus.ti.com/docs/prod/folders/print/tmp275.html">TMP275 digital sensor</a>. The sensor has some nice features which I quote from it&#8217;s <a title="TMP275 datasheet" href="http://www.ti.com/lit/gpn/tmp275">datasheet</a>:</p>
<p>The <strong>TMP275</strong> is a 0.5°C accurate, Two-Wire, serial output temperature sensor available in an MSOP-8 or an SO-8 package. The TMP275 is capable of reading temperatures with a resolution of 0.0625°C. The TMP275 is SMBus-compatible and allows up to eight devices on one bus. It is ideal for extended temperature measurement in a variety of communication, computer, consumer, environmental, industrial, and instrumentation applications. The TMP275 is specified for operation over a temperature range of −40°C to +125°C.</p>
<p>The easiest way to get the temperature out of the TMP275 seemed to be I2C. So I started by designing a board which has all the components needed: the sensor, an atmega8 brain, and some other components needed for the display and for powering the board. The display is a 4 digit 7 segment display from kingbright product code <strong>CA56-12GWA</strong>. As for the display part of the board, I used PNP transistors on the common anodes and resistors on the segments to limit the current draw on the atmega&#8217;s pins. The transistors are not current limited so the display will alaways light-up the same no matter how many segments are turned on.</p>
<p><a href="http://www.youritronics.com/wp-content/uploads/2009/07/intro-w.jpg"><img class="alignnone size-full wp-image-2595" title="TMP275 digital thermometer board" src="http://www.youritronics.com/wp-content/uploads/2009/07/intro-w.jpg" alt="TMP275 digital thermometer board" width="682" height="434" /></a></p>
<p>For the supply part of the board, I choose to make it portable and power it from a 9V battery, so I needed to use a voltage regulator. The choice was the good old 7805 because it&#8217;s cheap and easy to find.</p>
<p>I2C is a pretty common protocol so various libraries can be found on the web. I chose <a title="I2C library" href="http://homepage.hispeed.ch/peterfleury/group__pfleury__ic2master.html">Peter Fleury&#8217;s I2C library</a> because it was very well documented. The only external components needed by the TMP275 are a bypass capacitor between VCC and GND and two pull-up resistors required on SDA and SCL lines.</p>
<p>All the I2C stuff is handled by the library, so I only had to write a couple of lines of code to get the temperature out of the sensor:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"> i2c_start_wait<span style="color: #009900;">&#40;</span>sensor<span style="color: #339933;">+</span>I2C_WRITE<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	<span style="color: #666666; font-style: italic;">// set device address and write mode</span>
 i2c_write<span style="color: #009900;">&#40;</span><span style="color: #208080;">0x0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>			<span style="color: #666666; font-style: italic;">// write pointer register 00000000 to select temp register</span>
 i2c_rep_start<span style="color: #009900;">&#40;</span>sensor<span style="color: #339933;">+</span>I2C_READ<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	<span style="color: #666666; font-style: italic;">//set device address and read mode</span>
 temp_high<span style="color: #339933;">=</span>i2c_readAck<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>		<span style="color: #666666; font-style: italic;">// Read high byte of temperature</span>
 temp_low<span style="color: #339933;">=</span>i2c_readNak<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>		<span style="color: #666666; font-style: italic;">// Read low byte of temperature</span></pre></div></div>

<p>After reading the temperature from the sensor I had to display it on the 4 digit display. For that I had to write a display macro, which figures out the numbers and how to display them, basically I used software multiplexing. I even tested it on negative temperatures by placing the sensor in my fridge <img src='http://www.youritronics.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . The readout was correct because I checked with another thermometer.</p>
<p>These new type of digital sensors are great, because you don&#8217;t have to worry about analog to digital conversion, all the  ADC is done inside the sensor. I mainly started working with this sensor because I want to incorporate a temperature reading function into a future project. Now that this part is done, is time to move onto the next one, ultrasonic range finder, which I&#8217;m guessing wont be as easy as the temperature reading.</p>
<p>I tried to comment every line of my code, but if you feel you don&#8217;t understand something, just post a comment and I&#8217;ll reply.</p>
<ul>
<li><a title="source code" href="http://www.youritronics.com/wp-content/uploads/2009/07/TMP275-thermometer-source-files.zip">source code</a></li>
<li><a href="http://www.youritronics.com/wp-content/uploads/2009/07/TMP275-thermometer-schematic.zip">Eagle schematic</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.youritronics.com/tmp275-digital-sensor-thermometer/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Seven segment display explained</title>
		<link>http://www.youritronics.com/seven-segment-display-explained/</link>
		<comments>http://www.youritronics.com/seven-segment-display-explained/#comments</comments>
		<pubDate>Sat, 30 May 2009 01:26:44 +0000</pubDate>
		<dc:creator>Laci</dc:creator>
				<category><![CDATA[DIY]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[LED]]></category>
		<category><![CDATA[Microcontroller]]></category>
		<category><![CDATA[Personal Projects]]></category>
		<category><![CDATA[ATmega88]]></category>
		<category><![CDATA[AVR]]></category>
		<category><![CDATA[Display]]></category>
		<category><![CDATA[seven segment]]></category>

		<guid isPermaLink="false">http://www.youritronics.com/?p=2254</guid>
		<description><![CDATA[In this article I intend to explain the functionality and usage of the seven segment display, probably you have seen many projects with these type of displays, however the price drop of LCD&#8217;s tend to overtake the market, there are a still few applications for which these devices are more suited. For large numeric displays, [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;"><a href="http://www.youritronics.com/wp-content/uploads/2009/05/frontview.jpg"><img class="aligncenter size-full wp-image-2268" src="http://www.youritronics.com/wp-content/uploads/2009/05/frontview.jpg" alt="Seven segment display" width="350" height="263" /></a></p>
<p style="text-align: left;">In this article I intend to explain the functionality and usage of the seven segment display, probably you have seen many projects with these type of displays, however the price drop of LCD&#8217;s tend to overtake the market, there are a still few applications for which these devices are more suited. For large numeric displays, like clock&#8217;s, railway station displays, low-cost measuring devices or very stressing environments the led based displays are better, and cheaper.  The most simple led display available is the seven segment display, it consists of 7 led stripes arranged forming the number 8, because of its simple construction it is very robust and can function in very low or high temperatures, can withstand vibrations,  mechanical shocks without problems, for what the LCD would fail to work or even get permanently damaged.</p>
<p style="text-align: left;"><a href="http://www.youritronics.com/wp-content/uploads/2009/05/singlesegment.jpg"><img class="aligncenter size-full wp-image-2269" src="http://www.youritronics.com/wp-content/uploads/2009/05/singlesegment.jpg" alt="single sevene segment" width="191" height="179" /></a></p>
<p style="text-align: left;">If we look at one digit we can see 10pins each segment and the small dot are LED&#8217;s, each of them has one terminal connected to a common pin, from this comes the name common anode or common cathode, and the other terminal is connected to a standalone pin, since the common pin is doubled, we have the 10 pins for each digit.</p>
<p style="text-align: left;"><a href="http://www.youritronics.com/wp-content/uploads/2009/05/7_seg_pin_config.gif"><img class="aligncenter size-full wp-image-2270" src="http://www.youritronics.com/wp-content/uploads/2009/05/7_seg_pin_config.gif" alt="seven segment config" width="250" height="222" /></a></p>
<p style="text-align: left;">Lets take as example the common anode type, to light the segments we need to connect the positive supply rail to the common pin, and pull to ground the segments, each segment depending on its size can handle a few miliamps, after all we are talking about LED&#8217;s not bulbs. That&#8217;s fine if you need just one number to display, but how can these digits be connected to form a multi-digit display? The first approach is to connect each segment to a micro-controller pin, this way for each digit you need 8 pins and isn&#8217;t elegant at all.</p>
<p style="text-align: left;">The other solution is to connect each corresponding segment from the digits to a common bus, and power the digits one at a time, thus multiplexing the data.</p>
<p style="text-align: center;"><a href="http://www.youritronics.com/wp-content/uploads/2009/05/displayschematic1.jpg" target="_blank"><img class="aligncenter size-medium wp-image-2280" src="http://www.youritronics.com/wp-content/uploads/2009/05/displayschematic1-300x206.jpg" alt="seven segment schematic" width="300" height="206" /></a></p>
<p style="text-align: left;">
<p style="text-align: left;">This multiplexing probably sounds more complicated than it really is, look at the next picture:</p>
<p style="text-align: left;"><a href="http://www.youritronics.com/wp-content/uploads/2009/05/illustrated-seven-segment-operation.jpg"><img class="aligncenter size-full wp-image-2276" src="http://www.youritronics.com/wp-content/uploads/2009/05/illustrated-seven-segment-operation.jpg" alt="illustrated seven segment operation" width="350" height="241" /></a></p>
<p style="text-align: left;">Since the digits share the same data bus, each digit will have the same number displayed, like the wheel on the picture, to change the number the &#8220;data guy&#8221; rotates the wheel. So how can we display 1234 you might ask, well wee need another guy, the selector, which will leave only one digit to be seen, all the others are shut off, by synchronizing the &#8220;data guy&#8221; and the &#8220;selector guy &#8221; so they operate at the same time, when the wheel is at the 1111 position, the selector opens the first window, when at 2222 it opens the second and so on. By changing the data and selecting the digits at many times per second the human eye will see a steady image with 1234, the display refresh rate should be above 50 times in 1 second, otherwise the image may flicker.</p>
<p style="text-align: left;">In the schematic the &#8220;selector guy&#8221; is implemented by the PNP(BC327) transistors and the &#8220;data guy&#8221; is the data bus (PORTB0..7). For the practical demonstration I used my own avr development board with ATmega88, four HD1131R type seven segment digits which I rescued from an old TV a few years ago, the connections are made on a prototyping pcb with scrap wires. The data port is PORTB, for selection the PD4..PD7 pins where used.</p>
<p style="text-align: left;">Like I mentioned earlier we need a periodic data update with digit selection to have a steady image, and since the entire display refresh should be above 50Hz and we have four digits we need to change the digits at frequencies greater than 200Hz. Since the amount of time which one digit is turned on is 1/digit count, as the display has more digits the light intensity gets weaker, in our case the HD1131R has 1.6V voltage drop, by powering from 5V and trough 330Ohm results 10mA trough each segment, but since we have 4 digits the average current received by each segment is 10/4=2.5mA, this will result in a very fade light. For the demo application I used 220Ohm values, with the on board 100Ohm resistors the average current is 2.5mA/segment, although I could have used only the on board resistors, thus having 8.5mA average current, but the peak would be 35mA, and the micro-controller can handle at maximum 25mA/pin, off course the pin won&#8217;t get blowed right away from 35-50mA, but you should be careful when designing similar circuits.</p>
<p style="text-align: left;">That&#8217;s enough about the hardware, let&#8217;s see the software, for the periodic refresh I used a timer interrupt with 244Hz, resulting in 61Hz refresh rate, in Europe we have 50Hz AC power, so that&#8217;s fine, but in the case of 60Hz AC power the refresh rate should be at 70Hz to avoid the stroboscopic effect.</p>
<p style="text-align: left;">For the display data I used 4 byte buffer from which the interrupt reads and sends to PORTB, the buffer index can be used also for digit selection(see void DisplayData(uint8_t* Display) ).</p>
<p style="text-align: left;">Because of the seven segment data format by directly writing 5 to PORTB, won&#8217;t result in displaying 5, so the numeric data must be converted first, because there isn&#8217;t any easy algorithm to mathematically make this conversion, we must use another method, for a one digit display you could make if-else or switch statements, but with 2 digits you already need 100 lines of code, for 3 digits 1000 lines and so on. A very handy solution is a look-up table:</p>
<p style="text-align: left;">const uint8_t DigitCharTable[] = { DigImage0, DigImage1, DigImage2, DigImage3, DigImage4,\<br />
DigImage5, DigImage6, DigImage7, DigImage8, DigImage9, };
</p>
<p style="text-align: left;">By indexing the table with the numeric value 0-9 we get the needed data format, example PORTB = DigitCharTable[5]; results in displaying 5;</p>
<p style="text-align: left;">The void NumToDispValue(int16_t Number, uint8_t* DataBuffer) function uses this method to convert 16bit signed value into display compatible string.</p>
<p style="text-align: left;">After the conversion made, the actual display buffer needs to be updated with the new value, here is a tricky part, by converting 1234 into display compatible data we will have [DigImage1, DigImage2, DigImage3, DigImage4], by having DigImage1 at the first position and my display has  D4,D3,D2,D1 physical configuration the data displayed will look like this: 4321, it gets reversed. This can be overcome by reversing the selection lines PD4..PD7, or by copying the reversed string into the display buffer(see void StrUpdateDisplay(uint8_t* DisplayBuffer, uint8_t* UpdateData, uint8_t InvDir)  ).</p>
<p style="text-align: left;">After the conversion, the result is a string(not ascii!), so the string manipulation techniques can be easily used, the dot can be added to any digit, simply by setting the 7-th bit in that byte(see macro WITHPOINT(a) in SSDisplay.h ). There is also possible to display a limited amount of characters like E,F,c,C.., (see SSDisplay.h) it won&#8217;t be pretty but it&#8217;s readable.</p>
<p style="text-align: left;">Last but not least, since the refresh is done in interrupt, the display buffer update operation should be made atomic, in other words first disable the refresh interrupt, and then update the buffer, otherwise the image will flicker, and don&#8217;t forget to re-enable the interrupt after!</p>
<p style="text-align: left;">If you use only the refresh interrupt, than it&#8217;s easier to just disable all interrupts globally, although if you have other interrupt sources too, then disable only the refresh interrupt, this way you won&#8217;t hold back the other incoming events.</p>
<p style="text-align: left;">For data source I used the ADC to measure the potentiometer output, you can also tweak the macro&#8217;s used to handle the ADC, the dot in the 2th digit is activated if the ADC value  is above 512.</p>
<p style="text-align: left;">The demo project was made using avr-gcc and avrstudio, some variable type notations may differ from the ANSI C standard since I use the avr-gcc typedefs, the entire project among with schematics, pdf&#8217;s is available for download.</p>
<p style="text-align: left;">In the next article I will explain the usage of the matrix keyboard.</p>
<p><strong>Seven segment display explained:</strong> <a href="http://www.youritronics.com/wp-content/uploads/2009/05/sevensegmentdemoapplication.zip">[download]</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.youritronics.com/seven-segment-display-explained/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
	</channel>
</rss>

