{"id":423,"date":"2013-06-01T15:08:40","date_gmt":"2013-06-01T15:08:40","guid":{"rendered":"http:\/\/stompville.co.uk\/?p=423"},"modified":"2020-10-11T15:06:14","modified_gmt":"2020-10-11T15:06:14","slug":"test-2","status":"publish","type":"post","link":"https:\/\/stompville.co.uk\/?p=423","title":{"rendered":"True Bypass Relay with Muting"},"content":{"rendered":"<p><strong>Update <\/strong>&#8211; extra schematics and timing diagrams added (see below). Also <strong>TLP222G <\/strong>photo mosfets are available in the shop <a title=\"stompville.co.uk\/shop\/22-tlp222g-optofet-isolator.html\" href=\"https:\/\/stompville.co.uk\/cart\/optoisolators\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.<\/p>\n<p>There has been discussion on Stompville <a title=\"True bypass with latching relay\" href=\"http:\/\/stompville.co.uk\/?p=260\">here<\/a> (in the comment section) and on <a title=\"www.diystompboxes.com\/smfforum\/index.php?topic=96667.40\" href=\"http:\/\/www.diystompboxes.com\/smfforum\/index.php?topic=96667.40\">diystompboxes.com<\/a> about problems with audio clicks when using a relay for true bypass. The consensus seems to be that the answer is to use a photofet opto-isolator to mute the audio output while the relay is switching. Two components in particular have been discussed, the <strong>Toshiba TLP222G<\/strong> and the <strong>Fairchild H11F1M<\/strong>.<\/p>\n<p>These devices are called photofet isolators and comprise an LED (the input or control side) optically isolated from a push-pull MOSFET (the output or detector side). There is no external gate connection to the detector and the output stage is switched on by the light coming from the LED. Our intention is to use the MOSFET to short the audio signal to ground (i.e. mute the signal), then switch the relay, then release the mute. The opto isolator function allows us to separate the control signal (from our micro-controller) and the audio signal (from our bypass relay) and in particular have separate (or managed) analogue and digital grounds.<\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/05\/132SV.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/05\/132SV.png\" alt=\"Basic Mute Schematic\" width=\"405\" height=\"243\" \/><\/a><\/p>\n<p>Now, we could just switch the LED on when we want to mute and this will probably work adequately in most cases. However, it would be more elegant if we could have a soft mute so the sound would fade out over a period of time (say 20 ms) then we switch the relay, then un-mute over a further 20ms, giving a total switching time of 50 ms (allowing 10 ms for the relay to change-over).<\/p>\n<p>To cut a long story short, the TLP222G is a better option all round than the H11F1M (more on this later), so I have been experimenting with the &#8216;222. The following circuit has been suggested as a way of providing soft mute:<\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/05\/134SV.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/05\/134SV.png\" alt=\"RC Led drive schematic\" width=\"405\" height=\"279\" \/><\/a><\/p>\n<p>Unfortunately, the switching characteristic of the &#8216;222 is such that the above circuit simply delays switching of the output stage and does not provide a soft muting function.<\/p>\n<p>Another possible option would be to use PWM control of the LED current:<\/p>\n<p><a href=\"http:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/06\/135SV.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/06\/135SV.png\" alt=\"135SV\" width=\"369\" height=\"320\" \/><\/a><\/p>\n<p style=\"text-align: left;\">Unfortunately, the switching characteristic of the &#8216;222 does not lend itself to this solution because the maximum useable PWM frequency for the &#8216;222 is less than 5kHz (which is, of course, audible). We would need a PWM frequency of 40kHz or higher to make this circuit useable.<\/p>\n<p style=\"text-align: left;\">However, if we hard-switch the LED (i.e. don&#8217;t use PWM), but make the resistor R fairly large, we can at least ramp the audio down:<a href=\"http:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/06\/140SV.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-446\" src=\"http:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/06\/140SV.png\" alt=\"140SV\" width=\"369\" height=\"320\" srcset=\"https:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/06\/140SV.png 410w, https:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/06\/140SV-300x260.png 300w\" sizes=\"(max-width: 369px) 100vw, 369px\" \/><\/a><\/p>\n<p style=\"text-align: left;\">Here&#8217;s a timing diagram for the above with an LED current (set by R) of about 2mA:<\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/06\/141SV.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-447\" src=\"http:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/06\/141SV.png\" alt=\"141SV\" width=\"534\" height=\"421\" srcset=\"https:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/06\/141SV.png 620w, https:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/06\/141SV-300x237.png 300w\" sizes=\"(max-width: 534px) 100vw, 534px\" \/><\/a><\/p>\n<p>However, there is a caveat here as well. I bought a batch of 25 TLP222G&#8217;s and after trying only about half a dozen of them it became clear that the resistor required to give the 20 ms mute period is a moveable feast and would need to be selected for the individual sample of TLP222G you have &#8211; which is OK if you have an oscilloscope handy.<\/p>\n<p>So it seems the way forward is to forget trying to force a soft mute of the photofet for the time being &#8211; I will continue to tinker with any ideas which come to mind. We should set the value of <strong>R<\/strong> low enough to make sure that any sample of the TLP222G will fire reliably. That value would coincide with a <strong>If<\/strong> of 3mA and the resistance would be (5V &#8211; 1.15V)\/3mA = 1.28k so 1.5k would be adequate. This gives us our timings as follows:<\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/06\/142SV.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-448\" src=\"http:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/06\/142SV.png\" alt=\"142SV\" width=\"496\" height=\"391\" srcset=\"https:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/06\/142SV.png 620w, https:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/06\/142SV-300x237.png 300w\" sizes=\"(max-width: 496px) 100vw, 496px\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/06\/136SV.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/06\/136SV.png\" alt=\"136SV\" width=\"558\" height=\"495\" \/><\/a><\/p>\n<p style=\"text-align: left;\">Note that if you want to muck about with the soft mute, I have left a 20 ms delay before operating the relay. R2 will need to be in the region of 3.6k &#8211; 5.6k. You might consider a 1.5k resistor with a 5k preset in series.<\/p>\n<p style=\"text-align: left;\">As previously noted, U1 could be LP2950-5V to save battery life; U2 could be ATtiny13 in lieu of ATtiny13A; and finally, U3 could be TLP222A. R1 may need to be reduced if your LED is too dim.<\/p>\n<p style=\"text-align: left;\"><a title=\"http:\/\/stompville.co.uk\/ATRelayMute-1R.zip\" href=\"https:\/\/stompville.co.uk\/ATRelayMute-1R.zip\">Here&#8217;s a link<\/a> to firmware hex file with timings as per figure 142SV above. No fuse changes required.<\/p>\n<p style=\"text-align: left;\">TLP222G&#8217;s are available for sale in the <a title=\"stompville.co.uk\/shop\/22-tlp222g-optofet-isolator.html\" href=\"https:\/\/stompville.co.uk\/cart\/optoisolators\" target=\"_blank\" rel=\"noopener noreferrer\">Stompville Shop<\/a>.<\/p>\n<p>\u00a0<strong>Update &#8211; Where should the Capacitor go?<\/strong><\/p>\n<p>I&#8217;ve received a few comments suggesting that the electrolytic capacitor should go before the resistor and this will make all the difference. In fact it makes no difference. We can&#8217;t escape from two facts we have discovered:<\/p>\n<ul>\n<li>The photofet has sharp turn-on and turn-off characteristics<\/li>\n<li>The actual characteristics vary significantly from sample to sample<\/li>\n<\/ul>\n<p>This means that it is not practical to finesse the soft-muting function using a simple RC network. Here are schematics and timing diagrams for the three possible scenarios:<\/p>\n<p><a href=\"http:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/06\/143SV.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-462\" src=\"http:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/06\/143SV-790x1024.png\" alt=\"143SV\" width=\"595\" height=\"771\" srcset=\"https:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/06\/143SV-790x1024.png 790w, https:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/06\/143SV-231x300.png 231w, https:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/06\/143SV.png 1024w\" sizes=\"(max-width: 595px) 100vw, 595px\" \/><\/a><\/p>\n<p>We can see from the timing diagrams that the addition of the capacitor has some effect on the &#8216;mute-on&#8217; function, but no effect on the &#8216;mute-off&#8217; function.<\/p>\n<h5><strong>Appendix &#8211; Choosing a Photofet<\/strong><\/h5>\n<p>The Toshiba TLP222 comes in two variants, the TLP222A and the TLP222G. The two significant differences which apply here are the on-state resistance of the output (<strong>Ron<\/strong>) and the off-state capacitance of the output (<strong>Coff<\/strong>). Here is a summary of the differences:<\/p>\n<p><a href=\"http:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/05\/130SV.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/05\/130SV.png\" alt=\"Comparison of TLP222 Variants\" width=\"240\" height=\"117\" \/><\/a><\/p>\n<p>Notionally, we want the lowest possible <strong>Ron<\/strong> (to give optimal muting) <em>and<\/em> the lowest possible<strong> Coff<\/strong> (to give minimal filtering of the audio signal). However, in this case, lower<strong> Coff<\/strong> trumps lower <strong>Ron<\/strong> and TLP222G is the better choice (but it may not make much difference in practice).<\/p>\n<p>The Fairchild alternative also comes in two variations, the H11F1M and the H11F3M. The datasheet also refers to the H11F2M, but this is an obsolete part. Here is a summary of the relevant differences:<\/p>\n<p><a href=\"http:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/06\/131SV.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/06\/131SV.png\" alt=\"131SV\" width=\"240\" height=\"117\" \/><\/a><\/p>\n<p>Note that\u00a0 <strong>Coff<\/strong> is comparable with the <strong>TLP222G<\/strong>, but <strong>Ron<\/strong> is much higher. Clearly, we would want to choose the &#8216;F1 variant over the &#8216;F3 variant.<\/p>\n<p><a href=\"http:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/06\/P140SV.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/stompville.co.uk\/wp-content\/uploads\/2013\/06\/P140SV.jpg\" alt=\"Photofets\" width=\"340\" height=\"242\" \/><\/a><\/p>\n<p>So it turns out that the Toshiba part is a better choice all round. Both parts have acceptably low capacitance &#8211; but the TLP222G has lower on-resistance, comes in a smaller package and is less expensive than the H11F1M.\u00a0 <img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/stompville.co.uk\/wp-content\/uploads\/2012\/02\/svfavicon.png\" alt=\"svfavicon.png\" width=\"16\" height=\"16\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update &#8211; extra schematics and timing diagrams added (see below). Also TLP222G photo mosfets are available in the shop here. There has been discussion on Stompville here (in the comment section) and on diystompboxes.com about problems with audio clicks when using a relay for true bypass. The consensus seems to be that the answer is\u2026 <span class=\"read-more\"><a href=\"https:\/\/stompville.co.uk\/?p=423\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,7],"tags":[],"_links":{"self":[{"href":"https:\/\/stompville.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/423"}],"collection":[{"href":"https:\/\/stompville.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/stompville.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/stompville.co.uk\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/stompville.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=423"}],"version-history":[{"count":9,"href":"https:\/\/stompville.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/423\/revisions"}],"predecessor-version":[{"id":1425,"href":"https:\/\/stompville.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/423\/revisions\/1425"}],"wp:attachment":[{"href":"https:\/\/stompville.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=423"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stompville.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=423"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stompville.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=423"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}