The Skee-Ball Machine: Part 3, The Code

Control Board

The old control board for the Skee-Ball machine come in a metal case and fits in the top of the machine with the score board and lights. It comes form a time long ago before modern micro controllers and computers were available. It works fine for what it was for but uses a lot of power along with the incandescent bulbs. I might have been able to use the old controller but I wasn’t sure and either my board or power supply had failed at some point.

ESP32 Dev Board

I decided to rewrite the game on a new micro controller. Network connectivity was a requirement for my build so I chose an ESP32 from Expressif. The ESP32 is a SoC with WiFi, Bluetooth, GPIO, PWM, and many other features. The EPS32 is very versatile and can be used in many projects. I’ve used its predecessor the ESP8266 in many different projects such as my RF 433mhz WiFi “bridge” and my pool temperature sensor. There are multiple options for programing the board. The native tool chain from Expressif, MicroPython, and Arduino are a few examples.

The project I completed before this is an inventory system for custom rack builds for work. The company had no way to track inventory on hand and to verify what was delivered as such they would only order one to three racks of equipment at a time. This cause some major delays in our project. To speed things up I built a custom inventory app using Python and Flask. It runs in GCP with the database in GCP as well. Since this was the most recent thing in my memory I decided to use Micro Python.

The latest builds of Micro Python for the ESP32 seemed to be broken as upip wouldn’t install any packages. So I complied my own from source using the CPython implementation. I ended up still having to many problems with upip. I switched to C in Arduino. The Arduino IDE is nice for small projects but I’d started using VSCode for most projects. After a quick install of the Arduino extension for VSCode I was up an running.

After getting the code working for scoring and ball counting and debouncing the inputs a little more in software I started on the GUI. Since I couldn’t use the score board yet I wrote a quick web page hosted on the ESP32. I had a few versions but settled on a page using SevenSeg.js for the numbers and a websocket connection for realtime scoring. The page works on phones, tablets, and computers. I tried on a very old iPad I was planning on using as a temporary display but the iOS version was to old for some part of the page. I’m not sure if it was the websocket or the SevenSeg display. The first version didn’t use websockets. The page would refresh every 5 seconds and the new score and ball count would appear. Is was near as satisfying as the incremental scoring the original score board had. The websocket provided that same feel. As the ball travels down the score path each ball is counted individually and shows up immediately on the display. Such a little thing really made the game feel much more original.

If you want to check out the code it’s hosted on my github at https://github.com/khensler/skeeball

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: