PIN-‘UINO

Using an Arduino in pinball projects

What is a pin-‘Uino? The term is a portmanteau of the words pinball and Arduino. As you are probably reading this article in Pinball News’s Learn How section, you may be familiar with pinball machines. However, you may not be familiar with the Arduino.

Arduino is an open-source platform for ATmega 168 and 328 microcontrollers. You can use the microcontroller as part of your own custom pinball add-ons, modifications and toppers.

Arduino is the American-branded version. Genuino is the version branded for the rest of the world. Save labeling differences, both boards are very similar. An Arduino UNO board and Genuino UNO board are juxtaposed, below.

The Arduino and the Genuino
The Arduino and the Genuino

For more information about using an Arduino microcontroller, see the instructions put together for middle schoolers, Intro to Arduino. Be sure to read this instruction article before continuing with this project article (pin-‘Uino).

Don’t be fooled by the simplicity of the instructional article or this project article. Some very complex programs (sketches) can be run on most Arduino microcontrollers and their clones. In fact, entire pinball machines have been built using the surprisingly powerful Arduino and clever programming.

Old vs. New

In a set of previous Pinball News articles, we shared with you relay controllers you could use to make your own custom pinball add-ons, modifications, and toppers.

Note: See these articles for information, description of discrete electronic parts and where to purchase those parts.

As in the previous two articles, although we are still going to use a light dependant resistor (LDR), this third article moves on from using a simple relay controller to a microcontroller; namely the Arduino UNO (R3, 5 Volts).

Note: See the end of this article for additional parts and purchasing information.


Relay vs. Microcontroller

The discrete electronic component known as a relay is considered a ‘dumb’ device. We will be using a ‘smart’ (programmable) device; a microcontroller.

Though not capable of handling high power like a relay, with the 40 milliamp maximum peak (per pin) current handling capabilities of the UNO we can safely run a handful of Light Emitting Diodes (LEDs) to add new lamps to our pinball machines or pinball projects.

For the learning purpose of this project and as to NOT overload the microcontroller, we will be using a single indicating Light Emitting Diode (LED). An alternate sketch and additional add-on method for using a UNO microcontroller to light multiple LEDs are both mentioned later in this article, but they are not covered in much detail. If you want to light multiple LEDs see the links in the Intro to Arduino article and at the end of this article for more information.

In this primer article, we will be using either a single T-1 3/4 (ø5 mm) or T-3 1/4 (ø10 mm) radial leaded discrete electronic component. One of several colors will work. This type of LED usually requires about 20mA of direct current. Unfortunately, you can’t just plug an LED straight into your +5 Volt UNO. You must use a dropping resistor in series with the LED.

General +5V Rules for Indicator LEDs and their Dropping Resistors
LED Color RED ORANGE YELLOW GREEN BLUE WHITE
Nominal LED Voltage (DC) 1.5 2.0 2.0 2.5 3.0 3.5
Calculated Dropping Resistor Value (Ohms) 175 150 150 125 100 75
Nominal Dropping Resistor Value (Ohms) 200 150 150 150 100 100

The LED/resistor table was made specifically for use with +5 Volt Arduino boards. From the table, you can see that the smaller the voltage for a specific LED, the larger the Ohm value for its dropping resistor. The larger Ohm value of the dropping resistor, the greater voltage ‘dropped’ across that resistor.

For our purpose, a 1/4 Watt axial leaded resistor should work just fine. This dropping resistor needs to be rated at a 1/4 watt to handle the electrical power going through it. And, its lead thickness is good for plugging into the headers of the UNO.

Look back at the LED/resistor table, notice there are five different calculated dropping resistor Ohm values. From an electronics engineering viewpoint and in practical use, only three nominal Ohm values are needed: 200, 150, and 100 Ohm. This is because the calculated Ohm values are close enough to the nominal values when lighting discrete indicator-type LEDs.

From a literal human viewpoint, due to the way we humans perceive brightness it is hard for us to even notice the slight change in brightness; when we use a near value resistor versus the calculated value when lighting a LED. This is an example of the inverse-square law of light in effect with human eye physiology.

The LED/resistor table shows both actual calculated values and nominal values. The calculated values are real values, whereas the nominal values are easily chosen close values, either for convenience or practical availability. In this case, calculated resistor values are based on useful nominal voltage values for each LED color.


Calculate Dropping Resistors Values for Your Own LEDs

HINT 1: Remember, even if you calculate the actual dropping resistor value, you may only be able to easily purchase a close nominal value.

HINT 2: In the case of round-up to the neared available nominal value, you can see from the LED/resistor table and its explanations that an increased difference of even 25 Ohms won’t make any practical difference.

HINT 3: We’ve had great luck and even better results with (and l-o-v-e) ‘Gumdrop LEDs’. Use your favorite search engine if you want to find them.

You may either use the table provided as a practical reference, or you may choose to calculate the actual dropping resistor value (Rdrop) for your own LED. If you wish to calculate the actual value of you own dropping resistor, start by using the operating voltage of your UNO. Additionally, you will need to know the following:

  • Voltage In (Vin)
    This value is 5.0 for five volt UNO boards.
  • LED Voltage (Vled)
    See the seller’s specifications.
  • LED Current (Iled)
    See the seller’s specifications.

The following formula is based on Ohm’s Law. Use the actual values above in the formula below:

Rdrop = (VinVled) / Iled

When reviewing manufacturer’s specification, you many need to substitute the following technical names in the formula below:

  • Voltage In (Vin)
    This value is 5.0 for five volt UNO boards.
  • LED Voltage (Vf)
    See the manufacturer’s specifications.
  • LED Current (If)
    See the manufacturer’s specifications.

R = (VinVf) / If

If you chose to perform the dropping resistor calculation (Rdrop or R), why not use your UNO?

Enter the following sketch into your UNO to easily calculate the value of Rdrop or R.

NOTE 1: This program has been released under GPL. Freely use and modify the CalcLEDDropResist sketch.

NOTE 2: In order to use communication via the Serial Monitor window, you will need to keep a USB cable connected between your computer and your UNO.

The Calc_LED_Drop_Resist.INO sketch is a simple Ohm’s Law calculator/solver for single resistor/LED combinations.

