In this make I’ve built a money box with a bet generator using an Arduino. For more information on why you can read previous blog entries and follow the progress I made in working out this build. But here I present you with the instructions to make something similar.

For this make you will need:

  • Arduino
  • LCD1620 screen
  • Header pins
  • Breadboard
  • Male to female jumper wires
  • Male to male jumper wires
  • Female to female jumper wires
  • Push button
  • 220 ohm resistor
  • 3mm plywood
  • 2 M3 bolts
  • 3 M3 nuts
  • 2 zip ties
  • Velcro strips
  • Prototyping board

You’ll also need access to:

  • Soldering iron
  • Laser Cutter
  • Scissors

 

The Circuit

Step 1: Solder the pin header to the LCD1602

Step 2: Assemble the Arduino and screen on a breadboard as follows:

From the LCD screen:

  • Both end pins (VSS & K) go to ground and the next pins along (VDD & A) go to 5V
  • VO goes to the middle pin on the potentiometer
  • RS goes to Arduino Digital Pin 12
  • RW goes to ground
  • E goes to Arduino 11
  • D4 goes to Arduino 5
  • D5 goes to Arduino 4
  • D6 goes to Arduino 3
  • D7 goes to Arduino 2

The push button:

  • connect the resistor between the positive leg and 5V
  • connect ground leg to ground
  • connect positive leg to Arduino 8

The potentiometer

With the turner facing you the left pin goes to 5V and the right pin goes to ground.

Finally:

Connect the breadboard positive and negative rails to  the Arduino 5v and Gnd pins.

The Code

Connect the Arduino to a computer and log in to the online Arduino web editor or use the IDE to create a new sketch.
Copy and paste this code and upload it to the Arduino.


      #include 
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); //set the LCD pins to Arduino rs, E, D4, D5, D6, D7

  char * scores [] = {"1-0","2-0","3-0","4-0","5-0","2-1","3-1","4-1","5-1","3-2","4-2","5-2","4-3","5-3","5-4"};
  char * goaltime [] = {"First","Last"};
  char * player[] = {"Salah", "Firmino","Mane","Shaqiri","Milner"};


long betscore;
long bettime;
long betplayer;



// constants won't change. They're used here to set pin numbers:
const int buttonPin = 8;     // the number of the pushbutton pin


// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
  lcd.begin(16, 2);
  lcd.clear();
  
}
void loop() {
  pinMode(buttonPin, INPUT);
  buttonState = digitalRead(buttonPin);
  betscore = (random(sizeof(scores)/sizeof(char*)));
  bettime = (random(sizeof(goaltime)/sizeof(char*)));
  betplayer = (random(sizeof(player)/sizeof(char*)));
   if (buttonState == LOW) {
    lcd.setCursor(0, 0);
    lcd.print(scores[betscore]);
    lcd.setCursor(0, 1);
    lcd.print(goaltime[bettime]);
    lcd.setCursor(6, 1);
    lcd.print(player[betplayer]);
    delay(5000);
    lcd.clear();
   }  
   else {
     lcd.clear();
   }
}  

    

Casing

Assuming it all works you can move on to making a casing for it.

Download file – Case design

Cut the design using a laser cutter.

Assembly

While using the breadboard you probably used male to male jumper wires. We can now attach wires directly to the pin header on the screen using male to female wires. We can also connect the potentiometer to the screen using a female to female wire.

I used 2 pieces of prototyping board and soldered all the ground wires  to one and all the 5V wires to another, ensuring there was a connection between all the wires. Remember the resistor also connects to 5V so you may need an extra wire between the resistor and the prototyping board.

Plug in the Arduino again to make sure it is all connected and working and then assemble the box.

  • I started with sticking the USB socket through the square hole on the side panel.
  • Push the button through the round hole on the top piece and the LCD screen through the large rectangle hole. If there’s a nut for the push button add this to the front to secure it in place. The screen should be a snug fit so won’t require screwing.
  • The hole on the remaining side panel is for the potentiometer.

Glue all the side pieces together with the base and then carefully bundle together all the wires and fit them into the space before adding the lid. Do not glue this in place as you may need to access the wires inside in future.

If the wires push the lid up secure it with elastic bands.

Plug the Arduino in and check it’s still all working….

 

 

Optional Money Box

I used the following design for the money box which includes a space for depositing money and a hatch at the back to retrieve the money. I secured the betting generator box to the top using velcro strips. And then cut a fancy front piece for decorative purposes.

Download – The money box design file

Download – The front piece design file

  • Use zip ties to attach the hatch to the box forming hinges
  • Attach the small rectangle with 2 holes to the outside of door plate using a bolt and secure it on the inside with a nut.
  • Thread a bolt from inside the money box through the 3mm hole above the hatch, secure with a nut and then push through the remaining hole of the small rectangle and secure with a nut. This will be the open and closing mechanism for the hatch.
  • Glue all the sides together.
  • Glue the front piece to the front of the box and use velcro strips to secure the bet generator to the top of the money box

 

0.00 avg. rating (0% score) - 0 votes