EEVblog #392 - 555 LED PWM Hack

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi in a previous video I reviewed this mantis 3d microscope and I complained that the LED brightness wasn't adjustable on it and for the price what that damn will should be so I wanted to actually take a look at that and see if it can be modified if it has any internal regulation circuit or anything like that so um as it turns out it's pretty easy to take this sucker apart I'll switch it off here and it this top cover here it just pops off and then we've got a little diffuser then for the LED and let's zoom in a bit more and on this we've got this whole assembly just comes apart here nice nicely screwed in with metal threaded inserts and everything and bingo there's the PCB and there'll be one on each side here and check this out it's just got a little DC jack on there you can just pull that off very nice nicely engineered and there's a all the metal threaded inserts it's really quite a nice design and as you can see the LEDs are around there in a circular fashion angled at a you know they've engineered it at a very specific angle so the diffuser plate sits in there like that and it's all angled like that and it's very beautiful I like it but look at this there's no circuitry on there at all it's just dropper resistors that's it so Oh measure the rest of it to make sure it just comes through this from the but I think it's just that directly from the 9 volt plug pack straight through a dropper resistor for each led so to easy to modify this thing to use a PWM to get the brightness adjustment or you don't even need PWM you can just use an lm317 linear regulator or something looks like those little plastic Clips there they're like sort of those molded-in types so I don't really want to break the board out there so I'll just measure these resistors and do that just fine bang 82 ohms there you go so all they're do and all they're doing is just driving this directly from the nine volt source I think okay so what I'm going to do is I'm going to measure the to see if there's any internal circuitry in here or whether or not the 9-volt jack just passes straight through so I'm going to get there I've got this plugged in here I've got the ground here and no no it doesn't me all right now I think there's the intellect DC jack switch on there so you've actually got to plug the thing in so that because I can't believe the grounds not connected so it must be yep there you go so that ground is connected straight through to there now all we need to do is check the center Jack on that and the center pin here and what do we get uh-huh well as something point six Meg let's I suspect is there a diode in there perhaps let's whip that around and have a look there we go that looks like a diode drop but it seems to be in the wrong direction so I'm not sure what's going on there there is definitely something in there though and I cracked it open and yeah look what we have here we have an lm317 in here and also you can see the yust spring as well go in all the way up that shaft up there that's how it gets its nice retention system very nice spring I like it and it's attached to there it's insulated it's got a little sill pad washer on there so but they're using that as a heat sink and lm317 so I'm curious to know if it's a just like a voltage regulator or a constant current or set up as a constant current source well of course it's got to be a constant current source because there's only two wires coming in and out of this in the positive supply there so it goes through the switch into it and then out to the LEDs so they've got this thing set up as a constant current source and there you have it folks now we could have you know discovered all this without taking off that heat shrink but that would have been no fun but there you go it's an lm317 constant current source they've got total of 2.5 ohms so 1.25 volts divided by the which is the reference voltage of the lm317 divided by the 2 point 5 ohms is around about 500 milliamps constant current so we've got 24 LEDs in this thing so assuming that they're evenly spread across all the LEDs we should be looking at about 20 point 8 milli amps per lead let's measure that and see if we get it now I've already established that these resistors are 82 ohms each so assuming the current is shared across all of them equally it'll be roughly something like that then for twenty point eight milliamps per lead we're expecting times 82 ohms we should get about one point seven volts across each resistor so let's have a look tada there you go there you go one point seven so it looks like the current is pretty evenly shared across all these not entirely spot-on but fairly well shared across all these LEDs there you go so these things are operating at about 20 point 8 milli amps per lead so how do we go about dimming this thing well I'm because we have access to the circuitry in here now we can add our own stuff in there but I mean that's that's quite nice but anyone who wants to mod this thing themselves it it's not that great they have to actually crack this thing open so it's probably better to put something in series with this lead here so you don't have to modify anything on your mantas at all so anyone should be able to do this and add the mod in or remove it as they need to so that's a better way to do it but this is a constant current output so it's given us half an amp constant current so we need a circuit in here to dim these lens and well we can do that with PWM so let's lash up a quick little circuit and see what we can do and there's plenty of ways to do this but well why not use the classic triple five timer you can get a triple five timer to do a zero to 100 percent PWM fairly easily so what we got here is I'm going to use a triple five timer here in the PWM configurations is my Dave CAD drawing a PWM led dimmer it's a classic triple five circuit and there's not much to it at all we've got our input over here and our output here and now because this is a constant usually you don't do this with a constant current source on the input here but it should still work I think so you know normally this is just a voltage source and you and then you would just pwn the output then you choose to drop a resistor based on and we could do that if we ripped out the circuitry we could just have the nine volt source and then we could calculate well we can actually put a voltage regulator in there calculate what voltage is required to give the same maximum current of 20.8 milliamps per lead that we had before or five hundred milliamps and you know that's all too hard so we want to leave in that constant current source so I think this circuit will still work even though it's constant current because we're just switching the constant current off and on off and on instead of the voltage this is the classic triple five PWM configuration we've got an adjustment pot here which are just our pulse width modulation value from roughly is zero to 100% it's not going to go over the entire range but it's going to be pretty close and we've got two white steering diodes here and the and you know it's quite a basic configurations now how this circuit works is pretty simple when you first power it on this capacitor is going to be a short circuit so the trigger pin is going to what set this output high here and the output PNP transistor will be switched off because we've got a high here a high here this transistor only switches on when this output pin goes low so the output goes high so the LED is starting switched off and then we're going to charge up this capacitor through this 1k resistor here through this diode and through there and through the pot here so the pot is going to set our frequency as well as our PWM cycle and then once it reaches the threshold bingo we're going to switch the other direction and then our discharge pin is going to discharge that capacitor through the other diode they're easy because if you remember our triple five circuit configuration I got my triple five timer t-shirt which you can get from my zazzle store by the way I hand drew this it's how the triple 5 operates and you can see that the output here when the output switches it is a flip-flop so the naught Q output turns on the discharge transistor here and that's exactly what we have in the circuit configuration and this will come important later I think for a variation on this circuit so I've got my circuit built up on the breadboard here matches this precisely except for one thing labs a bit of a mess and for the life of me I couldn't find a one in 41:48 diode to go in there a one-in-nine 1/4 or whatever signal you want to use so I had some LEDs handy just sitting here on the bench so I used two LEDs instead of the two signal diodes it's going to work exactly the same or it should and except it's going to change its going to alter the frequency but we don't really care we just want to get this thing working so that's the breadboard build up I've got the Biddy one three six pm PL put power transistor here because we're talking about half an amp so you've got to choose a transistor here which has an adequate continuous collector current in it and this is like a one-and-a-half amp transistor so it should handle that fairly decently a 470 ohm base resistor here should give us enough current to drive that output at a half amp oh it's only one way to try it let's give it a go and here we go using those values my head here I am going to turn my pot here I've got a 10k pot and while it starts down here and you'll notice we're getting a duty cycle of a maximum 8.8% now this is the output on pin three of the triple five timer and you'll notice that it changes PWM all the way up to ninety nine point six percent duty cycle so that's not bad at all now unfortunately because we're using a PNP output transistor configuration here this is actually going to be inverted so this will be our on period so really we're not getting close well we're going to be eight or nine percent down from our hundred percent on periods so it's going to be on for only you know ninety-one percent of the time or something like that so we're not going to get absolute maximum brightness out of this thing but that's okay not a problem and I've got my I'm just pairing this from the bench supply by the way this is not coming from the constant current source of the mantas that's the next step by repairing it from about six volts at the moment I can drop it down where two volts per division and there and as you can see I mean the frequency is going to change we were what 300 Hertz before I get down to you know five volt power supply a five volt supply there and we're looking at 40 Hertz or something like they go up to six volts and it changes the you know is this thing is not stable in terms of frequency but for our purposes it doesn't matter and we can go up like if we go up to 10 volts 12 volts something like that we're still going to operate overton so 99.7% 29.2% so our minimum or our maximum because we're inverted drops there at 12 volts so anyway where this thing is going to be working at less than nine volts so it should work over that range quite nicely so let's hook this up to our constant current source and see if it still works and we can dim our lids alright first of all let's take a baseline here so I've got my mantas plugged into the existing 500 milliamp sauce I've got my light meter here and I've turned off my main LED lights above me just so it's you know the ambient doesn't interfere up with it that much but we just want to get a ballpark we want to see if this circuit gives out pretty much are close to the maximum and then dims so our benchmark there is about 16 30 lux so let's plug this circuit in series with that and see what we get and here we go I've got it budged into it there so I've got it in line and we're get it we're not quite getting the maximum there as we expect it because the PWM isn't going to 100% but maybe we have to tweak our base resistor there so that's maximum on the pot so if I just the adjust the pot look at that there we go that dims quite nicely fairly linear with the turning of the pot so let me I'll show you the show you the pot here so and then it switches right off at the bottom there 177 lux turn it on that's pretty nice I like that I think we have a winner it doesn't quite go to the maximum Lux will get in before so I'm going to drop that base resistor a bit I've got 4 70 let's get a here we go a 220 let's give that a go so let's go from 470 to 220 ohms and see if we can hello 16 so we get in it's a little bit better bump something here so we get a 1500 Lux out of that thing let's plug the original mantas back in yeah it's 1,600 so we're only losing a hundred Lux there not a big deal so with our values in the circle we're operating from 733 Hertz so it jumps up a bit jumps all over the place as you adjust a duty cycle down to a low of 310 Hertz so 300 Hertz to 700 Hertz or there abouts with our constant current source not a problem I mean we don't particularly care about the frequency that's a much higher than any you know flicker that's going to be a problem so no drama and if you're wondering what the current output waveform looks like the output waveform is channel 1 here the yellow one and the green channel 2 signal here is the ALP is the pin 3 output the Q output of our triple 5 timer flip-flop so let me adjust the so let me adjust the pulse width there and as you can see as I said before it's actually inverted because we're using a PNP transistor there so we're going from you know like down under a percent there - right up to well you know close to 98% so that's pretty good I'm pretty happy with that and if you're curious to see our charge and discharge wave form ie pins 2 and 6 it's the bottom waveform there and the top one is our pin 3 Q output so you can clearly see that point 1 microfarad cap charging up there until it hits the threshold value and then the discharge pin kicks in shorts to ground and that then shorts out the cap and bang it goes back back like that and it oscillates that's how the triple 5 works now we can't just leave it that I think this thing has got too many components and I think we can get rid of one so I've got another circuit here optimized and you will notice that the differences between them aren't well there's only basically spot the difference we've removed is 1k resistor up here but we've swapped pins 3 & 7 like that so now the discharge pin of the triple 5 timer here is turning on our PNP output transistor here and then our Q output of our triple 5 timer is doing the charge and discharge because we don't need that pull-up resistor anymore in there because the because we didn't need it before because the discharge pin is an open collector output so it doesn't have it's not a totem pole output so it doesn't have anything to pull it up so we need the 1k to pull it up but the pin 3 of the triple 5 timer the Q output is not an open collector output so we can do away with that pull-up resistor so we've just optimized the circuit there and we have government gotten rid of one resistor let's try it so this is circuit number 2 we'll leave it here so let's just modify that so we'll there's our pin 7 pull-up so we'll get rid of that and we'll this base resistor here has to change that's got to go over to pin hang on this is gonna this is going to get messy but so we want our LED on pin three let's just switch this thing off shall we for a second and so we want that through the pin three now other diode through the pin three it's working well with these LEDs not a problem and we want our base resistor the transistor to go up to pin seven up there so we've gotten rid of our one resistor we've optimized that out let's hook this thing back up and give it a go hey it is still still working that Lux meter is switched off that Lux meter is still reading oh it's reading what's it reading there we go we're up to 1600 lux and we're going all the way down - there you go not a problem so let's take a look at those waveforms again and see what Judi cycles we get there should be near-identical all right let's have a look at the output we're measuring the duty cycle of the input - now which is our top waveform which is our pin 7 discharge pin and if we adjust our PWM value we're going down to nought point three percent brilliant smoothly once again the frequency does change but whoop-dee-doo all the way up to ninety-nine point two percent lost our trigger there a little bit but there you go just get a more accurate value of the maximum there you go it's close to 99% ah this works really quite well I like it point three percent $2.99 greater than 99% terrific so just why were we able to swap pens three and seven well here's the discharge pin here and as you can see it's the cute it's the not Q output of this rs flip-flop and the regular output is just a buffered version of the Q output so really these are just going to be complementary outputs so there's no in this particular circuit configuration there's no problem with swapping these two pens and by virtue of doing that we managed to save a resistor beauty so there's our final circuit base resistor there around about 220 ohms I'm using a 10k pot I'm using LEDs in there but we can just use regular signal diodes if you want it's still going to work just to treat hundred in timing cap here I'm just putting on a 10 in compensation cap there you don't necessarily have to do that it might still work and of course there's a bypass cap across the rail there but that's all there is to it and the bt 136 has that plenty of grunt to drive the 500 milliamp constant-current leds in this thing and and no it doesn't really get warmer door so there's no power dissipation issues there and the whole thing works a treat over the whole duty cycle range very smooth very linear really in terms of the pot I'm using a linear pot by the way I'm not using a logarithmic one and it works just fine so all that's left to do is build this thing up and put it in series as a permanent fix and I'm actually using the CMOS version of the triple 5 the LMC triple 5 here but yes it is a genuine national semiconductor and yes just add a little bit of authenticity it is greater than 20 years old 50 second week 91 nice now let's have a look at what it's like when it's completely assembled again I've got both LEDs lighting down nice and evenly and we're getting basically 4,500 Lux or there abouts because that's a times 10 rain so uh you know four thousand years a thousand five hundred Lux got my board build up here ready to go it's not heat shrunk or anything or in a case or anything yet so let's plug it in and bingo we get in 4300 Lux is that maximum it's just the pot here there we go look at that from 500 lux and now for the big test does it actually work through the viewfinder that's maximum there I've got constant exposure on my camera and I'm turning the wick down turning it down and it's a little bit a little bit touchy at the bottom in there but certainly we have a very nice adjustable range now I like it let's put our board on a 45 degree angle there and adjust our light all the way down to pretty darn low I like it I mean it's actually brighter than that in through the viewfinder that's just my the constant exposure mode I've got on the camera there I mean if I turn constant exposure off there we go where I've turned all the way down and the camera is still going to compensate so I turned all the way up constantly exposure again and turn it all the way down beautiful it's a nice smooth linear range there's no flicker on the camera ah perfect what a win so that was just a quick simple hack there on some very bored not a problem as the output connector which helps to if it's a right angle one like that going in and there's the input socket and the adjust pot now I can mount this in some sort of case so now I'll probably put some large heat shrink over it or something like that and I don't know maybe cable tied up in or up in place I don't know there's a few options for mounting the thing in line but you want to sort of keep it as short as possible I think and just have it dangling in there really I mean you know it's not often that you have to adjust this thing so really if it just hangs there that's fine so yeah I will just heat shrink that there we go no problems at all that'll give it a nice reasonable protection and maybe I can a cable tie the thing in place or something like that perhaps you know do a second heat shrink pass on this thing so that it seals in the pot and the pot just sort of mounts on the side there like that and that'll hold it in place nicely I think so you know it'll just dangle there it so I can put a knob on it but you know frills who cares and it could be mounting an ice box or something like that but it's nothing wrong with just a bit of heat shrink like this and maybe some hot snot as well some hot melt glue in various places but there you go I think that is quite a nice little solution I like it and there's the finished mod I've just got a cable tied up in there and it just sits there really quite nice it's all hidden out of here I can just reach around and adjust the brightness as required that works an absolute treat I'm pretty darn happy with that simple hack yeah could have been done better but don't mind that at all so there you go if you've got a mantis it's well worth doing this mod to get varible brightness on your LED it's really quite neat and you don't have to hack the circuitry inside it's just using the constant current source straight in beauty if you want to discuss it jump on over to the eevblog forum if you like the hack please give it a big thumbs up catch you next time
Info
Channel: EEVblog
Views: 246,917
Rating: 4.9361191 out of 5
Keywords: mantis elite, microscope, hack, 555 timer, pwm, pulse width modulation, oscilloscope, measurement, breadboard, constant current, led, led pwm, 555, brightness, adjustment, build, how to, ring light, microscope light, led light, light, testing, transistor
Id: OXsu29K_Ap4
Channel Id: undefined
Length: 28min 56sec (1736 seconds)
Published: Wed Nov 28 2012
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.