Open the Arduino application and copy/paste the following sketch over the entire staring program in a new sketchbook window. Save the sketch as Calc_LED_Drop_Resist.INO. For information on how to do this, see Intro to Arduino.

/* CalcLEDDropResist.INO
Todd Andersen
06-JAN-17This sketch requests users to enter specific values in the Serial Monitor
Those values are used to calculate the value of the LED Dropping ResistorDropping Resistor Value (Rdrop)
Voltage In (Vin)
LED Voltage (Vled)
LED Current (Iled)
R = (Vin – Vled) / Iled
*/#include “math.h” // Include the Math Library
float Vin;
float Vled;
float Iled;
float Rdrop;
char junk = ‘ ‘;void setup(){ // Setup sketch
Serial.begin(9600); // Serial Terminal baud (9600 bps)
Serial.println(“”);
Serial.flush();
}void loop(){ // Calculate Rdrop
Serial.println(“Calculate the value for your Dropping Resistor, ‘Rdrop'”);
Serial.println(“Enter the voltage for ‘Vin’, Press ENTER”);
while (Serial.available()==0); // Wait here until input buffer has a character
{
Vin = Serial.parseFloat(); // Input Vin
Serial.print(“Vin = “); Serial.println(Vin,DEC/10);
while (Serial.available()>0) // Serial.parseFloat(), User input
{junk = Serial.read();} // Clear keyboard buffer
}Serial.println(“Enter the voltage for ‘Vled’, Press ENTER”);
while (Serial.available()==0);
{
Vled = Serial.parseFloat(); // Input Vled
Serial.print(“Vled = “); Serial.println(Vled,DEC/10);
while (Serial.available()>0)
{junk = Serial.read();}
}Serial.println(“Enter the milliamps for ‘Iled’, Press ENTER”);
while (Serial.available()==0);
{
Iled = Serial.parseFloat(); // Input Iled
Serial.print(“Iled = “); Serial.println(Iled,DEC/10);
while (Serial.available()>0)
{junk = Serial.read();}
}Rdrop = ((float(Vin-Vled)/Iled)*1000);Serial.print(“Dropping Resistor = “);
Serial.print(Rdrop,(DEC/100));
Serial.println(” Ohms”);
Serial.println(“”);
Serial.println(“”);
}

You should see something similar to the following:

The CalcLEDDropResist.ino sketch
The CalcLEDDropResist.ino sketch

Use your UNO to calculate dropping resistor values:

  • Click the magnifying glass in the upper right corner of the sketchbook window
  • A Serial Monitor window will open
  • Follow the on-screen instructions
  • Enter the requested values in the top line
The Serial Monitor window
The Serial Monitor window

Use the specific values from the Manufacturer’s specifications:

  • Enter all the requested values: Vin, Vled and Iled
  • The dropping resistor value will be given with the last ‘Press ENTER’

NOTE: The sketch will then automatically reset; for you to calculate as many dropping resistor values as you need.

The dropping resistor value
The dropping resistor value

Making your Connections

In the end, programming comes down to just ones (1s) and zeros (0s). Due to limitations such as these, programmers must find creative solutions to complete their projects.

One creative solution can save us from having to solder. That solution is to use a clever combination of (2.54mm / 0.1 inch DuPont connector) male and female jumper cables.

The right combination of a variety of jumper cables works surprisingly well, using a little hot glue to shore up each junction.

The following pictures show such DuPont jumper cables, on their own and in use.

Dupont jumper cables
Dupont jumper cables
Male and female jumpers
Male and female jumpers
Using jumper cables to connect the LED
Using jumper cables to connect the LED

UNO Board LED/Resistor Jumper Cable:

  • Plug one end of your dropping resistor into the ‘GND’ pin, near pin ’11’
  • Plug the other end of your dropping resistor into one end of a jumper cable with female to female ends
  • Use a second jumper cable with male to female ends to connect between the first jumper cable and one lead of your LED
  • Use a third jumper cable with two female ends to plug into the other lead of your LED
  • Use a fourth jumper cable with two male ends to connect between the third jumper cable and pin ’11’

TROUBLESHOOTING: If your LED does not light after you run your UNO sketch, simply turn around the LED.

LED connections to the UNO
LED connections to the UNO

LDR on the UNO board:

  • Plug one end of the LDR, into the ‘GND’ pin
  • Plug the other end of the LDR, into pin ‘AO’
  • Plug one end of the 10 KOhm resistor into pin ‘AO’
  • Plug the other end of the 10 KOhm resistor, into pin ‘5V’

NOTE: You may also remotely mount the LDR on jumper cables, although it may be best to keep it on the UNO board.

Mounting the LDR and 10K resistor
Mounting the LDR and 10K resistor

IMPORTANT NOTE: When you are all done with wiring and programming, be sure to put your microcontroller LDR into a project box or use some other means to ensure your UNO project and its components don’t short to anything.

Upload the pin_uino.INO Sketch

NOTE 1: This program has been released under GPL. Freely use and modify the pin_uino sketch.

NOTE 2: In order to use communication via the Serial Monitor window, you will need to keep a USB cable connected between your computer and your UNO.

The pinUino.INO sketch turns on a single LED when the value read from the LDR is above a certain threshold, eg. during normal game play, when all the GI lights of your pinball machine are lit.

Open the Arduino application and copy/paste the following sketch over the entire staring program in a new sketchbook window. Save the sketch as pin_uino.INO. For information on how to do this, see Intro to Arduino.

/*
pin_uino.INO
Todd Andersen
01-JAN-17This example demonstrates the use of an “if (then) / else” statement.
It reads the state of an LDR (an analog input) and turns on a LED.
It prints the analog value regardless of any software or hardware inputs.The circuit:
The LDR is connected between AO and GND
The 10 KOhm Resistor is connected between AO and 5V
The LED is connected, through a dropping resistor, between pin 11 and GND
*/// Constants to set up sketch parameters
const int analogPin1 = A0;   // Pin that the sensor is attached
const int analogValue;          // Value from sensor pins
const int ledPin1 = 11;          // pin that the LED is attached
const int threshold = 500;     // threshold level in the range of the LDR in usevoid setup(){
// initialize the LED pin as an output
pinMode(ledPin1, OUTPUT);
// initialize serial communications
Serial.begin(9600);
}void loop(){
// Read the value of the LDR
int analogValue = (analogRead (analogPin1));// If the analog value is high enough, turn on the LED
if (analogValue > threshold )
{digitalWrite(ledPin1, HIGH);}
else {digitalWrite(ledPin1, LOW);}// print the analog value
Serial.println(analogValue);
delay(250);
}

