Introduction: Labyrinth Game With Joystick and 28BYJ Stepper Motors

About: I have a passion for making things, could be anything I can think of or something I see. There is nothing better than designing something and it works, doesn't matter if its 3D Printed, CNC, Lathe whatever com…

Welcome to this Instructable, I've wanted to build one of these Labyrinth Games for some time now but rather than use the conventional method with the hand turn knobs, I wanted to use 2 of the small 28BYJ-48 stepper motors controlled by a Joystick to move both Axis.

Disclaimer:

This game is not my idea, there are various Labyrinth games out there, whether there are games utilising stepper motors and a Joystick then I don't know, this version is just my take on the game.

The stepper motors should make for a smoother and more precise axis movement in theory which is needed to navigate the steel ball through the course, the whole idea of a game of skill is that it can be achieved, a lot I have seen are nearly impossible to complete, so some thought must be given to the layout and the route the ball must take to achieve this goal.

I will be using some left over spruce boards from a garden bench build and an off cut of 10mm Mdf for the playing area, the base will be 3mm ply

For everything to work correctly the woodworking may be beyond my skills, I'm not that precise but with this type of build, everything has to be precise especially with Axis movement.

On the Electronics side I am using an Arduino Nano with servo shield, with digital pins used for the stepper motors and Analog pins for the Joystick.

The stepper motors are driven by the ULN2003 driver boards.

It should make for a very Interesting build so lets get to it!

Supplies

Arduino Nano and Servo Shield

2 x 28BYJ-48 5v Stepper motors with ULN2003 Drivers.

10mm MDF

3mm MDF

3mm Ply

CA Glue

Wood glue

20mm x 20mm wood battens

20mm x 40mm

6mm dowelling

String

Eye screws

Small Springs for String Tension

Step 1: Making the Outer Sides of the Labyrinth

With no sort of plan in mind I chose to make the outer sides of the box first, I had 2 lengths of spruce wood left over from a previous job, One length is and 20mm thickness and the other is and 20mm thickness.

No fancy joints here, my option for securing the sides together is just simple glued butted joints pilot holes then countersunk screwed in 2 positions to fasten them together, I will build it so when looking from the front the screws are all on the sides, the main thing with this particular build is ensuring everything is square, before screwing everything together, a flat surface is a must, the sides are 355mm or 14 inches and cut using a chop saw, a hand saw could be used, the holes for the screws are measured 10mm from the edges and 10mm in as the wood is 20mm thickness, with the main framework done, I routed the top edge and then sanded the whole thing with a Palm sander and medium grit sandpaper.

Time to make the outer axis:

Step 2: Making the Outer Axis Frame Work

The most important thing with both Axis is to ensure that they can move freely within each other, there should be at least 3/4mm clearance all the way round, if it catches anywhere it will send the steel ball off on a different trajectory which is not good.

I will drill pilot holes first and then countersink each hole, all sides need to be flush.

I measured the distance inside the box and cut the lengths 20mm x 20mm which will be screwed with one screw in each side, first ensuring that there was a gap at each end, then the other 2 components were cut, I used the bed and internal lip/edge of my cnc to work to when gluing and screwing the pieces together, It was a bit of a faff trying to get everything square and laid flat, but after a few attempts I achieved this, if its not done correctly at this point it wont look right when it's installed into the box, I bashed my finger at this point which had me cursing and jumping around the workshop, a bit like an impression of the first Astronaut landing on the Sun! :))

With the outer Axis complete it was time to move onto the Inner Axis:

Step 3: Inner Axis Frame Work

This is very much the same process as the first axis apart from this one is deeper to accommodate the play area board, the depth of this wood is 30mm and again 20mm thickness.

Measuring the inside of the first axis now and cutting the sides to be screwed first, but using 2 screws at each position now, the holes are pilot holed and countersunk, using the same method I managed to get the thing square and sat flat after some tweaking.

With the main framework and axis frames complete its now time to fit the axis pieces within the box.

Step 4: Axis Instalment and Pivot Points

This is another crucial part of this build, for the outer axis I wanted it sunk into the box by 10mm, so I marked 10mm from the top on all internal sides, Using the axis frame I then marked off 2 lines and marked the centre of these in 2 places where I would be drilling the pivot holes, I'm using stepper motors to control the axis so rather than using dowel for the pivots I opted for turning some scrap brass hexagon bar down on the mini lathe to make some 5mm rods for the pivots, making for a more smoother operation.

