{"id":361,"date":"2019-11-25T19:40:19","date_gmt":"2019-11-25T19:40:19","guid":{"rendered":"http:\/\/photobuilds.com\/?p=361"},"modified":"2022-10-28T13:09:45","modified_gmt":"2022-10-28T13:09:45","slug":"arduino-basics-how-to-get-started","status":"publish","type":"post","link":"https:\/\/photobuilds.com\/index.php\/2019\/11\/25\/arduino-basics-how-to-get-started\/","title":{"rendered":"Arduino Basics: How To Get Started"},"content":{"rendered":"\n<p>Several of my photography project builds are based on the Arduino boards. These provide a very versatile and low-cost platform that mostly avoids having to design discrete electronics for basic sensing and timing functions. Getting set up to build with an Arduino is very simple and doesn\u2019t need a background in electronics or computing. However, starting out can be a bit daunting if you\u2019ve never used one before, so this is a quick guide to Arduino basics.<\/p>\n\n\n\n<p>Note: this is not intended to be an exhaustive description or some sort of reference text. There are plenty of more in-depth guides available online. If you are looking for something more extensive the Arduino website (<a href=\"http:\/\/www.arduino.cc\" target=\"_blank\" rel=\"noopener\">www.arduino.cc<\/a>) is always a good place to start.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The Arduino Board<\/h2>\n\n\n\n<p>The first thing you\u2019re going to need is an Arduino board. There are quite a wide range of models available (see the Arduino site <a href=\"http:\/\/www.arduino.cc\/en\/Main\/Products\" target=\"_blank\" rel=\"noopener\">www.arduino.cc\/en\/Main\/Products<\/a>), so how do you pick the right one for your project? The fact is, it doesn\u2019t matter much which you use and the most basic are probably going to be able to handle most photo related projects. Some boards have more powerful processors and\/or more input\/output pins, but for most photo related projects these aren\u2019t really necessary. The good news with Arduinos is that the code is pretty much the same as you move from board to board. So if you decide to change boards for some reason you\u2019re not faced with a major code rewrite.<\/p>\n\n\n\n<p>In the interests of keeping things simple, in this article I\u2019m going to focus on just two models: the <a href=\"https:\/\/amzn.to\/3FiAr8z\" target=\"_blank\" rel=\"noopener\" title=\"\">Uno<\/a> and the <a href=\"https:\/\/amzn.to\/3U2JKxy\" target=\"_blank\" rel=\"noopener\" title=\"\">Nano<\/a>, which are the ones I use for most of my Arduino experiments. Technically they\u2019re up to the job, and they have the added benefit of being pretty cheap, so building one into a device that\u2019s only going to be used occasionally isn\u2019t an issue.<\/p>\n\n\n\n<p>The Uno is probably the most widely used of the \u201cfull sized\u201d Arduino boards and features 14 digital input\/output pins and 6 analog inputs \u2013 that\u2019s more than enough for any of the projects I\u2019ve built so far. The Uno also features the standard Arduino headers, making it simple to plug in a massive range of shield boards without having to get involved in soldering up boards and cables. Supply voltage is 7-12 volts, and there&#8217;s a built in regulator to give the 5 volt operating voltage. The genuine Arduino version of this board can be bought from Amazon amongst other places. Cheaper clones are available, but can suffer from driver problems (which can make it very difficult to connect to the development computer) and potential reliability issues, so are probably worth avoiding when you\u2019re first starting out.<\/p>\n\n\n\n<p>If you need something a bit more compact for a particularly small build, try the Arduino Nano. It features 22 digital input\/output pins and 8 analog I\/O pins, all in a package that\u2019s just 18 x 45mm, and only consumes 19mA. Again, supply voltage is 7-12 volts.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The Other Stuff<\/h2>\n\n\n\n<p>Apart from the Arduino board, you need only the development environment and a USB cable to connect the board to your development machine. The development environment, which is free and available for multiple operating systems, can be downloaded here: <a href=\"https:\/\/www.arduino.cc\/en\/Main\/Software\" target=\"_blank\" rel=\"noopener\">https:\/\/www.arduino.cc\/en\/Main\/Software<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"979\" height=\"773\" src=\"https:\/\/photobuilds.com\/wp-content\/uploads\/2022\/07\/Arduino-IDE-Screenshot2.jpg\" alt=\"Arduino Basics\" class=\"wp-image-365\" srcset=\"https:\/\/photobuilds.com\/wp-content\/uploads\/2022\/07\/Arduino-IDE-Screenshot2.jpg 979w, https:\/\/photobuilds.com\/wp-content\/uploads\/2022\/07\/Arduino-IDE-Screenshot2-300x237.jpg 300w, https:\/\/photobuilds.com\/wp-content\/uploads\/2022\/07\/Arduino-IDE-Screenshot2-768x606.jpg 768w, https:\/\/photobuilds.com\/wp-content\/uploads\/2022\/07\/Arduino-IDE-Screenshot2-920x726.jpg 920w, https:\/\/photobuilds.com\/wp-content\/uploads\/2022\/07\/Arduino-IDE-Screenshot2-230x182.jpg 230w, https:\/\/photobuilds.com\/wp-content\/uploads\/2022\/07\/Arduino-IDE-Screenshot2-350x276.jpg 350w, https:\/\/photobuilds.com\/wp-content\/uploads\/2022\/07\/Arduino-IDE-Screenshot2-480x379.jpg 480w\" sizes=\"auto, (max-width: 979px) 100vw, 979px\" \/><\/figure>\n\n\n\n<p>Once you\u2019ve run through the install process you need to connect the Arduino board to your development machine via an appropriate USB cable. Different Arduino boards use differing USB connectors: for example the Uno uses a USB Type B and the Nano a USB Mini B connector. When your project is under development the Arduino board can run from the power supplied by the USB connection so there\u2019s generally no need to rig up a power supply at this stage, although this will depend on what other electronics are also needing to be powered.<\/p>\n\n\n\n<p>Run the development environment and connect to the Arduino \u2013 this isn\u2019t always straightforward (based on experience running under Windows) due to the way com ports get assigned to USB ports. Click the \u201cTools\u201d dropdown and select the correct Arduino board from the \u201cBoard\u201d list, then click \u201cTools\u201d again and select the correct com port from the \u201cPort\u201d list. It may not always be obvious which com port to select \u2013 sometimes there are more than one listed with the Arduino model against them, and other times there is no Arduino model listed against the com port at all, just a numbered list of ports. In this case, if you\u2019re running under Windows run the Control Panel and select \u201cDevice Manager\u201d. On the list if devices expand the \u201cPorts (COM &amp; LPT)\u201d items and it should be possible to see the com port number for the Arduino board. Select this port back in the Arduino development environment.<\/p>\n\n\n\n<p>Before getting involved in any serious programming it\u2019s probably worth doing a quick check that everything is functioning correctly using one of the sample sketches supplied with the Arduino IDE. These can be found in the \u201cFile\u201d menu under \u201cExamples\u201d: in the \u201c01 Basics\u201d list there\u2019s a program called \u201cBlink\u201d which, when running will flash the Arduino\u2019s on-board LED. <\/p>\n\n\n\n<p>Once you\u2019ve selected this you can compile it using the tick button and upload it to the board using the arrow button. It should give a message saying \u201cDone uploading\u201d if it\u2019s been successfully sent to the Arduino. At this point it will start running on the board and the on-board LED should now repeatedly turn on for one second and off for one second. The timing of the flashes can be modified by changing the values in brackets in the delay(1000) statements: 1000 being the time in milliseconds. If you change these recompile and upload and the flash pattern will change based on the on\/off delays you\u2019ve entered in the code.<\/p>\n\n\n\n<p>After that confidence booster you can type or copy the code (or sketch in Arduino speak) for your real application into the Arduino IDE.<\/p>\n\n\n\n<p>A couple of useful debug tools built in to the IDE are the Serial Monitor and Serial Plotter. If there\u2019s any serial output from the Arduino sketch (created by adding Serial.println statements to the code) it can be viewed on the development computer using the serial monitor. This can be started by clicking the magnifying glass icon at the top right of the Arduino IDE window. When developing new code this serial debug is very useful to see where it\u2019s all going wrong. You can see the serial monitor window on the right hand side of the display in the simple development setup pictured below.<\/p>\n\n\n\n<p>The picture also illustrates the point above about serial port selection in Windows. Com 20 probably isn&#8217;t the port you&#8217;d expect when the only USB device plugged into the laptop is the Arduino.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"702\" src=\"https:\/\/photobuilds.com\/wp-content\/uploads\/2022\/07\/Development-Setup-1024x702.jpg\" alt=\"Arduino Basics\" class=\"wp-image-360\" srcset=\"https:\/\/photobuilds.com\/wp-content\/uploads\/2022\/07\/Development-Setup-1024x702.jpg 1024w, https:\/\/photobuilds.com\/wp-content\/uploads\/2022\/07\/Development-Setup-300x206.jpg 300w, https:\/\/photobuilds.com\/wp-content\/uploads\/2022\/07\/Development-Setup-768x527.jpg 768w, https:\/\/photobuilds.com\/wp-content\/uploads\/2022\/07\/Development-Setup-1536x1054.jpg 1536w, https:\/\/photobuilds.com\/wp-content\/uploads\/2022\/07\/Development-Setup-920x631.jpg 920w, https:\/\/photobuilds.com\/wp-content\/uploads\/2022\/07\/Development-Setup-230x158.jpg 230w, https:\/\/photobuilds.com\/wp-content\/uploads\/2022\/07\/Development-Setup-350x240.jpg 350w, https:\/\/photobuilds.com\/wp-content\/uploads\/2022\/07\/Development-Setup-480x329.jpg 480w, https:\/\/photobuilds.com\/wp-content\/uploads\/2022\/07\/Development-Setup.jpg 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Newer versions of the Arduino IDE also have a serial plotter which plots levels against time if the right print statements are included in the code \u2013 this can provide another useful level of debug.<\/p>\n\n\n\n<p>By the time you get here you will hopefully have a working Arduino board which you can program from the development device of your choice. Obviously a stand-alone board isn\u2019t going to get very far as the controller for your photographic projects, but it is the place where all the heavy lifting will be done. In the individual projects I\u2019ll describe how to add inputs to allow triggering from various sensors and outputs to trigger cameras, flashes, valves and the like.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Several of my photography project builds are based on the Arduino boards. These provide a very versatile and low-cost platform that mostly avoids having to design discrete electronics for basic [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[128,217],"tags":[206,5,207,208,209,9,10,111,210,211,212,213,214,17,215,216],"class_list":["post-361","post","type-post","status-publish","format-standard","hentry","category-background","category-microcontrollers","tag-arduino","tag-camera","tag-compile","tag-compiler","tag-development","tag-diy","tag-dslr","tag-electronics","tag-ide","tag-micro-controller","tag-microcontroller","tag-nano","tag-programming","tag-self-build","tag-software","tag-uno"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/photobuilds.com\/index.php\/wp-json\/wp\/v2\/posts\/361","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/photobuilds.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/photobuilds.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/photobuilds.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/photobuilds.com\/index.php\/wp-json\/wp\/v2\/comments?post=361"}],"version-history":[{"count":6,"href":"https:\/\/photobuilds.com\/index.php\/wp-json\/wp\/v2\/posts\/361\/revisions"}],"predecessor-version":[{"id":985,"href":"https:\/\/photobuilds.com\/index.php\/wp-json\/wp\/v2\/posts\/361\/revisions\/985"}],"wp:attachment":[{"href":"https:\/\/photobuilds.com\/index.php\/wp-json\/wp\/v2\/media?parent=361"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/photobuilds.com\/index.php\/wp-json\/wp\/v2\/categories?post=361"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/photobuilds.com\/index.php\/wp-json\/wp\/v2\/tags?post=361"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}