You should see something similar to the following:

The pin_uino sketch
The pin_uino sketch

LDR practical values:

  • Upload the program to your UNO
  • Click the magnifying glass in the upper right corner of the sketchbook window
  • A new Serial Monitor window will open
  • Change the amount of light falling on the LED
  • Vary that the readings change in the Serial Monitor window

NOTE: These reading can give you some idea of the useful range values of your specific LDR.

The LDR readings
The LDR readings

IMPORTANT NOTE: When you are all done with wiring and programming, be sure to put your microcontroller LDR into a project box. Or, use some other means to ensure your Arduino project and its components don’t short to anything.

TROUBLESHOOTING: If your LED doe not light after you run your UNO sketch, simply turn around the LED.

Software vs. Hardware

One advantage of using a microcontroller is the ease of using software changes over hardware changes.

Keeping the same hardware configuration, you can make the LED turn off when a certain value is read from the LDR. eg. during ‘blackout’ mode, just before multiball mode. Simply change one number in your software. Unlike in the other two articles mentioned at the beginning of this article, there is no need to rewire components.

To change from Light Sensing to Dark Sensing, simply change the greater-than sign in:

if (analogValue > threshold )

to a less-than sign:

if (analogValue < threshold )

 

Don’t forget to also change your comment from:

// If the analog value is high enough, turn on the LED

to:

// If the analog value is low enough, turn on the LED

 

Is the LED changing states not quite as you expected?

Simply change the number value of the threshold in:

const int threshold = 500;     // threshold level in the range of the LDR in use

to adjust the event threshold.

  • A lesser value will create a lower threshold (trip point)
  • A greater value will create a higher threshold (trip point)

NOTE 1: The values from the Serial Monitor can help you select a useable threshold.

NOTE 2: Almost any LDR can be used with an adjustment in software.


Boring . . . what else can I program my microcontroller to make the LED do?

You can make the LED blink, flash, fade, and perform other visual effects. Use the built-in examples of the Arduino software, and the built-in LED of the UNO board to see some of the ways you can light an LED. Be sure to explore all the built-in examples, not just ‘Blink’.

Navigate (drill down) to: File Examples 01.Basics Blink

The 'Blink' example
The ‘Blink’ example

Where do I get programs to use with my project?

Now may be the time for you to start writing your own sketches. However, one last sketch is included with this article:
Conditional_If_Statements_with_Hysteresis.INO
.

This sketch lights two LEDs, one for each of two different conditions.

NOTE 1: The potentiometer may be replaced with a LDR

NOTE 2: Move the jumper side of the LED in the previous set up from pin ’11’ to pin ‘9’.

NOTE 3 In order to use communication via the Serial Monitor window, you will need to keep a USB cable connected between your computer and your UNO.

NOTE 4: Use the resources previously mentioned in this article for help.

NOTE 5: This program has been released under GPL. Freely use and modify the Conditional_If_Statements_with_Hysteresis sketch.

Put the following sketch in a new sketchbook window. Save the sketch as Conditional_If_Statements_with_Hysteresis.INO and view the Serial Monitor window as previously shown in this article.

/*
Conditional_If_Statements_with_Hysteresis.INOThis example demonstrates the use of if (then) / else statements.
It reads the state of a potentiometer (an analog input) and turns on LEDs.
It prints the analog value regardless of the level.The circuit:
* potentiometer connected to analog pin 0.
Center pin of the potentiometer goes to the analog pin.
side pins of the potentiometer go to +5V and ground
* 1st LED connected, through a dropping resistor, from digital pin 9 to ground
* 2nd LED connected, through a dropping resistor, from digital pin 13 to ground
* Note: On most Arduino boards, there is already an LED on the board connected to pin 13, so you don’t need any extra components to use that LEDcreated 17 Jan 2009
modified 9 Apr 2012
by Tom Igoe
modified 19 Oct 2016
by Todd AndersenThis example code is in the public domain.http://www.arduino.cc/en/Tutorial/IfStatement*/// These constants won’t change:
const int analogPin = A0;    // pin that the sensor is attached to
const int ledPin1 = 9;          // pin that the 1st LED is attached to
const int ledPin2 = 13;        // pin that the 2nd LED is attached to
const int threshold = 500;   // an arbitrary threshold level that’s in the range of the analog input
const int hysteresis = 5;      // an arbitrary hysteresis levelvoid setup() {
// initialize the LED pin as an output:
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
// initialize serial communications:
Serial.begin(9600);
}void loop() {
// read the value of the potentiometer:
int analogValue = analogRead(analogPin);// if the analog value is high enough, turn on the 1st LED:
if (analogValue > threshold + hysteresis) {
digitalWrite(ledPin1, HIGH);
} else {
digitalWrite(ledPin1, LOW);
}// if the analog value is low enough, turn on the 2nd LED:
if (analogValue < threshold – hysteresis) {
digitalWrite(ledPin2, HIGH);
} else {
digitalWrite(ledPin2, LOW);
}// print the analog value:
Serial.println(analogValue);
delay(250);        // delay in between reads for stability
}

Luckily for us, Arduino is open source. Just use your favorite search engine to search for example programs, additional help and other useful resources.


Must my UNO Stay Plugged into my Computer?

Once programmed, your Arduino can continuously run a loaded sketch without your computer. Just apply the proper power.

To power a project needing 1 Amp or less of peak current, you can use a spare USB cable (like you used to program your UNO) and an AC/DC (+5 Volt DC @ 2 Amp) USB phone charger. See the following picture of a custom holiday pinball topper.

USB Phone Charger to Project:

  • Plug the charger into: an extension cord, a nearby wall outlet, or your pinball machine’s utility jack.
  • Plug the USB cord between the charger and your UNO project.
“It’s a major award!”
“It’s a major award!”

