Generating a 100KHz square wave - Page 1
Forum section: electronics / beginners

author: marcosgildavid
author_rank: Contributor
timestamp: October 10, 2012, 08:44:21 am
content: Hi,I was wondering what is the best way to generate a 100KHz square wave. A 555 timer or a schimdt trigger.I will be driving a very small load (100 Ohm) and will only need about 40mA of current.Thanks!MGD

author: PA4TIM
author_rank: Super Contributor
timestamp: October 10, 2012, 09:14:47 am
content: A 555 in bistable mode is a smith triggerDepends on the votage you need. A 100 Ohm load and a 5 V square or 12V square will not draw the same current.

author: AndyC_772
author_rank: Super Contributor
timestamp: October 10, 2012, 09:16:46 am
content: How accurate or stable do you need it to be?I might do this in many different ways depending on what it's needed for:- signal generator- op-amp based R-C oscillator- transistor astable- crystal oscillator with digital divider- microcontroller with internal oscillator or external crystal

author: marcosgildavid
author_rank: Contributor
timestamp: October 10, 2012, 09:40:13 am
content: Thanks for the help!The square wave will have an amplitude of 5V, so it really doesn't need that much current.It also doesn't need to be very accurate.I'm building an ESR meter like the one Dave used to check for bad capacitors.I found some circuits that used a schimdt trigger and others that used a 55 timers. Since I only have 555's in "stock" I was wondering if there were some disadvantages of one method over the other.MGD

