Projects

Basketball Arcade Machine Part 2

Daniel Koch and Liam Davies

Issue 73, August 2023

This month, we put some finishing touches on the build, and make and install the electronics.

Last month's physical build was so extensive in the end that we had to split this project in two. Now, we are going to get stuck into the electronics and the 3D printing for the functional side of the build, as well as a couple of finishing touches on the structure, like the side netting and the deflection net. We will also make our own nets for the hoops, and install the lighting.

FINISHING THE CONSTRUCTION

CONSTRUCTION Parts QTY Required:

MATERIAL

USE

5

1.2m lengths 40 x 20 DAR Pine

Three for Rear Panel Battens, Two Cut for Upper Frame Brace

2

1200 x 600 x 3mm MDF Sheet

rear Panel Protection

4

2.4m Lengths 40 x 8mm Timber

Cabinet Top Edges

160

100 x 3mm Cable Ties

Side Nets

100

8G x 15mm Button head Screws

Various

80

8G x 20mm Button Head Screws

Various

20

8G x 40mm Button head Screws

Top Frame

24

4G x 20mm countersunk Wood Screws

Fixing 3D printed Parts To Panels

2

1.5m Lengths of 12mm Copper Water Pipe

Deflection Frame

2

12mm Copper Pipe Elbows

Deflection Frame

4

12mm Copper pipe Saddles

Deflection Frame

1

20m Pack 4mm Shock Cord

Deflection Frame

1

2 x 2.5m Ute Tray Cargo Net

Side Nets

2

Rubber Bands

Goal Sensor Retun

There are few jobs left to finish the construction of the machine itself, with most being minor and some more significant. Firstly, we need to construct a structure to deflect balls that hit the backboard and bounce straight back at players or at least out the front of the machine. In commercially-produced arcade machines, these structures vary from a large metal grille to just a bit of netting. The intent is to catch any errant balls and drop them to the floor of the cabinet, where they roll back to the return area. In the home-style collapsible units we covered last month, these items are usually absent.

Another significant thing we need to do is edge-finishing. Thanks to a couple of bad straight-edge moments, we have a significant fault to hide on one side of the cabinet. We also need an edge strip to mount UV lights on the under-side of, so they are not directly in the players' lines of vision. The decorative RGB LED strip will go on top of this. Once the strip is on, we can use gap filler to smooth our imperfections and gaps in the panel work.

Of the minor jobs, one is to paint the cabinet again, as the coats so far are not thick enough and the edging and gap filler need to be covered too. We also need to attach either some sort of fabric, net, or board to the upper frame structure above the hoops, to deflect bounce-ups. We also need to install the netting at the sides of the machine.

DEFLECTION STRUCTURE

The deflection structures are actually a bit annoying because they end up close to the average person's eye line, but they are a lot less annoying than having basketballs bounce straight back at your face. We built ours from 12.7mm copper water pipe and joiners. At 0.92mm wall thickness, it's not absolutely strong, but it is available, and it is workable. We thought of using 12mm reinforcing steel rod but this requires either cutting and welding, or heating and bending. Both of these are skill sets that fall outside of our 'everyday' criteria we set at the beginning of the project.

