{"id":168,"date":"2011-06-01T11:43:08","date_gmt":"2011-06-01T11:43:08","guid":{"rendered":"http:\/\/www.martyndavis.com\/?p=168"},"modified":"2022-04-12T07:45:29","modified_gmt":"2022-04-12T06:45:29","slug":"veroboarduino-part-three-crystal-and-final-connections","status":"publish","type":"post","link":"https:\/\/www.martyndavis.com\/?p=168","title":{"rendered":"VeroBoardUino Part Three &#8211; Crystal and Final Connections"},"content":{"rendered":"<p>In which we add the crystal, finish wiring and insert the chip.<\/p>\n<p><!--more--><\/p>\n<p><em>This is part three of a short series describing in detail how to build an arduino clone from scratch for very little money. &nbsp;You can find the previous parts here:<\/em><\/p>\n<p><a href=\"http:\/\/www.martyndavis.com\/?p=105\">Part 1<br \/>\n<\/a><a href=\"http:\/\/www.martyndavis.com\/?p=133\">Part 2<br \/>\n<\/a><a href=\"http:\/\/www.martyndavis.com\/?p=150\">Part 2.5 (circuit and parts list)<\/a><\/p>\n<h3>CRYSTAL OSCILLATOR CIRCUIT<\/h3>\n<p>The crystal circuit is used to allow the ATMega chip to accurately time intervals.<\/p>\n<p>Components required:<\/p>\n<ul>\n<li>1 \u00d7 crystal &#8211; 16.0MHz U4 style low profile can<\/li>\n<li>2 \u00d7 22pF ceramic capacitors<\/li>\n<\/ul>\n<p>See the picture below for placement. As you can&#8217;t see where the crystal&#8217;s legs are placed, I&#8217;ve marked which holes they are in by two red dots. For clarity I&#8217;ve also marked where the capacitors&#8217; legs attach also.<\/p>\n<p><a href=\"https:\/\/www.martyndavis.com\/wp-content\/uploads\/2011\/05\/step6.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-118\" src=\"https:\/\/www.martyndavis.com\/wp-content\/uploads\/2011\/05\/step6-234x300.jpg\" alt=\"\" width=\"234\" height=\"300\" srcset=\"https:\/\/www.martyndavis.com\/wp-content\/uploads\/2011\/05\/step6-234x300.jpg 234w, https:\/\/www.martyndavis.com\/wp-content\/uploads\/2011\/05\/step6.jpg 761w\" sizes=\"(max-width: 234px) 100vw, 234px\" \/><\/a><\/p>\n<p>For extra clarity, from the picture:<\/p>\n<p>Capacitor &#8220;A&#8221; connects to rows 15 and 17<br \/>\nCapacitor &#8220;B&#8221; connects to rows 15 and 16<br \/>\nCrystal &#8220;C&#8221; connects to rows 16 and 17.<\/p>\n<p>Note that the crystal&#8217;s legs are set too wide to span two adjacent rows &#8211; I&#8217;ve just bent them in so they fit &#8211; it means the crystal&#8217;s case doesn&#8217;t sit flush to the board, but that doesn&#8217;t matter.<\/p>\n<p>None of these components have a polarity so it doesn&#8217;t matter which way round they go.<\/p>\n<h3>FINAL CONNECTIONS<\/h3>\n<p>We&#8217;ve got all the componentry on the board now (apart from plugging in the ATMega chip!). Now it&#8217;s just a question of making a few more connections. See the following image and follow the list below:<\/p>\n<p><a href=\"https:\/\/www.martyndavis.com\/wp-content\/uploads\/2011\/06\/step7.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-173\" src=\"https:\/\/www.martyndavis.com\/wp-content\/uploads\/2011\/06\/step7-204x300.jpg\" alt=\"\" width=\"204\" height=\"300\" srcset=\"https:\/\/www.martyndavis.com\/wp-content\/uploads\/2011\/06\/step7-204x300.jpg 204w, https:\/\/www.martyndavis.com\/wp-content\/uploads\/2011\/06\/step7.jpg 586w\" sizes=\"(max-width: 204px) 100vw, 204px\" \/><\/a><\/p>\n<p>Wire &#8220;A&#8221; connects row 7 to row 22 &#8211; now 7 and 22 are at +5V.<br \/>\nWire &#8220;B&#8221; connects row 2 (GND) to 23. We now have power &#8220;rails&#8221; at the bottom of the board.<br \/>\nWire &#8220;C&#8221; connects 22 back to row 14 (left side), i.e. attaches the ATMega&#8217;s VCC pin to +5V.<br \/>\nWire &#8220;D&#8221; connects 23 back to row 15 (left side), i.e. attaches the ATMega&#8217;s GND pin to negative.<\/p>\n<p>We also need to connect a couple of pins on the right side of the ATMega:<\/p>\n<p>Wire &#8220;E&#8221; connects row 22 to 16 (right side), i.e. attaches the ATMega&#8217;s AVCC pin to +5V.<br \/>\nWire &#8220;F&#8221; connects row 23 to 14 (right side), i.e. attaches the ATMega&#8217;s other GND pin to negative.<br \/>\nCapacitor &#8220;G&#8221; connects between the bottom power &#8220;rails&#8221;, i.e. row 22 &amp; 23.<\/p>\n<p>Now&#8217;s probably a good time to list the pins of the chip in more detail. I&#8217;ll list them by the row number of the board, starting with the left side:<\/p>\n<pre><span style=\"color: #808080;\">Row Pin Description&nbsp;\n<\/span><span style=\"color: #808080;\">8 RESET - we've wired this to the reset button&nbsp;\n<\/span><span style=\"color: #808080;\">9 RXD (pin 0) - this connects to the serial connector on the left for uploading your \"sketches\". \n10 TXD (pin 1) - again, connects to the serial connector. \n11 pin 2 \n12 pin 3 \n13 pin 4 \n14 VCC - connected to +5V \n15 GND - connected to negative \n16 CLOCK1 - connected to the crystal \n17 CLOCK2 - connected to the crystal \n18 pin 5 \n19 pin 6 \n20 pin 7 \n21 pin 8<\/span><\/pre>\n<p>Now the right side of the chip:<\/p>\n<pre><span style=\"color: #808080;\">Row Pin Description \n8 Analogue pin 5 \n9 Analogue pin 4 \n10 Analogue pin 3 \n11 Analogue pin 2 \n12 Analogue pin 1 \n13 Analogue pin 0 \n14 GND - connected to negative \n15 AREF - we're leaving this unconnected \n16 AVCC - connected to +5V \n17 pin 13 \n18 pin 12 \n19 pin 11 \n20 pin 10 \n21 pin 9<\/span><\/pre>\n<p>As you&#8217;ll probably see, all the pin names are the ones available on your &#8220;real&#8221; arduino. So, for example, if we wanted to test the board using the &#8220;blink&#8221; sketch, we could hook up an LED (plus current limiting resistor) to pin 13 on <strong>row<\/strong> 17, right hand side&nbsp;(&#8220;real&#8221; arduino boards already have an LED connected) and test it.<\/p>\n<h3>ADDING A HEADER FOR PIN-OUTS<\/h3>\n<p>Normally if we&#8217;re building a dedicated circuit we&#8217;ll want to solder our connections to particular input \/ output pins on the ATMega directly to the stripboard. However for convenience of testing and burning the bootloader, I&#8217;m adding a small female header to the board. This step is optional, especially if you are using an ATMega which has already had an arduino bootloader burned onto it.<\/p>\n<p>We&#8217;re essentially just exposing three pins &#8211; 13,12 and 11. Connect it to rows 17,18 and 19, &nbsp;on the right hand edge of the stripboard.<\/p>\n<p>Now plug the ATMega chip in, carefully, to its socket, making sure the little notch on the top edge matches the notch on the socket (i.e. at the top, nearest to the power supply circuit). Usually chips come with their feet splayed a little wider than the socket &#8211; just gently bend them in on a flat surface if this is the case. When you&#8217;re inserting the chip make sure none of the legs get folded under rather than going into their sockets &#8211; it&#8217;s an easy thing to do if you&#8217;re not careful.<\/p>\n<p>So, we&#8217;re finished as far as the hardware is concerned. Here&#8217;s the finished product:<\/p>\n<p><a href=\"https:\/\/www.martyndavis.com\/wp-content\/uploads\/2011\/06\/step7a.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-180\" src=\"https:\/\/www.martyndavis.com\/wp-content\/uploads\/2011\/06\/step7a-203x300.jpg\" alt=\"\" width=\"203\" height=\"300\" srcset=\"https:\/\/www.martyndavis.com\/wp-content\/uploads\/2011\/06\/step7a-203x300.jpg 203w, https:\/\/www.martyndavis.com\/wp-content\/uploads\/2011\/06\/step7a-695x1024.jpg 695w, https:\/\/www.martyndavis.com\/wp-content\/uploads\/2011\/06\/step7a.jpg 751w\" sizes=\"(max-width: 203px) 100vw, 203px\" \/><\/a><\/p>\n<p>&#8211;<\/p>\n<p>And that wraps up this installment. &nbsp;We now have a board which is almost ready. So the next post will be an interesting one &#8211; how to burn the bootloader, which a lot of people seem to have problems with (especially using an Uno to do so), and after that we can then cover how to upload our programs to it.<\/p>\n<p><em>Next post is now up here: &nbsp;<a href=\"http:\/\/www.martyndavis.com\/?p=188\">http:\/\/www.martyndavis.com\/?p=188<\/a><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In which we add the crystal, finish wiring and insert the chip.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,1],"tags":[19,10],"_links":{"self":[{"href":"https:\/\/www.martyndavis.com\/index.php?rest_route=\/wp\/v2\/posts\/168"}],"collection":[{"href":"https:\/\/www.martyndavis.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.martyndavis.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.martyndavis.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.martyndavis.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=168"}],"version-history":[{"count":23,"href":"https:\/\/www.martyndavis.com\/index.php?rest_route=\/wp\/v2\/posts\/168\/revisions"}],"predecessor-version":[{"id":851,"href":"https:\/\/www.martyndavis.com\/index.php?rest_route=\/wp\/v2\/posts\/168\/revisions\/851"}],"wp:attachment":[{"href":"https:\/\/www.martyndavis.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=168"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.martyndavis.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=168"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.martyndavis.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=168"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}