author: PA4TIM
author_rank: Super Contributor
timestamp: October 10, 2012, 11:32:51 am
content: Make it adjustable. 100KHz is useless for caps over a few hundered uF. They become inductive there. I just finnished some tests or my new article about ESR, i was using a very fast 5Vp squarewave generator ( risetime under 1 nS) a 50 Ohm resistor for the current mesurement that i did use to clip a tek current probe on, and because this resistor is the usual way, for the rest I used a inline probeadapter and 1GHz probe so the probe will not influence measurements and a coaxial dut holder to be sure no testleads do influence the measurement. The whole setup still added 120 mOhm resitance. But I correct measurements for that. The resulting squarewave got a terrible slow risetime but still faster as a 555. Without the 50 ohm resitor the squarewave was nice. But it did not alter results so that is no problem. The advantage was less ESL problems.I tested 5 caps, all with knowsn specs. Two new high quality caps, 47 and 3300uF after forming them, a 10 uF 0.5% philips standard and a 0.1% 1 uF GR standard. Then a 1000 uF NP and a known bad esr cap.Also did some simulations to check if the calculations for esr are accurate and they were. But no way to detect this with a uP or diodedetector. You need a very good scope for this and eventjen it s impossible to meaure real low ESR values ( under 100 mOhm ) because you are talking about a voltdrop that is at 50 mA just a 2 or 3 mV part of a signal that is a few Volt and if there is ESL ( and using testleads this will be huge, it is allmost impossible to define the ESR part. The ESL i had was very small but still upto 40 mV and the second problem that makes ESR looks smaller or looks like ESL but is not ( you have to go to something like 2nS/div to see it) is ringing.The results compared to the datasheets, peak atlas ers60, my own design esr meter and the known caps was rather accurate when ESR is over 1 Ohm but up to a few hundered % wrong under 100 mOhm.I measuered at 120Hz ( most datasheets give ESR at 120Hz) 1, 10 and 100KHz. The 100KHz was the least usefull, the 10 uF, 1uF and 47 uF gave results but because datasheets did not specify at that frequency and ESL got a problem it is plain useless. The other caps i ould not measure because they became inductive and the bad cap ot a greater ESR as reactance. Best result was 1KHz. Not strange if you know most good C bridges use this frequency.The resaon they use 100K is that they can cheat. They can measure the whole voltdrop over C and R and C is low so ESR looks , allthough in real much to high, still looks like it is at low frequency in datasheets. So it looks usable ( but who are you kidding) and a 10 ohm ESR will be measured as 10 Ohm because Xc is e few mOhm. That is also the reaon they are limmited to things like 10 uF. Xc becomes to big. And that is why they measure resistors nice. So real bad caps you will find but do not bother to make a digital display and calibrate it at mOms using resistors. You are kidding yourself.I will publish it soon.

author: kripton2035
author_rank: Super Contributor
timestamp: October 10, 2012, 12:09:21 pm
content: I was just wondering :the fact that most esr meters use the 100KHz frequency, isnt it based upon the fact that in smps where the esr of a capacitor is important (and often the cause of failure) these capacitors works arouns 100KHz ?just my 2 cts ...

author: BravoV
author_rank: Super Contributor
timestamp: October 10, 2012, 12:34:43 pm
content: Quote from: kripton2035 on October 10, 2012, 12:09:21 pm+1 , I'm really curious too, cause almost "all" cap's datasheet based on 100 KHz for their ESR value.Anyway, PA4TIM, really eager to read your work there, must be really interesting.

author: robrenz
author_rank: Super Contributor
timestamp: October 10, 2012, 02:17:42 pm
content: Quote from: PA4TIM on October 10, 2012, 11:32:51 amI am not challenging your capacitor knowledge, but my LCR meter seems to give readings that are within 25% change thru the frequency range if I use series resistance mode instead of ESR mode ( it wont give an ESR past 120Hz on a 6000uF cap). The progression of readings is smooth and continuous. 25% is a lot but since many times you won't know what the cap ESR is supposed to be to any better certainty, does it matter for general testing?Using real Kelvin connections on short leads and meter is calibrated to remove test lead LCR.DE-5000 readings on an ancient Sprague 6000uF 15V capHz series res. C or L100 0.08 7.53mF120 0.07 7.48mF1K 0.072 3.9uH Meter shows overload in auto LCR mode but manual Ls mode shows the inductance.10K 0.065 0.04uH "100K 0.060 0.037uH "I get no change in resistance measurement on a 100mOhm resistor in series resistance mode thru the Hz rangeHz series res.100 0.10120 0.101K 0.10610K 0.106100K 0.106Calibrated 510A micro ohmeter reading of same resistor 106.07 mOhm (accurate within+/- 45uOhm = .043% of reading)

author: PA4TIM
author_rank: Super Contributor
timestamp: October 10, 2012, 02:17:59 pm
content: AC Rs measuring is what old bridges do, this is indeed a good method and a accurate bridge can measure accurate down to a few mOhm. Good idea, i will add this kind of measurement too ( ease using impedance bridges or RF-IV meter)ESR must change over freuency, so this is a good thing. Only a pure resistor will change almost nothing. But ESR is part chemical and part electronic so not a constant. It becomes leer if frequency risesThe datasheet gives you D or ESR or both. This for one or more frequencies. And indeed 100KHz is a much used value. So for repairing a smps with the small high frequency caps this is a good frequency.But many people do not know what they are measuring. And also use them on large filter caps. The 47 uF I used had specs for 120Hz and 100 KHz. A RF-IV based C meter has no problems with 100KHz because they measure the loss angle and that can be easy converted to ESR or D. But meauring esr with the simple schematics is a total different way. Using a scope you can see the ESR part if you can zoom in enough, but the schematics I have seen use 100KHz for the sole reason that in that case they measure the total impedance. As you know impedance is R and jX. JX is the reactance of the capacitance and R is the ESR.If the reactance is very small, and it is for most electrolitics at 100KHz, the R part is sooner dominating. And if a cap is bad esr is all you see. But i could not measure the low ESR of a 1uF or 10uF standard cap. However if I just use the total Z I get a value that looks pretty low. But in real it is about 10x higher or more as the ESR realy is. But again, real bad caps show up. ( but in real, many good caps will show bad to because of the ESL, however, you will never know, if you replace ten caps that measure bad and only two of them were really bad so 8 good, then the repair was a succes and you will never know you replaced 8 caps that were good. And you tell everyone how good that esr meter was. )Just draw the schematic and do the math and you know what I mean. Or use spice. Take a 5Vt squarewave, put a 100 ohm resistors in serie then, a try combinations of 10-100 nH coils, 10mOhm to 10 Ohm series resistors and 1 to 1000 uF caps. Measure current by using the inline current probe.For instance take 47 uF, 1 Ohm, 10KHz and 10 nH 50 mA, then look at the voltage over the LCR combination. The voltdrop from top to where the curve starts is the ESR. Lets say this is 50 mV. Now you divide 50 mV by 50 mA and the answer is 1 Ohm.But then take 100KHz , 1000 uF and 10 mOhm Now try to measure the ESR and look if you still manage to zoom in far enough to get 10 mOhm. And then enlarge 10 nH to 100 nH. This is still a very low value is you are not using test leads. Then you know what I mean.These pictures will be in my article too, also scope measurements made on a 350MHz DSO. Also bridge measurements madecwith. 0.01% GR bridge, a 0.1% GR bridge, a peak atlas ESRr60, my esr very simple homebrew meter that use a total different concept and several VNA and RF-IV measurements that are able to measure phase, D, ESR upto 1500 MHz.I will show SRF curves, ESR curves, D curves , capacitance curves and compare them with simulations and the rest.If you use 100KHz only for smps caps, so the onces that actually work at those frequency ( many ( older) smps work at much lower frequency ) then its OK, but most people use them for all caps because they do not know what they measure, or what selfresonance is or that ESR is frequency dependend ect. My ESR meter meaures ESR down to 100 nF and with reduced accuracy even lower. And the ESR of a 100 nF can be is still close to a few mOhm. The 1uF standard cap I could not measure, but the tabels on things like the Parker meter tell different.10 uF at 100KHz is 0.16 Ohm. If ESR is 0.16 Ohm this means that the DF is 1. A bad cap. The power dissipated in the cap is as large as the power through the reactnce part, so another way is to say is dissipation is 100 %, a bit confusing because not 100% of total power is dissipated. An other way is to use the loss angle. A good cap has a 90 degree phase difference between current and voltage. A D of 1 is arc tan 1 or a 45 degrees loss angle.A good 10 uF would have a for instance a 5 degree loss angle, or tan 5 is a D of 0.087We know Xc is 0.16 ohm so 0.16 x 0.087 is an ESR of 14 mOhm.The current though you 100 Ohm and the ~ 0.16 Ohm impedance is about 50 mA.The voltdop over the ESR will be 0.014 X 0.05 = 700 uV. You can not measure this whit home made stuff or a simple build in uP ADC. Not only because the resolution but also because it can not sepate R from Xc so the meter will tell the ESR is 0.16 Ohm and that sound pretty low. If the cap is bad and ha an ESR of 2 Ohm there is no problem , ESR will show as 2.16 Ohm. But if the dap is above self resonance skineffect and ESL peak make the total impedance much higher and so the ESR is a useless value. Lucky the processors are slow so with some luck nd bad enough designed it will not see the ESL and still give a value you think is correct.Then the test often is used , put 1 or 10 ohm in serie with your cap and it will show this, so it must be correct. Now you know why that test will not tell you if initial ESR is correct. My ESR meter is not able to measure a resistor direct because it samples only that the voltdrop by switching between to sample caps and the opapm only sees that drop. Whit only a resistor this is not possible, no phase angle.It does not cost 100 dollar, just an analog meter or your multimeter, and 4 sub dollar junkbox ICs, not even matched parts. Sample frequency i most times use is 50KHz but I used a potmeter to adjusted it. In practice it is allways on 50KHz. The advantage of analog is you see the meter climbing up and this tell you also something about the cap, it must go smooth.In circuit measurements are not possible and most times useless. On powerrails a lot of caps are parallel.Pff, i never learn to type short stories.

author: PbFoot
author_rank: Contributor
timestamp: October 10, 2012, 06:12:57 pm
content: Hi,How about a 4060. Then you can pick off different frequencies for different uses.-PbFoot

author: tbj
author_rank: Contributor
timestamp: October 10, 2012, 10:35:46 pm
content: How about a NAND gate oscillator made from something like a CD4011? The advantage there is that they produce an almost perfectly symmetrical square wave.

author: PA4TIM
author_rank: Super Contributor
timestamp: October 10, 2012, 10:45:13 pm
content: This is what i use

author: robrenz
author_rank: Super Contributor
timestamp: October 11, 2012, 03:40:15 am
content: From Doug Jones Capacitor Wizard site. interesting input about 100kHz test frequency.http://midwestdevices.com/_pdfs/Tnote3.pdfGood capacitor info by Conrad Hoffmanhttp://www.conradhoffman.com/capchecktut.htm

author: PA4TIM
author_rank: Super Contributor
timestamp: October 11, 2012, 07:29:49 am
content: Thanks for that links. Good information.Yes, Conrad knows about caps, I know him from the GR collectors group. He tells about the same thing i do. I agree with his story, But my article will also compare several alternative measurements and give simulations on models. I will talk more about selfresonance and ESL effects and use network analysers and RF-IV as compareThe capacitor wizzard articels right too, that is what I told before, they take 100KHz because they do not measure ESR but Z. But that was based on my own conclusion and the user manual from a Chinese ESR meter. He is also honnest to tell it is done because of cost and less complexity.Also that they made compromises to allow in circuit measurements. That last may be conviniant and important for those who use that ( in smps many schottkey diodes are under 0.3V we all know that but in truth they start conducting a lot sooner, i have seen under 200 mV but you are taling in the range of 10-50 uA. Not much, but measuring mOhms is something easy poluted by these sort of things.He also tells the caps must be within a range of the instrument. That is something alot of people forget, who reads the manual ?The AC resistance is correct, but like the capwizzard writes, beware you do not measure Z. i tested it yesterday using a compensated bridge, it was a lot of work, involved compensating for zeroing the bridge ausing an external decade and a loth of math but the values were very good.But not all LCR meters correct for this. The out of range can be because the comensation ran out of fuell. On my 1608 bridge the internal compensation was not enough but I have a external box for thatAnd used it. But it was a nice uggestion from Robrenz, thanks.On thing that they do not tell and is my biggest problem with 100KHz is ESL.He assumes at 100KHz the Reactance is almost zero and this is pertupinent not true. This is only through in theory. Conrad tell more About this but stops at 10K. Xc decreases with frequency, Xl increases. At some frequency they cancel each other out. This can be as low as 10K or high above 100KHz. And so it is not wise to just measure Z because you think Xc is zero. I will show pictures of resonance and ESL and you will see this factor is not unimportant and not to neglect.My meter is based on what the capwizzard names methode three. Drawback, not in circuit and more " complex" the is right, the second ?? A kid can build it under 5 dollar and it oes like he tells, measure only ESR anf on all caps. Downside is you got to desolder 1 lead.

author: kripton2035
author_rank: Super Contributor
timestamp: October 11, 2012, 07:45:28 am
content: seems to me that elektor's esr meter uses the same 4066 switchs configuration as you do in your phase difference esr meter ?did you try it ?also elektor uses hct4066 and explained in the article that it is needed at these frequencies.do you use a high speed 4066 ?

author: PA4TIM
author_rank: Super Contributor
timestamp: October 11, 2012, 08:00:29 am
content: I do not know the elector meter. But there are more schematics that use this setup. Seen one in an EDN article that used this concept but with a negative supply added , protection and in circuit measurement and a lot of adjustments. That gave me the idea for mine.I do not know the 4066 I used, i should look but it only samples at 55KHz and the normal CD4066 is rated for 40MHz so that looks fast enough for me. The really fast switching gives more problems with ringing caused by ESL. The same reason they use soft recovery diodes in fast smps.

author: ElektroQuark
author_rank: Unknown
timestamp: October 11, 2012, 09:18:59 am
content: Quote from: PA4TIM on October 11, 2012, 07:29:49 amWhat's that?

author: marcosgildavid
author_rank: Contributor
timestamp: October 11, 2012, 09:47:03 am
content: Quote from: PA4TIM on October 10, 2012, 11:32:51 amHi!Thanks for all the info.But making it adjustable might be a problem since I would have to know at which frequency I am getting the readings, and I should also output its value.It can be made, but since I am a beginner with this kind of things, I'm afraid it will get very complicated.But my goal is a simple project, a small circuit to generate the square wave, feed it into a ESR detection circuit, read the output value trough a microprocessor ADC, make some calculations and display the value on some 7segment LEDs.If I make the frequency adjustable, that means that I would have to use something more sophisticated for a display (small 2 line lcd), a more powerful micro, a frequency detector, a lot more calculations... More expensive stuff... etcI just want to build a simple tool to test for bad caps in-circuit.Of course I'll have a relative amount off error for some caps, but does this error justify complicating things?Besides, from what I could tell from Dave's video, the ESR meter he was using didn't seem that complicated, or I'm being over simplistic?BTW I'm a big fan of the KISS philosophyThanks!MGD

author: PA4TIM
author_rank: Super Contributor
timestamp: October 11, 2012, 10:30:45 am
content: Kiss is great as long as you know its limmitation and it is not corrupting meaurements to muchthis is what your ADC must do. The test signal in this case was 800 mV ( higher as you want for in circuit measurement)The ESR is the voltdrop of 3.4 mV cursor. Your ADC will measure about 22 mV the voltdrop over ESR ( 3.4) and reactance (19 mV) . So that is why you should use 100 KHz. The 19 mV drop then is reduced to a few mV and your mistake will be the reactance of the cap that is small so you will only be so wrong as the reactanceis big and that is easy to calculate if you want. And you still have a very usable value.Problem is at 100KHz yous rignal will look like this:that ESL spike masks the ESR and you measure that spike ( and this is whithout the huge lead inductance)

author: marcosgildavid
author_rank: Contributor
timestamp: October 11, 2012, 10:59:25 am
content: Well I based my circuit on the design from this site:http://members.shaw.ca/swstuff/esrmeter.htmlThe circuit is this:I replaced the 156Khz for a 100KHz since I read somewhere that most datasheets have their ESR at this frequency.I also replaced the schmidt with a 555 since it's the ones I have in stock.The amp meter will be replaced for the micro adc (with proper filtering and stuffThe simulations I've made on LTSPiceIV don't show any spikes like that, but I'm guessing it's no taking inductances and other stuff into account.So this is a question of simulation vs real life. Which is always a pain

author: robrenz
author_rank: Super Contributor
timestamp: October 11, 2012, 11:56:01 am
content: Quote from: EdoNork on October 11, 2012, 09:18:59 amI think it is GenRad or General Radio

author: PA4TIM
author_rank: Super Contributor
timestamp: October 11, 2012, 01:23:38 pm
content: GR is general radio, or as it was later named GenRad.In LT spice you see what you model.A real cap is made out of Rs, Cs, Rp and LsSee the schematic next to my simulation in simetrix.Spice can do a lot, but you must make the right models. Allmost all experiments I model in simetrix or qucs and most times I can get reality and simulation at one line. This is very eductional, you can check your medurement setup this way. Your simulation model has no ESR in it ( as far as i see, i do not know LT spice well.)By the way, that looks like a schematic I used also. That was one of the first and it used a 555. But I later used a scope to view because the meter readings were much to high.About dataheets: do not look at the word KHz and Ohm alone. Often they state esr or DF at low frequency and impedance at 100KHz and that is not ESR !But some do state ESR at 100 KHz. Allways read carefull. ( a lot of people do not know the difference between impedance and reactance)105 degrees low ESR caps in small values ( upto 250 uF ?) will probably give ESR too at higher frequency but a 1000 uF ?? Not much use, i'm just sweeping some caps and upto now most 1000 uF are reduced to around 150 uF at 100KHz but ESR stays rather constant from 10Khz up as expected. ( i now use a vector network analyser, so this meaures phase difference too)

author: kripton2035
author_rank: Super Contributor
timestamp: October 11, 2012, 03:00:22 pm
content: Quote from: PA4TIM on October 11, 2012, 08:00:29 amelektor uses a LF412 as differential amplifier, and a HCT4066 as switch.article extract FYI... the full article link is on my esr repository.The LF412 in position IC4 is a good choice for the differential amplifier. Since we are deal- ing with high frequency signals in the milli- volts range, low drift, low offset and high bandwidth are crucial. Many different op- amps have been tested but most resulted in DC drift problems. The LF412 emerged as a good, low cost choice causing minimal drift.IC5, then, is a 5-volt regulator that works just fine at a voltage drop less than 600 mV and so ensures long battery life. This regula- tor enables the circuit to keep working down to a battery voltage of less than 6 V. IC2, a 74ACT74, is capable of delivering enough cur- rent at 100 kHz to produce a nice clean square wave. IC3 is a high speed (VHC) ver- sion of the well known 4066. Compared to the common 4066, the effect of unwanted reac- tance is halved. For best performance the specified components should be used, but all in all, quite acceptable performance is achieved still if you use an ordinary 4066 for IC3, and a 74HCT74 for IC2.

author: marcosgildavid
author_rank: Contributor
timestamp: October 11, 2012, 03:18:31 pm
content: Quote from: PA4TIM on October 11, 2012, 01:23:38 pmHi,LTSpice allows me to set an ESR and even to run the simulation with different values of ESR it also supports the series inductance and equivalent parallel resistance and capacitance. I guess its a question of choosing the proper values according to real life caps.Anyway I'll try the circuit out and then build a prototype.Thanks again for all the info and help.

author: PA4TIM
author_rank: Super Contributor
timestamp: October 11, 2012, 04:25:23 pm
content: Krypton, nice ESR site you have there, so I' m not only cap nut ;-)http://geoffg.net/Measuring_ESR.html.This shows what I mean by ESL. Here you see those huge spikes. Your Eye has not much trouble with this but a ADC will not understand it.This method I know too, but if you use a wider pulse you can get more acurate results.Strange that the Elector was so critical about parts. I have no drift at all. But I think they use a different concept , more like the one I got the idea from to use the 4066, because I can not meaure in circuit and also not a resistor alone.A 100 mOhm ESR is easy to read, from about 20 mOhm you see the needle move. I can increase that sensitivity but now it goes to 40 Ohm. I was planning an improved version with logdetector but to many projects and it is very usefull this way. It is better under 1 Ohm as the Peak atlas ESR60. I like the analog meter because that shows if all is well. A smooth climb of the meter is good, if it has jumps i know there could be trouble and if it wobbles a bit at the measured value that to is a bad sign..

author: robrenz
author_rank: Super Contributor
timestamp: October 12, 2012, 03:02:35 am
content: PA4TIM, I sure you have read this but after looking thru it, this should be required reading for anyone asking questions about impedance measurements. AGILENT IMPEDANCE HANDBOOKhttp://www.google.com/url?sa=t&rct=j&q=&esrc=s&frm=1&source=web&cd=1&cad=rja&ved=0CCAQFjAA&url=http%3A%2F%2Fwww.home.agilent.com%2Fagilent%2Fredirector.jspx%3Faction%3Dref%26cname%3DAGILENT_EDITORIAL%26ckey%3D436474%26lc%3Deng%26cc%3DUS%26nfr%3D-536902441.0.00&ei=6YV3ULLVOfLG0AHF94GQAw&usg=AFQjCNHV0T_tSFwmcIaCabM0KxwderzPUw&sig2=Ci6HhrUEGRuYn0i7HHChXw

author: PA4TIM
author_rank: Super Contributor
timestamp: October 12, 2012, 06:01:09 am
content: Yes, that is a great book. Downloaded it a few years ago and used it a lot.The book about vna from Siebel ( R&S) is also great ( but much more complex and not a free download, it costed me about 80 euro if Iremember well)There is a very good pdf about AC electrical theory from David W Knight atwww.g3ynh.infoHere you find all the math you need about impedance (this is my bible)And I can recommend Analog Seekrets, DC to daylight, from Lesly Green, this is the most indept book I know, but be warned, things like 28 pages about caps alone and 30 about resistors and the whole ( free download) is around 500 pages.Also look for the General radio experimenter , they are all downloadable from the EIT site ( the once that took over a part of GenRad.( and still make one of the best C bridges ever, the GR 1620, i have one)But there are many more good books. Frederick E Terman wrote a great book about RF measurements in the 30's, still very usable today. Escpecially if you collect bridges. But his other books are great too. ( he was the teacher of hewlett and Packard and he stimulated them to start there business, in some forgotten place we now all know as silicon valley)

author: robrenz
author_rank: Super Contributor
timestamp: October 12, 2012, 01:31:34 pm
content: Thanks for the info PA4TIM, Leslie's book is excellent and I will investigate the others. lcr1 just posted this link to the IET LCR primer. It seems to add some more detail on top of what is covered in the Agilent version.http://www.ietlabs.com/notes/lcrprimer

author: PA4TIM
author_rank: Super Contributor
timestamp: October 12, 2012, 01:53:58 pm
content: Thanks, great link. I am already printing it. The GR experimenters are noa bene on the same site. So if I hasd used my eyes I should have found it before

author: PA4TIM
author_rank: Super Contributor
timestamp: October 12, 2012, 04:50:18 pm
content: http://www.pa4tim.nl/?p=3775The first trial of my new ESR page.