The pipe is available in 1.2m to 1.5m (depending on supplier or standard 6m lengths, although many trade-oriented plumbing suppliers only sell it in 6m lengths because plumbers rarely have any need for short lengths that they cannot just cut off a longer one. We bought two 1.5m lengths from a hardware shop, and cut one into two 700mm pieces (plus some scrap). Then, we propped our square up using a scrap of timber at an angle that looked good. The specific angle didn't matter and only had to be roughly right, but consistency between left and right was important, hence the prop. We marked the lines and used saddles and 4G x 12mm screws to mount the two 700mm lengths of pipe.

The two elbows were positioned on the uprights, and the length between them was measured. We were careful to include the inside of the elbows as well, up to where the pipe seat stopped. Then, that length was cut from the other 1.5m pipe. We removed everything and used two-part epoxy to join these sections together, flat on the ground to maintain squareness. In plumbing, these would always be soldered, generally with silver solder. However, we lack the ability to pump that much heat into the copper pipe that fast. Our workbench 40W soldering station certainly won't do it! This is not a temperature issue, it's a heating power issue. The pipe is a heat sink. Because ours will never carry water, an adhesive is fine.

After it was glued, we marked 80mm increments from the top, factoring in the 10mm height of the elbows for the horizontal starting height and not the top of the upright pipes, and ended up with the last mark 230mm above the table surface. This allows balls easy passage underneath. Then, the marks were drilled with 5mm holes, and
deburred.

Following assembly and drilling, the pipe frame was rubbed with steel wool and sprayed with etch primer before being sprayed black. The saddles were painted too. Then, the frame was remounted inside the cabinet and the screws replaced in the saddles. 4mm shock cord was threaded through the holes, in a back-and-forth 'S' pattern, from top to bottom. Tension was applied, and the ends knotted.

SIDE NETTING

The side netting was a painful challenge that took far more time and effort than it should have. Unfortunately, any netting that has any elasticity also has a tendency to be messy. It does not keep nice square forms and hanging it causes other sides to deform. Anyone who has ever worked with shade cloth or hail or bird netting knows exactly what we mean here. The netting in question was sourced from a local chain hardware store as a ute tray cover. It featured shock cord looped around the outer edge, and a polymer rope which was woven onto the edge of the net with a fine polymer twine.

The first step was withdrawing the easily-removed shock cord before carefully removing the plaited fine twine that held the rope to the netting. This step was very slow at first. The weave on the twine was sound and unpicking it like stitching was slow. Cutting each strand was not much faster. However, we realised that it was directional - when we started unpicking the other end, suddenly the whole plait fell apart. There were three strands, looped between each other, and when the strands were pulled one at a time in the right order, over and over, the whole lot unplaited. It still took over an hour, but it was done.

Now, we could mount the netting. The original plan had been to hang the netting on its own, as bought, but the real product was nowhere near as suitable as the product images implied. After unpicking the edges, we were left with an unfinished but neater and more consistent net, but no way to mount it. We realised the answer was there all along, in the form of the shock cord we had removed earlier. However, the upper frame needed strengthening.

We marked the angle on the end of a piece of 40 x 20mm DAR pine so that it could meet the backboard flush when screwed to the underside of the upper frame. Then, we cut the angle on the drop saw before fitting it in place to mark the front edge. Because of the angles involved, it was easier to do this than try to measure and calculate on the ground.

After this, the new pieces were clamped in place before being pilot-drilled for 8G x 40mm button-head screws. There are six screws along the top and four into the sides of these new pieces. The top screws are never going to be visible and the location is arbitrary. This allowed us to space them evenly but move the exact positions to avoid other screws already there. The four in the side are placed 30mm below the existing screws in the top of the rear side panels. The clamps are removed, the holes in the top frame and side panels enlarged to clearance holes, and then the braces are replaced and screwed firmly down.

Now that the upper frame was stronger and would not flex, we could install the shock cord. A 6.5mm hole was drilled in each side of the upper frame near the forward edge, and the same on the forward side panels near the front panel on the top edge. Then, shock cord was cut into 1.1m lengths, knotted at one end of each piece, fed through the holes in the upper frame, stretched, and fed through the holes in the side panels before the other ends were knotted for retention.

Now, the net can be cable-tied to the shock cord. The net is 2 x 2.5m, so we oriented it first to ensure that we were working with the 2.5m side. Of course, we're kidding! We forgot the net was rectangular and not square, and were three quarters of the way down when we found we had the 2m side. So, we cut the cable ties and started again. After a while, cable-tying every second square of the netting, we had it secured and ready to cut.

We had not yet decided how to secure our netting to the sides of the cabinet. Commercial machines usually have it secured to the inside edge with custom-engineered mountings but the lighting system we are adding to ours (lacking on most commercial machines) rules this out. The lighting mounts to the top and underside of the edging,

which is why ours is so wide. For now, we draw a line 20mm below the edge of the panels. The original plan was to fix screws at regular intervals and hook on the net, but it just didn't look very neat and the screws ended up out of alignment with everything else on the cabinet.

Suddenly, we hit on the idea of using more shock cord. There was enough left. Two more holes were drilled, very close to the ones used to mount the shock cord for the top of the net. Then, the 20mm line was marked with screw holes and pilot drilled for 8G x 15mm button head screws at slightly more than 100mm intervals: They are in line with the 100mm straight lines below them down the cabinet, and because the slope is the hypotenuse of a triangle, they're a bit more than 100mm apart.

After the screws were all in place, the shock cord was pulled tight and knotted at both ends, following the line of screws.

Yet more cable ties were used to secure the net to the shock cord. Every single point of contact between the shock cords and the net is cable tied to keep the form, rather than every second square like above. There is a lot of pulling and stretching needed too, to keep the net shape looking ok. The net was tied to both the forward and rear panel sloped sections.

After the netting was neat and secure, all the cable ties were pulled tight again, looking for any extra tension that could be applied. Then, side cutters were used to cut every strand of the net as close to the shock cord as possible. A gas torch was used to neaten the frayed ends, which also helped ensure they would not slip back through the cable ties. Finally, the cable tie ends were cut with flush cut side cutters so there were no sharp edges. Then, the net was free to be used to repeat the process on the other side.

UPPER FRAME

The final building task is the upper frame. This needs a top put on it, and while we initially thought we might use some soft fabric like photo lighting scrim or stretchy t-shirt-like fabric that we had lying around from another project, there

ended up being enough net from the sides left over to cover this panel. However, there was only just enough in terms of width at the narrowest point. Therefore, we added 8G x 15mm button head screws without pilot holes into the edges of the top of the pine frame.

We hooked the corner of the narrowest section of the net over the top left screw and then stretched it straight across to the top right screw, taking care that it was in a neat line. Then, we made sure we were using the same row, and hooked the bottom left corner on, followed by the bottom right. The net bows in greatly when tensioned like this. However, we added screws every second square, in the corners, along the top and bottom edges, and then the sides. This corrected the bowing.

After this, we tightened each screw and cut the net away, as close to the knots as we could, before finishing frayed edges with a gas torch. Because this will never be seen from above, this was all the finishing that was needed.

EDGE DRESSING

The edges of the panels are dressed with 40 x 8mm DAR Tasmanian Oak. We chose Tasmanian Oak because the required size of timber was not available in pine in the length we needed to fit in a normal car. Tasmanian Oak is not plantation grown, according to Tasmanian timber industry publications, and all harvesting is from native old-growth forests. We avoid it where possible, as Radiata Pine is plantation-grown on the same ground as previous plantations because it grows far faster. It is therefore more sustainable.

Attaching it was fairly simple, as each length was measured and cut, then screwed down. Nothing really fancy or difficult for this job. However, the screws needed to be lined up with those already there in the side panels, so they do not look out of place. We started with the front panel, and made its edging full-width. Then, we measured between this and the end of the first slope, on the forward side panels. These pieces were cut and screwed on, too. In each case, the screw locations were marked and pilot drilled for 8G x 20mm screws, then the edging was removed and clearance drilled before being attached.

The slopes facing the front on the rear side panels were measured the same way, but we had to be careful to measure from the top of the edge strip in front, and not from the top of the MDF. This is because the angle means the top of the timber edging will meet before the bottom, and leave a gap. This would push the other end of the timber higher, and it needs to fit under the upper frame. This gap will be filled later. Best carpentry practice would be to mitre join this face. However, not only does our basic and rarely-used mitre box only handle basic angles (as opposed to a continuously variable mitre saw), gap filler was already needed in many other places, making the effort redundant. As they say in the trade, "Do your best, patch the rest."

Now, all of the facing edges were covered by timber strip, right up to the underside of the upper frame, which itself would carry the LED strip where relevant for the UV lighting and the RGB decorative strip. Note that we forgot to mention drilling a 13mm hole for the deflection frame. We did this by unstringing the shock cord but cutting a slot instead of a hole would be easier.

GAP FILLING AND PAINTING

We used Selley's No More Gaps interior gap filler on our project, but generic equivalents are available too. This product is paintable, and not all caulking compounds are. Most interior gap fillers are, but not all caulking compounds are decorative gap fillers as such. Some are just meant to fill a nuisance gap between surfaces that move or are of dissimilar materials, and these are often never set, being designed to stay soft and gummy. Because all gap fillers are technically a caulking compound, some generic products are labelled this way, hence this warning: Look for a dedicated interior product, not an industrial one.

The product is applied with a caulking gun and tooled with a plastic spatula dipped in water with some dish soap in it. It was applied to all the panel gaps, as well as under the edging. This involved backing off the screws holding the netting, and releasing it to clear the work area. We paid particular attention to the panel gaps where the saw cuts wandered.

The product is said to be paintable in ten minutes, but we left it overnight to monitor for shrinkage in the larger areas. Then, it was painted again with the relevant colours for either the inside or outside. The sheen is slightly different, but not enough to matter.

PREPARING FOR ELECTRONICS

Parts Required:Jaycar
3W WS2812 RGB LEDSLEDsales
2 x 5m RGB LED COB Strip, see textOnline Marketplace
2 x 5m UV 5050 LED StripLEDsales
1 x Arduino Mega or Compatible BoardXC4420
1 x 76mm SpeakerAS3006
1 x MP3 Player BoardXC3748
1 x microSD Card for MP3 PlayerOffice Stock
4 x Arcade Buttons %SP0669
1 x Toggle SwitchST0335
2 x Limit SwitchesSM1038
5m Cat5e Stranded CableWB2020
Various Hookup Wire, See Text-
1 x Arduino Relay BoardXC4419
ATX Power Supply-
Plastic optic FibreOnline Marketplace

% Recyled from Giant Connect 4, with WS2812 LEDs still fitted. You can use plain coloured LEDs supplied with switches.

GOAL SENSORS

Prior to any electronics being fitted, the base of the goal sensor was fitted. The goal sensor as a whole is described in detail further on. For now, they're a 3D-printed bracket with a cable coming out. A hole was drilled under the hoop bracket, around 100mm lower. The exact height is up to user preference. The lever is not fitted at this point, so the base block is positioned over the hole and screwed in using 8G x 30mm screws. Pilot-drilling the MDF is very helpful here. With the bracket positioned, other preparation work could go on.

FIBRE OPTICS

We wanted to add a starry sky display on the backboard, mainly for the UV mode, but it can be left on all the time. These will be run by an analog circuit based on an NE555 and a 4017 decade counter, powering LEDs with PMMA fibres attached. We debated excluding this step, fearing that the balls hitting the backboard would be problematic for the fibres. However, experiments proved that rounding over the ends of the fibres a little with a heat gun stops them being forced back through the holes, and they do not protrude far enough to be snapped off. While the circuit will be covered soon, we needed to prepare the cabinet for the installation of the fibres.

This involved drilling many holes, just bigger than the size of fibre we were fitting. Our cordless drill has a chuck that cannot handle 1mm drill bits, instead having a minimum drill diameter of 1.5mm. That means we need 1mm fibres rather than 0.75mm fibres, to fit neatly in the holes. We started by marking hole locations at random with a white paint marker, so we could see them against the dark blue background paint. Then, we stood back, assessed the layout, and added some more. The object is to have something that is random-looking and covers most of the area, but without looking too even: just like a real night sky where there are clusters of stars, even patches, and areas of darkness.

We realised we would need a backing board to protect the fibres, both from prying hands and also from accidental damage when moving the machine. To avoid screw heads being visible in the backboard, we used construction adhesive to fix three 1200mm battens made from 40 x 20mm DAR pine to the backboard's rear face. This gave something to screw some cover sheets of 1200 x 600 x 6mm MDF onto, which would protect the fibres but also the wiring from the goal sensors and from the lighting in the upper sections of the project. The display wiring would need to pass through the centre of the back area, so we drilled some holes across the 40mm axis for this purpose.

After this, the holes were drilled at 1.5mm for 1mm fibres. We also bored ten 12mm holes through the back panel underneath the table level, to accept the bundles of fibres. The process was to slide the end of the fibre roll through a hole, then have someone inside the cabinet sitting on the table dome the end with a heat gun. Then, the fibre was withdrawn until the domed end was firm against the backboard face, and a spot of PVA glue added to the back. The strand was cut off the roll at a nominal line, around 200mm below the end of the rear panel, to allow length to pass through to the circuit.

Then, the strands were grouped into random bundles before being passed through the holes into the interior of the cabinet. Random bundling helps distribute the effects of the twinkling LEDs by having the fibres connected to each one distributed around the board.

LIGHTING

Next up was the installation of the RBG LED strip. This was always going to be fiddly, because we needed to interrupt the data line every so often to add the 3W addressable LEDs that were to be mounted to the inside of the cabinet area. The LED strip is a diffused version with a series of 5cm lengths of very small form factor LEDs COB mounted to the flexible PCB, and covered by a silicone rounded strip. Each 5cm length is controlled by one WS2811 IC. Luckily, the power and data tracks are not under the silicone cover, which is one of the reasons we bought this strip.

We decided to add the 3W LEDs every 30cm. We have forty-two of them left over from the since-dismantled giant Connect 4 project, but if you are building one of these machines and don't want to (or can't) source these LEDs, it is feasible to use more RGB LED strip on the underside of the edge strip to light the cabinet interior. The challenge with this is that the lighting effect would be mismatched between the two strips, so you would probably need to still cut the data track of each strip every 15cm or so and make both strips into an interlocked continuous single line.

