{"id":2384,"date":"2019-02-07T07:21:33","date_gmt":"2019-02-07T07:21:33","guid":{"rendered":"https:\/\/www.keithstestgarage.com\/?p=2384"},"modified":"2019-03-04T14:15:23","modified_gmt":"2019-03-04T14:15:23","slug":"analog-tester","status":"publish","type":"post","link":"https:\/\/www.keithstestgarage.com\/old\/2019\/02\/07\/analog-tester\/","title":{"rendered":"Analog Tester"},"content":{"rendered":"\n<p>Sometimes I need to read an analog <em>value&nbsp;<\/em>but don&#8217;t want to tether to a computer, load the Arduino IDE, and open Serial Monitor.<\/p>\n\n\n\n<p><span style=\"background-color: rgb(232, 234, 235);\">The solution involves an Arduino Pro Mini, a 4-segment display, a battery and some spring terminals, all hot melt glued to an AA battery pack. <\/span><\/p>\n\n\n\n<p style=\"background-color:#f4fcff\" class=\"has-background\">The spring terminals expose a GND, 5V, and 2x A0 inputs.  This allows easy pairings of an analog device along with your preference of pull-up or pull-down resistor.  <\/p>\n\n\n\n<p>Since the range of analog value readings is 0-1023, an inexpensive 4-digit display fits the bill perfectly. <\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img data-attachment-id=\"2390\" data-permalink=\"https:\/\/www.keithstestgarage.com\/old\/83d6d66e-6a20-401a-ad3c-b690ad1e2f69-4473-000002b9de7fce24_file-1-jpg\/\" data-orig-file=\"https:\/\/i2.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/83d6d66e-6a20-401a-ad3c-b690ad1e2f69-4473-000002b9de7fce24_file-1.jpg?fit=4032%2C3024&amp;ssl=1\" data-orig-size=\"4032,3024\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;2.2&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;iPhone SE&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1549502366&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;4.15&quot;,&quot;iso&quot;:&quot;64&quot;,&quot;shutter_speed&quot;:&quot;0.0333333333333&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"83d6d66e-6a20-401a-ad3c-b690ad1e2f69-4473-000002b9de7fce24_file-1.jpg\" data-image-description=\"\" data-medium-file=\"https:\/\/i2.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/83d6d66e-6a20-401a-ad3c-b690ad1e2f69-4473-000002b9de7fce24_file-1.jpg?fit=300%2C225&amp;ssl=1\" data-large-file=\"https:\/\/i2.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/83d6d66e-6a20-401a-ad3c-b690ad1e2f69-4473-000002b9de7fce24_file-1.jpg?fit=770%2C578&amp;ssl=1\" loading=\"lazy\" src=\"https:\/\/i2.wp.com\/www.keithstestgarage.com\/wp-content\/uploads\/2019\/02\/83d6d66e-6a20-401a-ad3c-b690ad1e2f69-4473-000002b9de7fce24_file-1.jpg?resize=580%2C435&#038;ssl=1\" alt=\"\" class=\"wp-image-2390\" width=\"580\" height=\"435\" srcset=\"https:\/\/i2.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/83d6d66e-6a20-401a-ad3c-b690ad1e2f69-4473-000002b9de7fce24_file-1.jpg?w=4032&amp;ssl=1 4032w, https:\/\/i2.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/83d6d66e-6a20-401a-ad3c-b690ad1e2f69-4473-000002b9de7fce24_file-1.jpg?resize=300%2C225&amp;ssl=1 300w, https:\/\/i2.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/83d6d66e-6a20-401a-ad3c-b690ad1e2f69-4473-000002b9de7fce24_file-1.jpg?resize=768%2C576&amp;ssl=1 768w, https:\/\/i2.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/83d6d66e-6a20-401a-ad3c-b690ad1e2f69-4473-000002b9de7fce24_file-1.jpg?resize=1024%2C768&amp;ssl=1 1024w, https:\/\/i2.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/83d6d66e-6a20-401a-ad3c-b690ad1e2f69-4473-000002b9de7fce24_file-1.jpg?resize=370%2C278&amp;ssl=1 370w, https:\/\/i2.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/83d6d66e-6a20-401a-ad3c-b690ad1e2f69-4473-000002b9de7fce24_file-1.jpg?resize=270%2C203&amp;ssl=1 270w, https:\/\/i2.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/83d6d66e-6a20-401a-ad3c-b690ad1e2f69-4473-000002b9de7fce24_file-1.jpg?resize=740%2C555&amp;ssl=1 740w, https:\/\/i2.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/83d6d66e-6a20-401a-ad3c-b690ad1e2f69-4473-000002b9de7fce24_file-1.jpg?resize=80%2C60&amp;ssl=1 80w, https:\/\/i2.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/83d6d66e-6a20-401a-ad3c-b690ad1e2f69-4473-000002b9de7fce24_file-1.jpg?w=1540&amp;ssl=1 1540w, https:\/\/i2.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/83d6d66e-6a20-401a-ad3c-b690ad1e2f69-4473-000002b9de7fce24_file-1.jpg?w=2310&amp;ssl=1 2310w\" sizes=\"(max-width: 580px) 100vw, 580px\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<p><em>Both A0 inputs go to the same A0 pin since that&#8217;s often hooked up to both the resistor and the analog device.<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-attachment-id=\"2386\" data-permalink=\"https:\/\/www.keithstestgarage.com\/old\/2019\/02\/07\/analog-tester\/img_0939\/\" data-orig-file=\"https:\/\/i1.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/img_0939.jpg?fit=1940%2C1439&amp;ssl=1\" data-orig-size=\"1940,1439\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;1&quot;}\" data-image-title=\"img_0939\" data-image-description=\"\" data-medium-file=\"https:\/\/i1.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/img_0939.jpg?fit=300%2C223&amp;ssl=1\" data-large-file=\"https:\/\/i1.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/img_0939.jpg?fit=770%2C571&amp;ssl=1\" loading=\"lazy\" width=\"770\" height=\"571\" src=\"https:\/\/i0.wp.com\/www.keithstestgarage.com\/wp-content\/uploads\/2019\/02\/img_0939.jpg?resize=770%2C571\" alt=\"\" class=\"wp-image-2386\" srcset=\"https:\/\/i1.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/img_0939.jpg?w=1940&amp;ssl=1 1940w, https:\/\/i1.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/img_0939.jpg?resize=300%2C223&amp;ssl=1 300w, https:\/\/i1.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/img_0939.jpg?resize=768%2C570&amp;ssl=1 768w, https:\/\/i1.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/img_0939.jpg?resize=1024%2C760&amp;ssl=1 1024w, https:\/\/i1.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/img_0939.jpg?resize=370%2C274&amp;ssl=1 370w, https:\/\/i1.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/img_0939.jpg?resize=270%2C200&amp;ssl=1 270w, https:\/\/i1.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/img_0939.jpg?resize=740%2C549&amp;ssl=1 740w, https:\/\/i1.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/img_0939.jpg?resize=80%2C60&amp;ssl=1 80w, https:\/\/i1.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/img_0939.jpg?w=1540&amp;ssl=1 1540w\" sizes=\"(max-width: 770px) 100vw, 770px\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<p>Now, I can test values of photo-resistors, electret mics, infrared diodes, potentiometers, and anything else that has an analog output suited for reading by an Arduino.  <\/p>\n\n\n\n<h2>Code<\/h2>\n\n\n\n<p>The code is very simple. <\/p>\n\n\n\n<p>First, install the library <strong>&#8220;TM1637 by Avishay Orpaz&#8221;&nbsp;<\/strong>through the Arduino IDE&#8217;s library manager:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-attachment-id=\"2392\" data-permalink=\"https:\/\/www.keithstestgarage.com\/old\/2019\/02\/07\/analog-tester\/image\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/image.png?fit=786%2C443&amp;ssl=1\" data-orig-size=\"786,443\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image\" data-image-description=\"\" data-medium-file=\"https:\/\/i0.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/image.png?fit=300%2C169&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/image.png?fit=770%2C434&amp;ssl=1\" loading=\"lazy\" width=\"770\" height=\"434\" src=\"https:\/\/i1.wp.com\/www.keithstestgarage.com\/wp-content\/uploads\/2019\/02\/image.png?resize=770%2C434\" alt=\"\" class=\"wp-image-2392\" srcset=\"https:\/\/i0.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/image.png?w=786&amp;ssl=1 786w, https:\/\/i0.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/image.png?resize=300%2C169&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/image.png?resize=768%2C433&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/image.png?resize=370%2C209&amp;ssl=1 370w, https:\/\/i0.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/image.png?resize=270%2C152&amp;ssl=1 270w, https:\/\/i0.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/image.png?resize=740%2C417&amp;ssl=1 740w\" sizes=\"(max-width: 770px) 100vw, 770px\" data-recalc-dims=\"1\" \/><figcaption>TM1637 by Avishay Orpaz<\/figcaption><\/figure>\n\n\n\n<p>Or, get it from GitHub:  <a href=\"https:\/\/github.com\/avishorp\/TM1637\">https:\/\/github.com\/avishorp\/TM1637<\/a><\/p>\n\n\n\n<h2>Arduino Sketch<\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"cpp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ library:  https:\/\/github.com\/avishorp\/TM1637\n#include &lt;TM1637Display.h> \n\n#define APIN A0 \/\/ Analog input pin\n#define CLK 5 \/\/ TM1637 CLK pin to D5\n#define DIO 4 \/\/ TM1637 DIO pin to D4\n\nTM1637Display display(CLK, DIO);\n\nvoid setup(){  \n  display.setBrightness(5); \/\/ range is 1 to 7\n}\n\nvoid loop(){\n  \/\/ read the analog value and display it\n  \/\/ (false indicates no leading zeroes)\n  display.showNumberDec(analogRead(APIN), false); \/\/ 0...1023\n  delay(100); \/\/ wait 100ms\n}<\/pre>\n\n\n\n<h2>Parts &amp; Links<\/h2>\n\n\n\n<ul><li>Arduino Pro Mini (5v, 16Mhz) [<a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/amzn.to\/2Tk9IC4\" target=\"_blank\">Amazon<\/a>]<\/li><li>TM1637 4-digit 7-segment display [<a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/amzn.to\/2HcYqYN\" target=\"_blank\">Amazon<\/a>]<\/li><li>Spring terminals [<a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/amzn.to\/2NGNQe3\" target=\"_blank\">Amazon<\/a>]<\/li><li>Through-hole perf board [<a href=\"https:\/\/amzn.to\/2ITvveP\">Amazon<\/a>]<\/li><li>4x AA battery pack w\/ switch [<a href=\"https:\/\/amzn.to\/2ENr41f\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Amazon<\/a>]<\/li><\/ul>\n\n\n\n<p>Now, I can keep this handy, whether I&#8217;m at my computer, the soldering area counter, or my garage.  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes I need to read an analog value&nbsp;but don&#8217;t want to tether to a computer, load the Arduino IDE, and open Serial Monitor. The solution involves an Arduino Pro Mini, a 4-segment display, a battery and some spring terminals, all hot melt glued to an AA battery pack. The spring terminals expose a GND, 5V, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2389,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[80],"tags":[65,64],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.keithstestgarage.com\/old\/wp-content\/uploads\/2019\/02\/e84e03e1-12f9-4ac7-93ad-a8c31c350f5b-4473-000002ba71a64f0f_file.jpg?fit=3544%2C1690&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/pa3G03-Cs","_links":{"self":[{"href":"https:\/\/www.keithstestgarage.com\/old\/wp-json\/wp\/v2\/posts\/2384"}],"collection":[{"href":"https:\/\/www.keithstestgarage.com\/old\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.keithstestgarage.com\/old\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.keithstestgarage.com\/old\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.keithstestgarage.com\/old\/wp-json\/wp\/v2\/comments?post=2384"}],"version-history":[{"count":13,"href":"https:\/\/www.keithstestgarage.com\/old\/wp-json\/wp\/v2\/posts\/2384\/revisions"}],"predecessor-version":[{"id":2947,"href":"https:\/\/www.keithstestgarage.com\/old\/wp-json\/wp\/v2\/posts\/2384\/revisions\/2947"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.keithstestgarage.com\/old\/wp-json\/wp\/v2\/media\/2389"}],"wp:attachment":[{"href":"https:\/\/www.keithstestgarage.com\/old\/wp-json\/wp\/v2\/media?parent=2384"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.keithstestgarage.com\/old\/wp-json\/wp\/v2\/categories?post=2384"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.keithstestgarage.com\/old\/wp-json\/wp\/v2\/tags?post=2384"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}