{"id":26053,"date":"2022-10-16T22:27:06","date_gmt":"2022-10-16T21:27:06","guid":{"rendered":"https:\/\/www.pinballnews.com\/site\/?p=26053"},"modified":"2022-10-16T22:28:23","modified_gmt":"2022-10-16T21:28:23","slug":"new-ir-pinball-testers-part-two","status":"publish","type":"post","link":"https:\/\/www.pinballnews.com\/site\/2022\/10\/16\/new-ir-pinball-testers-part-two\/","title":{"rendered":"NEW IR PINBALL TESTERS: PART TWO"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Welcome to the second part of Todd Andersen&#8217;s article detailing how to build and program an infra-red (IR) tester transmitter and receiver.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a rel=\"noreferrer noopener\" href=\"https:\/\/www.pinballnews.com\/site\/?p=25980\" data-type=\"URL\" data-id=\"https:\/\/www.pinballnews.com\/site\/?p=25980\" target=\"_blank\">The first part<\/a> showed the components used, why they were selected, and how to connect them to build the two devices.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now it&#8217;s time to program the microcontrollers to pulse the IR transmitter&#8217;s LED and indicate with the in-built LED when the receiver detects IR radiation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Back to Todd&#8230;<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">Don\u2019t worry if you haven\u2019t programmed before. I took advantage of the easy-to-use <a href=\"https:\/\/www.arduino.cc\/en\/software\" data-type=\"URL\" data-id=\"https:\/\/www.arduino.cc\/en\/software\" target=\"_blank\" rel=\"noreferrer noopener\">Arduino IDE (Integrated Development Environment)<\/a>, and you can too. If needed, a troubleshooting section is included at the end of this second part.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><span style=\"text-decoration: underline;\">Getting Started<\/span><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Use of a good quality programming cable and a USB hub is highly recommended. These did, indeed, fix the major issue of my Windows 10 computer not automatically detecting any ATtiny85-based board I was using as a <strong>P<\/strong>lug and <strong>P<\/strong>lay <strong>(PnP)<\/strong> device. See the <a href=\"http:\/\/digistump.com\/wiki\/digispark\">Digistump wiki<\/a> for even more help getting started.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><span style=\"text-decoration: underline;\">Programming<\/span><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When first trying to programming these ATtiny85-based boards I went through multiple drivers and board configuration files to get Windows 7 and 10 to play nice. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I was only partly successful until I either updated the Arduino Integrated Development Environment (IDE) to the latest version or, in the case of Windows 10, it just &#8216;felt&#8217; like these non-native boards should be detected as PnP devices. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In both of these cases, my uploading to the boards stopped-at-start. I also found myself fighting Windows 10 every time it decided it had to be upgraded; against my requesting it not to. And, with Windows 11 already here, I had to find a permanent solution.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As brought up at the start of this article,<strong> <\/strong>that solution was to simply employ an inexpensive USB hub between whichever computer and whichever ATtiny85 board variety I tried to connect. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Any cheap USB hub, powered or unpowered, should do the trick. My first attempt&#8217;s success rate was anecdotally only about ten percent. In fact, it usually took three attempts to be successful, so a little patience and doggedness was required.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Instructions at this point assume you have the <a rel=\"noreferrer noopener\" href=\"https:\/\/www.arduino.cc\/en\/software\" data-type=\"URL\" data-id=\"https:\/\/www.arduino.cc\/en\/software\" target=\"_blank\">Arduino <\/a><a rel=\"noreferrer noopener\" href=\"https:\/\/www.arduino.cc\/en\/software\" data-type=\"URL\" data-id=\"https:\/\/www.arduino.cc\/en\/software\" target=\"_blank\">I<\/a><a rel=\"noreferrer noopener\" href=\"https:\/\/www.arduino.cc\/en\/software\" data-type=\"URL\" data-id=\"https:\/\/www.arduino.cc\/en\/software\" target=\"_blank\">D<\/a><a rel=\"noreferrer noopener\" href=\"https:\/\/www.arduino.cc\/en\/software\" data-type=\"URL\" data-id=\"https:\/\/www.arduino.cc\/en\/software\" target=\"_blank\">E<\/a><a href=\"https:\/\/www.arduino.cc\/en\/software\" data-type=\"URL\" data-id=\"https:\/\/www.arduino.cc\/en\/software\" target=\"_blank\" rel=\"noreferrer noopener\"> <\/a><a rel=\"noreferrer noopener\" href=\"https:\/\/www.arduino.cc\/en\/software\" data-type=\"URL\" data-id=\"https:\/\/www.arduino.cc\/en\/software\" target=\"_blank\">software<\/a> on your computer and Digstump boards selected in Arduino. If not, Digstump has an incredibly detailed but easy-to-follow <a href=\"http:\/\/digistump.com\/wiki\/digispark\/tutorials\/connecting\">tutorial<\/a> for both requirements.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Instructions from this point also assume you have rudimentary experience using the Arduino software.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If not, Pinball News has already covered the use of Arduino software in a <a href=\"https:\/\/www.pinballnews.com\/learn\/pinduino\/index.html\">previous article<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Instructions from this point also assume you are programming a Digistump Digispark clone board. However, the code found later on in this article can be easily modified to work with genuine Arduino boards and alternative clone boards if you wish.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Open whichever version of the Arduino IDE you are using. It should automatically open and fill your entire computer screen.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Go to &#8216;Tools&#8217; in the <strong>U<\/strong>pper <strong>L<\/strong>eft <strong>H<\/strong>and <strong>(ULH)<\/strong> corner.<\/li><li>Go down to &#8216;Board&#8217;.<\/li><li>Go down and over to &#8216;Digistump AVR Boards&#8217;.<\/li><li>Select &#8216;Digispark (default \u2013 16.5 Mhz)&#8217; with either a left mouse click or by pressing &#8216;Enter&#8217; on your keyboard.<\/li><\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/21a-new-ir-testers.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"624\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/21a-new-ir-testers-1024x624.jpg\" alt=\"Selecting the appropriate board\" class=\"wp-image-26069\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/21a-new-ir-testers-1024x624.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/21a-new-ir-testers-300x183.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/21a-new-ir-testers-768x468.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/21a-new-ir-testers-1536x936.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/21a-new-ir-testers-850x518.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/21a-new-ir-testers.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>Selecting the appropriate board<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">If your board can be programmed by the Arduino IDE, it will probably already have the manufacturer\u2019s test program (known as a &#8216;sketch&#8217;) on it. Therefore, its on-board LED may be blinking when you first plug your board in to your computer\u2019s USB port.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Verify you can load your own sketch by testing your board with Arduino\u2019s built in &#8216;Blink&#8217; sketch.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>While still in Arduino, left mouse click <em><strong>File<\/strong><\/em> in the <strong>ULH<\/strong> corner.<\/li><li>Go down to <em><strong>Examples<\/strong><\/em><\/li><li>Go down and over to <em><strong>01 Basics<\/strong><\/em><\/li><li>Go down and over to <em><strong>Blink<\/strong><\/em><\/li><li>Select <strong><em>Blink<\/em><\/strong> with either a left mouse click or by pressing Enter on your keyboard<\/li><\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/22a-new-ir-testers.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"577\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/22a-new-ir-testers-1024x577.jpg\" alt=\"Loading the Blink sketch\" class=\"wp-image-26070\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/22a-new-ir-testers-1024x577.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/22a-new-ir-testers-300x169.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/22a-new-ir-testers-768x432.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/22a-new-ir-testers-1536x865.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/22a-new-ir-testers-850x479.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/22a-new-ir-testers.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>Loading the Blink sketch<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">The &#8216;Blink&#8217; sketch will automatically pop up.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This is the how the &#8216;Blink&#8217; small-sized popup window looks:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/23-new-ir-testers.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/23-new-ir-testers-1009x1024.jpg\" alt=\"The Blink sketch\" class=\"wp-image-26061\" width=\"505\" height=\"512\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/23-new-ir-testers-1009x1024.jpg 1009w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/23-new-ir-testers-296x300.jpg 296w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/23-new-ir-testers-768x779.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/23-new-ir-testers-1514x1536.jpg 1514w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/23-new-ir-testers-850x862.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/23-new-ir-testers.jpg 1600w\" sizes=\"auto, (max-width: 505px) 100vw, 505px\" \/><\/a><figcaption>The Blink sketch pop-up<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">To make programming easier, you may want to make the sketch window fit your computer monitor\u2019s entire screen. This is done by simply left-clicking the &#8216;Maximize&#8217; box in the <strong>U<\/strong>pper <strong>R<\/strong>ight <strong>H<\/strong>and <strong>(URH)<\/strong> corner.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/24a-new-ir-testers.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"577\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/24a-new-ir-testers-1024x577.jpg\" alt=\"The Blink sketch window when maximised\" class=\"wp-image-26073\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/24a-new-ir-testers-1024x577.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/24a-new-ir-testers-300x169.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/24a-new-ir-testers-768x433.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/24a-new-ir-testers-850x479.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/24a-new-ir-testers.jpg 1345w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>The Blink sketch window when maximised<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Once the &#8220;Blink&#8221; sketch is up on your screen, you will do your first bit of programming by slightly modifying it &#8211; adding just one line of programming syntax to the freshly opened sketch.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The purpose of this new line is to let the program know which pin on the Digispark clone board has its built in <a href=\"https:\/\/www.pinballnews.com\/learn\/leds.html\"><strong>L<\/strong>ight <strong>E<\/strong>mitting <strong>D<\/strong>iode <strong>(LED)<\/strong><\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><span style=\"text-decoration: underline;\">Digispark Clone Model Identification<\/span><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Three models of the Digispark clone boards have been shipped. They have no feature differences, only a different connection for the on-board LED.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">From the Digispark section of the Digistump&nbsp; <a href=\"http:\/\/digistump.com\/wiki\/digispark\/tutorials\/modelbi2c\">Wiki<\/a> . . .<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table><tbody><tr><td>\u201c<em>You can identify your <a href=\"http:\/\/digistump.com\/wiki\/digispark\/tutorials\/modelbi2c\">model<\/a> by the presence of &#8216;rev2&#8217;, &#8216;rev4&#8217;, or nothing on the top (the side with the gold connectors) of the USB end of the Digispark. Also, there is a &#8216;rev3&#8217; version in circulation; this is actually counterfeit (i.e. a clone which falsely uses the Digispark trade name), although functionally it seems to match the (true) revisions 2 and 4. Rev2 or Rev4 marking: The on-board LED is connected to P1 This board should cause no conflicts with any devices, but remember the LED is on pin 1 not pin 0! No marking: The on-board LED is connected to P0.<\/em>\u201d<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"is-style-plain wp-block-paragraph\">Note: Most Digispark clones will have their on-board LEDs connected to Arduino pin designation 1 (for board designation PB1). If this is not the case for yours, use 0 (for board designation PB0) in the #define you will add to the &#8216;Blink&#8217; sketch.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><span style=\"text-decoration: underline;\">Test Your Boards<\/span><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Use your mouse wheel or the slide bar on the right side to go the bottom of the sketch.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/25a-new-ir-testers.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"574\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/25a-new-ir-testers-1024x574.jpg\" alt=\"The bottom of the Blink sketch\" class=\"wp-image-26074\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/25a-new-ir-testers-1024x574.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/25a-new-ir-testers-300x168.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/25a-new-ir-testers-768x431.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/25a-new-ir-testers-850x477.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/25a-new-ir-testers.jpg 1344w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>The bottom of the Blink sketch<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Notice the <strong>(empty space)<\/strong> between&nbsp; . . .<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>https:\/\/www.arduino.cc\/en\/Tutorial\/BuiltInExamples\/Blink<br>*\/<br><strong>(empty space)<\/strong><br>\/\/ the setup function runs once when you press reset or power the board<\/code><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In place of the empty space, add:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>#define LED_BUILTIN 1<\/strong><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">So it now reads:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>https:\/\/www.arduino.cc\/en\/Tutorial\/BuiltInExamples\/Blink\n*\/\n<strong>#define LED_BUILTIN 1<\/strong>\n\/\/ the setup function runs once when you press reset or power the board<\/code><\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/26a-new-ir-testers.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/26a-new-ir-testers-1024x576.jpg\" alt=\"The on-board LED is defined\" class=\"wp-image-26075\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/26a-new-ir-testers-1024x576.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/26a-new-ir-testers-300x169.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/26a-new-ir-testers-768x432.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/26a-new-ir-testers-850x478.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/26a-new-ir-testers.jpg 1333w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>The on-board LED is defined<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">LED_BUILTIN is the on-board LED specified in <a href=\"http:\/\/digistump.com\/wiki\/digispark\/tutorials\/modelbi2c\">Digispark Clones Model Identification<\/a>. Here we have selected the default of &#8216;1&#8217;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The Digispark clone board\u2019s built-in LED is now identified in the sketch.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Click the Upload Right Arrow (\u25ba) or use the Ctrl+U keyboard shortcut.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">At the bottom of the window, you will be told to, \u201cPlug in device now\u201d.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/27-new-ir-testers.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/27-new-ir-testers-1024x576.jpg\" alt=\"Plug in your board at this point\" class=\"wp-image-26076\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/27-new-ir-testers-1024x576.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/27-new-ir-testers-300x169.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/27-new-ir-testers-768x432.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/27-new-ir-testers-850x478.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/27-new-ir-testers.jpg 1336w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>Plug in your Sender board at this point<\/figcaption><\/figure>\n<\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/28-new-ir-testers.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"249\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/28-new-ir-testers-1024x249.jpg\" alt=\"The same message a little clearer\" class=\"wp-image-26077\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/28-new-ir-testers-1024x249.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/28-new-ir-testers-300x73.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/28-new-ir-testers-768x187.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/28-new-ir-testers-1536x373.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/28-new-ir-testers-850x207.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/28-new-ir-testers.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>The same message as above but a little clearer<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">This \u201cFlash write error\u201d (below) at the bottom of the window is to be expected.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/29-new-ir-testers.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"244\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/29-new-ir-testers-1024x244.jpg\" alt=\"No cause for alarm\" class=\"wp-image-26078\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/29-new-ir-testers-1024x244.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/29-new-ir-testers-300x71.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/29-new-ir-testers-768x183.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/29-new-ir-testers-1536x366.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/29-new-ir-testers-850x202.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/29-new-ir-testers.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>No cause for alarm<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">If you get some sort of a \u201cflash write error\u201d it\u2019s actually a good sign. This is due to &#8216;bit-banging&#8217; or technology incompatibility issues. But, it means your board is probably working. Just follow the instructions that will follow the error \u2013 and simply try again.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On the second try, by looking at the bottom of the window you can see a second error.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/30-new-ir-testers.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"210\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/30-new-ir-testers-1024x210.jpg\" alt=\"Another try, another error\" class=\"wp-image-26079\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/30-new-ir-testers-1024x210.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/30-new-ir-testers-300x62.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/30-new-ir-testers-768x157.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/30-new-ir-testers-1536x315.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/30-new-ir-testers-850x174.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/30-new-ir-testers.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>Another try, another error<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Chances are, this won\u2019t reconnect. Simply close the Arduino IDE software, reopen it, and try again.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You know what they say? You can see by checking the bottom of the window that&#8230;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/31-new-ir-testers.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"396\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/31-new-ir-testers-1024x396.jpg\" alt=\"Third time\u2019s a charm!\" class=\"wp-image-26080\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/31-new-ir-testers-1024x396.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/31-new-ir-testers-300x116.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/31-new-ir-testers-768x297.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/31-new-ir-testers-1536x594.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/31-new-ir-testers-850x329.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/31-new-ir-testers.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>Third time\u2019s a charm!<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><span style=\"text-decoration: underline;\"><strong>Program Your Boards<\/strong><\/span><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Open new instance\/widow of the Arduino IDE.<\/li><li>Go to <em><strong>File<\/strong><\/em> and go down to and click on <strong><em>New<\/em><\/strong> (or use Ctrl+n).<\/li><li>A new Arduino window will pop up, which you can maximise.<\/li><\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/32-new-ir-testers.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"713\" height=\"843\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/32-new-ir-testers.jpg\" alt=\"A new empty sketch\" class=\"wp-image-26081\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/32-new-ir-testers.jpg 713w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/new-ir-testers\/32-new-ir-testers-254x300.jpg 254w\" sizes=\"auto, (max-width: 713px) 100vw, 713px\" \/><\/a><figcaption>A new empty sketch<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Select and copy (<strong><em>Ctrl+c<\/em><\/strong>) the <strong>ATTinyUniqueBlinkPattern<\/strong> sketch in the grey box below.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Click anywhere in the sketch window and use <em><strong>Ctrl+a<\/strong><\/em> to select all of the default sketch.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Use <em><strong>Ctrl+v<\/strong><\/em> to paste the copied <strong>ATTinyUniqueBlinkPattern<\/strong> sketch so it replaces the blank sketch.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Use the same procedure as above to upload this sketch to the Sender board.<\/p>\n\n\n\n<pre class=\"wp-block-code has-background\" style=\"background-color:#cccccc\"><code>\/\/ATTinyUniqueBlinkPattern.INO\n\/\/ Author: Pinball News\n\/\/ Website: https:\/\/www.pinballnews.com\/\n\/\/ Creation Date: 16-SEP-22\n\n\/\/ This code is in the public domain.\n\/\/ Please feel free to: copy, distribute, or modify this sketch.\n\n\/\/ This very simple program (Arduino sketch) makes an ATtiny85 based board blink both its onboard LED and attached IR LED a unique pattern.\n\n\/\/ This unique pattern of seven blinks is different than any signal in a pinball machine; therefor helpful for diagnostics \/ troubleshooting.\n\n\/\/ The built-in \/ onboard LED is on pin 0 for Digispark Model B . . . and . . . that LED is on pin 1 for Digispark Model A or EDAtiny.\n\n\/\/ Change the number in \"digitalWrite(1, HIGH);\" to match the onboard LED pin number for your specific board.\n\nvoid setup() {                \npinMode(1, OUTPUT);       \/\/ This is Pin 1 \/ PB1 on the ATtiny85 board and the Anode \/ +5 volt connection for the Ir Diode.\npinMode(0, OUTPUT);       \/\/ This is Pin 0 \/ PB0 on the ATtiny85 board and Cathode \/ GND connection for the Ir Diode.\ndigitalWrite(0, LOW);        \/\/ In this application: 0, LOW, and GND are all the same thing.\ndelay (10);                           \/\/ This short delay is important and allows the ATtiny itself to think about how it is going to best work for you.\n}\n\nvoid loop() {\n\/\/ 1st Blink                        \/\/ This blink is similar to all 7; therefore only this 1st Blink will be fully commented.\n  digitalWrite(1, HIGH);   \/\/ This turns on the ATtiny onboard LED and Ir LED by making the voltage HIGH \/ +5 Volts. \n  delay(175);                     \/\/ This holds \/ keeps the ATtiny LEDs turned on.\n  digitalWrite(1, LOW);   \/\/ This turns the LEDs off by making the voltage LOW \/ GND.\n  delay(175);                     \/\/ This keeps the LEDs turned off.\n\/\/ 2nd Blink                      \/\/ Lather, rinse, repeat.\n  digitalWrite(1, HIGH);\n  delay(175);\n  digitalWrite(1, LOW); \n  delay(175);\n\/\/ 3rd Blink\n  digitalWrite(1, HIGH);\n  delay(175);\n  digitalWrite(1, LOW); \n  delay(175);\n\/\/ 4th Blink\n  digitalWrite(1, HIGH);\n  delay(175);               \n  digitalWrite(1, LOW); \n  delay(175);             \n\/\/ 5th Blink\n  digitalWrite(1, HIGH);\n  delay(175);               \n  digitalWrite(1, LOW); \n  delay(175);\n    delay(500);\n\/\/ 6th Blink\n  digitalWrite(1, HIGH);\n  delay(150);\n  digitalWrite(1, LOW); \n  delay(150);\n\/\/ 7th Blink\n  digitalWrite(1, HIGH);\n  delay(150);\n  digitalWrite(1, LOW); \n  delay(150);\ndelay(2000);  \n}\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Follow the same procedure to paste the <strong>ATtiny85IrReceiver<\/strong> sketch below into another new window and upload it to the Receiver board.<\/p>\n\n\n\n<pre class=\"wp-block-code has-background\" style=\"background-color:#cccccc\"><code>\/\/ATtinyIrReceiver.INO\n\n\/\/ Author: Pinball News\n\/\/ Website: https:\/\/www.pinballnews.com\/\n\/\/ Creation Date: 17-SEP-22\n\n\/\/ This code is in the public domain.\n\/\/ Please feel free to: copy, distribute, or modify this sketch.\n\n\/\/ This very simple program (Arduino sketch) makes an ATtiny85 based board light its onboard LED when an IR source is present.\n\n\/\/ The builtin \/ onboard LED is on pin 0 for Digispark Model B . . . and . . . that LED is on pin 1 for Digispark Model A or EDAtiny\n\n\/\/ Change the number in \"digitalWrite(1, HIGH);\" to match the onboard LED pin number for your specific board.\n\n\/\/  Connections for the Phototransistor \/ 10 KOhm resistor follow . . . \n\/\/  +5V pin on the ATtiny85 board \/ the Collector of the Ir Transistor.\n\/\/  PB2 pin on the ATtiny85 board and the Emitter of the Ir Transistor \/ 10 KOhm resistor connection.\n\/\/  PB0 pin on the ATtiny85 board and the other side of the 10 KOhm resistor.\n\nvoid setup() {                \n  pinMode(A1, INPUT);       \/\/ This is PB2 on the ATtiny85 board and Pin A1 in the Arduino sketch.\n  pinMode(1, OUTPUT);      \/\/ This is PB1 on the ATtiny85 board, the onboard LED and Pin 1 in the Arduino sketch. \n  pinMode(0, OUTPUT);      \/\/ This is PB0 on the ATtiny85 board and Pin 0 in the Arduino sketch.\n  digitalWrite (0, LOW);      \/\/ This grounds the other side of the 10 KOhm resistor.\n    delay (10);                        \/\/ This short delay is important and allows the ATtiny itself to think about how it is going to best work for you.\n}\n\nvoid loop() {\nanalogRead(A1);              \/\/This reads the value Ir light detected by theg Ir Transistor.\nif(analogRead(A1) &gt; 33)  {\n  digitalWrite(1, HIGH);  \/\/This turns ON the onboard LED when Ir light is detected.    \n  }\nelse  {\ndigitalWrite(1, LOW);     \/\/This turns OFF the LED onboard when no Ir light is detected.\n  }\n}\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><span style=\"text-decoration: underline;\">Troubleshooting and &#8216;Got-Ya&#8217;s<\/span><\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Is it worth having to retry programming the same board? With: changing technology, the prices of other boards, and their unavailability &#8211; yes &#8211; but YMMV.<br><\/li><li>Buy fresh new Digispark clone boards from a dependable dealer. Still expect that ten percent of your boards simply will not work.<br><\/li><li>The names of the individual ATTiny85 pins vary upon how they are referenced: physical, designation, and use.<br><\/li><li>Use a good quality, male USB 2.0 A-male to a USB 2.0 Micro-B male cable, that can handle both power and data.<br><\/li><li>Use a cheap USB hub between your computer and your boards.<br><\/li><li>Don\u2019t plug in your chosen ATtiny85 clone boards until the you get the Arduino prompt to do so from your computer.&nbsp;<br><\/li><li>Be patient and allow the Digispark bootloader and the Arduino IDE time to do their work.<br><\/li><li>Close the Arduino program and open it up for a second or even third try.<br><\/li><li>Even when battery-powered, your ATtiny85 board it will still try to &#8216;talk&#8217; to your computer for a few seconds each time power is applied.<br><\/li><li>Test your IR Sender and Receiver boards with each other. If either either do not work, check to make sure you have placed your components with correct orientation.<br><\/li><li>Your IR Receiver is responsive enough to be tested with a standard TV IR remote.<br><\/li><li>The beam angles of the IR components are quite narrow, therefore the testers work best when kept parallel to the IR switches under test.<br><\/li><\/ol>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><span style=\"text-decoration: underline;\">Digistump Digispark Wiki<\/span><\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"http:\/\/digistump.com\/wiki\/digispark\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/digistump.com\/wiki\/digispark<\/a><\/li><li><a href=\"http:\/\/digistump.com\/wiki\/digispark\/tutorials\/connecting\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/digistump.com\/wiki\/digispark\/tutorials\/connecting<\/a><\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><span style=\"text-decoration: underline;\">Pinball Repair Guides<\/span><\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/homepinballrepair.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/homepinballrepair.com\/<\/a><\/li><li><a href=\"https:\/\/www.pinwiki.com\/wiki\/index.php\/Williams_Pinball_Repair_Guides\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.pinwiki.com\/wiki\/index.php\/Williams_Pinball_Repair_Guides<\/a><\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><span style=\"text-decoration: underline;\"><strong>Conclusion<\/strong><\/span><br>With your ATtiny85-based clone boards built, programmed, and tested, you should be able to use them to troubleshoot Infrared (IR) switches in pinball machines.<br><br>This concludes the second, software-related half of this pair of Pinball News articles. Please follow <strong><a rel=\"noreferrer noopener\" href=\"https:\/\/www.pinballnews.com\/site\/?p=25980\" data-type=\"URL\" data-id=\"https:\/\/www.pinballnews.com\/site\/?p=25980\" target=\"_blank\">this link<\/a><\/strong> to view the first half covering the hardware&#8217;s details.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Welcome to the second part of Todd Andersen&#8217;s article detailing how to build and program an infra-red (IR) tester transmitter and receiver. The first part showed the components used, why they were selected, and how to connect them to build the two devices. Now it&#8217;s time to program the microcontrollers to pulse the IR transmitter&#8217;s &hellip;<\/p>\n","protected":false},"author":2,"featured_media":26086,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[1914,1916,1915,1909,1912,1913,1911,1910],"class_list":["post-26053","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-learn","tag-components","tag-diagnostic","tag-fault-finding","tag-ir","tag-opto","tag-switches","tag-tester","tag-testing"],"_links":{"self":[{"href":"https:\/\/www.pinballnews.com\/site\/wp-json\/wp\/v2\/posts\/26053","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pinballnews.com\/site\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pinballnews.com\/site\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pinballnews.com\/site\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pinballnews.com\/site\/wp-json\/wp\/v2\/comments?post=26053"}],"version-history":[{"count":10,"href":"https:\/\/www.pinballnews.com\/site\/wp-json\/wp\/v2\/posts\/26053\/revisions"}],"predecessor-version":[{"id":26117,"href":"https:\/\/www.pinballnews.com\/site\/wp-json\/wp\/v2\/posts\/26053\/revisions\/26117"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pinballnews.com\/site\/wp-json\/wp\/v2\/media\/26086"}],"wp:attachment":[{"href":"https:\/\/www.pinballnews.com\/site\/wp-json\/wp\/v2\/media?parent=26053"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pinballnews.com\/site\/wp-json\/wp\/v2\/categories?post=26053"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pinballnews.com\/site\/wp-json\/wp\/v2\/tags?post=26053"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}