We first stuck our LED strip down to the inner side of the edge material, and then used a 2mm drill to carefully cut the data track at the relevant points. This is slightly over the track width, so it cuts the line and also allows us to pass small wires down the hole to the 3W LEDs. They are 12V powered and so is the strip but we are using a different power rail for the 3W LEDs: They will have a twin-core wire running around just for them, while the strip will be powered by its own power traces with the occasional power injection point.

The 3W LEDs were power-wired next, with pre-cut 34cm sections of two-core hookup wire used to link them in a chain. This gave enough slack to raise the wire up toward the underside of the edge material to be secured there out of the way of any damage from the basketballs. We also added finer wire to the Data In (DI) and Data Out (DO) pads of each LED so that we can connect them to the LED strip. The 3W LEDs are already mounted to 40mm heatsinks from the giant Connect 4 project.

The 3W LEDs have two holes on the PCB for screws which were not used in the Connect 4 project. The heatsink behind these was drilled through with a 3mm, just enough to fit the 4G x 20mm screws we used to secure them.

SWITCHES

The switches that provide control interface are mounted in a 3D-printed cowling on the front of the machine. We decided to use the internal pull-up resistors in the Arduino and thus could use a common ground for both the LEDs and the switch contacts in each case. The LEDs are WS2812-controlled, and for details on them, check out the Giant Connect 4 article in issue 54. This means wiring one ground wire between five switches, one data wire between four switches, and six signal wires for the individual switches. Power is also needed for the LEDs, and they are already set up for 5V.

