{"id":260,"date":"2012-04-20T14:52:33","date_gmt":"2012-04-20T14:52:33","guid":{"rendered":"http:\/\/stompville.co.uk\/?p=260"},"modified":"2020-10-11T15:22:47","modified_gmt":"2020-10-11T15:22:47","slug":"true-bypass-with-latching-relay","status":"publish","type":"post","link":"https:\/\/stompville.co.uk\/?p=260","title":{"rendered":"True bypass with latching relay"},"content":{"rendered":"<p><strong>Update: Remote controlling the True Bypass <a href=\"https:\/\/stompville.co.uk\/?p=1264\">here<\/a>.<\/strong><\/p>\n<p><strong>Update: SMD version <a title=\"True Bypass Relay SMD\" href=\"https:\/\/stompville.co.uk\/?p=744\">here<\/a>.<\/strong><\/p>\n<p><strong>Update: True Bypass Relay with muting <a title=\"True Bypass Relay with Muting\" href=\"https:\/\/stompville.co.uk\/?p=423\">here<\/a>.<\/strong><\/p>\n<p><strong>Update: True Bypass kits are available to buy in the shop <a title=\"stompville.co.uk\/shop\/6-true-bypass-relay-kit.html\" href=\"https:\/\/stompville.co.uk\/cart\/kits-modules\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.<\/strong><\/p>\n<p>I have used Arduino over the last twelve months or so for a couple of projects and I have been looking for an excuse to go to play with the AVR ATTiny embedded microcontroller range.\u00a0 I came across Jack Orman&#8217;s <a title=\"http:\/\/www.muzique.com\/schem\/bypass.htm\" href=\"https:\/\/www.muzique.com\/schem\/bypass.htm\" target=\"_blank\" rel=\"noopener noreferrer\">true bypass<\/a> project and initially thought that controlling a relay with a microcontroller was a little over-the-top.\u00a0 Whilst researching another project I came across Jack Gannsle&#8217;s excellent article on <a title=\"http:\/\/www.ganssle.com\/debouncing.htm\" href=\"http:\/\/www.ganssle.com\/debouncing.htm\" target=\"_blank\" rel=\"noopener noreferrer\">switch debouncing<\/a> where it becomes clear that custom chips for debouncing switches are basically non-existent and if you&#8217;re going to debounce a momentary switch and drive a bipolar (latching) relay, you&#8217;re going to end up with quite a few components.\u00a0 So maybe using a microcontroller is not such a bad idea.\u00a0 Let&#8217;s try it!<\/p>\n<p>Here&#8217;s the schematic:<\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/stompville.co.uk\/wp-content\/uploads\/2012\/04\/123SV.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-261 aligncenter\" title=\"123SV\" src=\"http:\/\/stompville.co.uk\/wp-content\/uploads\/2012\/04\/123SV.png\" alt=\"ATRelay schematic\" width=\"612\" height=\"430\" srcset=\"https:\/\/stompville.co.uk\/wp-content\/uploads\/2012\/04\/123SV.png 1020w, https:\/\/stompville.co.uk\/wp-content\/uploads\/2012\/04\/123SV-300x211.png 300w\" sizes=\"(max-width: 612px) 100vw, 612px\" \/><\/a><\/p>\n<p style=\"text-align: left;\">As you can see, once you get the voltage regulator out of the way, the whole thing is only five components.\u00a0 ATTiny outputs can sink or source 40mA and the relay coil requires about 20mA so that&#8217;s OK.\u00a0 When we power up PB3 and PB4 are made low.\u00a0 To set the relay, we make PB3 high for a few milliseconds then low again.\u00a0 To reset the relay, we make PB4 high for a few ms then low again.\u00a0 Thus the power consumption of the circuit is very low (a continuous 1mA instead of 20mA if we used a non-latching relay).\u00a0 I used an LP2950-5 in lieu of the 78L05 shown on the schematic to reduce quiescent current from around 4mA to 1mA ( see below).<\/p>\n<p style=\"text-align: left;\">Here&#8217;s the finished item:<\/p>\n<p style=\"text-align: left;\"><a href=\"http:\/\/stompville.co.uk\/wp-content\/uploads\/2012\/04\/P127SV.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-265 size-medium\" title=\"P127SV\" src=\"http:\/\/stompville.co.uk\/wp-content\/uploads\/2012\/04\/P127SV-300x258.jpg\" alt=\"ATRelay pcb assembly\" width=\"300\" height=\"258\" srcset=\"https:\/\/stompville.co.uk\/wp-content\/uploads\/2012\/04\/P127SV-300x258.jpg 300w, https:\/\/stompville.co.uk\/wp-content\/uploads\/2012\/04\/P127SV.jpg 600w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p style=\"text-align: left;\">The PCB dimensions are 30mm x 25mm.\u00a0 Here&#8217;s another picture with the development board and a couple of half-finished PCB&#8217;s:<\/p>\n<p style=\"text-align: left;\"><a href=\"http:\/\/stompville.co.uk\/wp-content\/uploads\/2012\/04\/P128SV.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-266 size-medium\" title=\"P128SV\" src=\"http:\/\/stompville.co.uk\/wp-content\/uploads\/2012\/04\/P128SV-300x219.jpg\" alt=\"ATRelay development\" width=\"300\" height=\"219\" srcset=\"https:\/\/stompville.co.uk\/wp-content\/uploads\/2012\/04\/P128SV-300x219.jpg 300w, https:\/\/stompville.co.uk\/wp-content\/uploads\/2012\/04\/P128SV-1024x746.jpg 1024w, https:\/\/stompville.co.uk\/wp-content\/uploads\/2012\/04\/P128SV.jpg 1200w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p style=\"text-align: left;\">The software is interrupt-driven and uses Dr Marty&#8217;s <a title=\"http:\/\/drmarty.blogspot.co.uk\/2009\/05\/best-switch-debounce-routine-ever.html\" href=\"https:\/\/drmarty.blogspot.co.uk\/2009\/05\/best-switch-debounce-routine-ever.html\" target=\"_blank\" rel=\"noopener noreferrer\">best-switch-debounce-routine-ever<\/a>&#8230; and it works very well (but see the last paragraph <a href=\"https:\/\/stompville.co.uk\/?p=1264\">here<\/a>).\u00a0 I toyed with using a jumper to determine whether the unit should power-up with the effect active or bypassed but I decided there was no downside to detecting if the stomp switch was pressed at the time the unit powers up and, if so,\u00a0 toggling the power up status.\u00a0 The power-up status is held in EEPROM.<\/p>\n<p style=\"text-align: left;\">Whilst the 78L05 is less expensive than the LP2950-5 (about half price)\u00a0 neither are going to break the bank.\u00a0 Furthermore, looking at the specs,\u00a0 the 78L05 has a quiescent current of 3mA and a minimum load current of 1mA whereas the LP2950 has a quiescent current of 0.1mA and a minimum load current of 0.1mA to maintain regulation.\u00a0 So it seems like a no-brainer to choose the LP2950-5 and get much better battery life.\u00a0 The ATTiny is currently running at a clock frequency of 9.6MHz and if I rewrote the software to run it at 128kHZ the power consumption of the ATTiny13A would fall further but as the idle current is already less than 1mA, I may not get a round tuit.<\/p>\n<p style=\"text-align: left;\">All in all, an interesting my-first-ATTiny project.\u00a0 <img loading=\"lazy\" decoding=\"async\" title=\"svfavicon.png\" src=\"http:\/\/stompville.co.uk\/wp-content\/uploads\/2012\/02\/svfavicon.png\" alt=\"\" width=\"16\" height=\"16\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update: Remote controlling the True Bypass here. Update: SMD version here. Update: True Bypass Relay with muting here. Update: True Bypass kits are available to buy in the shop here. I have used Arduino over the last twelve months or so for a couple of projects and I have been looking for an excuse to\u2026 <span class=\"read-more\"><a href=\"https:\/\/stompville.co.uk\/?p=260\">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\/260"}],"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=260"}],"version-history":[{"count":6,"href":"https:\/\/stompville.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/260\/revisions"}],"predecessor-version":[{"id":1434,"href":"https:\/\/stompville.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/260\/revisions\/1434"}],"wp:attachment":[{"href":"https:\/\/stompville.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=260"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stompville.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=260"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stompville.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=260"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}