Project tutorial
DIY 37 LED Roulette Game

DIY 37 LED Roulette Game © GPL3+

Following the principle of the original Roulette, the movement of the LED simulates a ball whose speed gradually decreases until it stops.

  • 3,736 views
  • 5 comments
  • 6 respects

Components and supplies

Necessary tools and machines

09507 01
Soldering iron (generic)

Apps and online services

About this project

Roulette is a casino game named after the French word meaning little wheel. In the game, players may choose to place bets on either a single number, various groupings of numbers, the colors red or black, whether the number is odd or even, or if the numbers are high (19–36) or low (1–18).

Most often you can find a project of a roulette game with 10 LEDs, so I decided to do with 37 LEDs as in the original wheel. Following the principle of the original Roulette game, the movement of the LED simulates a ball whose speed gradually decreases until it stops at a randomly generated number. The construction is greatly simplified with the use of an Arduino microcontroller. Device is relativly simple to build and consist few components:

- Arduino Nano microcontroller

- 74HC595 shift register 5 pisces

- 37 Leds

- NPN transistor

- 2 Resistors

- and Buzzer

This is the European-style layout and consist a single zero, and 36 other numbers. By pressing the button we actually throw the virtual ball, whereby the rotation is simulated by the subsequent illumination of the LEDs. The rotation of the LEDs is accompanied by an appropriate sound effect, which gives a realistic feel to the game. Rotation speed as well as time can be easily adjusted in the code.

Finally, the device is placed in a suitable box made of PVC plastic and coated with colored wallpaper.

Code

CodeC/C++
int SER_Pin = 8;   //pin 14 on the 75HC595
int RCLK_Pin = 9;  //pin 12 on the 75HC595
int SRCLK_Pin = 10; //pin 11 on the 75HC595

//How many of the shift registers - change this
#define number_of_74hc595s 5

//do not touch
#define numOfRegisterPins number_of_74hc595s * 8

boolean registers[numOfRegisterPins];

int Randomwaarde;
int del = 5 ;
void setup(){
 pinMode(SER_Pin, OUTPUT);
 pinMode(RCLK_Pin, OUTPUT);
 pinMode(SRCLK_Pin, OUTPUT);

 //reset all register pins
 clearRegisters();
 writeRegisters();

 randomSeed(analogRead(3));
 Randomwaarde = random(190, 210);
 Serial.println(Randomwaarde);
}              

//set all register pins to LOW
void clearRegisters(){
 for(int i = numOfRegisterPins - 1; i >=  0; i--){
   registers[i] = LOW;
 }
}

//Set and display registers
//Only call AFTER all values are set how you would like (slow otherwise)
void writeRegisters(){

 digitalWrite(RCLK_Pin, LOW);

 for(int i = numOfRegisterPins - 1; i >=  0; i--){
   digitalWrite(SRCLK_Pin, LOW);

   int val = registers[i];

   digitalWrite(SER_Pin, val);
   digitalWrite(SRCLK_Pin, HIGH);

 }
 digitalWrite(RCLK_Pin, HIGH);

}

//set an individual pin HIGH or LOW
void setRegisterPin(int index, int value){
 registers[index] = value;
}

void loop(){


 for (int x=0; x<=36; x++)
 {
   if (del <= Randomwaarde)
   {
     setRegisterPin(x, HIGH);
     writeRegisters();
     delay(del);
     setRegisterPin(x, LOW);
     writeRegisters();
     del = del +1;
   }
   else
   {
     setRegisterPin(x, HIGH);
     writeRegisters();
     delay(10000);
     setRegisterPin(x, LOW);
     writeRegisters();
     del = 5;

   }

 }
}

Schematics

Schematic diagram
Untitled sketch bb 6confcowrm

Comments

Similar projects you might like

DIY Led Racing Game (Open Led Race)

Project tutorial by Mirko Pavleski

  • 2,199 views
  • 1 comment
  • 3 respects

Space Invaders Game on 8x8 Homemade LED Matrix

Project tutorial by Mirko Pavleski

  • 2,525 views
  • 1 comment
  • 5 respects

LED Roulette Game

Project tutorial by Arduino “having11” Guy

  • 20,517 views
  • 9 comments
  • 28 respects

DIY Arduino 1D Pong Game with WS2812 LED Strip

Project tutorial by Mirko Pavleski

  • 6,145 views
  • 10 comments
  • 17 respects

DIY Android+Arduino Controlled Labyrinth (Maze) Game

Project tutorial by Mirko Pavleski

  • 3,709 views
  • 0 comments
  • 18 respects

OSU! Catch the Beat Game on Homemade 8x8 Matrix

Project tutorial by Mirko Pavleski

  • 1,177 views
  • 1 comment
  • 6 respects
Add projectSign up / Login