The switches were laid on the workbench and the common wires attached. With a total of ten wires, we had decided to use green silicone wire for the data wiring between the switches, then twin-core hookup wire for the data in and data out (using the trace on the twin core) to run back to the Arduino. The same twin wire was used for the power wiring for the switches, and then red and black silicone wire between the switches. Finally, the data contacts, one from each pushbutton and two from the toggle, were run individually with coloured hookup wire. Lengths were chosen based on running the full length of the machine, but we would likely place the Arduino somewhere in the middle.

TWINKLING STAR CIRCUIT

The circuit to give our twinkling stars on the backboard is based on an NE555 driving a 4017 decade counter, with each output taken to a transistor, so that it can drive LEDs that take more than the 10mA current limit of the 4017's outputs, and so that each can have a partial 'on' level set.

The circuit works by having the transistors biased somewhere below saturation. This produces a current through the LEDs that is much lower than that required for full brightness. This is achieved by fitting a trimpot to each transistor's base as a voltage divider. When the relevant decade counter output goes high, that transistor suddenly goes into saturation, passing full current to the LED and allowing it to reach full brightness.

The original Kids' Basics circuit that this is based on had capacitors added to soften the transition between partial and full current, but these were deemed unnecessary this time because the effect is very backgrounded in this case, whereas it was central to the Kids' Basics artwork. We saw no value in crowding the PCB even more for little gain.

The circuit was built on two separate solder breadboards. Because these are hole-for-hole copies of the solderless version we're most familiar with, transferring a prototype layout is very easy. You can even use the same wire links used on the solderless boards. The driver circuit and two of the transistors go on one board, while the other eight transistors go on the other.

Because the 4017's clock input is edge-triggered, the symmetry of the clock signal does not matter. Therefore, to make the twinkle rate variable, we constructed a very basic astable with a variable resistor between pins 6 and 7 (and a fixed one in series to maintain a minimum value).

The use of solder breadboards means the layouts can be a bit quirky. This one is not too painful though. The potentiometers were mounted next to the transistors they belong to, and a wire link joins the wiper to one end. The 1kΩ base safety resistors were used to link the wiper to the base, and the fly lead from the 4017 output pin also went in the same row.

The emitters were wire linked straight to the ground rail, while PCB pins were used to connect the LEDs. Current-limiting resistors were soldered straight to the LED anodes, and twin-core hookup wire was used to connect the LEDs to the board. This enabled their placement in a holder, detailed later.

The driver board is much the same story. The Fritzing and photos probably show this better than words because there is a bit going on, particularly around the NE555. Of note, the placement of the 100kΩ trimpot to the right of the IC was mandated by space, and there are a number of wire links involved. The photos were all taken before the installation of the trimpots, and so blue dots are marked on the board to represent their placement.

On reflection, we really should have stood the 1kΩ resistors on their ends and used one row for the ground end of the trimpots, and the transistor emitters. This would have economised on wire links but also space. However, that's fairly minor. The boards share power wiring, connected via PCB pins, and only one set of wire links to connect the rails on the opposite sides of the boards.

DEVELOPING THE GOAL SENSORS

