Facebooktwittergoogle_plusredditpinterestlinkedinmailFacebooktwittergoogle_plusredditpinterestlinkedinmail

I’ve seen these games around, and I wanted to make my own. The object is simple. The metal wand has a loop with a long windy wire going through it, and the object is to get from one end of the wire to the other, without touching the wand to the wire. It automatically detects when the game is starting and when it ends, and records the last time and record time. It also displays this information on the OLED display and it buzzes when the wire is touched.

NOTE: I tried to explain the construction of this as well as I could. If anything doesn’t make any sense, just let me know. I can post more pictures if needed.

Here’s a list of the materials that I used. Of course, you can definitely get similar results with different items. Overall, this cost me about $20, with $11 of it being the copper pipe.

The first thing that you need to do is create the windy wire and attach it to the base. I wanted a clean look with everything hidden away, so I used 2 blocks of wood (2″x4″x12″) and hollowed out the middle using a 3/4″ bit. I used the same bit in a few places to make a countersink for the screws so the screw heads aren’t sticking out.

I hollowed out 2 pieces of wood just like this to create a cavity for the electronics. This is a picture of the bottom block of wood.

Then I drilled 2x 1/4″ holes through the top piece of wood for the 2 ends of the copper pipe to go into. I also drilled 2 more holes right next to those for the wires for the washer to pass through. Next I drilled a small hole in the washers so that I can screw them into the wood. I also used the screw to hold the wires for the washers. I also drilled a larger hole in the middle to pass 6 wires (4 for the OLED and 2 for the speaker) and be able to fit the headers on the OLED. Be sure to put the pipe through the washers and the wand before fixing it to the wood.

Top block of wood. You can see the washers/screw on the left and right sides that hold the pipe. I also chiseled some channels for the washer wires.

Next, I bent the copper pipe in the shape I wanted. Be careful not to make really tight turn or else it might kink. Then I passed the copper pipe through the hole in the middle of the washers. I was able to dig through my bucket of screws to find a couple that fit perfectly into the pipe. If you don’t have a bucket of screws, you may want to go to a hardware store find screws that would go into the pipe. I used one of those screws to hold the wire that goes into D6 on the Wemos.

Next, I just screwed the speaker to the top, and used 2 screws to hold the OLED.

This shows how I used 2 screws to hold the OLED and the speaker. There is a hole between them to feed the wires down.

Now that we’re done being carpenters, we can wire everything up. Below is a schematic. Wire it up any way that is comfortable for you. I put headers on a protoboard along with the resistors and then jumpers to Wemos.

Schematic.

Once you have done that, you can load the code below on the Wemos/ESP8266. I have it connecting to WiFi using WifiManager so that I can upload firmware to it via OTA. You may want to disable that to speed up the boot.

A few notes about the code. I use an interrupt on the WIRE_PIN to catch any time the wand touches it. Before that, I just had the code in the loop to detect if it was touching. Since the loop took about 50ms to run(Mostly because of the OLED), that often caused issues where a ‘touch’ wouldn’t be detected if the player was lucky. However, the interrupt often caused the screen to get garbled if it happened in the middle of drawing.

I solved that problem by doing a complete redraw in the interrupt code. This causes a flashing of the screen when the wire is touched. If anyone knows of a better way to get around, please let me know.

The code just checks to see if the wand is on the ‘starting washer’ and not touching anything else. Then, when the player lifts up the wand, the timer starts. If the player completes the course, then the time is recorded to SPIFFS in JSON format. When the code is first run, SPIFFS is formatted and the high score file is created with really high values for the times.

I also wanted to play a a nice melody in the code when someone makes it to the end, but just didn’t get around to it. Also, the sound from the speaker isn’t that great, so I’m not sure if a ‘pleasant’ melody is possible. I’ll update here if I add that.

 

The ‘course’ that I made with the copper pipe has proven to be difficult. After trying dozens of times, I was only able to beat it once, and haven’t been able to do it again since then. No one else that has tried it was able to get more than half way through. You can see the high score in my pictures as less than a second. I had to cheat using a wire for testing. If you are testing it out, and you ever want to reset the scores, just add SPIFFS.format(); into the setup function and upload the code. Then remove that line and upload the code again.

If anyone has any questions or comments, feel free to post them here, on the Reddit post, or Twitter.

Leave a Reply

Your email address will not be published. Required fields are marked *