{"id":31533,"date":"2024-02-02T22:58:37","date_gmt":"2024-02-02T22:58:37","guid":{"rendered":"https:\/\/www.pinballnews.com\/site\/?p=31533"},"modified":"2024-02-03T11:16:05","modified_gmt":"2024-02-03T11:16:05","slug":"pinball-ball-detector-alternative-microcontrollers","status":"publish","type":"post","link":"https:\/\/www.pinballnews.com\/site\/2024\/02\/02\/pinball-ball-detector-alternative-microcontrollers\/","title":{"rendered":"PINBALL BALL DETECTOR &#8211; ALTERNATIVE MICROCONTROLLERS"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong><span style=\"text-decoration: underline;\">Introduction<\/span><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In his new two-part article (<a href=\"https:\/\/www.pinballnews.com\/site\/2024\/02\/02\/pinball-ball-detector-part-one\/\" data-type=\"link\" data-id=\"https:\/\/www.pinballnews.com\/site\/2024\/02\/02\/pinball-ball-detector-part-one\/\" target=\"_blank\" rel=\"noreferrer noopener\">Part One<\/a>, <a href=\"https:\/\/www.pinballnews.com\/site\/2024\/02\/02\/pinball-ball-detector-part-two\/\" data-type=\"link\" data-id=\"https:\/\/www.pinballnews.com\/site\/2024\/02\/02\/pinball-ball-detector-part-two\/\" target=\"_blank\" rel=\"noreferrer noopener\">Part Two<\/a>), Todd Andersen shows us how to build a microcontroller-based pinball ball detector to trigger add-ons such as toppers or enhanced lighting effects. His article focuses on building a system around an Arduino Uno microcontroller but, as he explains, other microcontrollers can be used instead.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this addendum he examines several alternatives to the Arduino Uno, describing how they have their unique features and requirements, and provides the sketches to make them read the IR sensor input module and control the relay output module.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" id=\"tiny-88\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">As only just a few pins are needed to make the Arduino-based pinball detector featured in <a href=\"https:\/\/www.pinballnews.com\/site\/2024\/02\/02\/pinball-ball-detector-part-one\/\" data-type=\"link\" data-id=\"https:\/\/www.pinballnews.com\/site\/2024\/02\/02\/pinball-ball-detector-part-one\/\" target=\"_blank\" rel=\"noreferrer noopener\">Part One<\/a> and <a href=\"https:\/\/www.pinballnews.com\/site\/2024\/02\/02\/pinball-ball-detector-part-two\/\" data-type=\"link\" data-id=\"https:\/\/www.pinballnews.com\/site\/2024\/02\/02\/pinball-ball-detector-part-two\/\" target=\"_blank\" rel=\"noreferrer noopener\">Part Two<\/a>, a few different microcontroller boards could be used instead. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In addition to the genuine Arduino Uno board, I have had success using various standalone microcontrollers, Digistump Digispark and clone boards, LilyTiny clone boards, ATtiny88 boards and clones, Arduino clone boards, and Raspberry Pi Pico.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here are some suggestions listed from the smallest board to the largest:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.arrow.com\/en\/research-and-events\/articles\/attiny85-arduino-tutorial\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>ATtiny85<\/strong><\/a><br>Click <a href=\"https:\/\/highlowtech.org\/?p=1695\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a> for details of how to add this board to the Arduino IDE<br> <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-white-color\">.<\/mark><\/li>\n\n\n\n<li><a href=\"http:\/\/digistump.com\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Digistump Digispark USB-MICRO<\/strong><\/a> <br>Follow these two Pinball News links for more detailed information: <a href=\"https:\/\/www.pinballnews.com\/site\/2022\/10\/16\/new-ir-pinball-testers-part-one\/\" target=\"_blank\" rel=\"noreferrer noopener\">Link 1<\/a> and <a href=\"https:\/\/www.pinballnews.com\/site\/2022\/10\/16\/new-ir-pinball-testers-part-two\/\" target=\"_blank\" rel=\"noreferrer noopener\">Link 2<\/a><br>Click <a href=\"https:\/\/github.com\/digistump\/DigistumpArduino\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a> and <a href=\"http:\/\/digistump.com\/wiki\/digispark\/tutorials\/connecting\" data-type=\"link\" data-id=\"http:\/\/digistump.com\/wiki\/digispark\/tutorials\/connecting\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a> for details of how to add this board to the Arduino IDE<br> <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-white-color\">.<\/mark><\/li>\n\n\n\n<li><strong><a href=\"http:\/\/digistump.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Digistump Digispark USB-A<\/a> <\/strong><br>Follow these two Pinball News links for more detailed information: <a href=\"https:\/\/www.pinballnews.com\/site\/2022\/10\/16\/new-ir-pinball-testers-part-one\/\">Link 1<\/a> and <a href=\"https:\/\/www.pinballnews.com\/site\/2022\/10\/16\/new-ir-pinball-testers-part-two\/\">Link 2<\/a><br>Click <a href=\"https:\/\/github.com\/digistump\/DigistumpArduino\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">here<\/a> and <a href=\"http:\/\/digistump.com\/wiki\/digispark\/tutorials\/connecting\" data-type=\"link\" data-id=\"http:\/\/digistump.com\/wiki\/digispark\/tutorials\/connecting\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">here<\/a> for details of how to add this board to the Arduino IDE<br> <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-white-color\">.<\/mark><\/li>\n\n\n\n<li><a href=\"http:\/\/digistump.com\/\"><strong>Digistump Digispark Pro<\/strong><\/a><a><strong> <\/strong><\/a><br>Follow <a href=\"http:\/\/digistump.com\/\">this link<\/a> for more detailed information<br>Click <a href=\"https:\/\/github.com\/digistump\/DigistumpArduino\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a> and <a href=\"http:\/\/digistump.com\/wiki\/digispark\/tutorials\/connectingpro\" data-type=\"link\" data-id=\"http:\/\/digistump.com\/wiki\/digispark\/tutorials\/connectingpro\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">here<\/a> for details of how to add this board to the Arduino IDE<br> <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-white-color\">.<\/mark><\/li>\n\n\n\n<li><strong><a href=\"https:\/\/github.com\/MHEtLive\" target=\"_blank\" rel=\"noreferrer noopener\">Nano \u2013 MH-ET LIVE Attiny88<\/a> <\/strong><br>See <a href=\"#tiny-88-nano\">details below<\/a><br>Click <a href=\"https:\/\/handsontec.com\/dataspecs\/module\/Arduino\/Arduino%20Tiny%2088.pdf\" data-type=\"link\" data-id=\"https:\/\/handsontec.com\/dataspecs\/module\/Arduino\/Arduino%20Tiny%2088.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a> and <a href=\"https:\/\/mhetlive.nodebb.com\/topic\/47\/mh-et-live-tiny88-16-0mhz\" data-type=\"link\" data-id=\"https:\/\/mhetlive.nodebb.com\/topic\/47\/mh-et-live-tiny88-16-0mhz\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">here<\/a> for details of how to add this board to the Arduino IDE<br> <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-white-color\">.<\/mark><\/li>\n\n\n\n<li><strong><a href=\"https:\/\/github.com\/UnfinishedStuff\/CH340C\" target=\"_blank\" rel=\"noreferrer noopener\">Nano \u2013 Atmega328P<\/a> <\/strong><br>Follow these Pinball News links for more detailed information: <a href=\"https:\/\/www.pinballnews.com\/site\/2022\/12\/24\/pinball-add-on-controller-part-one\/\" target=\"_blank\" rel=\"noreferrer noopener\">Link 1<\/a> and <a href=\"https:\/\/www.pinballnews.com\/site\/2022\/12\/24\/pinball-add-on-controller-part-two\/\" target=\"_blank\" rel=\"noreferrer noopener\">Link 2<\/a><br>This board is supported in the standard Arduino IDE installation<br> <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-white-color\">.<\/mark><\/li>\n\n\n\n<li><strong><a href=\"https:\/\/github.com\/RalphBacon\/LGT8F328P-Arduino-Clone-Chip-ATMega328P\/blob\/master\/README.md\" target=\"_blank\" rel=\"noreferrer noopener\">Nano \u2013 LGT8F328P<\/a> <\/strong><br>See <a href=\"#lgt8f328p\">details below<\/a><br>Click <a href=\"https:\/\/github.com\/dbuezas\/lgt8fx\" data-type=\"link\" data-id=\"https:\/\/github.com\/dbuezas\/lgt8fx\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a> for details of how to add this board to the Arduino IDE<br> <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-white-color\">.<\/mark><\/li>\n\n\n\n<li><strong><a href=\"https:\/\/www.raspberrypi.com\/products\/raspberry-pi-pico\/\" target=\"_blank\" rel=\"noreferrer noopener\">Raspberry Pi Pico<\/a> <\/strong><br>See <a href=\"#raspberry-pi-pico\">details below<\/a><br>Click <a href=\"https:\/\/github.com\/earlephilhower\/arduino-pico\" data-type=\"link\" data-id=\"https:\/\/github.com\/earlephilhower\/arduino-pico\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a> for details of how to add this board to the Arduino IDE<br><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-white-color\"> .<\/mark><\/li>\n\n\n\n<li><strong><a href=\"https:\/\/blog.devgenius.io\/using-arduino-ide-with-unofficial-arduino-clones-bearing-ch340-chip-752d1b90810d\" target=\"_blank\" rel=\"noreferrer noopener\">Uno<\/a> <\/strong><br>Follow these Pinball News links for more detailed information: <a href=\"https:\/\/www.pinballnews.com\/site\/2017\/01\/11\/intro-to-arduino\/\" target=\"_blank\" rel=\"noreferrer noopener\">Link 1<\/a> and <a href=\"https:\/\/www.pinballnews.com\/site\/2017\/01\/12\/pin-uino\/\" target=\"_blank\" rel=\"noreferrer noopener\">Link 2<\/a><br>This board is supported in the standard Arduino IDE installation<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">This list also, coincidentally, is listed from the hardest to the easiest to use.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Bonus board:<\/strong> The \u2018VCC-GND Studio YD-RP2040\u2019 is a RP2040-based Arduino Nano sized microcontroller board. And, it has an RGB LED output.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-white-color\">&#8230;&#8230;<\/mark>10. <a href=\"https:\/\/github.com\/micropython\/micropython\/pull\/12281\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Nano \u2013 YD-RP2040<\/strong><\/a> <br> <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-white-color\">&#8230;&#8230;&#8230;&#8230;.<\/mark>See <a href=\"#yd-rp2040\">details below<\/a><br> <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-white-color\">&#8230;&#8230;&#8230;&#8230;.<\/mark>Click <a href=\"https:\/\/github.com\/earlephilhower\/arduino-pico\" data-type=\"link\" data-id=\"https:\/\/github.com\/earlephilhower\/arduino-pico\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">here<\/a> for details of how to add this board to the Arduino IDE<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Because the YD-RP2040 is RP2040 microcontroller-based, it can be programmed much like the Raspberry Pi Pico.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This tenth bonus board is more expensive than the first eight (or nine, if you use an Uno clone board rather than a genuine Arduino Uno). It costs more than the fiver or tenner the other nine boards cost, but even with its own associated add-ons it\u2019s still much more affordable than many commercially available pinball add-ons or toppers. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\" id=\"tiny-88-nano\">Let&#8217;s take a look at a selection of four of those alternative microcontrollers.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><span style=\"text-decoration: underline;\">TINY 88 NANO<\/span><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Introduction<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This MH-ET LIVE Tiny88 is an ATtiny88-based microcontroller similar to the ATMega328p-based Nano microcontroller, but with fewer capabilities and at a lower price.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/201-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"900\" height=\"890\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/201-pinball-ball-detector.jpg\" alt=\"The MH-ET LIVE Tiny88 microcontroller\" class=\"wp-image-31538\" style=\"width:550px\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/201-pinball-ball-detector.jpg 900w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/201-pinball-ball-detector-300x297.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/201-pinball-ball-detector-768x759.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/201-pinball-ball-detector-850x841.jpg 850w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/a><figcaption class=\"wp-element-caption\">The MH-ET LIVE Tiny88 microcontroller<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Boards<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The &#8216;Tiny88&#8217; is similar to the standard Arduino Nano (and clones) boards, but with a different pin arrangement.<\/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\/pinball-ball-detector\/202-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"919\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/202-pinball-ball-detector-1024x919.jpg\" alt=\"Tiny88 Nano front and back\" class=\"wp-image-31539\" style=\"width:840px;height:auto\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/202-pinball-ball-detector-1024x919.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/202-pinball-ball-detector-300x269.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/202-pinball-ball-detector-768x689.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/202-pinball-ball-detector-1536x1379.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/202-pinball-ball-detector-850x763.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/202-pinball-ball-detector.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Tiny88 Nano front and back<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Arduino IDE<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Only a few years after its introduction, the Tiny88 microcontroller is almost fully supported in the <a href=\"https:\/\/mhetlive.nodebb.com\/topic\/47\/mh-et-live-tiny88-16-0mhz\" data-type=\"link\" data-id=\"https:\/\/mhetlive.nodebb.com\/topic\/47\/mh-et-live-tiny88-16-0mhz\" target=\"_blank\" rel=\"noreferrer noopener\">Arduino IDE<\/a>.<\/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\/pinball-ball-detector\/250-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"595\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/250-pinball-ball-detector-1024x595.jpg\" alt=\"The microcontroller's selection in the Arduino IDE\" class=\"wp-image-31655\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/250-pinball-ball-detector-1024x595.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/250-pinball-ball-detector-300x174.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/250-pinball-ball-detector-768x446.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/250-pinball-ball-detector-1536x892.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/250-pinball-ball-detector-850x494.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/250-pinball-ball-detector.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">The microcontroller&#8217;s selection in the Arduino IDE<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Building<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Rather than explaining further, we will get to putting together and showing the controller.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Sketch<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The <a>T<\/a>iny88 sketch below is laid out to include hardware connections. See lines #12 &#8211; #15 and #17 &#8211; #20.<\/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\/pinball-ball-detector\/205-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"629\" height=\"1024\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/205-pinball-ball-detector-629x1024.jpg\" alt=\"The sketch for the Tiny88 microcontroller\" class=\"wp-image-31542\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/205-pinball-ball-detector-629x1024.jpg 629w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/205-pinball-ball-detector-184x300.jpg 184w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/205-pinball-ball-detector-768x1250.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/205-pinball-ball-detector-850x1384.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/205-pinball-ball-detector.jpg 900w\" sizes=\"auto, (max-width: 629px) 100vw, 629px\" \/><\/a><figcaption class=\"wp-element-caption\">The sketch for the Tiny88 microcontroller ball detector<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Entire Sketch<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can view or copy the full sketch for the Tiny88 here.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/Tiny88PIrSens.INO\n\n\n\/*\nPinball News\nhttps:&#47;&#47;www.pinballnews.com\/\nFebruary, 2024\nThis example code is in the public domain.\n*\/\n\n\n\/\/Input Module pins\n\/\/ irSensorPwr  =  5V \n\/\/ irSensorGnd  =  GND\nint irSensorOut  =  3;\n\n\/\/Output Module pins\n\/\/ relayPwr  =  5V\n\/\/ relayPGnd  =  GND\nint relayIn  =  0;\n\n\/\/ Change as needed\nint Dwell  =  777;  \n\n\n\/\/ Setup\nvoid setup ()                         \n{                                     \n  pinMode (irSensorOut, INPUT_PULLUP);    \n    digitalWrite (irSensorOut, HIGH);\n  pinMode (relayIn, OUTPUT);\n    digitalWrite (relayIn, LOW); \n}                                     \n\n\n\/\/ Loop\nvoid loop ()                          \n{                                     \n  if (digitalRead (irSensorOut) == LOW)   \n  {                                   \n    digitalWrite (relayIn, HIGH);       \n    digitalWrite (LED_BUILTIN, HIGH);\n      delay (Dwell);                   \n  }                                   \n  else                                \n  {                                   \n    digitalWrite (relayIn, LOW);\n    digitalWrite (LED_BUILTIN, LOW);        \n  }                                      \n}                <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Finished Controller<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">With hardware and software together, we have a finished <a>T<\/a>iny88 microcontroller-based prototype ball detector.<\/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\/pinball-ball-detector\/206-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"728\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/206-pinball-ball-detector-1024x728.jpg\" alt=\"IR sensor module, relay module and Tiny88 board all powered - but not activated\" class=\"wp-image-31543\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/206-pinball-ball-detector-1024x728.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/206-pinball-ball-detector-300x213.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/206-pinball-ball-detector-768x546.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/206-pinball-ball-detector-1536x1092.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/206-pinball-ball-detector-104x74.jpg 104w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/206-pinball-ball-detector-850x605.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/206-pinball-ball-detector.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">IR sensor module, relay module and Tiny88 board all powered &#8211; but not activated<\/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\/pinball-ball-detector\/207-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"728\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/207-pinball-ball-detector-1024x728.jpg\" alt=\"IR sensor module, relay module and Tiny88 board all powered and also triggered\" class=\"wp-image-31544\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/207-pinball-ball-detector-1024x728.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/207-pinball-ball-detector-300x213.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/207-pinball-ball-detector-768x546.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/207-pinball-ball-detector-1536x1092.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/207-pinball-ball-detector-104x74.jpg 104w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/207-pinball-ball-detector-850x605.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/207-pinball-ball-detector.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">IR sensor module, relay module and Tiny88 board all powered and also triggered<\/figcaption><\/figure>\n<\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\" id=\"lgt8f328p\"\/>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><span style=\"text-decoration: underline;\">LGT8F328P NANO<\/span><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Introduction<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This LGT8F328P-based microcontroller is similar to ATMega328p-based microcontroller, but with additional capabilities and at a lower price.<\/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\/pinball-ball-detector\/211-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"627\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/211-pinball-ball-detector-1024x627.jpg\" alt=\"LGT8F328P's features\" class=\"wp-image-31548\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/211-pinball-ball-detector-1024x627.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/211-pinball-ball-detector-300x184.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/211-pinball-ball-detector-768x470.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/211-pinball-ball-detector-1536x941.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/211-pinball-ball-detector-850x521.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/211-pinball-ball-detector.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">LGT8F328P&#8217;s features<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Boards<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Some versions of this LGT8F328P module are pin-for-pin compatible with the standard Arduino Nano (and clones) board. This makes them convenient for using on some of the inexpensive Nano breakout boards available.<\/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\/pinball-ball-detector\/212-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"467\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/212-pinball-ball-detector-1024x467.jpg\" alt=\"Tired old ATMega328p Nano board\" class=\"wp-image-31549\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/212-pinball-ball-detector-1024x467.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/212-pinball-ball-detector-300x137.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/212-pinball-ball-detector-768x350.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/212-pinball-ball-detector-1536x700.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/212-pinball-ball-detector-850x387.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/212-pinball-ball-detector.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Tired old ATMega328p Nano board<\/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\/pinball-ball-detector\/213-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"425\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/213-pinball-ball-detector-1024x425.jpg\" alt=\"Shiny new LGT8F328P Nano board\" class=\"wp-image-31550\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/213-pinball-ball-detector-1024x425.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/213-pinball-ball-detector-300x125.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/213-pinball-ball-detector-768x319.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/213-pinball-ball-detector-1536x637.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/213-pinball-ball-detector-850x353.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/213-pinball-ball-detector.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Shiny new LGT8F328P Nano board<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Breakout Boards<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Several relatively-inexpensive breakout boards (a.k.a. &#8216;shileds&#8217;) are available to aid connections to the Nano board.<\/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\/pinball-ball-detector\/214-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"793\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/214-pinball-ball-detector-1024x793.jpg\" alt=\"A remotely-powered Breakout board\" class=\"wp-image-31551\" style=\"width:841px;height:auto\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/214-pinball-ball-detector-1024x793.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/214-pinball-ball-detector-300x232.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/214-pinball-ball-detector-768x595.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/214-pinball-ball-detector-1536x1189.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/214-pinball-ball-detector-850x658.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/214-pinball-ball-detector.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">A remotely-powered Breakout board<\/figcaption><\/figure>\n<\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/215-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"900\" height=\"830\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/215-pinball-ball-detector.jpg\" alt=\"A simpler unpowered breakout board\" class=\"wp-image-31552\" style=\"width:550px\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/215-pinball-ball-detector.jpg 900w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/215-pinball-ball-detector-300x277.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/215-pinball-ball-detector-768x708.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/215-pinball-ball-detector-850x784.jpg 850w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/a><figcaption class=\"wp-element-caption\">A simpler unpowered breakout board<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Arduino IDE<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Only a few years after its introduction, the LGT8F328P microcontroller is almost fully supported in the <a href=\"https:\/\/github.com\/dbuezas\/lgt8fx\" data-type=\"link\" data-id=\"https:\/\/github.com\/dbuezas\/lgt8fx\" target=\"_blank\" rel=\"noreferrer noopener\">Arduino IDE<\/a>.<\/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\/pinball-ball-detector\/204-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"583\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/204-pinball-ball-detector-1024x583.jpg\" alt=\"The microcontroller's selection in the Arduino IDE\" class=\"wp-image-31541\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/204-pinball-ball-detector-1024x583.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/204-pinball-ball-detector-300x171.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/204-pinball-ball-detector-768x437.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/204-pinball-ball-detector-1536x875.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/204-pinball-ball-detector-850x484.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/204-pinball-ball-detector-384x220.jpg 384w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/204-pinball-ball-detector.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">The microcontroller&#8217;s selection in the Arduino IDE<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Building<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This article will be taking advantage of an already existing <a href=\"https:\/\/en.wikipedia.org\/wiki\/Pinout\" target=\"_blank\" rel=\"noreferrer noopener\">pinout<\/a> arrangement to create our pinball controller \u2013 modified from previous articles. Rather than explaining any further, we will get to putting together and showing the controller.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Sketch<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The LGT8F328P sketch below is laid out to include the hardware connections. See lines #10 &#8211; #13 and #15 &#8211; #18. For simplicity, all the connections are kept on one side of the board, with only one connection doubled-up.<\/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\/pinball-ball-detector\/216-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"616\" height=\"1024\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/216-pinball-ball-detector-616x1024.jpg\" alt=\"The sketch for the LGT8F328 microcontroller ball detector\" class=\"wp-image-31553\" style=\"width:550px;height:auto\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/216-pinball-ball-detector-616x1024.jpg 616w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/216-pinball-ball-detector-180x300.jpg 180w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/216-pinball-ball-detector-768x1277.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/216-pinball-ball-detector-850x1413.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/216-pinball-ball-detector.jpg 900w\" sizes=\"auto, (max-width: 616px) 100vw, 616px\" \/><\/a><figcaption class=\"wp-element-caption\">The sketch for the LGT8F328 microcontroller ball detector<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Entire Sketch<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/LGT8F328PIrSens.INO\n\n\/*\nPinball News\nhttps:&#47;&#47;www.pinballnews.com\/\nFebruary, 2024\nThis example code is in the public domain.\n*\/\n\n\/\/Input Module pins\n\/\/ irSensorPwr  =  3.3 Volt  \n\/\/ irSensorGnd  =  GND\nint irSensorOut  =  A0;\n\n\/\/Output Module pins\n\/\/ relayPwr  =  5.0 Volt\n\/\/ relayPGnd  =  GND\nint relayIn  =  A7;\n\n\/\/ Change as needed\nint Dwell  =  777;  \n\n\/\/ Setup\nvoid setup ()                         \n{                                     \n  pinMode (irSensorOut, INPUT_PULLUP);    \n    digitalWrite (irSensorOut, HIGH);\n  pinMode (relayIn, OUTPUT);\n    digitalWrite (relayIn, LOW); \n}                                     \n\n\/\/ Loop\nvoid loop ()                          \n{                                     \n  if (digitalRead (irSensorOut) == LOW)   \n  {                                   \n    digitalWrite (relayIn, HIGH);       \n    digitalWrite (LED_BUILTIN, HIGH);\n      delay (Dwell);                   \n  }                                   \n  else                                \n  {                                   \n    digitalWrite (relayIn, LOW);\n    digitalWrite (LED_BUILTIN, LOW);        \n  }                                      \n}                                     <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Finished Controller<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">With hardware and software together, we have a finished LGT8F328P-based microcontroller prototype ball detector.<\/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\/pinball-ball-detector\/217-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"715\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/217-pinball-ball-detector-1024x715.jpg\" alt=\"Sensor and relay modules and the LGT8F328P board all powered, but not activated\" class=\"wp-image-31554\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/217-pinball-ball-detector-1024x715.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/217-pinball-ball-detector-300x209.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/217-pinball-ball-detector-768x536.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/217-pinball-ball-detector-1536x1072.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/217-pinball-ball-detector-104x74.jpg 104w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/217-pinball-ball-detector-850x593.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/217-pinball-ball-detector.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Sensor and relay modules and the LGT8F328P board all powered, but not activated<\/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\/pinball-ball-detector\/218-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"715\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/218-pinball-ball-detector-1024x715.jpg\" alt=\"Sensor and relay modules and the LGT8F328P board all powered, and also triggered\" class=\"wp-image-31555\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/218-pinball-ball-detector-1024x715.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/218-pinball-ball-detector-300x209.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/218-pinball-ball-detector-768x536.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/218-pinball-ball-detector-1536x1072.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/218-pinball-ball-detector-104x74.jpg 104w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/218-pinball-ball-detector-850x593.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/218-pinball-ball-detector.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Sensor and relay modules and the LGT8F328P board all powered, and also triggered<\/figcaption><\/figure>\n<\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\" id=\"raspberry-pi-pico\"\/>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><span style=\"text-decoration: underline;\">RASPBERRY PI PICO<\/span><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Introduction<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This RP2040 based microcontroller is similar to ATMega328p based microcontroller, but available at a lower price.<\/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\/pinball-ball-detector\/240-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"660\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/240-pinball-ball-detector-1024x660.jpg\" alt=\"RP2040 features\" class=\"wp-image-31634\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/240-pinball-ball-detector-1024x660.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/240-pinball-ball-detector-300x193.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/240-pinball-ball-detector-768x495.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/240-pinball-ball-detector-1536x990.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/240-pinball-ball-detector-850x548.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/240-pinball-ball-detector.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">RP2040 features<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Boards<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Some versions of this RP2040 microprocessor module can be used with inexpensive breakout boards.<\/p>\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\/pinball-ball-detector\/241-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"900\" height=\"979\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/241-pinball-ball-detector.jpg\" alt=\"Raspberry Pi Pico front and back\" class=\"wp-image-31635\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/241-pinball-ball-detector.jpg 900w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/241-pinball-ball-detector-276x300.jpg 276w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/241-pinball-ball-detector-768x835.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/241-pinball-ball-detector-850x925.jpg 850w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/a><figcaption class=\"wp-element-caption\">Raspberry Pi Pico front and back<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Breakout Boards<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Several relatively-inexpensive breakout boards are available.<\/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\/pinball-ball-detector\/242-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"696\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/242-pinball-ball-detector-1024x696.jpg\" alt=\"A remotely-powered breakout board\" class=\"wp-image-31636\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/242-pinball-ball-detector-1024x696.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/242-pinball-ball-detector-300x204.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/242-pinball-ball-detector-768x522.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/242-pinball-ball-detector-1536x1044.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/242-pinball-ball-detector-850x578.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/242-pinball-ball-detector.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">A remotely-powered breakout board<\/figcaption><\/figure>\n<\/div>\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\/pinball-ball-detector\/243-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"798\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/243-pinball-ball-detector-1024x798.jpg\" alt=\"An unpowered breakout board with LED indicators\" class=\"wp-image-31637\" style=\"width:841px;height:auto\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/243-pinball-ball-detector-1024x798.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/243-pinball-ball-detector-300x234.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/243-pinball-ball-detector-768x599.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/243-pinball-ball-detector-1536x1197.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/243-pinball-ball-detector-850x662.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/243-pinball-ball-detector.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">An unpowered breakout board with LED indicators (shown lit for clarity)<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Arduino IDE<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Only a few years after its introduction, the RP2040 microcontroller is almost fully supported and compatible in the <a href=\"https:\/\/arduino-pico.readthedocs.io\/\" target=\"_blank\" rel=\"noreferrer noopener\">Arduino IDE<\/a> software.<\/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\/pinball-ball-detector\/244-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"547\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/244-pinball-ball-detector-1024x547.jpg\" alt=\"The Raspberry Pi Pico in the Arduino IDE\" class=\"wp-image-31638\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/244-pinball-ball-detector-1024x547.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/244-pinball-ball-detector-300x160.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/244-pinball-ball-detector-768x410.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/244-pinball-ball-detector-1536x820.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/244-pinball-ball-detector-850x454.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/244-pinball-ball-detector.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">The Raspberry Pi Pico in the Arduino IDE<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Building<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Rather than explaining further, we will get to putting together and demonstrating the controller.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Sketch<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The Raspberry Pi Pico sketch below is laid out to include hardware connections. See lines #12 \u2013 #15 and #17 \u2013 #20. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To make things simpler, connections are kept on just one side of the board, while no connections are doubled-up.<\/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\/pinball-ball-detector\/245-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"651\" height=\"1024\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/245-pinball-ball-detector-651x1024.jpg\" alt=\"The sketch in the Arduino IDE\" class=\"wp-image-31639\" style=\"width:550px\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/245-pinball-ball-detector-651x1024.jpg 651w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/245-pinball-ball-detector-191x300.jpg 191w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/245-pinball-ball-detector-768x1207.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/245-pinball-ball-detector-850x1336.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/245-pinball-ball-detector.jpg 900w\" sizes=\"auto, (max-width: 651px) 100vw, 651px\" \/><\/a><figcaption class=\"wp-element-caption\">The sketch in the Arduino IDE<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Entire Sketch<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here&#8217;s the full sketch you can copy and paste:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/RaspberryPiPicoIrSens.INO\n\/*\nPinball News\nhttps:&#47;&#47;www.pinballnews.com\/\nFebruary, 2024\nThis example code is in the public domain.\n*\/\n\n\/\/Input Module pins\n\/\/ irSensorPwr  =  3v3OUT  \n\/\/ irSensorGnd  =  GND\nint irSensorOut  =  28;\n\n\/\/Output Module pins\n\/\/ relayPwr  =  VBUS\n\/\/ relayPGnd  =  GND\nint relayIn  =  22;\n\n\/\/ Change as needed\nint Dwell  =  777;  \n\n\/\/ Setup\nvoid setup ()                         \n{                                     \n  pinMode (irSensorOut, INPUT_PULLUP);    \n    digitalWrite (irSensorOut, HIGH);\n  pinMode (relayIn, OUTPUT);\n    digitalWrite (relayIn, LOW); \n}                                     \n\n\/\/ Loop\nvoid loop ()                          \n{                                     \n  if (digitalRead (irSensorOut) == LOW)   \n  {                                   \n    digitalWrite (relayIn, HIGH);\n      delay (Dwell);                   \n  }                                   \n  else                                \n  {                                   \n    digitalWrite (relayIn, LOW);        \n  }                                      \n}                                     \n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Finished Controller<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">With hardware and software together, we have a finished RP2040-based prototype controller.<\/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\/pinball-ball-detector\/246-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"682\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/246-pinball-ball-detector-1024x682.jpg\" alt=\"Sensor and relay modules and Pico all powered, but not activated\" class=\"wp-image-31640\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/246-pinball-ball-detector-1024x682.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/246-pinball-ball-detector-300x200.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/246-pinball-ball-detector-768x511.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/246-pinball-ball-detector-1536x1022.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/246-pinball-ball-detector-850x566.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/246-pinball-ball-detector.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Sensor and relay modules and Pico all powered, but not activated<\/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\/pinball-ball-detector\/247-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"682\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/247-pinball-ball-detector-1024x682.jpg\" alt=\"Sensor and relay modules and Pico all powered and also activated\" class=\"wp-image-31641\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/247-pinball-ball-detector-1024x682.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/247-pinball-ball-detector-300x200.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/247-pinball-ball-detector-768x511.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/247-pinball-ball-detector-1536x1022.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/247-pinball-ball-detector-850x566.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/247-pinball-ball-detector.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Sensor and relay modules and Pico all powered and also activated<\/figcaption><\/figure>\n<\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\" id=\"yd-rp2040\"\/>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><span style=\"text-decoration: underline;\">YD-RP2040 NANO<\/span><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Introduction<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The VCC-GND Studio YD-RP2040 is an RP2040-based microcontroller board similar to the ATMega328p-based Nano microcontroller board.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This board is the first used in this series of articles to include an on-board multi-colour light &#8211; its own RGB LED module. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">With the use of this added LED module (called a &#8216;<a href=\"https:\/\/learn.adafruit.com\/adafruit-neopixel-uberguide?gad_source=1\" target=\"_blank\" rel=\"noreferrer noopener\">NeoPixel<\/a>&#8216;), we have switched from a behind-the-scenes controller to a module which may be playfield or backbox top mounted to add visual effect(s). <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">And, we don\u2019t have to stop with the single LED NeoPixel of this module. NeoPixels come in a wide variety of <a href=\"https:\/\/learn.adafruit.com\/adafruit-neopixel-uberguide\/form-factors\" target=\"_blank\" rel=\"noreferrer noopener\">forms<\/a>, any of which could be added to give complex lighting effects to the playfield or backbox. The single NeoPixel is only used here as a very singular example to give you some idea of what NeoPixels can do.<\/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\/pinball-ball-detector\/221-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"531\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/221-pinball-ball-detector-1024x531.jpg\" alt=\"The VCC-GND Studio YD-RP2040's features\" class=\"wp-image-31562\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/221-pinball-ball-detector-1024x531.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/221-pinball-ball-detector-300x156.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/221-pinball-ball-detector-768x398.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/221-pinball-ball-detector-1536x797.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/221-pinball-ball-detector-850x441.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/221-pinball-ball-detector.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">The VCC-GND Studio YD-RP2040&#8217;s features<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Boards<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Some boards utilizing the RP2040 module, such as the ones below, include NeoPixel(s).  The top board also includes a button (labelled &#8216;USR&#8217;) which we can use as a convenient manually-activated input device for easy prototype testing.<\/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\/pinball-ball-detector\/222-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"1024\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/222-pinball-ball-detector-1024x1024.jpg\" alt=\"Boards with at least one NeoPixel\" class=\"wp-image-31563\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/222-pinball-ball-detector-1024x1024.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/222-pinball-ball-detector-300x300.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/222-pinball-ball-detector-150x150.jpg 150w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/222-pinball-ball-detector-768x768.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/222-pinball-ball-detector-1536x1536.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/222-pinball-ball-detector-850x850.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/222-pinball-ball-detector.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Boards with one or more NeoPixels<\/figcaption><\/figure>\n<\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/251-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"900\" height=\"948\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/251-pinball-ball-detector.jpg\" alt=\"The features of the VCC-GND Studio YD-RP2040 board\" class=\"wp-image-31659\" style=\"width:550px\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/251-pinball-ball-detector.jpg 900w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/251-pinball-ball-detector-285x300.jpg 285w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/251-pinball-ball-detector-768x809.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/251-pinball-ball-detector-850x895.jpg 850w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/a><figcaption class=\"wp-element-caption\">The features of the VCC-GND Studio YD-RP2040 board<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Breakout Boards<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On a related note, NeoPixel breakout boards are also available for the Raspberry Pi Pico.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"646\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/223-pinball-ball-detector-1024x646.jpg\" alt=\"Raspberry Pi Pico wearing an LED matrix \u2018hat\u2019\" class=\"wp-image-31564\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/223-pinball-ball-detector-1024x646.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/223-pinball-ball-detector-300x189.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/223-pinball-ball-detector-768x484.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/223-pinball-ball-detector-1536x969.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/223-pinball-ball-detector-850x536.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/223-pinball-ball-detector.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Raspberry Pi Pico wearing an LED matrix \u2018hat\u2019<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Arduino IDE<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This RP2040-based microcontroller board is supported in the <a href=\"https:\/\/arduino-pico.readthedocs.io\/\" target=\"_blank\" rel=\"noreferrer noopener\">Arduino IDE<\/a>, as a &#8216;Sparkfun ProMicro RP2040&#8217; board.<\/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\/pinball-ball-detector\/224-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"547\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/224-pinball-ball-detector-1024x547.jpg\" alt=\"The RP2040-based microcontroller board in the Arduino IDE\" class=\"wp-image-31565\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/224-pinball-ball-detector-1024x547.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/224-pinball-ball-detector-300x160.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/224-pinball-ball-detector-768x410.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/224-pinball-ball-detector-1536x820.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/224-pinball-ball-detector-850x454.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/224-pinball-ball-detector.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">The RP2040-based microcontroller board in the Arduino IDE<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Sketch<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We will have to investigate the well-commented sketch further.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s first give credit where due, to Adafruit Industries who provided their own example; the original <a href=\"https:\/\/github.com\/adafruit\/Adafruit_NeoPixel\/blob\/master\/examples\/buttoncycler\/buttoncycler.ino\" data-type=\"link\" data-id=\"https:\/\/github.com\/adafruit\/Adafruit_NeoPixel\/blob\/master\/examples\/buttoncycler\/buttoncycler.ino\" target=\"_blank\" rel=\"noreferrer noopener\">&#8216;buttoncycler&#8217; sketch<\/a>.<\/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\/pinball-ball-detector\/233-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"794\" height=\"1024\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/233-pinball-ball-detector-794x1024.jpg\" alt=\"The edited 'buttoncycler' sketch with the required library and definitions\" class=\"wp-image-31626\" style=\"width:550px\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/233-pinball-ball-detector-794x1024.jpg 794w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/233-pinball-ball-detector-233x300.jpg 233w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/233-pinball-ball-detector-768x991.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/233-pinball-ball-detector-850x1097.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/233-pinball-ball-detector.jpg 900w\" sizes=\"auto, (max-width: 794px) 100vw, 794px\" \/><\/a><figcaption class=\"wp-element-caption\">The edited &#8216;buttoncycler&#8217; sketch with the required library and definitions<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">This sketch requires a few things.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Line #34: Inclusion of the &#8220;<a href=\"https:\/\/github.com\/adafruit\/Adafruit_NeoPixel\">Adafruit_NeoPixel.h<\/a>&#8221; library.<br><em>Note: If a NeoMatrix were used instead, the <a href=\"https:\/\/github.com\/adafruit\/Adafruit_NeoMatrix\">Adafruit_NeoMatrix.h<\/a> library must be included instead.<\/em><br><\/li>\n\n\n\n<li>Line #42: Defining of the \u201cBUTTON_PIN\u201d. <br><em>Note: Do not hook a microcontroller directly to the switches on your pinball machine as damage to one or both may occur.<\/em><br><\/li>\n\n\n\n<li>Line #44: Defining of the \u201cPIXEL_PIN\u201d.<br> and<\/li>\n\n\n\n<li>Line #46: Defining of the \u201cPIXEL_COUNT\u201d.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">There is also a setup required for your selected NeoPixel brightness.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Line #66: Setting the brightness of the NeoPixel via \u201cstrip.setBrightness\u201d. <br><em>Note: This value is user-selectable from \u20180\u2019 (off) to \u2018255\u2019 (maximum brightness).<\/em><\/li>\n<\/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\/pinball-ball-detector\/253-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"900\" height=\"743\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/253-pinball-ball-detector.jpg\" alt=\"The chosen brightness of 15 out of 255, for prototyping purposes\" class=\"wp-image-31680\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/253-pinball-ball-detector.jpg 900w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/253-pinball-ball-detector-300x248.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/253-pinball-ball-detector-768x634.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/253-pinball-ball-detector-850x702.jpg 850w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/a><figcaption class=\"wp-element-caption\">The chosen brightness of 15 out of 255, for prototyping purposes<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Once defined, the brightness level is set for the entire sketch.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Shown below is the main loop where nine different lighting effects are configured in a wrap-around set. These cases can be changed and\/or added to as you deem necessary.<\/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\/pinball-ball-detector\/235-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"838\" height=\"1024\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/235-pinball-ball-detector-838x1024.jpg\" alt=\"The main loop with the different light shows\" class=\"wp-image-31628\" style=\"width:550px\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/235-pinball-ball-detector-838x1024.jpg 838w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/235-pinball-ball-detector-245x300.jpg 245w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/235-pinball-ball-detector-768x939.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/235-pinball-ball-detector-850x1039.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/235-pinball-ball-detector.jpg 900w\" sizes=\"auto, (max-width: 838px) 100vw, 838px\" \/><\/a><figcaption class=\"wp-element-caption\">The main loop with the different light shows<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">The main disadvantage of this easy example is that, once started, each case must complete. That is, pushing the USR button (or triggering the input pin with a IR module) will not advance to the next light show while the previous one is still running.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here&#8217;s the entire sketch:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ ArduinoNeoPixelButton.INO\n\n\/*\nLightly edited by Pinball News\nFebruary, 2024\n*\/\n\n\/*\nOriginal example code from Adafruit Industries\nAdafruit Industries\nhttp:&#47;&#47;adafruit.com\nAdafruit_NeoPixel\/examples\/buttoncycler\n\/buttoncycler.ino\n*\/\n\n\/*\nAdafruit_NeoPixel.h\nadafruit\/Adafruit_NeoPixel \nhttps:\/\/github.com\/adafruit\/Adafruit_NeoPixel\n*\/\n\n\/*\nThe Magic of NeoPixels\nhttps:\/\/learn.adafruit.com\/adafruit-neopixel-uberguide\/the-magic-of-neopixels\n*\/\n\n\/\/ Simple demonstration on using an input device to trigger changes on your\n\/\/ NeoPixels. Wire a momentary push button to connect from ground to a\n\/\/ digital IO pin. When the button is pressed it will change to a new pixel\n\/\/ animation. Initial state has all pixels off -- press the button once to\n\/\/ start the first animation. As written, the button does not interrupt an\n\/\/ animation in-progress, it works only when idle.\n\n#include &lt;Adafruit_NeoPixel.h>\n#ifdef __AVR__\n #include &lt;avr\/power.h> \/\/ Required for 16 MHz Adafruit Trinket\n#endif\n\n\/\/ Digital IO pin connected to the button. This will be driven with a\n\/\/ pull-up resistor so the switch pulls the pin to ground momentarily.\n\/\/ On a high -> low transition the button press logic will execute.\n#define BUTTON_PIN  24\n\n#define PIXEL_PIN   23  \/\/ Digital IO pin connected to the NeoPixels.\n\n#define PIXEL_COUNT 1   \/\/ Number of NeoPixels\n\n\/\/ Declare our NeoPixel strip object:\nAdafruit_NeoPixel strip(PIXEL_COUNT, PIXEL_PIN, NEO_GRB + NEO_KHZ800);\n\/\/ Argument 1 = Number of pixels in NeoPixel strip\n\/\/ Argument 2 = Arduino pin number (most are valid)\n\/\/ Argument 3 = Pixel type flags, add together as needed:\n\/\/   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w\/WS2812 LEDs)\n\/\/   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)\n\/\/   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)\n\/\/   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)\n\/\/   NEO_RGBW    Pixels are wired for RGBW bitstream (NeoPixel RGBW products)\n\nboolean oldState = HIGH;\nint     mode     = 0; \/\/ Currently-active animation mode, 0-9\n\nvoid setup() {\n  pinMode(BUTTON_PIN, INPUT_PULLUP);\n  strip.begin(); \/\/ Initialize NeoPixel strip object (REQUIRED)\n  strip.show(); \/\/ Initialize all pixels to 'off'\n  strip.setBrightness(15); \/\/ Set BRIGHTNESS to 15 (max = 255)\n}\n\nvoid loop() {\n  \/\/ Get current button state.\n  boolean newState = digitalRead(BUTTON_PIN);\n\n  \/\/ Check if state changed from high to low (button press).\n  if((newState == LOW) &amp;&amp; (oldState == HIGH)) {\n    \/\/ Short delay to debounce button.\n    delay(20);\n    \/\/ Check if button is still low after debounce.\n    newState = digitalRead(BUTTON_PIN);\n    if(newState == LOW) {      \/\/ Yes, still low\n      if(++mode > 8) mode = 0; \/\/ Advance to next mode, wrap around after #8\n      switch(mode) {           \/\/ Start the new animation...\n        case 0:\n          colorWipe(strip.Color(  0,   0,   0), 50);    \/\/ Black\/off\n          break;\n        case 1:\n          colorWipe(strip.Color(255,   0,   0), 50);    \/\/ Red\n          break;\n        case 2:\n          colorWipe(strip.Color(  0, 255,   0), 50);    \/\/ Green\n          break;\n        case 3:\n          colorWipe(strip.Color(  0,   0, 255), 50);    \/\/ Blue\n          break;\n        case 4:\n          theaterChase(strip.Color(127, 127, 127), 50); \/\/ White\n          break;\n        case 5:\n          theaterChase(strip.Color(127,   0,   0), 50); \/\/ Red\n          break;\n        case 6:\n          theaterChase(strip.Color(  0,   0, 127), 50); \/\/ Blue\n          break;\n        case 7:\n          rainbow(10);\n          break;\n        case 8:\n          theaterChaseRainbow(50);\n          break;\n      }\n    }\n  }\n\n  \/\/ Set the last-read button state to the old state.\n  oldState = newState;\n}\n\n\/\/ Fill strip pixels one after another with a color. Strip is NOT cleared\n\/\/ first; anything there will be covered pixel by pixel. Pass in color\n\/\/ (as a single 'packed' 32-bit value, which you can get by calling\n\/\/ strip.Color(red, green, blue) as shown in the loop() function above),\n\/\/ and a delay time (in milliseconds) between pixels.\nvoid colorWipe(uint32_t color, int wait) {\n  for(int i=0; i&lt;strip.numPixels(); i++) { \/\/ For each pixel in strip...\n    strip.setPixelColor(i, color);         \/\/  Set pixel's color (in RAM)\n    strip.show();                          \/\/  Update strip to match\n    delay(wait);                           \/\/  Pause for a moment\n  }\n}\n\n\/\/ Theater-marquee-style chasing lights. Pass in a color (32-bit value,\n\/\/ a la strip.Color(r,g,b) as mentioned above), and a delay time (in ms)\n\/\/ between frames.\nvoid theaterChase(uint32_t color, int wait) {\n  for(int a=0; a&lt;10; a++) {  \/\/ Repeat 10 times...\n    for(int b=0; b&lt;3; b++) { \/\/  'b' counts from 0 to 2...\n      strip.clear();         \/\/   Set all pixels in RAM to 0 (off)\n      \/\/ 'c' counts up from 'b' to end of strip in steps of 3...\n      for(int c=b; c&lt;strip.numPixels(); c += 3) {\n        strip.setPixelColor(c, color); \/\/ Set pixel 'c' to value 'color'\n      }\n      strip.show(); \/\/ Update strip with new contents\n      delay(wait);  \/\/ Pause for a moment\n    }\n  }\n}\n\n\/\/ Rainbow cycle along whole strip. Pass delay time (in ms) between frames.\nvoid rainbow(int wait) {\n  \/\/ Hue of first pixel runs 3 complete loops through the color wheel.\n  \/\/ Color wheel has a range of 65536 but it's OK if we roll over, so\n  \/\/ just count from 0 to 3*65536. Adding 256 to firstPixelHue each time\n  \/\/ means we'll make 3*65536\/256 = 768 passes through this outer loop:\n  for(long firstPixelHue = 0; firstPixelHue &lt; 3*65536; firstPixelHue += 256) {\n    for(int i=0; i&lt;strip.numPixels(); i++) { \/\/ For each pixel in strip...\n      \/\/ Offset pixel hue by an amount to make one full revolution of the\n      \/\/ color wheel (range of 65536) along the length of the strip\n      \/\/ (strip.numPixels() steps):\n      int pixelHue = firstPixelHue + (i * 65536L \/ strip.numPixels());\n      \/\/ strip.ColorHSV() can take 1 or 3 arguments: a hue (0 to 65535) or\n      \/\/ optionally add saturation and value (brightness) (each 0 to 255).\n      \/\/ Here we're using just the single-argument hue variant. The result\n      \/\/ is passed through strip.gamma32() to provide 'truer' colors\n      \/\/ before assigning to each pixel:\n      strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue)));\n    }\n    strip.show(); \/\/ Update strip with new contents\n    delay(wait);  \/\/ Pause for a moment\n  }\n}\n\n\/\/ Rainbow-enhanced theater marquee. Pass delay time (in ms) between frames.\nvoid theaterChaseRainbow(int wait) {\n  int firstPixelHue = 0;     \/\/ First pixel starts at red (hue 0)\n  for(int a=0; a&lt;30; a++) {  \/\/ Repeat 30 times...\n    for(int b=0; b&lt;3; b++) { \/\/  'b' counts from 0 to 2...\n      strip.clear();         \/\/   Set all pixels in RAM to 0 (off)\n      \/\/ 'c' counts up from 'b' to end of strip in increments of 3...\n      for(int c=b; c&lt;strip.numPixels(); c += 3) {\n        \/\/ hue of pixel 'c' is offset by an amount to make one full\n        \/\/ revolution of the color wheel (range 65536) along the length\n        \/\/ of the strip (strip.numPixels() steps):\n        int      hue   = firstPixelHue + c * 65536L \/ strip.numPixels();\n        uint32_t color = strip.gamma32(strip.ColorHSV(hue)); \/\/ hue -> RGB\n        strip.setPixelColor(c, color); \/\/ Set pixel 'c' to value 'color'\n      }\n      strip.show();                \/\/ Update strip with new contents\n      delay(wait);                 \/\/ Pause for a moment\n      firstPixelHue += 65536 \/ 90; \/\/ One cycle of color wheel over 90 frames\n    }\n  }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Finished Controller<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For the software portion, the \u201cBUTTON_PIN\u201d, \u201cPIXEL_PIN\u201d, \u201cPIXEL_COUNT\u201d, and \u201cNeoPixel strip object\u201d were all selected to match the hardware we are using &#8211; in this case, the VCC-GND Studio YD-RP2040. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you wanted to use a different board or alternative NeoPixel type, you would have to select the pin values and NeoPixel object to match.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The VCC-GND Studio YD-RP2040 was chosen as an example board for its singular NeoPixel and pre-mounted user button. By referring to the previous Pinball Ball Detector set of articles in this series (<a href=\"https:\/\/www.pinballnews.com\/site\/2024\/02\/02\/pinball-ball-detector-part-one\/\" data-type=\"link\" data-id=\"https:\/\/www.pinballnews.com\/site\/2024\/02\/02\/pinball-ball-detector-part-one\/\" target=\"_blank\" rel=\"noreferrer noopener\">Part One<\/a> and <a href=\"https:\/\/www.pinballnews.com\/site\/2024\/02\/02\/pinball-ball-detector-part-two\/\" data-type=\"link\" data-id=\"https:\/\/www.pinballnews.com\/site\/2024\/02\/02\/pinball-ball-detector-part-two\/\" target=\"_blank\" rel=\"noreferrer noopener\">Part Two<\/a>) you can determine how to add the IR and relay modules to almost any controller module, and get those modules to work in conjunction with the detection of pinball(s) inside your pinball machine.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">With hardware and software together, we have a finished RP2040-based prototype controller.<\/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\/pinball-ball-detector\/236-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"602\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/236-pinball-ball-detector-1024x602.jpg\" alt=\"The YD-RP2040 board powered with NeoPixel at 'case 0' (OFF)\" class=\"wp-image-31629\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/236-pinball-ball-detector-1024x602.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/236-pinball-ball-detector-300x176.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/236-pinball-ball-detector-768x451.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/236-pinball-ball-detector-1536x902.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/236-pinball-ball-detector-850x499.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/236-pinball-ball-detector-413x244.jpg 413w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/236-pinball-ball-detector.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">The YD-RP2040 board powered with NeoPixel at &#8216;case 0&#8217; (OFF)<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><\/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\/pinball-ball-detector\/237-pinball-ball-detector.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"602\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/237-pinball-ball-detector-1024x602.jpg\" alt=\"The YD-RP2040 board powered with NeoPixel at 'case 7' (Rainbow)\" class=\"wp-image-31630\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/237-pinball-ball-detector-1024x602.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/237-pinball-ball-detector-300x176.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/237-pinball-ball-detector-768x451.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/237-pinball-ball-detector-1536x902.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/237-pinball-ball-detector-850x499.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/237-pinball-ball-detector-413x244.jpg 413w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-ball-detector\/237-pinball-ball-detector.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">The YD-RP2040 board powered with NeoPixel at &#8216;case 7&#8217; (Rainbow)<\/figcaption><\/figure>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>In his new two-part article, Todd Andersen shows us how to build a microcontroller-based pinball ball detector to trigger add-ons such as toppers or enhanced lighting effects.<\/p>\n","protected":false},"author":2,"featured_media":31646,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[1943,148,1909,149,2044,1938,2056,2045],"class_list":["post-31533","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-learn","tag-add-on","tag-arduino","tag-ir","tag-led","tag-module","tag-nano","tag-raspberry-pi","tag-topper"],"_links":{"self":[{"href":"https:\/\/www.pinballnews.com\/site\/wp-json\/wp\/v2\/posts\/31533","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=31533"}],"version-history":[{"count":9,"href":"https:\/\/www.pinballnews.com\/site\/wp-json\/wp\/v2\/posts\/31533\/revisions"}],"predecessor-version":[{"id":31718,"href":"https:\/\/www.pinballnews.com\/site\/wp-json\/wp\/v2\/posts\/31533\/revisions\/31718"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pinballnews.com\/site\/wp-json\/wp\/v2\/media\/31646"}],"wp:attachment":[{"href":"https:\/\/www.pinballnews.com\/site\/wp-json\/wp\/v2\/media?parent=31533"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pinballnews.com\/site\/wp-json\/wp\/v2\/categories?post=31533"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pinballnews.com\/site\/wp-json\/wp\/v2\/tags?post=31533"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}