We had been exploring the use of Hall Effect sensors for the goal detection. The lever that sticks through the net and is depressed by a ball passing through would have a magnet attached and the sensor could be positioned in a non-moving place next to it. However, this does require a tunable comparator circuit, or the use of the analog-to-digital converter in the Arduino. In the former case, the comparator needs to be adjustable so that sensitivity can be set. That is easy enough, but care must be taken regarding magnet polarity.

The UGN3503 Hall Effect sensor that is most commonly available at the retail level has a steady state output of 2.5V, which decreases in the presence of a south magnetic

pole, and increases in response to a north magnetic pole. The voltage by which it changes is related to the strength of the magnetic flux. So, to be used with a digital input, the driver circuit needs to be adjustable so that different magnet strengths and distances can be factored in after assembly.

Further, the polarity of the magnet matters, or else the circuit must include a way to sense whether the voltage is an adjustable amount over or under 2.5V, yet still, give a high out in either case. We could ensure the magnet is mounted with the correct pole facing, but we want this design to be reasonably easy for anyone else to make. Not many rare earth magnets ship with polarity marked as ours did, and there is also the issue of just making a mistake. All of that means more complexity than just a comparator with adjustable reference.

We burned four or five days dealing with Hall Effect sensors and trying to get the output we need while also having adjustability. The other option is to deal with this in code and use the analog input pins for the hall effect sensor. However, while simple enough for many coders on its own, this would have to occur while timers are running and displays updating. We want our design to be modifiable and that includes code.

The entire reason we wanted to use Hall Effect sensors is to avoid some of the problems with limit switches and making sure contact is achieved. The lever may move a little or a lot between shots that are still valid goals, depending on what angle and position the ball takes. Therefore, having a lever or micro switch under it is not reliable. It risks having the lever not travel far enough to hit the button, or, if the switch is positioned so that it will certainly be contacted, then both it and the lever are under significant mechanical stress on some shots.

Mounting the microswitch beside the lever and using the normally closed contact seemed to be a logical solution, however, experiments revealed a tenancy for non-goal shots, like those bouncing off the next rim and hitting the lever side-ways, to flex the lever enough horizontally to move it off contact and indicate a goal. There needs to be some clearance in the hinge this lever mounts on, so as to avoid too much friction.

However, in the end, we decided to bite the proverbial bullet and use a microswitch. Further time invested in the Hall Effect option did not look like it was going to generate a decent return. So, we came up with a mounting that had the switch positioned above the lever, in such a way that we can use a lever-actuated microswitch and use the lever to gain a little bit of range.

The switch was mounted so that when the goal lever was fully home, the metal switch lever was flexed back slightly. Then, if the goal lever did not return fully home (it sometimes gets impacted by netting) then the metal switch lever would still actuate the pushbutton. A screw-adjustable switch mounting would help this.

So, after all that, the goal sensor only needed two cores and therefore, a single length of twin core hookup wire was readied for each. The normally closed contact was chosen, and it would be wired to the Arduino pin with the internal pullup resistors used. The common terminal of both switches would be grounded.

GOAL SENSOR HOUSING

The goal sensor overall is a lever that actuates some sort of switch or sensor. As such, we set about designing the 3D printed mechanism that went with it. To allow adjustment, we decided to mount the limit switch on the side of the sensor, which meant putting a tab on the lever. The housing needed to allow the lever to depress, but also guide it up and down. To implement this, we went with a semicircle, with a matching curved tab on the lever to provide extra surface area for stabilisation. The lever is sized so that a 32mm M3 bolt and lock nut can be used to secure it to the housing.

The lever features a tab for a rubber band to hook on, which also hooks onto the underside of the housing. This returns the lever to the set position after a ball depresses it. The rubber band has to be chosen to allow a long enough and easy enough movement for the ball to pass through. In other words, it cannot be too strong, but it still has to be strong enough to return the lever to the home position, possibly with some netting in the way.

On the subject of the goal net, we decided to eliminate one of the problems we had experienced with the home-style basketball games, and the nets on the hoops we had bought. To reduce the movement of the net around the lever, stop the lever coming through entirely, and to make the net more likely to settle back into the right position, we made it captive to the lever. This was achieved by adding two long slots in the side of the lever section, with a small gap at one end which could be closed with hot melt glue. Hot melt allows us to remove it if necessary down the track, yet is still strong enough to do the job.

The limit switch is secured to the side of the housing using hot melt glue. We were tempted to use screws but the housing is too thin to fully hide their depth and they would cause problems on the internal mechanism. The glue allows a degree of adjustment, and if glued with hot melt, is removable later. The switch is glued directly to the side of the housing, but a cover could be printed for additional mechanical protection.

SOUND

We wanted to be able to play sound from the machine, initially envisaging a crowd noise to be playing constantly, with a louder cheer when a goal is scored. We thought about having increasingly wild crowds when goals are scored in quick succession but this is another level of coding which, while interesting and fun, did not justify the development effort. Like the Hall effect sensor issue, this code would be easy enough on its own but there are already other simultaneous operations going on, so coding gets complicated quickly. The gain versus cost equation was still in negative numbers.

XC3748 MP3 Module from jaycar.com.au

However, the sound unit we have chosen is the SPI-controlled XC3748 MP3 player module from Jaycar, and it can play an array of sound files simply by calling their numbered files across SPI. It has a basic onboard amplifier or an output to an external amplifier. That means that anyone who builds one of these machines can customise the sound profile. For example, you can have it start insulting the players if too much time passes before a goal is scored. You could also add menu functionality if your coding skills (and time available to invest) are up to it. Annunciation of what mode you are in and what the button that was just pressed did, might be helpful.

