{"id":1450,"date":"2019-10-29T16:46:28","date_gmt":"2019-10-29T16:46:28","guid":{"rendered":"http:\/\/tomblog.firstsolo.net\/?page_id=1450"},"modified":"2020-12-30T22:43:13","modified_gmt":"2020-12-30T22:43:13","slug":"pid-controller-rev-1","status":"publish","type":"page","link":"http:\/\/tomblog.firstsolo.net\/index.php\/hobbies\/pimping-my-coffee-machine\/pid-controller-rev-1\/","title":{"rendered":"PID Controller rev 1"},"content":{"rendered":"<p>My original version (let&#8217;s call it &#8216;rev 0&#8242;<span class=\"footnote_referrer\"><a role=\"button\" tabindex=\"0\" onclick=\"footnote_moveToReference_1450_1('footnote_plugin_reference_1450_1_1');\" onkeypress=\"footnote_moveToReference_1450_1('footnote_plugin_reference_1450_1_1');\" ><sup id=\"footnote_plugin_tooltip_1450_1_1\" class=\"footnote_plugin_tooltip_text\">1<\/sup><\/a><span id=\"footnote_plugin_tooltip_text_1450_1_1\" class=\"footnote_tooltip\">I never wrote a page for this ancient version in case you&#8217;re wondering.<\/span><\/span><script type=\"text\/javascript\"> jQuery('#footnote_plugin_tooltip_1450_1_1').tooltip({ tip: '#footnote_plugin_tooltip_text_1450_1_1', tipClass: 'footnote_tooltip', effect: 'fade', predelay: 0, fadeInSpeed: 200, delay: 400, fadeOutSpeed: 200, position: 'top right', relative: true, offset: [10, 10], });<\/script>) of the controller had an Atmel AVR microcontroller soldered directly onto the board and I had to muck about with serial to USB converters. These days Arduino boards can be bought cheap (for less than a pound on ebay if you&#8217;re willing to wait for one to come from China<span class=\"footnote_referrer\"><a role=\"button\" tabindex=\"0\" onclick=\"footnote_moveToReference_1450_1('footnote_plugin_reference_1450_1_2');\" onkeypress=\"footnote_moveToReference_1450_1('footnote_plugin_reference_1450_1_2');\" ><sup id=\"footnote_plugin_tooltip_1450_1_2\" class=\"footnote_plugin_tooltip_text\">2<\/sup><\/a><span id=\"footnote_plugin_tooltip_text_1450_1_2\" class=\"footnote_tooltip\">And if you&#8217;re okay with importing from China. I worry about this kind of thing.<\/span><\/span><script type=\"text\/javascript\"> jQuery('#footnote_plugin_tooltip_1450_1_2').tooltip({ tip: '#footnote_plugin_tooltip_text_1450_1_2', tipClass: 'footnote_tooltip', effect: 'fade', predelay: 0, fadeInSpeed: 200, delay: 400, fadeOutSpeed: 200, position: 'top right', relative: true, offset: [10, 10], });<\/script>).<\/p>\n<p>So here are the Eagle CAD files for an Arduino Nano &#8220;shield&#8221; I designed to do the job:\u00a0<a href=\"http:\/\/tomblog.firstsolo.net\/wp-content\/uploads\/2016\/05\/coffeepidshield.r1003.zip\">coffeepidshield.zip<\/a>. (Or if you just want a PDF, it&#8217;s <a href=\"http:\/\/tomblog.firstsolo.net\/wp-content\/uploads\/2016\/05\/coffeepidshield.pdf\">coffeepidshield<\/a>.)<\/p>\n<p>Or if you just want to get a board printed, here are the Gerber files: <a href=\"http:\/\/tomblog.firstsolo.net\/wp-content\/uploads\/2016\/05\/coffeepidshield.gerber.r1002.zip\">coffeepidshield.gerber.zip<\/a>.\u00a0(Caveat Emptor: I discovered some things I would change about the board if I printed more. See my comments below.) I have some spare boards as the cheapest price I could get for printing was for 10 boards. Let me know if you want one. I have 2 left as of Oct 2019. You might want to wait for <a href=\"http:\/\/tomblog.firstsolo.net\/index.php\/hobbies\/pimping-my-coffee-machine\/pid-controller-rev-2\/\">rev 2<\/a>, though &#8211; although I am not sure when I&#8217;ll complete that.<\/p>\n<p>And here is the Arduino project file for driving the wee beastie: <a href=\"http:\/\/tomblog.firstsolo.net\/wp-content\/uploads\/2016\/10\/coffeepid.r1043.ino\">coffeepid.ino<\/a>. (Here&#8217;s an older one I originally posted:\u00a0<a href=\"http:\/\/tomblog.firstsolo.net\/wp-content\/uploads\/2016\/06\/coffeepid.r1023.ino\">coffeepid.ino<\/a>.)<\/p>\n<h2><span style=\"color: #000000; font-weight: bold;\"><span style=\"color: #000000; font-weight: bold;\">Parts list<\/span><\/span><\/h2>\n<p>I got most of my parts at <a href=\"http:\/\/cpc.farnell.com\/\" target=\"_blank\" rel=\"noopener\">CPC<\/a> or the related <a href=\"https:\/\/uk.farnell.com\/\">Farnell<\/a><span class=\"footnote_referrer\"><a role=\"button\" tabindex=\"0\" onclick=\"footnote_moveToReference_1450_1('footnote_plugin_reference_1450_1_3');\" onkeypress=\"footnote_moveToReference_1450_1('footnote_plugin_reference_1450_1_3');\" ><sup id=\"footnote_plugin_tooltip_1450_1_3\" class=\"footnote_plugin_tooltip_text\">3<\/sup><\/a><span id=\"footnote_plugin_tooltip_text_1450_1_3\" class=\"footnote_tooltip\">In the USA <a href=\"https:\/\/www.newark.com\/\">Newark<\/a> is part of the same group.<\/span><\/span><script type=\"text\/javascript\"> jQuery('#footnote_plugin_tooltip_1450_1_3').tooltip({ tip: '#footnote_plugin_tooltip_text_1450_1_3', tipClass: 'footnote_tooltip', effect: 'fade', predelay: 0, fadeInSpeed: 200, delay: 400, fadeOutSpeed: 200, position: 'top right', relative: true, offset: [10, 10], });<\/script>, so I include CPC part numbers:<\/p>\n<ul>\n<li>C1: 1000uF 16V\u00a0<a title=\"CA05731\" href=\"http:\/\/cpc.farnell.com\/panasonic-electronic-components\/eca1cam102x\/capacitor-1000uf-16v\/dp\/CA05731\/false\" target=\"_blank\" rel=\"noopener\">CA05731<\/a>.<\/li>\n<li>C4: 1nF 0603\u00a0<a title=\"CA06574\" href=\"http:\/\/cpc.farnell.com\/kemet\/c0603c102k5ractu\/capacitor-0603-1nf-50v-x7r\/dp\/CA06574\/false\" target=\"_blank\" rel=\"noopener\">CA06574<\/a>.<\/li>\n<li>C5: 470nF 0603\u00a0<a title=\"CA06405\" href=\"http:\/\/cpc.farnell.com\/multicomp\/mcca000164\/mlcc-0603-y5v-16v-470nf\/dp\/CA06405\/false\" target=\"_blank\" rel=\"noopener\">CA06405<\/a>.<\/li>\n<li>All other caps: 10nF 0603 <a title=\"CA06573\" href=\"http:\/\/cpc.farnell.com\/kemet\/c0603c103k5ractu\/capacitor-0603-10nf-50v-x7r\/dp\/CA06573\/false\" target=\"_blank\" rel=\"noopener\">CA06573<\/a>.\u00a0(Note: you probably won&#8217;t populate C10-C15, see below.)<\/li>\n<li>D3: 1A diode\u00a0<a id=\"pdp\" href=\"http:\/\/cpc.farnell.com\/webapp\/wcs\/stores\/servlet\/ProductDisplay?catalogId=15002&amp;langId=69&amp;urlRequestType=Base&amp;partNumber=SC11345&amp;storeId=10180\" target=\"_blank\" rel=\"noopener\">SC11345<\/a>.\u00a0(Can&#8217;t for the life of me think why I picked this rectifier diode, a 200mA one would do.)<\/li>\n<li>IC1:\u00a0LM2904D\u00a0<a id=\"pdp\" href=\"http:\/\/cpc.farnell.com\/webapp\/wcs\/stores\/servlet\/ProductDisplay?catalogId=15002&amp;langId=69&amp;urlRequestType=Base&amp;partNumber=SC07981&amp;storeId=10180\" target=\"_blank\" rel=\"noopener\">SC07981<\/a>.<\/li>\n<li>OK1-OK3: MOC3022-M optocouple\u00a0<a id=\"pdp\" href=\"http:\/\/cpc.farnell.com\/webapp\/wcs\/stores\/servlet\/ProductDisplay?catalogId=15002&amp;langId=69&amp;urlRequestType=Base&amp;partNumber=SC12309&amp;storeId=10180\" target=\"_blank\" rel=\"noopener\">SC12309<\/a>.<\/li>\n<li>R1-R3: 470\u03a9 1206\u00a0<a title=\"RE03984\" href=\"http:\/\/cpc.farnell.com\/unbranded\/mc-0-125w-1206-1-470r\/res-thick-film-470r-1-0-125w-1206\/dp\/RE03984\/false\" target=\"_blank\" rel=\"noopener\">RE03984<\/a>.<\/li>\n<li>R4-R6: 330\u03a9 240VAC 1\/4W carbon film.\u00a0(e.g. <a title=\"RE03797\" href=\"http:\/\/cpc.farnell.com\/unbranded\/mcf-0-25w-330r\/resistor-0-25w-5-330r-pk-100\/dp\/RE03797\/false\" target=\"_blank\" rel=\"noopener\">RE03797<\/a>.\u00a0Don&#8217;t buy them individually, buy an assortment pack).<\/li>\n<li>R10, R11, R20: 2.7k\u03a9 240VAC 1\/4W carbon film. (Ditto.)<\/li>\n<li>R7: 1.2k\u03a9 0805\u00a0<a title=\"RE03939\" href=\"http:\/\/cpc.farnell.com\/unbranded\/mc-0-1w-0805-1-1k2\/res-thick-film-1k2-1-0-1w-0805\/dp\/RE03939\/false\" target=\"_blank\" rel=\"noopener\">RE03939<\/a>.<\/li>\n<li>R9: 2k\u03a9 1% 0805\u00a0<a id=\"pdp\" href=\"http:\/\/cpc.farnell.com\/webapp\/wcs\/stores\/servlet\/ProductDisplay?catalogId=15002&amp;langId=69&amp;urlRequestType=Base&amp;partNumber=RE03941&amp;storeId=10180\" target=\"_blank\" rel=\"noopener\">RE03941<\/a>.<\/li>\n<li>R12:\u00a0270k\u03a9 1%\u00a00805\u00a0<a id=\"pdp\" href=\"http:\/\/cpc.farnell.com\/webapp\/wcs\/stores\/servlet\/ProductDisplay?catalogId=15002&amp;langId=69&amp;urlRequestType=Base&amp;partNumber=RE03968&amp;storeId=10180\" target=\"_blank\" rel=\"noopener\">RE03968<\/a>.<\/li>\n<li>R14: 1.5M\u03a9 1%\u00a00805\u00a0<a id=\"pdp\" href=\"http:\/\/cpc.farnell.com\/webapp\/wcs\/stores\/servlet\/ProductDisplay?catalogId=15002&amp;langId=69&amp;urlRequestType=Base&amp;partNumber=RE07151&amp;storeId=10180\" target=\"_blank\" rel=\"noopener\">RE07151<\/a>.<\/li>\n<li>R15: 47k\u03a9 1%\u00a00805\u00a0<a id=\"pdp\" href=\"http:\/\/cpc.farnell.com\/webapp\/wcs\/stores\/servlet\/ProductDisplay?catalogId=15002&amp;langId=69&amp;urlRequestType=Base&amp;partNumber=RE03959&amp;storeId=10180\" target=\"_blank\" rel=\"noopener\">RE03959<\/a>.<\/li>\n<li>R16: 3.3M\u03a9 1%\u00a00805\u00a0<a id=\"pdp\" href=\"http:\/\/cpc.farnell.com\/webapp\/wcs\/stores\/servlet\/ProductDisplay?catalogId=15002&amp;langId=69&amp;urlRequestType=Base&amp;partNumber=RE07153&amp;storeId=10180\" target=\"_blank\" rel=\"noopener\">RE07153<\/a>.<\/li>\n<li>R18: 330k\u03a9 0805\u00a0<a title=\"RE03970\" href=\"http:\/\/cpc.farnell.com\/unbranded\/mc-0-1w-0805-1-330k\/res-thick-film-330k-1-0-1w-0805\/dp\/RE03970\/false\" target=\"_blank\" rel=\"noopener\">RE03970<\/a>.<\/li>\n<li>R19: 100k\u03a9 0805\u00a0<a id=\"pdp\" href=\"http:\/\/cpc.farnell.com\/webapp\/wcs\/stores\/servlet\/ProductDisplay?catalogId=15002&amp;langId=69&amp;urlRequestType=Base&amp;partNumber=RE03963&amp;storeId=10180\" target=\"_blank\" rel=\"noopener\">RE03963<\/a>.<\/li>\n<li>SG1: piezo buzzer\u00a0<a id=\"pdp\" href=\"http:\/\/cpc.farnell.com\/webapp\/wcs\/stores\/servlet\/ProductDisplay?catalogId=15002&amp;langId=69&amp;urlRequestType=Base&amp;partNumber=LS03804&amp;storeId=10180\" target=\"_blank\" rel=\"noopener\">LS03804<\/a>. (Make sure it is one that makes a tone when you apply a DC voltage, rather than one that needs a waveform. Also look for one that is loud at 5V.)<\/li>\n<li>T1, T3:\u00a08A snubberless isolated TRIAC BTA08-600CWRG\u00a0<a id=\"pdp\" href=\"http:\/\/cpc.farnell.com\/webapp\/wcs\/stores\/servlet\/ProductDisplay?catalogId=15002&amp;langId=69&amp;urlRequestType=Base&amp;partNumber=SC11522&amp;storeId=10180\" target=\"_blank\" rel=\"noopener\">SC11522<\/a>.<\/li>\n<li>T2: 24A\u00a0isolated TRIAC BTA24-600BWRG <a id=\"pdp\" href=\"http:\/\/cpc.farnell.com\/webapp\/wcs\/stores\/servlet\/ProductDisplay?catalogId=15002&amp;langId=69&amp;urlRequestType=Base&amp;partNumber=SC11517&amp;storeId=10180\" target=\"_blank\" rel=\"noopener\">SC11517<\/a>.<\/li>\n<li>TR1: 1.5VA 2x9V isolation transformer\u00a0<a id=\"pdp\" href=\"http:\/\/cpc.farnell.com\/webapp\/wcs\/stores\/servlet\/ProductDisplay?catalogId=15002&amp;langId=69&amp;urlRequestType=Base&amp;partNumber=TF01239&amp;storeId=10180\" target=\"_blank\" rel=\"noopener\">TF01239<\/a>. (I used the BLOCK transformer but I see MYRRA and VIGORTRONIX seem to offer cheaper equivalents as of April 2020. A 1x9V secondary winding would also be fine as long as the pins match and the power is 1.5VA or more. On the <a href=\"http:\/\/tomblog.firstsolo.net\/index.php\/hobbies\/pimping-my-coffee-machine\/pid-controller-rev-2\/\">rev 2<\/a> board, I&#8217;ll make space for two primary windings so 1x230V or 2x115V will work.)<\/li>\n<li>U1: not populated (see below about making solder bridges).<\/li>\n<li>2 x 15 pin female headers for Arduino Nano (something like\u00a0<a title=\"CN18766\" href=\"http:\/\/cpc.farnell.com\/pro-signal\/19950\/header-female-stackable-2-54mm\/dp\/CN18766\/false\">CN18766<\/a>\u00a0but with more contacts).<\/li>\n<li>3 x 2-pin\u00a0male headers for brew &amp; steam switches and for temperature probe (gold plated in latter case). (Break them off one of these:\u00a0<a title=\"CN18761\" href=\"http:\/\/cpc.farnell.com\/pro-signal\/ph1-40-ua\/header-2-54mm-pitch-40way\/dp\/CN18761\/false\">CN18761<\/a>.)<\/li>\n<li>1 x 3-pin male header for flow meter. (Ditto.)<\/li>\n<li>4 x M3 PCB standoffs (e.g. <a title=\"PC01257\" href=\"http:\/\/cpc.farnell.com\/richco\/tsm3-5-5-2-c50\/hex-spacer-steel-m3-m-f-5mm-10pcs\/dp\/PC01257\/false\">PC01257<\/a>\u00a0or anything to fit a 3mm hole).<\/li>\n<li>Heater, solenoid and pump 2-pin terminals:\u00a0<a id=\"pdp\" href=\"http:\/\/cpc.farnell.com\/webapp\/wcs\/stores\/servlet\/ProductDisplay?catalogId=15002&amp;langId=69&amp;urlRequestType=Base&amp;partNumber=CN11533&amp;storeId=10180\" target=\"_blank\" rel=\"noopener\">CN11533<\/a>.<\/li>\n<li>Mains (live, neutral, earth) 3-pin terminal:\u00a0<a id=\"pdp\" href=\"http:\/\/cpc.farnell.com\/webapp\/wcs\/stores\/servlet\/ProductDisplay?catalogId=15002&amp;langId=69&amp;urlRequestType=Base&amp;partNumber=CN11534&amp;storeId=10180\" target=\"_blank\" rel=\"noopener\">CN11534<\/a>.<\/li>\n<\/ul>\n<p>I make that a little over \u00a315, although some components have to be bought in bulk, which will make it more expensive and give you spares. Why not buy extra and make up some kits for your friends for Christmas?<\/p>\n<h2>Sensors<\/h2>\n<p><span style=\"font-weight: 300;\">For all of this to be any value, you will at least need some kind of temperature probe. These are, frankly, a bit of a pest. No one makes a nice probe you can just attach to a Gaggia machine. I have designed the circuit and firmware for a PT100 device (like\u00a0<\/span><a id=\"pdp\" style=\"font-weight: 300;\" href=\"http:\/\/cpc.farnell.com\/webapp\/wcs\/stores\/servlet\/ProductDisplay?catalogId=15002&amp;langId=69&amp;urlRequestType=Base&amp;partNumber=SN36364&amp;storeId=10180\" target=\"_blank\" rel=\"noopener\">SN36364<\/a><span style=\"font-weight: 300;\">). The resistor network around IC1 is carefully arranged so that for resistances from about 97\u03a9 to 163\u03a9, ADC pin A0 will read values in the range 0 to 1023. This corresponds to temperatures from just below 0\u00b0C to around 160\u00b0C. With suitable resistors and firmware, any kind of NTC, PTC or thermocouple probe could be used.<\/span><\/p>\n<p><span style=\"font-weight: 300;\">I leave the construction of a suitable probe to the reader. (Top tip, though, don&#8217;t mount your probe in the fat chunks of aluminium where the original bimetallic thermostats are mounted &#8211; it takes a long time for temperature changes to propagate through these. Go for half way up one of the side walls where the boiler shell is thinnest.) [Edit: I later wondered whether I might be mistaken about this. Using the <a href=\"http:\/\/tomblog.firstsolo.net\/index.php\/hobbies\/pimping-my-coffee-machine\/pid-controller-rev-2\/\">rev 2 board<\/a>, I have done <a href=\"http:\/\/tomblog.firstsolo.net\/index.php\/where-to-mount-a-temperature-probe\/\">some testing<\/a> to determine a good mounting point for a probe. I have also <a href=\"http:\/\/tomblog.firstsolo.net\/index.php\/temperature-probe-design\/\">made progress<\/a> on ways to mount a probe.]<br \/>\n<\/span><\/p>\n<p><span style=\"font-weight: 300;\">You will also, likely, want a flow meter, although some of the goodness can happen even without one. I used a Digmesa device like <\/span><a style=\"font-weight: 300;\" href=\"http:\/\/www.digmesa.com\/wp-content\/uploads\/2014\/03\/932-952xBxxx_GB_20V.pdf\" target=\"_blank\" rel=\"noopener\">this<\/a><span style=\"font-weight: 300;\">, but they&#8217;re hard to get hold of in their own right. The trick is to buy (ebay again) one as a spare part for a common coffee machine. Search, for example, for &#8220;saeco flow meter&#8221;. Many of the devices on ebay have a min flow rate of 300ml\/min. That is way too high, so watch out for that. What I really wanted was a Digmesa device with a 1mm nozzle, but I got one with a 1.2mm nozzle, which is okay for double shots, but very much on the edge of okay for single shots. See my comments below under caveats for pinouts of the flow meter header. [Edit: I now have a second hand Baby Twin (&#8220;for parts&#8221; for \u00a330 on ebay &#8211; would you believe?) and I see it has exactly the same flow meter.]<br \/>\n<\/span><\/p>\n<p>For both temperature probe and flow meter, you&#8217;ll get best results if you calibrate them and update the constants in the firmware source code.\u00a0If you get a different flow meter from mine, you&#8217;ll definitely need to calibrate it. I did my calibration by playing with the source code and taking measurements with a multimeter (temp probe) and graduated beaker (flow meter). Have fun with that.<\/p>\n<h2>Wiring<\/h2>\n<p><span style=\"font-weight: 300;\">Finally, you need to do some wiring. You&#8217;ll need wires with two and three pin header connectors. I ripped some out of old PC cases. You could also buy them on ebay. All the wire pairs should be twisted to reduce electromagnetic noise. (Really: fast switching of high currents into the boiler element, for example, can trigger all sorts of nasty pulses on the digital inputs, with all kinds of odd results like the Arduino rebooting.) Ideally make twisted pairs out of the wires to the temperature probe, the brew and steam switches,\u00a0the flow meter (a twisted triple) and all the mains wire pairs.<\/span><\/p>\n<p><span style=\"font-weight: 300;\">Connect the PUMP_SW and STEAM_SW headers to the pump and steam switches (after carefully disconnecting the mains voltage cables that come connected to these switches from the factory).<\/span><\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/tomblog.firstsolo.net\/wp-content\/uploads\/2016\/05\/gaggiaswitchwiring.jpg\"><img loading=\"lazy\" class=\"aligncenter wp-image-894\" src=\"http:\/\/tomblog.firstsolo.net\/wp-content\/uploads\/2016\/05\/gaggiaswitchwiring.jpg\" alt=\"gaggiaswitchwiring\" width=\"500\" height=\"288\" srcset=\"http:\/\/tomblog.firstsolo.net\/wp-content\/uploads\/2016\/05\/gaggiaswitchwiring.jpg 1500w, http:\/\/tomblog.firstsolo.net\/wp-content\/uploads\/2016\/05\/gaggiaswitchwiring-300x173.jpg 300w, http:\/\/tomblog.firstsolo.net\/wp-content\/uploads\/2016\/05\/gaggiaswitchwiring-1024x591.jpg 1024w, http:\/\/tomblog.firstsolo.net\/wp-content\/uploads\/2016\/05\/gaggiaswitchwiring-500x288.jpg 500w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 300;\">The temperature probe should be connected to PROBE1 (PROBE2 is for later expansion).<\/span><\/p>\n<p><span style=\"font-weight: 300;\">The mains supply 3-pin terminal is marked LNE for live, neutral and earth, which is the order of the pins with earth closest to the corner of the board.<\/span><\/p>\n<p><span style=\"font-weight: 300;\">The HEATER (i.e. boiler element), SOLENOID and PUMP terminals have one pin connected to mains neutral the other to a TRIAC which switches mains live to the device. So, ideally, connect the two ends of the device to the two pins of the terminal. Having said that, a really good idea is to keep the steam mode thermostat in series with the boiler. That way, the boiler cannot be overheated. I have saved myself from bad firmware and other design errors countless times with this trick. And, very very definitely keep the thermal fuse inline with the boiler wiring: this is your last bastion of defence against stupidity. (Thankfully I&#8217;ve never needed it owing to the aforementioned steam thermostat.)<\/span><\/p>\n<p>Important note: in the version of the software above, I have swapped the SOLENOID and HEATER pinouts so the heater is now the centre terminal. (See caveats below for an explanation.)<\/p>\n<p><span style=\"font-weight: 300;\">In principle, you could rip out all of the old wiring. I left mine in, but disconnected most of the connectors because a) I didn&#8217;t have a crimp connector for the boiler&#8217;s terminal pins, b) it was the easiest way to keep the thermal fuse in line and c) I wanted two of the neon lights still in the circuit so I could see whether the machine was switched on and whether the boiler is being heated. Your wiring may differ to <a href=\"http:\/\/tomblog.firstsolo.net\/index.php\/gaggia-baby-class-wiring\/\">mine<\/a>, but for my Gaggia Baby Class, this entailed leaving the orange and blue wires connected to live and neutral, leaving the blue wires connected to the boiler and the solenoid and leaving the red wire connected to the boiler and steam thermostat. This also meant only connecting one wire from the HEATER and SOLENOID terminals to the positive side of the boiler (i.e. the steam thermostat) and the solenoid because they were already connected to neutral via the blue wires.<\/span><\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/tomblog.firstsolo.net\/wp-content\/uploads\/2016\/05\/gaggiacontrollerwired.jpg\"><img loading=\"lazy\" class=\"aligncenter wp-image-896\" src=\"http:\/\/tomblog.firstsolo.net\/wp-content\/uploads\/2016\/05\/gaggiacontrollerwired.jpg\" alt=\"gaggiacontrollerwired\" width=\"500\" height=\"373\" srcset=\"http:\/\/tomblog.firstsolo.net\/wp-content\/uploads\/2016\/05\/gaggiacontrollerwired.jpg 1000w, http:\/\/tomblog.firstsolo.net\/wp-content\/uploads\/2016\/05\/gaggiacontrollerwired-300x223.jpg 300w, http:\/\/tomblog.firstsolo.net\/wp-content\/uploads\/2016\/05\/gaggiacontrollerwired-402x300.jpg 402w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><\/p>\n<h2><span id=\"caveats\" style=\"color: #000000; font-weight: bold;\">Caveats<\/span><\/h2>\n<p><span style=\"font-weight: 300;\">You&#8217;ll always regret your design and want to do something different just as soon as the physical product is set in stone. One set of things I wish to change is connector labelling. You can&#8217;t see the labels HEATER, SOLENOID, PUMP and MAINS_LNE once the terminals are soldered onto the board. Doh! You might want to write these onto the terminals with a permanent marker during assembly.<\/span><\/p>\n<p><span style=\"font-weight: 300;\">And then there&#8217;s the flow meter, which requires 5V, GND and count pins. I haven&#8217;t labelled these. So, for reference, 5V is closest to the edge of the board, GND is the middle pin and count is furthest from the edge of the board.<\/span><\/p>\n<p><span style=\"font-weight: 300;\">The other daft, daft design flaw was not leaving space for a heatsink on T2. This TRIAC switches the boiler element, which conducts about 5A<span class=\"footnote_referrer\"><a role=\"button\" tabindex=\"0\" onclick=\"footnote_moveToReference_1450_1('footnote_plugin_reference_1450_1_4');\" onkeypress=\"footnote_moveToReference_1450_1('footnote_plugin_reference_1450_1_4');\" ><sup id=\"footnote_plugin_tooltip_1450_1_4\" class=\"footnote_plugin_tooltip_text\">4<\/sup><\/a><span id=\"footnote_plugin_tooltip_text_1450_1_4\" class=\"footnote_tooltip\">I wrote this before I begin tinkering with <a href=\"http:\/\/tomblog.firstsolo.net\/index.php\/doubling-gaggia-heating-power\/\">doubling the boiler power<\/a>!<\/span><\/span><script type=\"text\/javascript\"> jQuery('#footnote_plugin_tooltip_1450_1_4').tooltip({ tip: '#footnote_plugin_tooltip_text_1450_1_4', tipClass: 'footnote_tooltip', effect: 'fade', predelay: 0, fadeInSpeed: 200, delay: 400, fadeOutSpeed: 200, position: 'top right', relative: true, offset: [10, 10], });<\/script> when on full-time (i.e. during preheat and when steaming milk). Suitable TRIACs will drop around a volt at this current, generating in the order of 5W. Hmm, how hot will a bare TO-220 get at 5W? Well, as expected, the datasheets tell you this, but I didn&#8217;t look. The answer is 60\u00b0C\/W, or 300\u00b0C above ambient. Rookie error number 1. Rookie error number 2 follows close behind: TRIACs must never, never get hotter than 125\u00b0C, otherwise they just switch on permanently until they cool down again or heat to self-destruct temperature.<br \/>\n<\/span><\/p>\n<p><span style=\"font-weight: 300;\">So, T2 needs a heatsink. This can be contrived, despite space not being left for one (not the mess in the picture above &#8211; although that does work). By bending a zig-zag into the TRIAC pins, you can get about 2.5mm between the terminals and the TRIACs. This leaves space for a 40mmx40mm heatsink to be placed vertically behind all three TRIACs. Get one with fins and a sticky pad, file off the bottom 7mm of the fins so the thickness is less than 2.5mm. To reduce the overall height and increase the efficiency, you can also cut the top 13mm off the heatsink and stick it onto the top of the remaining piece back to back. Or even on to the front of the metal heatsink tabs on the TRIACs. I didn&#8217;t make a particularly pretty job of this, but it works okay (using a nifty <a href=\"http:\/\/cpc.farnell.com\/webapp\/wcs\/stores\/servlet\/ProductDisplay?catalogId=15002&amp;langId=69&amp;urlRequestType=Base&amp;partNumber=SC14062&amp;storeId=10180\" target=\"_blank\" rel=\"noopener\">ceramic heat sink<\/a> which is easy to work &#8211; although also more fragile than aluminium):<\/span><\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/tomblog.firstsolo.net\/wp-content\/uploads\/2016\/05\/GaggiaTriacHeatsink.jpg\"><img loading=\"lazy\" class=\"aligncenter wp-image-940\" src=\"http:\/\/tomblog.firstsolo.net\/wp-content\/uploads\/2016\/05\/GaggiaTriacHeatsink.jpg\" alt=\"GaggiaTriacHeatsink\" width=\"500\" height=\"427\" srcset=\"http:\/\/tomblog.firstsolo.net\/wp-content\/uploads\/2016\/05\/GaggiaTriacHeatsink.jpg 964w, http:\/\/tomblog.firstsolo.net\/wp-content\/uploads\/2016\/05\/GaggiaTriacHeatsink-300x256.jpg 300w, http:\/\/tomblog.firstsolo.net\/wp-content\/uploads\/2016\/05\/GaggiaTriacHeatsink-350x300.jpg 350w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 300;\">It is also a good idea to spec T2 for as high a current as you can because higher spec TRIACs tend to produce less power for a given current. This is why I spec a 24A TRIAC for T2. An improved board layout would have more space between the TRIACs and the terminals. I have already made one improvement by moving the HEATER terminal to the middle in software, so the SOLENOID and HEATER labels on the board are now wrong. [Edit: I now wonder whether a batter trick would be to bolt a 50mmx60mm copper sheet onto the TRIACs and bend it over and mount the heatsink on that. Worst case scenario, use a 40mmx40mm water-cooled CPU heatsink with the inlet water running through it. This is my plan for if all goes wrong on the <a href=\"http:\/\/tomblog.firstsolo.net\/index.php\/hobbies\/pimping-my-coffee-machine\/pid-controller-rev-2\/\">rev 2 board<\/a>.]<br \/>\n<\/span><\/p>\n<p><span style=\"font-weight: 300;\">Finally, be aware that TRIACs come in insulated and uninsulated versions. The latter have the metal tab connected to pin 2, which is at mains live voltage. So you&#8217;d have exposed metal bits connected to 240VAC. And with a metal heatsink, quite large exposed metal bits. The insulated ones are slightly less efficient at cooling but they don&#8217;t kill people. The TRIACs I spec above are all insulated.<\/span><\/p>\n<h2>Unpopulated parts<\/h2>\n<p>I have visions of using two temperature probes one day, one at the top of the boiler and one at the bottom. This way I can better determine whether the boiler is full and\/or whether temperatures have stabilised. The board is designed to use a\u00a0SN74CBTLV3257PW multiplexer to switch between probes. For now, the firmware knows nothing of this and I have not populated this device on my board. Instead, I have made a solder bridge between pins 6 and 7 and another one between pins 9 and 10. I have also not populated the PROBE2 header or its associated noise reduction 10nF capacitor C10. [Update: I have now populated these parts and they work fine.]<\/p>\n<p>In planning, I also wondered whether I might, one day, think up other clever things to do which might need some of the presently unused Arduino pins. So I expose some of these via the DIGITALIO and ANALOGIO headers. These, too, I have not populated and neither have I populated C11-C15, their 10nF caps. [Edit: but I stupidly did not make any 5V or GND pins available, which I realised when I wanted to add a water level meter circuit. <a href=\"http:\/\/tomblog.firstsolo.net\/index.php\/hobbies\/pimping-my-coffee-machine\/pid-controller-rev-2\/\">Rev 2<\/a> will remedy this oversight.]<\/p>\n<p>Return to <a href=\"http:\/\/tomblog.firstsolo.net\/index.php\/hobbies\/pimping-my-coffee-machine\/\">main coffee machine page<\/a>.<\/p>\n<div class=\"speaker-mute footnotes_reference_container\"> <div class=\"footnote_container_prepare\"><p><span role=\"button\" tabindex=\"0\" class=\"footnote_reference_container_label pointer\" onclick=\"footnote_expand_collapse_reference_container_1450_1();\">&#x202F;<\/span><span role=\"button\" tabindex=\"0\" class=\"footnote_reference_container_collapse_button\" style=\"display: none;\" onclick=\"footnote_expand_collapse_reference_container_1450_1();\">[<a id=\"footnote_reference_container_collapse_button_1450_1\">+<\/a>]<\/span><\/p><\/div> <div id=\"footnote_references_container_1450_1\" style=\"\"><table class=\"footnotes_table footnote-reference-container\"><caption class=\"accessibility\">References<\/caption> <tbody> \r\n\r\n<tr class=\"footnotes_plugin_reference_row\"> <th scope=\"row\" class=\"footnote_plugin_index_combi pointer\"  onclick=\"footnote_moveToAnchor_1450_1('footnote_plugin_tooltip_1450_1_1');\"><a id=\"footnote_plugin_reference_1450_1_1\" class=\"footnote_backlink\"><span class=\"footnote_index_arrow\">&#8593;<\/span>1<\/a><\/th> <td class=\"footnote_plugin_text\">I never wrote a page for this ancient version in case you&#8217;re wondering.<\/td><\/tr>\r\n\r\n<tr class=\"footnotes_plugin_reference_row\"> <th scope=\"row\" class=\"footnote_plugin_index_combi pointer\"  onclick=\"footnote_moveToAnchor_1450_1('footnote_plugin_tooltip_1450_1_2');\"><a id=\"footnote_plugin_reference_1450_1_2\" class=\"footnote_backlink\"><span class=\"footnote_index_arrow\">&#8593;<\/span>2<\/a><\/th> <td class=\"footnote_plugin_text\">And if you&#8217;re okay with importing from China. I worry about this kind of thing.<\/td><\/tr>\r\n\r\n<tr class=\"footnotes_plugin_reference_row\"> <th scope=\"row\" class=\"footnote_plugin_index_combi pointer\"  onclick=\"footnote_moveToAnchor_1450_1('footnote_plugin_tooltip_1450_1_3');\"><a id=\"footnote_plugin_reference_1450_1_3\" class=\"footnote_backlink\"><span class=\"footnote_index_arrow\">&#8593;<\/span>3<\/a><\/th> <td class=\"footnote_plugin_text\">In the USA <a href=\"https:\/\/www.newark.com\/\">Newark<\/a> is part of the same group.<\/td><\/tr>\r\n\r\n<tr class=\"footnotes_plugin_reference_row\"> <th scope=\"row\" class=\"footnote_plugin_index_combi pointer\"  onclick=\"footnote_moveToAnchor_1450_1('footnote_plugin_tooltip_1450_1_4');\"><a id=\"footnote_plugin_reference_1450_1_4\" class=\"footnote_backlink\"><span class=\"footnote_index_arrow\">&#8593;<\/span>4<\/a><\/th> <td class=\"footnote_plugin_text\">I wrote this before I begin tinkering with <a href=\"http:\/\/tomblog.firstsolo.net\/index.php\/doubling-gaggia-heating-power\/\">doubling the boiler power<\/a>!<\/td><\/tr>\r\n\r\n <\/tbody> <\/table> <\/div><\/div><script type=\"text\/javascript\"> function footnote_expand_reference_container_1450_1() { jQuery('#footnote_references_container_1450_1').show(); jQuery('#footnote_reference_container_collapse_button_1450_1').text('\u2212'); } function footnote_collapse_reference_container_1450_1() { jQuery('#footnote_references_container_1450_1').hide(); jQuery('#footnote_reference_container_collapse_button_1450_1').text('+'); } function footnote_expand_collapse_reference_container_1450_1() { if (jQuery('#footnote_references_container_1450_1').is(':hidden')) { footnote_expand_reference_container_1450_1(); } else { footnote_collapse_reference_container_1450_1(); } } function footnote_moveToReference_1450_1(p_str_TargetID) { footnote_expand_reference_container_1450_1(); var l_obj_Target = jQuery('#' + p_str_TargetID); if (l_obj_Target.length) { jQuery( 'html, body' ).delay( 0 ); jQuery('html, body').animate({ scrollTop: l_obj_Target.offset().top - window.innerHeight * 0.2 }, 380); } } function footnote_moveToAnchor_1450_1(p_str_TargetID) { footnote_expand_reference_container_1450_1(); var l_obj_Target = jQuery('#' + p_str_TargetID); if (l_obj_Target.length) { jQuery( 'html, body' ).delay( 0 ); jQuery('html, body').animate({ scrollTop: l_obj_Target.offset().top - window.innerHeight * 0.2 }, 380); } }<\/script>","protected":false},"excerpt":{"rendered":"<p>My original version (let&#8217;s call it &#8216;rev 0&#8242;1I never wrote a page for this ancient version in case you&#8217;re wondering.) of the controller had an Atmel AVR microcontroller soldered directly onto the board and I had to muck about with &hellip; <a href=\"http:\/\/tomblog.firstsolo.net\/index.php\/hobbies\/pimping-my-coffee-machine\/pid-controller-rev-1\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":854,"menu_order":2,"comment_status":"open","ping_status":"open","template":"","meta":[],"_links":{"self":[{"href":"http:\/\/tomblog.firstsolo.net\/index.php\/wp-json\/wp\/v2\/pages\/1450"}],"collection":[{"href":"http:\/\/tomblog.firstsolo.net\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/tomblog.firstsolo.net\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/tomblog.firstsolo.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/tomblog.firstsolo.net\/index.php\/wp-json\/wp\/v2\/comments?post=1450"}],"version-history":[{"count":22,"href":"http:\/\/tomblog.firstsolo.net\/index.php\/wp-json\/wp\/v2\/pages\/1450\/revisions"}],"predecessor-version":[{"id":1708,"href":"http:\/\/tomblog.firstsolo.net\/index.php\/wp-json\/wp\/v2\/pages\/1450\/revisions\/1708"}],"up":[{"embeddable":true,"href":"http:\/\/tomblog.firstsolo.net\/index.php\/wp-json\/wp\/v2\/pages\/854"}],"wp:attachment":[{"href":"http:\/\/tomblog.firstsolo.net\/index.php\/wp-json\/wp\/v2\/media?parent=1450"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}