To power a more power-hungry project, use a Positive 9 to 12 Volt Direct Current (DC) power supply; rated at twice the estimated peak current of your project. For several Arduino boards, including the UNO, that power supply will need to have a 2.1 mm center-positive plug; which friction fits into the board’s power jack.


So where can I get one of these awesome microcontrollers and make my own pin-‘Uino project?

This article introduced you to the Arduino/Genuino UNO. This microcontroller has several different ‘flavours’ and ‘shrinkified’ versions. Use your favorite search engine and the links at the end of this article to learn about different boards and where to purchase them.


Add-ons

There are many useful add-ons for the UNO. These add-ons may help you in the learning and prototyping stages, and may even keep you from having to solder your final project.

A board which plugs directly into the UNO main board is called a ‘shield’. To name just a few, there are: Breadboard Shield (for directly plugging in discrete components), LED Shield (for multiple and/or multi-color LEDs), Motor Shield (for driving different motors), and Relay Shield (for controlling power to other devices).

Use your favorite search engine and the links at the end of this article to learn about different shields and where to purchase them. Any type of shield can usually be purchased preassembled. If you buy your shield as a kit, you can assemble it yourself and use the experience to practice soldering.

Pictured below is a Breadboard Shield.

The Breadboard Shield
The Breadboard Shield

What Else is Available for my UNO?

There are learning kits, project cases and various modules available for many Arduino/Genuino boards; not just the UNO.

This next example shows a 5 Volt Arduino/Genuino compatible module; a discrete RGB LED called NeoPixel. The NeoPixel has its own built it microcontroller and it can utilize ‘Libraries’. Libraries are sketches, put together by people from the Arduino/Genuino community to help make programming easier. The NeoPixel and Libraries are only mentioned in this introductory article to show just a tiny bit more of what you can do. Use your favorite search engine and the links at the end of this article to learn about different modules and where to purchase them.

Pictured below is a UNO/NeoPixel cycling through different colors and brightness levels. As the peak current requirements of this combination are only about 80 mA, a battery powered 1 Amp phone charger can easily power this set up for an entire night.

The UNO driving a NeoPixel
The UNO driving a NeoPixel

Built-In Help

Lucky for us, the Arduino software has built in help. Also, be sure to ‘Visit Arduino.cc‘.

Navigate to: HelpUser Chosen Section

The Arduino Help section
The Arduino Help section


Buy and Learn About Microcontroller Stuff from the Usual Suspects


Your pin-‘Uino Projects

Sorry, but Pinball News does not provide Arduino/Genuino support. However, we’d love to hear about and see your projects.

INTRO TO ARDUINO

An Arduino microcontroller

WHAT IS AN ARDUINO?

Great question! There are several versions (different board configurations) of the Arduino. An unofficial Arduino board is called a clone. We will be using a Five volt, ATmega328, Arduino Nano clone.

An Arduino is a standalone computer based on either the ATmega168 or ATmega328 microcontroller (µC); the 328 being the more recent and powerful.  The ATmega328 is a micro-chip using 32 Kbits of flash memory and 8 bit AVR processing.

We “talk” to the ATmega328, via USB, on computers using Windows or Apple software (among other software types). To program the ATmega, we use a simplified version of the C/C++ programming language. Fortunately, we don’t have to be programmers to use Arduino boards. We can use the Arduino Integrated Development Environment (IDE) to create and upload our programs (sketches).


AN ARDUINO CAN’T REALLY BE A COMPUTER, CAN IT?

Another great question and yes . . . yes it can!

The requirements for a machine to be a computer are:
– Clock [Crystal oscillating at 16 MHz (16,000,000 cycles per second)]
– Input (Mini-B USB Jack)
– Output [On-board Light Emitting Diodes (LEDs)]
– Power Source (+5 Volts of direct current provide by the computer’s USB port)
– Processor [ATmega328 Microcontroller (AT328)]
– Random Access Memory (RAM) [2 kilo-bytes (2,000 bytes) SRAM]
– Read Only Memory (ROM) [32 kilo-bytes (32,000 bytes) EEPROM]


WHERE IS ALL THAT STUFF?

Yet, another great question. Here’s one in return. “What did you have for breakfast, a great big bowl of great questions?”

Look at the two following pictures to see different parts of the “5 Volt Nano”:
– 16 Mhz Crystal (SMD Crystal)
– Analog Pins (A0 through A7)
– Digital Pins (D2 through D13)
– Light Emitting Diodes (LEDs)
– LED Pin (D13)
– Microcontroller – ATmega328 (µC)
– Other Pins (Various)
– Reset Button (RST)

Source: https://wiki.eprolabs.com/images/6/67/Nano.jpg
Source: https://wiki.eprolabs.com/images/6/67/Nano.jpg
Source: http://www.pighixxx.com/test/portfolio-items/nano/?portfolioID=314
Source: http://www.pighixxx.com/test/portfolio-items/nano/?portfolioID=314


WHAT CAN WE DO WITH THIS THING?

We can do simple projects, like we are going to do, flash an LED. Or, even make complicated machines.

HOW DO WE GET STARTED?
To program our ‘Duino, download the free software from Arduino. (But, feel free to donate.)

Link: https://www.arduino.cc/en/Main/Software
Link: https://www.arduino.cc/en/Main/Software

Remember where you saved the programs and if there is a shortcut.

Follow these instructions for your computers.
Link: https://www.arduino.cc/en/Guide/HomePage

Follow these instructions for our boards.
Link: https://www.arduino.cc/en/Guide/ArduinoNano


WHEN ARE WE GOING TO HAVE FUN?

Soon, let’s plug in our Nano boards.

First, plug the USB-A to Mini-B cable into your computers. Next, touch the metal of the mini-end. This will help make your Nano safe from Electrostatic Discharge (ESD).

ESD is the shock we sometimes feel when we touch a metal door knob during the winter. Most of us don’t like the winter zaps. Imagine how our poor little Nano boards feel.

Let’s load the first program, the “blink sketch”. Hold your Nano by the edges of its breadboard and connect it to your computer via a USB cable. Push or pull the connector end. Never wiggle the connector or pull the cord.


OPEN the ARDUINO SOFTWARE 

Open the Arduino software and wait for the welcome (splash) screen to finish.

After the welcome screen we should see a window similar to the next picture.