AS3006 Speaker from jaycar.com.au

As for wiring, the module needs 5V power and a speaker connection. The onboard amplifier is 1.2W and can drive an 8Ω speaker. We made a 3D printed enclosure that can house the module board as well as a 76mm 1W round general purpose speaker. This is below the max output of the unit but all of the other over-the-counter speakers we had access to that were in the low power range (for example, a 2W version) were 4Ω, which is problematic for the onboard amplifier.

Wiring consisted of twin-core hookup wire for power, ribbon cable for the SPI, and twin-core hookup wire for the speaker connections to the board. We decided that the sound unit could mount reasonably close to wherever the Arduino was mounted, so we made the wiring around 50cm long. The sound would emanate out from under the unit and reverberate through the cabinet, so we did not include specific cut-outs for it. However, that is a future possibility.

DISPLAY

The displays were something we covered only in limited detail in the last instalment. Our original plan was to use one of the large dot-matrix LED displays made of 5mm LEDs, in the 16 x 32 or 16 x 64 range. However, everything we wanted to use was discontinued! The next thought was to modify a seven-segment LED module to drive giant segments like the ZD1850 ones from Jaycar. However, there is a lot of fiddling around with transistors to drive the larger LEDs from these modules or the raw MAX7219 driver ICs. They're multiplexed, so the transistors need to be very fast, and after testing one, we found the segments aren't really that bright after all.

So, our plan changed to using 32x32mm display modules, based on the MAX7219 ICs, from Phipps Electronics. They are available as chains of four displays on one PCB, and they are cuttable so that you can customise the displays. We will do exactly that: One set of four will be the timer display in the centre, while another set of four will be broken in two to be the score displays on each side. For coding simplicity, the two score modules will be wired one after the other, even though the physical layout will be split either side of the clock.

The displays, or more accurately the MAX7219 IC, work via I2C, and are powered by 5V. They're smaller than we would have liked but they are brighter than the larger seven-segment displays and they are more versatile, being an 8x8 matrix on each display. This allows the display of alphabetic characters, greatly enhancing the menu navigation user-friendliness. What's more, because they are so common as Arduino modules, libraries are available enabling text and numbers to be sent directly from code, with the rest of the process run in the background.

We decided to mount these displays in a 3D-printed mount on the face of the backboard, rather than cutting and recessing anything onto it. The messiness and difficulty of cutting square shapes out of the MDF sheet, if they do not start from the edge, is significant. It would be worth it if flush-mounting the displays provided enough benefit, but it does not.

The housings will not be excessively deep, and the faces would not be any less exposed to physical impact than if they were in their own housing. Further, we designed the enclosure with slots to take a piece of 2mm clear acrylic over the front for some load-spreading impact resistance. You will not see this in any of the photos, because the acrylic is very reflective and hard to photograph. We just left it off until after photography.

We had not pre-planned display wiring, having not yet decided on the exact display type, so there was nothing installed earlier to work with. Instead, we soldered headers where relevant to the boards so that we could use header plugs when wiring up the displays after installation.

UV LED DRIVER

The UV LED strip will need to be turned on and off, and this will need to be done by switching the strip power. Other items that need to be turned off, like the RGB LED strip, 3W RGB LEDs, and sound module, can be code-controlled directly. The UV strip is not addressable, and so we need a switch connected to an Arduino pin. Because there is no PWM involved, a simple relay can be used. We could wire one up ourselves, but using a premade module is simpler, much faster, probably more reliable, and no more expensive most of the time.

We wired two 12V cables from the power supply to the Normally Open terminal (NO), and all of the positives from the UV LED strip into the common (COM) terminal. These terminals are a major advantage of using these modules, as is the fact that they are a 5V coil with a 10A contact load. Many relays on the retail market that have 5V coils only have a contact rating of 1A or even less. Apologies for the quality of the image here and some others in this section: There is very limited lighting under the cabinet and much of the lighting was by the same headlamp we had been working with in the wiring up.

POWER SUPPLY

The LED strips, both RGB and UV, are 12V powered, and take quite a bit of current. The Arduino, displays, button LEDs, and the other miscellaneous electronics all run on 5V. Therefore, a PC ATX power supply was the obvious choice. We had a spare lying around but rather than solder all of the 12V and all of the 5V wires into one big bundle, and the same for ground wires, we used BP connectors. This enabled us to quickly and securely join all of the 12V wires from around the cabinet to a matching number of 12V wires from the power supply, and the same for the 5V lines. It also made it easier to add more if we forgot one or discovered another hiding somewhere. The remaining wires on the PSU were cut short, with different lengths for the different voltages, and ground the longest, so nothing touched. Then, they were taped over.

The power supply itself was mounted near the back of the cabinet using a 3D printed bracket so that the cooling fans were exposed. We downloaded one from a sharing site rather than design our own, because different ATX supplies now have fans in different places. So, rather than including one, we recommend doing the same as we did and finding a model someone else has made that suits your particular supply.

FITTING THE ELECTRONICS

Installing switches into the console is easier than it might look at first. The prewired switches are a separate mechanism, actually a limit switch, attached to the body of the arcade switch by a bayonet system. As such, the switch bodies were fitted first and secured with their locking nuts before any wiring went anywhere near them so we still had working room.

Next, the switches were twist-locked into the relevant switches, taking care that the labels matched the position. Finally, the toggle switch was mounted by inserting its threat through the hole and utilising its supplied nut and washer. The wiring was fed through the hole at the back of the console area, cable-tied near where it would sit for strain-relief. Then, the switch console was mounted to the front of the cabinet with 8G x 15mm button head screws.