The outer framework is 20mm depth and the centres are marked off to mirror where I'd already marked off the positions on the insides of the box, these holes were drilled straight through with a 4.9 drill, for the holes in the side, .these were only partially drilled to 10mm, the same applies to the inner axis marking ff and drilling straight through the axis framework and then partially drilling the inner frame to 10mm.

I installed the outer frame first, and pushed the pins in, I mixed some epoxy resin to secure the pins before finally pressing the pins home, the same applies with the inner framework.

I forgot to put some some spacing washers in between the sides and both axis at the pivot points, but too late at this point, the movement is free on both Axis, if I made another I would use the washers.

The next process is the base for the Labyrinth game:

Step 5: The Base Process

My first job was to make around 20 x 10mm pieces of mdf at 30mm long, these would be glued around the bottom edge of the inner axis, equal spaces, the base would sit on these and would not be glued into position, It can be removed for access for maintenance purposes, these pieces were cut with a band saw, lightly sanded and secured with CA glue.

The next process is to measure and cut a suitable base, for this I used 10mm MDF I measured the internals of the inner framework and cut a piece out using the band saw, after some tweaking this sat within the framework nicely.

The next process is to mark out a course for the steel ball to Navigate:

Step 6: The All Important Labyrinth Course.

This is the part where a creative mind comes into play, unfortunately my mind is full of Porridge so I ended up looking on line and observed how others had planned the route with holes as obstacles for the steel ball to travel along.

I used Vetric Vcarve desktop to mark out a course sketching in some 6mm width rectangular shapes to include angles as well, (One thing to note is the I created a 262mm square then offset this inwards 10mm to compensate for the stand offs for the base to sit on) I guess the same thing could be achieved using Inkscape, but I'm using Vetric to cut the holes out as well as my drilling is not so precise, It took me quite some time to have layout which wasn't going to be easy whichever way you looked at it but could be achievable.

Another thing to note is that on some of the Labyrinth games I have seen have a line that shows the route of the course for the steel ball to follow, all the holes are numbered, I'm not sure if the idea is to play the game and see how far you get by logging the number where the ball drops, or is it the numbers added up for a total score, how many attempts do you get?? etc etc the bonus is obviously making it to the end of the course.

Anyway back to the base, All the circles 14mm were sketched and a 6mm Flat end router bit was chosen, pocket was chosen for the cutting path, the file was previewed, then named then saved to desktop and the file was then sent to the CNC machine.

Using 2 pieces of wood to clamp the mdf, the cnc was set up, Dust mask fitted and then the holes were cut, looking at the holes after cutting you might think they look a bit rough, but a quick sanding has these holes looking nice and precise.

Now to the layout barriers:

Step 7: Making the Barriers for the Course

The first thing I did with the base was to use some 6mm square pieces of wood to outline the base, for the little barriers these would be 11 x 6mm pieces of wood, I will be using a 12mm steel ball so 11mm height should be fine, I had printed off my sketch from Vetric its not to scale but will be a good guide, the pieces of wood are cut on the band saw and CA glue was used to secure them to the base, I just used my eye to line them up, but they could be measured out if one so desired.

This was a bit of a faff and I still ended up making it up as I went along, there are some challenges to this course but I think it's achievable, only time will tell.

With the base and course complete its time to move onto how to control the Axis.

Step 8: Controlling Axis Movement

For this process I am going to be using 2 x 28BYJ-48 5v stepper motors, they should have more than enough power to move the axis, and I hope they will give more control over the course, conventional Labyrinth games need 2 points of control making it awkward to use, the steppers and Joystick should in the theory be better, but who knows until we try it.

The first process is to mark out the holes, we are using 6mm dowelling and each axis will be controlled by a stepper motor and ULN 2003 driver, I will mark off and partially drill into one side of an axis, then the other side will be drilled straight through, I will use a couple of pieces of 7mm brass tubing to accommodate both the 6mm dowel and the stepper shaft, squeezing the tube at one end with pliers until the stepper shaft is a snug fit, and once everything is in position a gentle squeeze at the dowel end of the brass tube and a spot of CA Glue for good measure, 3mm holes are drilled for the stepper motors and these are secured with 3mm Allen head bolts, nuts and washers,I also drilled a hole for each the steppers cables to be routed through inside the box.

