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.






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