Navigate (drill down): File Examples 0.1Basics Blink

We should now see a second window, with the new one overlapping the first one; similar to the next picture.

Select: Tools Board: (“Arduino/Gunuino Uno”) Arduino Nano

Select: Tools Processor: “ATmega328” ATmega328

Select: Tools Port Com (As usually automatically chosen by our computers.)


BLINK (On Board LED)

Go back to or reopen the Blink window. (Select: File Examples 01.Basics Blink)

The Blink window should be in front showing something similar to the following.

Either maximize the window or use the scroll bars to view the sketch “Blink”.

Click the rightwards arrow (→) to upload and run the Blink sketch.

Observe the built in light (LED on pin 13.) blinking.


NEW WINDOW

We can copy and paste the sketch we are working on, in a new window. Just, do the following.

Select: File New (As shown in the following picture.)

When the new window appears, select and copy over the entire existing sketch. (See the picture.)


FLASH the LED (Don’t save at this time.)

Copy and paste the following “FLASH” code into a new sketch window and upload that new sketch.

void setup()
{
pinMode(13,OUTPUT);
digitalWrite(2,HIGH);
delay(1000);
digitalWrite(2,LOW);
}

void loop()
{
}

The Arduino software will automatically try to get us to save out new sketches. For now, we will cancel out of this action.

While our sketches are being uploaded to our Nano boards, observe the RX and TX LEDs flashing.

If we missed the flash of the LED just after loading the sketch, we can quickly press and release the reset button. What happens each time we press the button?


BLINK the LED (Don’t save at this time.)

Copy and paste the following “BLINK” code into our open sketch windows and upload that new sketch.

void setup() // one-time setup
{
pinMode(13,OUTPUT); // define pin 13 as an output
}

void loop() // continuously loop
{
digitalWrite(13,HIGH); // p13 HIGH (LED ON)
delay(500); // wait 500 ms (Wait 1/2 second)
digitalWrite(13,LOW); // p13 LOW (LED OFF)
delay(500); // 500 mSec delay (Wait 1/2 second)
}

Now what happens each time we press our reset buttons?


NEW WINDOW with OLD SKETCH

Multiple sketchbook windows can be open simultaneously. We can use this to our advantage by copy / paste the sketch we are working on in a second window. The first window is used to save our progress. The second window is used to troubleshoot (edit) our code. Once we have selected our entire program to be edited, do the following.

Select: File New (As shown in the following picture.)

Then, when the new window appears, select and copy over the entire starting sketch. (See the picture.)


FLASH CHANGED to DOUBLE BLINK

Paste the “BLINK the LED” sketch into to new window. We can identify our new and unsaved window / sketch by observing its tab. The tabs of new windows are labeled “sketch_(current date)(letter)”. The letter increments for each new window opened.

  1. So, our first new window is “sketch_(current date)a”.
  2. Our second new window is “sketch_(current date)b”.
  3. Our third new window is “sketch_(current date)c”.
  4. And, so on . . .