The display wiring was not pre-run earlier, and so needed to be installed now along with the display. Both the timer unit and the two score units had headers on them, but ribbon cable is a little thin to handle the current we wanted to run. Instead, we used stranded Cat 6 cable as our wiring between the headers and back to the Arduino and power. We cut the in-between cables and crimped on the header terminals, and inserted them carefully into the 4-way headers, so we did not mess up the order. We passed the cable between the two score displays through the hole in the batten first, before terminating it. Then, with the headers on, the cables were plugged into the modules, and the housings screwed into place on the backboard.

The goal sensor lever was next in line to be attached. We removed the net from the hoops, as we had a plan that is described further on. The lever was bolted in with a 32mm M3 cap head bolt and nylon lock nut, with washers in between to avoid damage to the plastic surface, and to decrease plastic-to-plastic friction on the 3D printed surfaces. Then, the rubber band was hooked on to hold the lever where it should be.

The microswitch was glued into place so that the lever was just activating the button. The wires were fed through the hole drilled earlier, and some hot melt glue added to help secure it neatly. Then, extra glue was added over the switch to protect it from errant basketballs. The wire for each sensor was slid down the cavity at the back where the optic fibres are.

The LEDs had to be fitted now.The UV LED strip is self-adhesive, but it is not always up to the task. So, we augmented it with thin double-sided tape in places. This is available from hardware stores and is thin and clear, but stronger than the variety that is sold in office suppliers for bonding paper.

The RGB strip was self-adhesive, and we mounted it to the inner side of the timber edging. We cut the corners as neatly as possible, but they cannot be 45° because of the LED chips and tracks. Therefore, we butt-jointed them as closely as possible. The tracks were joined with tiny lengths of solid-core hookup wire.

Finally, we mounted the 3W LEDs. These were pre-wired earlier, so all we needed to do was push them up against the UV LED strip, and screw them in place using 4G x 20mm screws. We used self-adhesive cable clips to help keep the power wiring neat.

Before we moved on, we needed to drill the Data In/ Data Out track on the RGB LED strip, to allow the 3W LEDs to be in synchronisation and phase with whatever we did to the LED strip, without excessive coding headaches. A drill bit just bigger than the width of the tracks was used to drill through them and the timber edging where the cut/solder pads are. Then, the data wires from the 3W LEDs were passed up through the holes. We had coloured the data out wire with a black marker to help keep tabs on which otherwise plain green wire was which. Then, the wires were cut and soldered in place.

Now we could install the power wiring for the LEDs. This was done with hookup wire rated at 7.5A, to avoid voltage drop. Smaller wire will do, but the next smallest size we had was too small, rated around 1A. As described in the power supply section, the 12V wires from the ATX PSU were taken individually or in pairs to the different injection points to power the LED strip.

The RGB strip does not draw as much as 5050-sized strip does, so we powered it at each corner.

The UV LED wiring was similar, because at 1A per metre, this strip's tracks can easily handle the 1.3M of its longest run up the steep sides of the cabinet's rear side panels. Small holes are needed in places from underneath the cabinet floor to permit power wiring. At the rear, power wiring follows the optic fibres and at the front, it uses the gap that was already between the table and the front panel.

The 3W LEDs had their own power wiring connected earlier. All we needed to do was add the injection points at the corners and drop the wiring down the cavity at the back or gap at the front.

The Arduino Mega was mounted under the cabinet with a plate mounting which we downloaded from a popular open-source 3D file sharing site. We saw no value in reinventing the wheel. Because we did not develop it, we have not included it for download, but we have included the link so the original designer gets some love.

Now it was time to connect things to the Arduino Mega. We worked according to the pinout diagram that we constructed. There is a data wire for all of the WS2812-controlled LEDs, except those in the switches. Those have another data line. Normally this is bad news and hard to code, but the LEDs in the switches are set to a colour at start-up, and never addressed again. Then, there is a switch wire for the Up, Down, Enter and Back/Reset buttons; UV On and UV Random from the toggle switch; one wire from each goal sensor; One wire to the UV LED MOSFET board; SPI to the sound module; SPI to the displays; and power.

GOAL NETS

We decided to make our own goal nets. We did this partly to use a heavier cord and to avoid some of the problems we described earlier regarding catching on things and not falling back into place; and partly to use glow-in-the-dark cord for the UV mode. While we were at it, we spray painted the hooks with a white base, and then several coats of glow-in-the-dark paint.

There are special knots used to make nets, and they take a bit of skill to do properly and evenly. We have no such skills, but we do have cable ties. Translucent white ones were used. We bought 550 Paracord with a glow-in-the-dark finish, and set about looping the cord around one of the hoops, using an original net as a guide to the length. The results are not perfect, but passable. However, it did enable us to utilise the feature we built into the goal lever 3D print: The slots so that the net is captive to the lever and slides around with a limited range. The intention is to reduce fouling of the net around the lever, or the escape entirely of the lever from the net when the net moves a long way.

Unfortunately, we had made the slots in the goal levers too thin for the paracord, and so we had to replace our new nets with the old ones for testing. The painting process had filled up the gaps in the net hooks on the hoop, too, so we had to use cable ties to attach the old nets! These are what you see in the photos but the paracord looks great under UV light so we're keen to use it when we have time to reprint the goal levers.

Regarding the goals, the last touch was to mark out a rectangle backboard like a smaller version of the markings on a real basketball backboard. We did this with self-adhesive glow in the dark tape, so it will like greeny-white in normal light, and glow brightly under UV light.

3D PRINTED PARTS

GOAL SENSOR

