IMG_3464.jpg

Plinko

 

Arduino Controlled Plinko Game

As a project in my Physical Computing class we worked on a project that would be triple transducer. We decided we wanted our transducer to be: sound input > motor action > pressure input > light output

In this case we decided to make the classic game of Plinko with a sound sensor that activates a servo motor. Once the ball falls through a series of panels and lands in a section, the FSR (force sensitive resistor) triggers activation of the LED strip light.

On the physical aspect I laser cut an acrylic box to house the Arduino and breadboard and designed the ramp so that the game of Plinko could be simulated.

 
IMG_3438.jpg
GREEN.gif
RAINBOW.gif
RED.gif
Overview of Wiring

Overview of Wiring

 
IMG_3481.jpg

Prototype One

With our first prototype we laser cut cardboard to explore the different features that would need to be added physically to Plinko. With this prototype we also considered the placement of the breadboard and Arduino Uno.

Prototype One testing in action: playing with the servo motor and FSR

Prototype One testing in action: playing with the servo motor and FSR

 
IMG_3474.jpg
(ME!) Playing with the sound sensor that triggers motor movement and FSR pressure triggering the LED light on the breadboard

(ME!) Playing with the sound sensor that triggers motor movement and FSR pressure triggering the LED light on the breadboard

Added the choices for ball placement

Added the choices for ball placement

Considering the connection between FSR bins and ramp placement

Considering the connection between FSR bins and ramp placement

Prototype Two

With this prototype we began to move closer to what we wanted the final design to look like. Dimension-wise, we attempted to figure out the connection between the bottom section to the ramp, since some space was needed for the FSR wire to fit through. In addition we had to consider the size of the FSR sections, since no extraneous pressure could be applied to the sensors without affecting the LED light strip.

 

Final Project

We decided to use clear acrylic with a paper backing to diffuse the colors of the LED strip. After finalizing the dimensions, we were able to laser cut and assemble the final game.

IMG_3440-2.jpg
Ball placement section

Ball placement section

Different engraved bins that correspond to LED strip color palette

Different engraved bins that correspond to LED strip color palette

Servo motor

Servo motor

LED strip lights shining through panels on the ramp

LED strip lights shining through panels on the ramp

Wiring Schematic

Wiring Schematic

#define PIN_GATE_IN 2 //connected to gate on sound detector
#define IRQ_GATE_IN  0
#define PIN_ANALOG_IN A0 //connected to envelope on sound detector
void soundISR()
{
int pin_val;
pin_val = digitalRead(PIN_GATE_IN);
}
// got the above and how to use sound detector from
// https://github.com/sparkfun/Sound_Detector
#include <PololuLedStrip.h>
PololuLedStrip<3> ledStrip;
#define LED_COUNT 13
rgb_color red[LED_COUNT]; //this and the next 3 lines set up the variables for the colors on the LED strip
rgb_color surprise[LED_COUNT];
rgb_color green[LED_COUNT];
rgb_color black[LED_COUNT]; 
#include <Servo.h>
Servo myLittleMotor;
int servoPin = 12; 
int fsrRightPin = A1; //fsr stands for Force Sensitive Resistor     
int fsrRightReading;     
int REDLEDON;
int fsrMiddlePin = A2;
int fsrMiddleReading;
int SURPRISELEDON;
int fsrLeftPin = A3;
int fsrLeftReading;
int GREENLEDON;
// learned how to use the FSRs from https://learn.adafruit.com/force-sensitive-resistor-fsr/using-an-fsr
void setup() {
myLittleMotor.attach(servoPin);
Serial.begin(9600);
// configure input to interrupt; from  https://github.com/sparkfun/Sound_Detector
attachInterrupt(IRQ_GATE_IN, soundISR, CHANGE);
//the interupt ensures that the sound will be detected no matter where in the loop the program is as the noise is made
}
void loop() {
static int count = 0; //static so that once it's initiallized, it won't restart the count every loop
int soundVal;
int minSound;
int landed;
minSound = 550;
soundVal = analogRead(PIN_ANALOG_IN);
Serial.println(soundVal);
if (soundVal > minSound) {
myLittleMotor.write(0);
count = 0; //restarts the count once the motor has been triggered
}
else {
count = count + 1;
}
if (count == 500) {
myLittleMotor.write(90); //makes the motor go back into start position when the noise is below the threshold for enough time
}
fsrRightReading = analogRead(fsrRightPin);
REDLEDON = map(fsrRightReading, 0, 1023, 0, 255);
fsrMiddleReading = analogRead(fsrMiddlePin);
SURPRISELEDON = map(fsrMiddleReading, 0, 1023, 0, 255);
fsrLeftReading = analogRead(fsrLeftPin);
GREENLEDON = map(fsrLeftReading, 0, 1023, 0, 255);
//the above maps each LED color pattern variable to its respective FSR
//some of below code on the LED strip originally from the Polulu LED gradient demo and then customized
byte time = millis() >> 2;
if (REDLEDON > 10) {
for (uint16_t i = 0; i < LED_COUNT; i++) //this rotates through each LED on the strip
{
byte x = time - i; //allows it to pulse red on and off
red[i] = rgb_color(255-x, 0, 0); 
}
ledStrip.write(red, LED_COUNT);
}
else if (SURPRISELEDON > 10) {
Serial.println(SURPRISELEDON);
byte time = millis() >> 2;
for (uint16_t i = 0; i < LED_COUNT; i++)
{
byte x = time - 20 * i; //allows each LED to cycle through the surprise color pattern 
surprise[i] = rgb_color(x, 0, 255-x);
}
ledStrip.write(surprise, LED_COUNT);
}
else if (GREENLEDON > 10) {
byte time = millis() >> 2;
for (uint16_t i = 0; i < LED_COUNT; i++)
{
byte x = time - 10 * i; //allows each LED to flow through green
green[i] = rgb_color(0, 255-x, 0);
}
ledStrip.write(green, LED_COUNT);
}
else {
byte time = millis() >> 2;
for (uint16_t i = 0; i < LED_COUNT; i++)
{
byte x = time - 10 * i;
black[i] = rgb_color(0, 0, 0);
}
ledStrip.write(black, LED_COUNT); //this turns off the LED strip as black is no color on it
}
}