Make Your Own: Bet Generator Money Box

Make Your Own: Bet Generator Money Box

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.


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.

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);
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.setCursor(0, 1);
    lcd.setCursor(6, 1);
   else {



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.


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


Adventures in Electronics: A betting generator

Adventures in Electronics: A betting generator

In my last update, I’d just written the code in C to randonly create a bet determining the score line by which Liverpool would win a match and who would score either the first or last goal. Having already written it in the (quite frankly much easier) Python, I had come up against some issues getting my LCD screen to work with a Raspberry Pi and so had turned to Arduino, despite my reluctance to attempt to write anything in C.

Having written the code and successfully tested it printing to the console, I logged into the online Arduino IDE and copied the code into a sketch that I had previously used to test the LCD screen. However, when I came to verify it, it failed. Repeatedly. Even though the code worked for the console.

I did some more googling and came across this instructable for Arduino that randomly chose a name from a list and printed it to the LCD.

I downloaded the sketch and tested it with the Arduino which worked fine – although it automatically changed the name every 5 seconds which wasn’t what I wanted, I wanted mine to only generate the information on a button press.  So I set about changing the code gradually. First of all I copied the format for generating the array of names and repeated it twice so I had the scores, timing and player.

So far so good, the information being shown was now random bet information, but it was automatically changing every 5 seconds. I needed to work out a button press so I used the sample digital button sketch and added that to my code, I removed all the remaining code from the previous example and would you believe it? It worked.

Then came the casing.

I measured all the parts, generated a box on box-designer and added some cut outs for the screen, potentiometer and USB cable.

I used 2 bits of protyping board and soldered all the ground wires to one and all the 5V wires to another

I swapped out the male to male jumper wires for male to female and connected the data pins to the Arduino.

And I chose a push button and soldered the LED and the push button pin wire to the positive terminal.

I plugged the Arduino in and nothing. Well, the screen came on but there was no data being pushed to the screen. It was blank. I was devastated. I tried rebuilding it on a breadboard and again, nothing happened. I was gutted,

I took everything home with me with a view to tackling it again over the weekend.

It was about 12:30am while in bed that it hit me – I’d forgotten to ground the RW pin. Maybe that was it. My very understanding other half said “Do you want to to test it?” And 2 minutes later I was enjoying my hot chocolate in bed, watching Brookside surrounded by wires.

Except, I couldn’t tell whether the problem was fixed because actually, the potentiometer was no longer working. I tried a different one, still nothing. I couldn’t adjust the screen contrast to see if the data was being written to the screen.

Another blow. The only thing I could think of, was that the connections on the LCD had been damaged. I would need to try another screen.

So Saturday afternoon, I head over to work, I assemble the whole thing again on a breadboard and again, nothing. So I tried an alternative screen and that worked. My hunch, may have been correct. So after soldering a set of header pins to the screen I reconnected all the wires I’d soldered the day before including an additional ground pin from RW and finally the whole thing worked.

I quickly assembled the box and all the wires before it could somehow change its mind! Throw in a Frank Spencer moment where I squeezed the glue too hard and the whole thing burst over the desk, chair and floor, and you have a faithful account of my bet generator adventure.

The finished make has put me in such a great mood. This is my first make that involved coding, electronics and crafting and I’m so proud of myself I could burst.

If you would like to make your own the full instructions are here.






Adventures in C – A betting generator (take two)

Adventures in C – A betting generator (take two)

My Raspberry Pi powered betting generator hit a bit of a roadblock today. I found a batch of LCD1202 screens and wired one up to the Pi. I found a whole load of tutorials and set up guides for using this screen with a Raspi and python, but no matter how many I tried, I could not get the screen to display anything. The contrast was fine, sometimes it would display a random collection of characters but never what was being generated by the script.

On the second day of piscreen adventures, I learned how to SSH into the Raspi from my laptop because I was finding it difficult to type in code on the Raspi while reading the code on my laptop, the monitor I was using was small and blurry, it wasn’t a fun experience. Still accessing the pi remotely made me feel like some kind of hacker which kept me amused for longer than it should have. Needless to say though, eventually the persistent failure of the screen to play with the Raspi was making me particularly frustrated.

During my travels around the web I found a whole load of tutorials for Arduino too, so I dismantled the Pi and wired up the Arduino instead. Once I got the Arduino IDE installed I found the LiquidCrystal example and sent it to the board… guess what? it worked first time. The LCD screen mocked me with its Hello World and a number displaying how many seconds since the code ran.

Ok so at least we know the screen works.

But my bet generator is written in Python and I do not know C at all. In fact, I was so reluctant to try recreating it in C that I RETURNED TO THE PI.

My head is in my hands even now, wondering why on earth I wasted a further few hours trying to make the pi work.

Eventually, I gave up and decided it was time to at least investigate C. Starting with the standard Hello World and jumping right on up to creating a betting generator. I found a script for creating a random sentence generator and, I suppose, I hacked it 🙂 There was a lot of false starts and errors but eventually it compiled and ran.

The results of the bets are here:

And I’ve already assembled the Arduino, so now I just need to work out how to push the results to the LCD screen instead of the console.

Adventures in Python: A betting generator

Adventures in Python: A betting generator

This week, I was having a discussion with my other half about football and money and the subject came round to betting. Whenever he goes to the match his mates all chip in a few quid and they put a bet on. The bet is usually the final score AND either the first or last goal scorer. Needless to say they never win any money.

We realised that while it is possible to have small windfalls through betting, it is so random, and obviously so stacked against you, otherwise how would bookmakers earn a living, that the amount you have to spend cumulatively far outweighs the amount you might win.

We decided to make that money work for us instead – we will enjoy the excitement of a bet while saving money.

Uh-oh! I feel a maker project coming on… Introducing Ralph & Edna’s Fixed Odds Betting Shop (named after Edna Cross and Ralph Hardwick from Brookside – they loved having a cheeky little bet)!

Both of us will place a £10 bet on a randomly generated final score AND first or last goalscorer. If either of us win, we win £20. If we lose the money goes into a savings box. At the end of the football season we’ll use whatever we have to go on holiday or something. There’s still a small chance one of us will win some money each week, but the house definitely wins most of the time – just in our case the house is ours so we win either way!

The make

Ultimately I want to make a money box that represents the house/betting shop. But I want to include a button that, when pressed, will display the random bet each of us is making.

I’m imagining this will use a Raspberry Pi or Arduino (depending on what we have lying around the makerspace that I can test on) and a 16 character, 2 line LCD screen.

For now though I’ve created a python script that will generate the bet for me.

I initially followed a tutorial for a magic 8 ball (be careful though if you’re trying it – this code is for python 2 but my laptop uses python 3 so there are a few discrepancies in the tutorial namely raw_input has been replaced by input and print now requires parentheses)

I noticed the random module was appearing a lot in the various forums and comments so I had a read about that here

It took a few attempts but eventually I came up with a bit of code (see featured image) which, miraculously worked for me.

Here’s the bets it generated…

Now I just need to learn how to run it from a button press and output it to the LCD screen and I’ll have my bet generator gadget!

Adventures in coding

Adventures in coding

I’ve been learning to code, on and off, for several years. In the 13 years I spent as a web designer, I picked up a thing or two with regards fixing and tweaking code, but mainly just HTML and CSS and if the Instagram memes are anything to go by, they’re not considered coding by any real coders.

Still, I learned how to find bits of code and tweak them, but I couldn’t have built a website from scratch (I am a genius with WordPress though).

I signed up for all manner of online lessons. I tried Javascript, Python, Ruby… but in every course I would get to the same point and give up. I find it hard to follow courses, I tend to learn by doing. Having something I want to make and learning how to make it.

Two of the kids from the kids tech club I run entered the Big Bang NW competition and won a place in the final. Their project, The Kerbinator, aims to make the streets more accessible for wheel chair users by using crowdsourced data to locate drop kerbs/ramps, and adding them to a map so that wheelchair users can plan their routes to include the drop kerbs. It’s a fabulous idea. The plan was to build a gadget that would include a button, which when pressed would write the gps coordinates and upload them to a database which would then be added to the map.
Feedback from the judges at the Big Bang suggested that a mobile app would make it more easily distributed in terms of crowdsourcing and so we decided to work on that for the final.

So now I have a purpose for learning to code. Although we have roped in a volunteer expert programmer who is mentoring the kids, I at least now have a direction for my learning… as well as an expert to help me when I get stuck!

So you can follow my journey as I learn NodeJS and MongoDB… whatever they are!