Use this new window technique and add two forward slashes (//) to “BLINK” just before the second “delay”. This is called “commenting out” code. It is very useful for troubleshooting our sketches.

void setup() // one-time setup
{
pinMode(13,OUTPUT); // define pin 13 as an output
}

void loop() // continuously loop
{
digitalWrite(13,HIGH); // p13 HIGH (LED ON)
delay(500); // wait 500 ms (Wait 1/2 second)
digitalWrite(13,LOW); // p13 LOW (LED OFF)
//delay(500); // 500 mSec delay (Wait 1/2 second)
digitalWrite(13,HIGH); // p13 HIGH (LED ON)
delay(1000); // wait 1000 ms (Wait 1 second)
digitalWrite(13,LOW); // p13 LOW (LED OFF)
delay(1000); // wait 1000 ms (Wait 1 second)
}

We will use the reset button to try the sketch with one line (//delay(500); // 500 mSec delay (Wait 1/2 second)) commented out and without being commented out.


SAVE THE SKETCH

The tab of our saved sketch will have the name we chose to call the sketch. When we open the Arduino software, the most recently used program will load.

Add two forward slashes (//) to the very top of the “FLASH CHANGED TO DOUBLE BLINK” sketch.  After the slashes, name the program something that is meaningful. We will save the sketch as named. If we add “.ino” to the end of the name, it will be easier to look for in the future; as Arduino sketches are “.ino” files. Copy the entire name and “Save As” . . .”.

The sketch we just saved should look something like this picture.


SAVE LOCATION

Arduino sketches automatically get saved to a “sketchbook”, in the following default location, on Windows machines.

Computer C: Users (User Name) Documents Arduino


TWO LIBRARIES and TWO SKETCHBOOK FOLDERS

Try not to confuse Arduino Libraries (Sketches to be included in other sketches.) with your Library of sketches. Not to make things more confusing, this is the Library folder in the Sketchbook folder. Each sketch will have its own sketch folder; as well.


PLAY TIME!

Now that we have saved programs, and know how to work on them without losing what works, try: duplicating the “digitalWrite” commands, or changing “delay” times, or adding delays. Have fun!

WHAT RESOURCES ARE AT OUR DISPOSAL?

ATmega328 Datasheet Summary
https://wp.pinballnews.com/wp-content/uploads/learn/pin-uino/Atmel-42735-8-bit-AVR-Microcontroller-ATmega328-328P_Summary.pdf

Arduino Nano User Manual, V2.3
https://wp.pinballnews.com/wp-content/uploads/learn/pin-uino/ArduinoNanoManual23.pdf

Arduino Microcontroller Guide, Ver. Oct-20
W. Durfee, University of Minnesota
www.me.umn.edu/courses/me2011/arduino/

Arduino Programming Notebook, V 1.1, First Edition August 2007
Written and Compiled by Brian W. Evans
https://wp.pinballnews.com/wp-content/uploads/learn/pin-uino/arduino_notebook_v1-1.pdf

ADDAMS FAMILY CHALLENGE CHAIR

The Addams Family Challenge chair

The story starts a few years back during a lull at work, while partaking in a favourite pastime; scouring Ebay looking for anything and everything – things I must have, things I don’t need and things I never even knew existed.

I usually start in the pinball section of course, but then I have to scour arcade machines too. This day I came across a large wooden chair resembling something out of an American prison. Think Stephen King’s The Green Mile. The chair was non-working, only a few miles away and, most importantly, cheap.

The more I looked at the pictures, the more I knew I had to have this ex-amusement machine. I didn’t care that it was a non-working example. It was super cool in just being a chair and would look great in any gameroom environment.

Having travelled far and wide to buy pinballs, the proximity of a few miles just over the bridge was telling me to get in the car and check it out.

It was being sold by an amusement specialist who had an array of ‘bandits’, boxing machines and all sorts of other arcade goodies. Sitting in the corner, covered in dirt ‘n dust, sat ‘The Original Shocker’.

This particular example had served its time on location at Blackpool’s Pleasure Beach; well, that’s what its stickers said.

These were produced by a firm in the UK called Nova Productions. The company had gone bust, nobody fixed the circuit boards, and the story went that this chair donated its innards to help keep another game running. The chair had sacrificed itself for another. I had to have this chair.

The sellers were keen to let the Ebay auction run its course, and any cheeky offers had been quickly turned down. I went home and made by auction bid, crossed my fingers and hoped no one else wanted it.

Well, the arcade gods were on my side as not a single other bid was made, and we are talking a cheap opening price. When the auction ended the following week I won the chair, and then had to ‘fess-up at home to another crazy purchase.

The chair arrived and I placed it into deep storage at the back of my garage, under the usual knickknacks that live in everybody’s over-full garages. There had been no point turning it on as it was missing its motherboard. I thought I would do some more searching and see if I could find the missing parts, although if I was unsuccessful it still worked as a chair.

I shared my recent purchase with my friends at Northern Lights Pinball (NLP) to see if they could put out feelers to see if we could get the game back to life. I was even searching for non-working examples of the circuit boards as I have some very clever and resourceful friends.

Nothing seemed to be available. I even had a phone conversation with an operator who had three of these chairs – all in non-working condition. He didn’t have a good word to say about Nova Productions. He wished me well in my search but he wouldn’t sell me any of his non-working parts. This project could probably take some time.

At the time I also mentioned it to a programming friend a.k.a. Dr Pinball, who has had some success with his DMD Extender kit. He thought that it was quite likely that we could Raspberry Pi some life into it, but he was too busy at the moment.

Fast forward about eighteen months to 2015. The chair is still sitting in the back of my garage under even more junk and I get a text from my pinball friend Chris ‘ Poibug’ Williams. “Have you still got that electric chair?“, he asked.

The NLP think-tank had been having a meeting and were looking for novel ways to play pinball. They had already come up with playing a Flintstones using your feet on a dance mat and putting a Fish Tales side-by-side with its electronic counterpart on Pinball Arcade, with the real-world pinball played via a Playstation joypad.

Eh? Yes Chris.“, I replied. So with a month to go before the NLP held their annual show as part of the huge Play Expo event, four pinheads met in my garage to dig out the chair and come up with a cunning plan.

Our primary objective was to hook up the chair so that it could be used to control a real pinball machine. Which pinball? Well it was obvious and agreed unanimously that The Addams Family would be the perfect choice.

The secondary objective was that it would be interactive and, most importantly, FUN!

The first night was spent stripping the chair down and removing the parts to see what we had to work with and come up with a plan to move forward.

The team consisted of me (a.k.a. Mooseman) – an electrician and generally handy-with-a-tool kinda guy, Chris (a.k.a. Poibug) who is an aircraft technician with many years of pinball repairs and service under his belt, Paul Garner (a.k.a. Wizcat) who is a computer programmer, and David Robinson (a.k.a. Dr Pinball) – also a software wizard and DMD Extender designer. We would co-opt others to help as the project continued.

A little history about this kind of amusement is probably needed around now.

The idea of the original game was to sit in a very realistic-looking ‘Old Sparky’ type of electric chair. You put your coins into the machine and then hold on to the two protruding handles which, as the game progresses, will ‘shock’ you. The longer you hold, the more you are ‘shocked’, the louder it gets, the more lights come on, the meter rises ever higher and ultimately smoke is seen rising from your head.

It’s a very visual experience. Totally non-politically-correct, but a lot of fun. The punter isn’t really shocked though – it’s just an illusion of being shocked. The handles contain vibrating motors which oscillate at ever-increasing speeds.

Now, wouldn’t it be good if we could shock the person playing The Addams Family?

Having dismantled the two handles, David took them home to see if he could get them to vibrate and work out if switches could be added to control the flippers. In fact, we all went away with various tasks to find, build, or come-up with solutions to make the project work.

I stripped the chair down further and spent an age sanding it to remove its original ‘Shocker’ logo which was stained into the wood. That had to go and something better sourced.

My neighbour, Paul Glending, is a very talented graphic artist and so he was co-opted onto the team to graphically bling the project. He went away and designed the Addams Family Shocker Challenge decal, plotted and weeded it all, and fixed it in place in about a week.

The Addams Family Challenge artwork
The Addams Family Challenge artwork

Good news – both handle motors are in working condition and they vibrate. Bad news – we can only get them to operate at one speed. Good news – it’s the fastest, insane speed. There is also room in the handle to fit two small push button switches.

One of the two handles
One of the two handles

It’s looking like objective one – getting the chair to control the pinball – can be achieved Objective two’s interactivity now needs looking at.

It was decided that, as we had no motherboard, a substitute surrogate mother needed to be found. We settled on the Arduino microcontroller would be a likely candidate, but a board would need to be designed to add all the inputs and outputs we would like to have working on the chair. It was also decided that the DMD technology could be used to activate certain things interactively with the gameplay.

A Raspberry Pi is used on the DMD Extender and this could recognise when certain screens were on the display. The RPi could then tell the Arduino to do something about it. We now had a way to make the chair truly interactive.

The chair is not an ideal height from which to play, so we looked into increasing its height. A skilled woodworker would be needed, and so Darren Ball (a.k.a. Replicas) built us a platform to sit the chair upon to give the player a better viewing angle.

The Addams Family Challenge Chair on its base
The Addams Family Challenge Chair on its base

The chair’s transformation was now picking up momentum with the four of us meeting after work about twice a week and staying into the wee hours rebuilding and rewiring its various components.

The smoke machine was missing but after searching on the ‘net a model train smoke generator was found to be an exact replacement. This, and a servo motor to control the smoke fluid’s, flow were purchased.

The ammeter didn’t really measure amps but gave the illusion through the use of a servo. Another servo was purchased.

The Addams Family Challenge ammeter
The Addams Family Challenge ammeter

The lights were changed for lower-power but much brighter LEDs. The sound was to feed through to the chair’s three speakers, so an amplifier had to be found and fitted. Further strobe-type lighting was installed under the chair and an extra vibro motor fitted under the seat.

This chair is going to ROCK!

The Addams pinball was fitted with the Raspberry Pi, and this communicates with the Arduino in the chair via a Cat 5 network cable. The sound is channelled down a separate audio cable from the pinball to the chair.

Having got the individual components to work, getting them to all work together was a further challenge that had us scratching our collective heads as the deadline for the NLP show got nearer and nearer.

A few loose wires and a credit dot on the display played some part in the problems, but eventually a working one-of-a-kind Addams Family Shocker Challenge debuted at the 2015 Northern Lights Pinball Show, part of the Play Expo show at EventCity in Manchester.

The chair and game combo was a huge hit, with queues of people waiting to have a go. Screams and giggles could be heard from afar as players were shocked mid-concentration as they were trying to keep the ball alive. As it was so popular, a fundraising bucket was set up and donations collected to supplement the total raised for the worthy charity, Teenage Cancer Trust.

The chair lasted well into the first day of the show before losing its power supply. A spare was quickly found, fitted, and on with the fun.

On the Sunday, the second day of the show, one of the handles sadly stopped vibrating. As it was quite dark in the venue and there were lots of wires, it was decided to let the game continue to on to the end without a repair as it was still a great experience.

Fast forward another six months to 2016 and we decided to make some improvements to the chair.

The broken vibration motor was just a loose wire, but this must be eliminated and more smoke was needed, as the train unit wasn’t dramatic enough for us.

The Arduino motherboard was redesigned with Molex connectors incorporated, a new, bigger smoke machine was added along with extra strobe lighting to accentuate the smoke.

Inside the The Addams Family Challenge
Inside the The Addams Family Challenge
The main shaker motor
The main shaker motor
The new Molex connectors
The new Molex connectors

The chair is now up and running, and about to go to the NLP show for 2016.

Players at NLP 2016 show enjoying the chair
Players at NLP 2016 show enjoying the chair
Players at NLP 2016 show enjoying the chair
Players at NLP 2016 show enjoying the chair
Wednesday Addams gives the chair a try
Wednesday Addams gives the chair a try

Comments on the internet have been very positive, and people can’t wait to give it a go again.

Credits for the The Addams Family Challenge
Credits for the The Addams Family Challenge

CHURCHILL CABINET COMPANY TOUR

Chicago Cabinets

Prior to the start of Pinball Expo in October this year, Pinball News was fortunate enough to visit the Churchill Cabinet Company factory in the Chicago suburb of Cicero to see how they make many of the playfields, cabinets and backboxes used in modern pinball machines.

The Churchill Cabinet Company factory in Chicago
The Churchill Cabinet Company factory in Chicago

Our guide was Doug Skor who is Vice President of Business Development at the company, and he began by relating how the Churchill Cabinet Company began, as the name suggests, by being a furniture maker. The business changed as cheaper, mass-produced furniture became the norm and the video game business took off, requiring the manufacturing of thousands of arcade cabinets for companies such as Namco and Midway.

The video bubble burst, of course, but pinball has remained a steady business for the company, and they bought playfield maker Lenc-Smith from Williams in 1996. In fact the building we were visiting at 4616 W. 19th Street in Cicero was the former Lenc-Smith facility.

The Churchill Cabinet Company factory in Chicago
The Churchill Cabinet Company factory in Chicago

Churchill not only makes pinball and video game cabinets and playfields, they also sell a range of complete games under the Chicago Gaming Company brand. This includes the remake of the Medieval Madness pinball and the Arcade Legends video multi-game console.

Home to the Chicago Gaming Company as well
Home to the Chicago Gaming Company as well

The company’s core business of building cabinets and playfields hasn’t changed greatly over the years, and upon entering the building it is apparent not much has changed in the reception area either. The wallpaper, carpet and sofa could all bear witness to the rollercoaster fortunes of the coin-op business since the ’60s.

Walking into the factory we were immediately faced with numerous boxes of completed games awaiting shipment. Medieval Madness remakes made up the majority but there were Arcade Legends games as well, with everything – and this is a theme we shall return to throughout the factory – coated in a fine layer of wood dust.

Boxed completed games
Boxed completed games
Medieval Madness remakes
Medieval Madness remakes
Arcade Legends video games
Arcade Legends video games

Walk inside a little further and the view changes from complete games to assembled components and finally to the constituent parts.

Medieval Madness remake backboxes
Medieval Madness remake backboxes
Decals being applied to video game cabinets
Decals being applied to video game cabinets
Ms. Pac-Man and Galaga combo cabinets
Ms. Pac-Man and Galaga combo cabinets

Of course building the cabinets and backboxes for the Chicago Gaming machines are only a part of the company’s business. Making cabinets, backboxes or playfields for other game manufacturers such as Stern Pinball, Jersey Jack Pinball and Raw Thrills is the bulk of their work.

Stacks of pinball cabinets ready to ship to a local pinball manufacturer
Stacks of pinball cabinets ready to ship to a local pinball manufacturer

As we walk further through the factory – it’s quite deep – we pass the playfield and cabinet panel routing areas.

A Metallica playfield on the router
A Metallica Pro playfield on the router
Stern now use code names for their games - James is Metallica
Stern now use code names for their games – James is Metallica

One thing you quickly marvel at is the sheer quantity of plywood sheets around the factory – some plain, some cut and some routed.

Stacks and stacks of wood
Stacks and stacks of wood

Previously the interior of pinball cabinets would have been sprayed black – usually quite roughly – but they now have a black laminate which is etched away by the routing machine to improve adhesion when other wooden parts need to be glued to the panel. The outer face is treated and spray-painted wood as printed decals adhere better to that than to a laminate.

Stacks of cut video game cabinet sides and pinball bottom panels
Stacks of cut video game cabinet sides and pinball bottom panels
Where the bottom panels are made
Where the bottom panels are made
Pinball cabinet bottom panels
Pinball cabinet bottom panels
Just one stack of many
Just one stack of many

Pinball cabinet side panels are first cut from a larger sheet and then routed to produce the interlocking grooves, the flipper button holes, the screw holes and etched where mounting blocks will be glued and screwed to the side.

Cutting the side panels
Cutting the side panels
The side panels are routed on this machine
The side panels are routed on this machine
A finished side panel
A finished side panel
Front panels are produced in the same way
Front panels are produced in the same way
The it's time to put them all together
The it’s time to put them all together

The actual method of building a cabinet looks a little ramshackle but it’s a tried-and-tested technique which has produced countless tens of thousands of pinball games.

The front, back, bottom and side panels are glued and interlocked before going into a giant hydraulic cabinet press which applies pressure to form a complete and very solid base cabinet.

The cabinet press
The cabinet press

There are actually two cabinet presses here back-to-back, allowing two cabinets to be made at once.

The cabinet forming area
The cabinet forming area

The playfields, meanwhile, continue on a separate line.

Routing the playfields
Routing the playfields

Once they have been routed they are examined for any flaws in the wood or in the routing. This produces a surprising number of rejects, all of which are stored in the Churchill Cabinet Company factory, although Doug said they would one day get around to clearing them out.

Reject playfields
Reject playfields
Reject playfields going back to NBA, Elvis, Monopoly and Wheel of Fortune
Reject playfields going back to NBA, Elvis, Monopoly and Wheel of Fortune
Playfields for Transformers and Rolling Stones
Playfields for Transformers and Rolling Stones

If you are wondering where all this wood comes from, the factory stores large stocks of Russian Birch – a name given to the type of wood whether or not it comes from Russia.

Stocks of Russian Birch
Stocks of Russian Birch
Stocks of Russian Birch
Stocks of Russian Birch

Those playfields which pass muster move on to the inserts room where every insert is hand glued and knocked into position. Boxes and boxes of inserts from Northern Plastics form the walls of the insert room.

Boxes of inserts
Boxes of inserts
Inserting the inserts into a Metallica playfield
Inserting the inserts into a Metallica playfield
Affixing the inserts needs glue - lots of glue
Affixing the inserts needs glue – lots of glue
After and before
After and before
More insert-complete playfields
More insert-complete playfields
Doug with some insert-complete playfields
Doug with some insert-complete playfields

If there are any imperfections, the playfield is sanded to level everything before it move on to have artwork screen printed on it.

Sanding down a playfield
Sanding down a playfield

Once a playfield is checked and passed it moves on to the screen printing room where the individual inks are applied by hand, one-by-one.

The artwork is traditionally printed using a CMYK process which has additional layers added to print white or other specific colours not adequately reproduced by CYMK inks.

Each ink requires a separate screen to be made. A screen is a semi-porous sheet which allows the ink to pass through in varying amounts in specific areas. Churchill don’t make the screens themselves, so before a screen is used it is verified in the screens room.

Checking the screens
Checking the screens
The multiple screens for various games
The multiple screens for various games
Screens for Ghostbusters, The Walking Dead and Star Trek
The multiple screens for various games
A The Walking Dead playfield without the magenta ink
A The Walking Dead playfield without the magenta ink

Once the screens are approved, they are used to print playfields.

A Ghostbusters cyan screen is primed with ink
A Ghostbusters cyan screen is primed with ink
A Ghostbusters playfield with magenta and yellow ink is picked and placed under the screen
A Ghostbusters playfield printed with magenta and yellow ink is picked and placed under the screen
The ink squeegee is slid down the playfield
The ink squeegee bar is slid down the playfield to spread the ink
The freshly inked playfield is removed to dry
The freshly inked playfield is removed to dry
Drying racks for playfields
Drying racks for playfields
Medieval Madness playfields drying
Medieval Madness playfields drying

Once all the ink layers have been screen-printed and the inks have cured, the playfields head off to be clearcoated.

Ghostbusters playfields being clearcoated
Ghostbusters playfields being clearcoated

Due to the noxious fumes we weren’t allowed in the clearcoating area, but we could see the results which looked very impressive.

Clearcoated playfields drying in racks
Clearcoated playfields drying in racks

Once the playfield is checked an approved, it is labelled and put in a shipping rack for the journey to the pinball factory.

Finished playfields
Finished playfields

While we were visiting, some tests were taking place on different mixes of clearcoat. A Ghostbusters playfield had been cut in four (yes, we know) and different levels of clear were tried on each part.

There’s no question that before the clear layer is added, the finish of the playfield is very dull and lifeless. The clearcoat brings it alive, making the colours far more saturated and vibrant as well as providing protection to the artwork.

A Ghostbusters playfield cut in four
A Ghostbusters playfield cut in four
The four parts are sprayed with clearcoat
The four parts are sprayed with clearcoat

As we headed back to the front of the building and the end of our tour, we grabbed a few more pictures of cabinets being built at the factory.

More video cabinet sides with the ever-present wood dust
More video cabinet sides with the ever-present wood dust
Building video cabinets with The Wizard of Oz pinball cabinets in the back
Building video cabinets with The Wizard of Oz pinball cabinets in the back
Building Arcade Legends video cabinets
Building Arcade Legends video cabinets

Finally, we were expecting Chicago Gaming Company to announce their second ‘remake’ title at Pinball Expo, but for various reasons that announcement didn’t take place.

Building Arcade Legends video cabinets
Once final look at the Churchill Cabinet Company factory floor

Huge thanks to Doug for taking time out from his Pinball Expo preparations to show us around the factory and explain its inner workings.

To an outsider it might all seem slightly chaotic, but the company has been building cabinets, backboxes and playfields for decades and know their stuff. As we have seen with other companies, not having that kind of experience can lead to problems with the quality of the product.

Meanwhile Churchill Cabinet / Chicago Gaming seem very relaxed and confident about the future. After all, while new pinball entrants bring technological advances and novel game designs to the pinball-buying masses, every game needs a cabinet, a backbox and a playfield.