The goal sensor has two parts: The lever and housing. Both can be printed with no supports but the housing is shown upside down for that reason: It will be mounted upside down compared to this.

SWITCH CONSOLE

The switch console is quite large and only just fits on the 300 x 300mm bed of our Creality CR-X. We designed it to be rounded with no sharp corners to catch on. Someone else building this could design a smaller unit if it were not to be semicircular. This one needs support no matter what orientation we put it in. We used linear support for this, and printed with a brim rather than a raft. We had no chance of colour-matching the switch housing to the cabinet colour, so we didn't try. The house/wall paint used on the cabinet does not stick well to 3D printing plastics even when primed well, and we could not find an exact spray colour, which is expected. Spray colours tend to be a bit more basic in range. Instead, we covered it well with automotive plastics trim primer, and then sprayed the console with silver automotive plastic part paint. The contrast looks good in our opinion, but we feel contrast was the only way in this case.

SOUND UNIT

The sound unit has a tray for the MP3 module, spaces for heat inserts to house bolts to hold it down, and a space for the speaker. The speaker is glued to the back of the lid, which is then bolted to the housing with M3 bolts and heat inserts. This can print without support in two parts.

DISPLAY HOUSING

The display housings are deep enough to hide the circuit board of the 8x8 matrix displays, and feature cutouts for the display face only, with the rest of the board hidden from view. There are two: One for the timer display at four units wide, and one for the score display at two units wide. We printed two of the latter and one of the former. All have holes for mounting screws on tabs next to the displays.

CODE

We have built several game modes which you can download in the digital resources for this project.

The simplest one is Timer, which is essentially a time-based mode, highest score wins.

You can adjust the duration of the game by modifying:

#define MAX_GAME_TIME 60000

The default is 60 seconds (60,000 milliseconds). Highest score once the time is over, wins! Yet you might like to adjust this for your own gameplay preferences, for shorter or longer games.

This is also the simplest code to use for testing. Simply adjust the MAX_GAME_TIME to 5000 for a 5-second test of the full gameplay experience.

We've published all four game modes with this part of this project, however we'll take a deeper dive through the code used in the various gameplay modes next month.

TESTING IT OUT

With a completed unit, there was only one thing for it: Stop the office, and play! We paid particular attention to user interface, height and length, and whether the twinkling was too distracting or not. The team tried all the game modes several times and supplied some feedback that shaped the text displayed on the game mode display. The throw height and length were found to be good, and the goal lever hooked onto or fouled up in the net far less often than the folding-frame type we had experience with. We were also happy with goal detection but needed to bend the metal lever on one of the limit switches down slightly because it was false-triggering when a hard enough hit landed very close by and shook the cabinet and mounting.

SELF REVIEW

The machine is far from perfect but definitely a few levels up on the $200 folding-frame fabric type of games available at sports and department stores. It is far more solid and durable, and more user-friendly, too. The finish and construction are not up to a genuine arcade standard, but it did not cost $10,000 either. We are definitely happy with it for what it is and what we put into it, despite some lessons learned and things we could do better with more time or more specialised tools and manufacturing skills.

We did have significant challenges with the RGB LED strips. While the silicone covered one looked good, drilling htrough the track was not the best. In a few places it caused problems that we spent hours solving. A better tactic would have been to cut the strip, space it by a millimetre or two, and rejoin the power rails. These small gaps would be visible but less so than the wires going over the top as-is. We had to wire over the top because the whole was too small to push wires though properly, except in a couple of places. This may be due to some being cleaner or being in harder wood than others and therefore having less fibres in the hole. Either way the whole thing was a nightmare. If we did this again, we would just have one length of LED strip on the outside, and another inside. We would use transistor drivers to run both in parallel from one Arduino pin.

WHERE TO NEXT

One of the things we would like to do is expand the sound options. We need a bigger amplifier and speaker, and it should probably have a grille in the side of the machine. Perhaps the rear side would be better, so the sound comes from near the goals. This would mean a box on the side of the unit, however, and we're not sure we want that. Further, we would like to expand the sound files and the coding to match. For kids, it could call encouragement between goals. For adults, particularly at parties where much drinking has happened, it could hurl insults if there is too much time between goals.

We also wanted to implement a compressor so that basketballs could be inflated. This would need a pressure sensor and control interface and we quickly realised it would be a project on its own. We bought a cheap 12V compressor, but went no further with it. Watch this space, because we will at some point turn this into a project to publish.

The display needs to be bigger. We were limited to what was in stock off the shelf but really, there is room for improvement. Now, we have ideas for our own display project. The challenge is that many displays now are arrays of WS28712 LEDs. That's great if the Arduino can be dedicated to the display.

However, with so much else going on, that was a 'no'. We're going to make a PCB that can take either 5mm, 10mm, or Superflux-style LEDs, and be fed straight serial text with the display driving to happen on-board. Again, that's a future project and we cannot promise a timeline.

We would like to revisit the magnetic goal sensing. Again, this may be a future project as the circuit that is necessary would be very useful. For this time, it was in the 'too hard, not enough benefit' basket but it will not stay there forever.

One thing we noticed during testing is that there is not quite enough UV light around the goal area. Our plan is to add a panel at the front of the upper frame, which would be made from 65 x mm timber. This would be covered on its rear side by either more 5050 UV LED strip, or by several UV power LEDs. This would improve visibility in UV mode.

Besides that, the outside of the cabinet could be decorated. Airbrushing or painting would be a good idea, and if in a youth group setting, there is usually at least one or two talented artists. Vinyl wrapping would also work, and wraps can be custom-ordered online now.