{"id":1782,"date":"2013-07-19T14:44:33","date_gmt":"2013-07-19T22:44:33","guid":{"rendered":"http:\/\/pididu.com\/wordpress\/?p=1782"},"modified":"2017-10-16T14:13:35","modified_gmt":"2017-10-16T22:13:35","slug":"measuring-inductance-at-high-currents-without-an-oscillosope","status":"publish","type":"post","link":"http:\/\/pididu.com\/wordpress\/blog\/measuring-inductance-at-high-currents-without-an-oscillosope\/","title":{"rendered":"Measuring Inductance at High Currents without an Oscillosope"},"content":{"rendered":"<p>I need an inductor of a certain value for my\u00a0<a title=\"Solar Bicycle Project\" href=\"http:\/\/pididu.com\/wordpress\/solarbike\">solar bike<\/a>. \u00a0Unfortunately, working with scavenged and surplus parts, it&#8217;s hard to get the value I really want. \u00a0It would be easy to measure an inductor with an LCR meter, or with a simple circuit plus an oscilloscope. \u00a0I have neither, so have to be creative about it. \u00a0(Kind of reminds me of high school, when I had only a multimeter, so measured capacitance by building an oscillator and listening to the tone through headphones&#8230;)<\/p>\n<figure id=\"attachment_1797\" aria-describedby=\"caption-attachment-1797\" style=\"width: 1170px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2013\/07\/Measure_Inductance_Schematic.gif\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-1797\" alt=\"put caption here\" src=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2013\/07\/Measure_Inductance_Schematic.gif\" width=\"1170\" height=\"765\" \/><\/a><figcaption id=\"caption-attachment-1797\" class=\"wp-caption-text\">The things in the green box are soldered outside the breadboard. Heavy lines indicate heavy wire for high currents.<\/figcaption><\/figure>\n<p>A PICAXE-08M2 embedded processor is the heart of the circuit above. That processor has built-in A\/D converters and pulse generators. Here is pseudo-code for its program:<\/p>\n<pre>set_low(peak_detector_capacitor); \/\/ zero out to start\r\nset_to_input(peak_detector_capacitor);\r\n\r\nvoltage = 0;\r\ncount = 0;\r\n\/\/ Pulse the power transistor\r\n\/\/ Peak current across sense resistor is translated\r\n\/\/ to voltage, and picked up by peak detector\r\n\/\/ It may take several pulses to charge the capacitor\r\n\/\/ in the peak detector, so keep pulsing until the\r\n\/\/ reading is stable\r\ndo {\r\n    last_voltage = voltage;\r\n    pulse(gate_of_mosfet);\r\n    voltage = readadc(peak_detector_capacitor);\r\n    count++;\r\n    } until ((voltage - last_voltage) &lt;= 1);\r\nprint(\"The voltage is \", voltage);\r\nprint(\"Number of iterations \", count);<\/pre>\n<p>Here&#8217;s how it works:<\/p>\n<ul>\n<li>There are several power supplies, but the 24-volt supply comes from lead-acid batteries.<\/li>\n<li>C1 and C2 are stiffening capacitors, since there will be transient currents of perhaps 40 amps on 24 volts.<\/li>\n<li>S1 enables power on 24 volts. \u00a0R7 is there to gracefully charge C1 and C2 upon initial connection to the batteries. \u00a0Without R7, there will be a big spark when the leads are initially connected, or when the switch is first turned on.<\/li>\n<li>U1 is the aforementioned PICAXE processor, with R1 and R2 as standard interface components to the programming port, a 3-wire serial interface. \u00a0Output from the program is sent through this same port to a terminal.<\/li>\n<li>Lx is the unknown inductor to be measured. \u00a0When Q1 is turned on, roughly 24 volts is applied across the inductor. \u00a0Current builds up in the inductor according to the equation V = L di\/dt. \u00a0Thus, if we know the duration for which the voltage is applied (dt), and the peak current (di), we should be able to calculate the inductance.<\/li>\n<li>The current flowing through the inductor also flows through sense resistor R9. \u00a0As it does, a voltage develops across R9. \u00a0This voltage is large enough to be measured, but small enough so as not to significantly interfere with the current through the inductor.<\/li>\n<li>U3, D2, and C4 form a peak detector circuit that monitors the voltage across R9. \u00a0U3, an LM393, has an open collector output, so needs pullup R3. \u00a0In order to get better precision, R3 has a higher value than would be capable of charging C4 to its final value within the time of one pulse, so it is necessary to pulse current through Lx multiple times.<\/li>\n<li>U3 is a bipolar part that has significant input bias current, so will charge C4 on its own if left alone. \u00a0An FET input comparator would have lower drift, but as implemented, the voltage on C4 can be read quickly before significant drift occurs.<\/li>\n<li>Pin 5 (C.2) on the PICAXE is a low-true signal to drive a pulse to the gate of Q1. \u00a0The 5-volt output of the PICAXE may not be enough to turn on Q1 solidly, so Q2 and R6 are used to invert and level-shift the signal to 12 volts.<\/li>\n<li>When the PICAXE is going through initialization or programming, and its pins will float.\u00a0 R4 insures that Q2 is turned on at this time, and in turn, that Q1 is turned off.<\/li>\n<li>R8 insures that static does not build up on the gate of Q1 and harm the transistor when the breadboard part of the circuit (outside the green box) is disconnected<\/li>\n<li>When current is flowing through Lx, and Q1 turns off at the end of a pulse, voltage builds across Lx, possibly to levels that would destroy Q1 if left unchecked. \u00a0Therefore, R10 is used as a dump load to absorb the excess energy. \u00a0The initial pulse of current through R10 would be quite high, and result in a high voltage, except that C3 absorbs the bulk of the current spike. \u00a0R10 is actually a 12-volt automotive lamp, so that if Q1 is pulsed continuously, there should be a visual indication of the power output.<\/li>\n<\/ul>\n<p>And here is what it looks like in real life:<\/p>\n<figure id=\"attachment_1784\" aria-describedby=\"caption-attachment-1784\" style=\"width: 994px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2013\/07\/Measuring-Inductance.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-1784\" alt=\"It's a crazy mess, but it works.\" src=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2013\/07\/Measuring-Inductance.jpg\" width=\"994\" height=\"768\" srcset=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2013\/07\/Measuring-Inductance.jpg 994w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2013\/07\/Measuring-Inductance-100x77.jpg 100w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2013\/07\/Measuring-Inductance-300x231.jpg 300w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2013\/07\/Measuring-Inductance-388x300.jpg 388w\" sizes=\"(max-width: 994px) 100vw, 994px\" \/><\/a><figcaption id=\"caption-attachment-1784\" class=\"wp-caption-text\">It&#8217;s a crazy mess, but it works.<\/figcaption><\/figure>\n<p>[18-JUL-2013] I don&#8217;t fully understand the results I got. \u00a0Perhaps you, the reader, can help. \u00a0The original drive circuit is shown below for reference.<\/p>\n<figure id=\"attachment_1804\" aria-describedby=\"caption-attachment-1804\" style=\"width: 523px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2013\/07\/RTLdrive.gif\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-1804\" alt=\"RTL type drive circuit for the MOSFET gate.\" src=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2013\/07\/RTLdrive.gif\" width=\"523\" height=\"342\" \/><\/a><figcaption id=\"caption-attachment-1804\" class=\"wp-caption-text\">RTL type drive circuit for the MOSFET gate.<\/figcaption><\/figure>\n<p>At first, I used a resistor of 1000 ohms for R1, and got a reading of 14.4 amps. \u00a0Theoretically, it should have been 24 amps, with a perfect switch, and a perfect inductor. Possibly the gate of the MOSFET Q1 was taking too long to charge? \u00a0So I changed R1 to 261 ohms, and got 19.4 amps. \u00a0Good, right direction. \u00a0Then I dropped R1 to 137 ohms, and got 21.4 amps &#8211; close enough, given all the unknown tolerances in the circuit. So it looked like I needed to do some work on the gate drive.<\/p>\n<figure id=\"attachment_1805\" aria-describedby=\"caption-attachment-1805\" style=\"width: 523px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2013\/07\/TotemDrive.gif\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-1805\" alt=\"Totem pole type drive circuit for the MOSFET gate\" src=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2013\/07\/TotemDrive.gif\" width=\"523\" height=\"342\" \/><\/a><figcaption id=\"caption-attachment-1805\" class=\"wp-caption-text\">Totem pole type drive circuit for the MOSFET gate<\/figcaption><\/figure>\n<p>The totem-pole drive above was my next attempt. This is similar to a TTL output, and should have a very low impedance both for charging and discharging the gate. Also, this configuration uses less power than the RTL drive above, since the NPN transistor does not need to sink any static current for the low state. With this circuit, I got a reading of 21.6 amps. Note that the supply voltage is only 5 volts here, but this seems to be all right, as the power MOSFET is designed for a logic level drive, with a low threshold voltage. A weakness of this circuit is that at startup, the driving processor pin is floating, so current flows out of the base of the PNP transistor, through the two base resistors, and into the base of the NPN transistor. Both transistors are turned on simultaneously, for a temporarily high power dissipation. If I actually end up using a totem pole, I will probably use NMOS and PMOS FETs, which will have less of this problem.<\/p>\n<p>Just for the heck of it, I decided to try driving the power MOSFET gate directly from a processor pin. I had low expectations.<\/p>\n<figure id=\"attachment_1807\" aria-describedby=\"caption-attachment-1807\" style=\"width: 523px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2013\/07\/DirectDrive.gif\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-1807\" alt=\"Direct drive circuit for the MOSFET.  In this case, the  gate resistor is driven directly from a processor output pin.  It was necessary to invert the sense of the drive signal in software.\" src=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2013\/07\/DirectDrive.gif\" width=\"523\" height=\"192\" \/><\/a><figcaption id=\"caption-attachment-1807\" class=\"wp-caption-text\">Direct drive circuit for the MOSFET. In this case, the gate resistor is driven directly from a processor output pin. It was necessary to invert the sense of the drive signal in software.<\/figcaption><\/figure>\n<p>Surprisingly, with the MOSFET gate connected directly to the processor pin (R5 = 0 ohms), I measured a peak current of 21.8 amps. \u00a0I put in 137 ohms, expecting the result to be smaller, but then saw 25.8 amps. \u00a0That didn&#8217;t make sense to me. I increased the resistor to 261 ohms, and got 26.3 amps as the peak current. Finally, I tried 1000 ohms, and got nothing. Perhaps there was not enough time to charge the MOSFET gate to turn on in the 10 uS pulse I was using?\u00a0 For that matter, with the lower value resistors, perhaps the gate was never fully turning off?<\/p>\n<p>With bolstered confidence, I put the 261 ohm resistor back into the circuit, and altered the software to put out a continuous train of pulses at increasing duty cycles. I connected a voltmeter across the dummy load, but was disappointed to see just 0.1 volt there when the duty cycle was cranked up to about 33%. If my calculations were correct, at that point, the lamp in the dummy load should have been at full brightness.\u00a0 I had not heat-sinked the transistor, thinking that these first few experiments would be at low power.\u00a0 Then, POP! The power MOSFET had gotten so hot, it unsoldered itself, and as the wire sprung away, there was a blue spark. Well, at least that confirmed that high currents were present.<\/p>\n<figure id=\"attachment_1806\" aria-describedby=\"caption-attachment-1806\" style=\"width: 400px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2013\/07\/UnsolderedSwitch.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-1806\" alt=\"The transistor got so hot, it unsoldered itself.\" src=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2013\/07\/UnsolderedSwitch.jpg\" width=\"400\" height=\"226\" srcset=\"http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2013\/07\/UnsolderedSwitch.jpg 400w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2013\/07\/UnsolderedSwitch-100x56.jpg 100w, http:\/\/pididu.com\/wordpress\/wp-content\/uploads\/2013\/07\/UnsolderedSwitch-300x169.jpg 300w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><\/a><figcaption id=\"caption-attachment-1806\" class=\"wp-caption-text\">The transistor got so hot, it unsoldered itself.\u00a0 Black wire came from the inductor, yellow wire went to the dummy load.<\/figcaption><\/figure>\n<p><span style=\"color: #ff0000;\"><strong>So what happened? Anyone??<\/strong><span style=\"color: #000000;\">\u00a0 I think I&#8217;ll have to break down and buy an inexpensive USB oscilloscope.\u00a0 This would be so much easier to debug if I could see what&#8217;s going on.<\/span><br \/>\n<\/span><\/p>\n<p>[23-AUG-2013] Update: I bought an oscilloscope, which made finding root cause of this issue easy. \u00a0Read about it <a title=\"$69 USB Oscilloscope\" href=\"http:\/\/pididu.com\/wordpress\/blog\/i-dropped-an-oscilloscope-on-my-foot-hantek-6022be\/\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I need an inductor of a certain value for my\u00a0solar bike. \u00a0Unfortunately, working with scavenged and surplus parts, it&#8217;s hard to get the value I really want. \u00a0It would be easy to measure an inductor with an LCR meter, or with a simple circuit plus an oscilloscope. \u00a0I have neither, so have to be creative &hellip; <a href=\"http:\/\/pididu.com\/wordpress\/blog\/measuring-inductance-at-high-currents-without-an-oscillosope\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Measuring Inductance at High Currents without an Oscillosope<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":1806,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[204],"tags":[],"_links":{"self":[{"href":"http:\/\/pididu.com\/wordpress\/wp-json\/wp\/v2\/posts\/1782"}],"collection":[{"href":"http:\/\/pididu.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/pididu.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/pididu.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/pididu.com\/wordpress\/wp-json\/wp\/v2\/comments?post=1782"}],"version-history":[{"count":0,"href":"http:\/\/pididu.com\/wordpress\/wp-json\/wp\/v2\/posts\/1782\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/pididu.com\/wordpress\/wp-json\/wp\/v2\/media\/1806"}],"wp:attachment":[{"href":"http:\/\/pididu.com\/wordpress\/wp-json\/wp\/v2\/media?parent=1782"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pididu.com\/wordpress\/wp-json\/wp\/v2\/categories?post=1782"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pididu.com\/wordpress\/wp-json\/wp\/v2\/tags?post=1782"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}