2 screw eyes are used on each axis, one on each side, then string is tied to one of the eyes and then wrapped around the dowel 3 times then to other side, this will use a small spring to keep tension on the string and this in turn is tensioned to a small screw in hook, the same applies to both of axis.

The next process is the wiring and electrical set up:

Step 9: The Electrical Set Up

In this section we cover the wiring of the stepper motors and ULN2003 drivers and the Arduino Uno and Servo shield.

I'm routing the cables from the stepper motors on the inside of the box, these in turn are routed to the ULN2003 Drivers, the cables are held in place with Hot glue, the Arduino Nano and shield are external on the back of the box, secured with hot glue, a hole is drilled adjacent to the Arduino and all the cables from the ULN 2003 driver boards are routed through this hole.

The servo shield is equipped with pins for 5v and Gnd in 2 positions, I needed 3, so I ended up soldering 2 of the 5v and Gnd's together with the ends utilising femal dupont connectors and using heat shrink for safety and additional strength, these were then connected to the relevant pins, I used an old Ethernet cable for the link between the Nano and the Joystick, I needed 4 ways, so just twisted the coloured pairs together and soldered them onto the relevant Joystick pins, then soldered female dupont cables to the other corresponding ends, and then terminated them on Analog pins A0 and A1.

No wiring diagram as such, the connections are fairly straight forward Digital pins, 4/5/6/7 Stepper 1 and 8/9/10/11 for stepper 2, the joystick Is wired to Analog pins A0/A1 power is provided by a 5v 2a Power supply with barrel connector, this plugs directly into the barrel on the Servo shield all 5v and ground connections are made on the shield.

The standard arduino style joysticks are inexpensive and are ideal for this project, I discarded the original toggle knob and designed and 3D printed a longer version with a 20mm ball on the end, I wanted to box in the joystick to the front of the box with MDF, and this worked out very well and the new knob functions just how I wanted it to.

Time to upload the basic stepper sketch and test the Labyrinth game.

Step 10: The Code and Initial Movements

A lot of these Chinese cloned Arduino Nano's use the old bootloader, so if you have problems uploading the code then select old bootloader and it should work.

The code is downloaded and speeds of the stepper motors can be adjusted at this point, for movement I want the joystick positions to mimic the Axis, this wasn't the case on initial power up but after a couple of tweaks this was achieved, the inner Axis moves left to right with the joystick and the outer axis tilts forward and backwards with the joystick, happy days, it works.

Using the Joystick is a lot easier than turning 2 knobs by hand in my honest opinion of course.

The next steps are to box in the Joystick and the Arduino with 3mm MDF, the box needs to have an angled base and a hole at the front so when balls drop through the holes, we can retrieve the balls and maybe a small trough on the top back side to keep some steel balls in adjacent to the start position.

Testing the game and final assumptions.

Step 11: Playing the Game and Final Assumptions

My Initial thoughts when trying to play the game is that its way too hard, I couldn't get further than the 3rd hole so I ended up making some more little barriers to assist navigating the ball through the maze, this should be a relatively hard game to play hence the title Labyrinth, but I feel with practice and a method a result should come, Joystick control is pretty smooth, there are no sudden jerks, the Y axis is less responsive than the X, sometimes the ball doesn't want to move, it could be the surface of the MDF, I will try say an 11mm ball and see if that makes any difference.(11mm Ball made no difference)

My assumptions with this build are, If I made another I would probably use small bearings for a really smooth Axis operation, we have wooden dowels going into wooden holes, its never going to be that smooth, but using bearings would overcome this, I think that using the brass axis pins has certainly made things smoother.

With my lack of woodworking skills I had difficulty getting both axis perfectly square and to sit flat, which in this type of game is crucial, I would prefer to cut the Axis framework on the CNC next time, It would be much more precise than Joints.

Update, after trying to play this game and getting nowhere fast I've had to resolve to adding more barriers but to assist this time, little pieces placed here and there on the layout seem to make things less difficult, I continued to do this throughout the layout and in the end I had something which was quirky and very playable.

My final thoughts are these, I already had the majority of the components, the 2 Items I had to purchase was 1 the 6mm round dowel and 2 the 11mm x 6mm spars for the barriers, so I'm really pleased with the outcome, It really is a functional game and can become quite addictive, and you could if you wanted to make different Labyrinth or maze layouts as the base is removeable.

Hope you enjoyed this Instructable and thanks for looking.

Toys and Games Contest

First Prize in the
Toys and Games Contest