Sunday, January 12, 2020

DIY Hot Wheels Finish Gate - Build Your Own Electronic Hot Wheels Finish Gate

In this article, I am going to walk you through step by step the easiest way to build an electronic finish line for racing Hot Wheels.  I am going to assume that you have no experience with electronics or programming.  I am also going to assume you have very limited resources when it comes to tools and building.  If you have more experience in any of these areas, take whatever knowledge you can from here and adapt it to fit your needs. Be creative and build something awesome! I am also going to assume you have some basic computer skills (you found this, so that’s a good start) and can download and install software on your computer.

Here is a video that shows you all the steps to build your Hot Wheels finish line.  Hopefully it will work together with this post so that if any of the steps are unclear, one or the other will aid in your understanding.  This post contains way more detail than the video, as well as links to everything you need.  I would suggest that you both watch the video and read the post before you get started.



Ok, here we go.  First a little background into this design.  Your basic finish line uses an emitter and a detector, one above the track and one below the track to shoot a “beam” across the track.  When the Hot Wheels car breaks the beam, an LED lights up.  One of the disadvantages with this setup is that you have to put a hole in the track that the “beam” can go through and you have to have some sort of housing under the track for the sensor and electronics/wiring.  Not terribly hard, but remember, we’re trying to make things as easy as possible.  The second disadvantage is that with our sensors out in the open, they can be influenced by background light which can disrupt their sensitivity. Sunlight can be especially disruptive, so outside use or by windows can get a little sketchy.
In the version we are going to make there is nothing below the track.  You can just set the finish line over the track anywhere you want.  Also all the electronics and sensors are enclosed so you shouldn’t have to worry about any background light interfering.

We are going to look at this build in three main parts.

The Brains
The Body
Putting it all together...It’s Alive!

The Brains
The brain in this finish line is an arduino.  So what is an arduino?  Well, from the arduino website we learn
“Arduino is an open-source electronics platform based on easy-to-use hardware and software. Arduino boards are able to read inputs - light on a sensor, a finger on a button, or a Twitter message - and turn it into an output - activating a motor, turning on an LED, publishing something online. You can tell your board what to do by sending a set of instructions to the microcontroller on the board. To do so you use the Arduino programming language.”
This is an Arduino

So basically, an arduino is a device that takes in some sort of information, in our case when the Hot Wheels car crosses the finish line, and then does something based on that information, in our case lights up an LED.
We need to program the Arduino and tell it what to do.  The program for an arduino is called a sketch.  There is some free downloadable software that we will use to write the sketch and then upload it to the Arduino.  Once the Arduino is programmed, we will hook up the sensors, LEDs and batteries and be ready to go.
So first we need to get an Arduino.  There are lots of places you can get them and there are also lots of generic brand boards that use the same software, but here is a good price on Amazon for the Arduino Uno and it also comes with the cord to hook it to your computer. ($14.57 as of this writing)
https://www.amazon.com/Development-Microcontroller-ATmega328-ATMEGA16U2-Original/dp/B07R1H4BKK/


Next we need to download the software that we will be using to program the Arduino.  You can find it here. https://www.arduino.cc/en/Main/Software You can choose which operating system you are using.




If using Windows, I would suggest not the ZIP file, but the regular Windows installer



Once the software is downloaded, install it on your computer.

Now that you have the software installed lets hook up the Arduino and test it out. Your going to need what’s called an A B USB cable or sometimes it is called a USB printer cable.  If you ordered your Arduino from Amazon using the link above then it came with the Arduino.  Plug the small side into the Arduino and the USB side goes into your computer.  Wait a few minutes and your computer should automatically find and install the drivers that you need.



Now open up the Arudino Software that you downloaded and installed.  During the installation it probably put an icon on your desktop.


The software comes with a few preloaded sketches.  Let’s try one out just to get used to things and see if everything is hooked up right and works.  This sketch is called blink and will make  an  LED on the Arduino blink.

Go to the “File” menu at the top, then “Examples” then “01.Basics” and select “Blink”.




Next we need to select the board type and the port.  Again I am assuming that you got the Arduino Uno that was linked above.  Go to the “Tools” menu, then “Board: Arduino/Genuino Uno” and then select “Arduino/Genuino Uno”




Next we’ll select the port.  Go to the “Tools” menu, then “Port”. The port is likely to be COM3 or higher (COM1 and COM2 are usually reserved for hardware serial ports). If you are not sure which port it is, to find out, you can disconnect your board and re-open the menu; the entry that disappears should be the Arduino. Reconnect the board and select that serial port.


Now we are ready to upload the “Blink” sketch to the Arduino.  Simply click the Upload button.
Wait a few seconds - you should see the RX and TX LEDs on the board flashing. If the upload is successful, the message "Done uploading." will appear in the status bar.



A few seconds after the upload finishes, you should see the pin 13 (L) LED on the board start to blink (in orange). If it does, congratulations! You've gotten your Arduino up-and-running.



Now we are ready to load the Finish Line sketch onto the Arduino.  Each time you upload a sketch to the Arduino it will replace whatever sketch was there previously.

Go to File and select “New”
Now copy and paste the following sketch



// This is the arduino sketch: Open the arduino IDE,
// create a new file and copy/paste the following code into it.
// Don't forget to upload the code to your arduino!

/*
* Two Lane Finish Gate
*
* Lights up LED 1 or 2 depending on which sensor is tripped first
* Both LEDs light up in the case of a tie
*
*
* Author: Robby Comeford 2020
*/

const int ledPin1 = 12;
const int ledPin2 = 13;
const int sensorPin1 = 2;
const int sensorPin2 = 3;
const int TIMEOUT = 4000; // milliseconds

// Setup runs once, at start
// Input and Output pins are set
void setup(){
   pinMode(sensorPin1, INPUT);
   pinMode(sensorPin2, INPUT);
   pinMode(ledPin1, OUTPUT);
   pinMode(ledPin2, OUTPUT);
   digitalWrite(sensorPin1, HIGH); // turn on the pullup
digitalWrite(sensorPin2, HIGH); // turn on the pullup
}

// Called repeatedly
void loop() {
   // Get the Sensor status
   int status1 = digitalRead(sensorPin1);
   int status2 = digitalRead(sensorPin2);

if (status1 == HIGH) {   
    // turn LED on:
    digitalWrite(ledPin1, HIGH);
  }
  else {
    // turn LED off:
    digitalWrite(ledPin1, LOW);
  }
 
if (status2 == HIGH) {   
    // turn LED on:
    digitalWrite(ledPin2, HIGH);
  }
  else {
    // turn LED off:
    digitalWrite(ledPin2, LOW);
}

   if (status1 == HIGH || status2 == HIGH) {
      // A sensor was tripped, show the results until timeout
      delay(TIMEOUT); // Wait for timeout
   }
}


Now go ahead and upload the sketch to the Arduino by clicking the upload button.  Once the sketch is uploaded the “Brain” of the finish line is ready to go.

Before we get to the body, let’s talk about one more part, we’ll call it the “eyes”.  This is what is going to “see” the Hot Wheels cars cross the finish line and tell the “Brain” so it can light up the winning lane.  The “eyes” of the finish line are a pair of Break Beam sensors.  You can find them at this link on the Adafruit website https://www.adafruit.com/product/2167 or at this link on Amazon https://www.amazon.com/Adafruit-Accessories-Break-Beam-Sensor/dp/B01BU6YBWU/ 

Break Beam Sensors
They are a little cheaper on Adafruit, but you have to pay shipping.  On Amazon they are a little more expensive but qualify for free shipping, you’ll have to decide what is the better deal based on where you live and how much shipping would be if you got them from Adafruit.  They come as an emitter/detector pair and you will need two pairs, one pair for each lane.  The way they work is that the emitter sends out a “beam” that the detector can detect.  In our finish line, the beam will be blocked by a lever arm that hangs down to the track.  As the car crosses the finish line, it will strike the lever arm and move it out of the path of the beam.  As soon as the detector detects the beam, it will tell the Arduino and the Arduino will light up the LED for the lane where the car moved the lever first...the winner.

The Body
Now that we have the “Brains” of the finish line working, we need to build the body, including the “eyes”, a place for the “Brain”, the LEDs, and a battery holder to power the finish line.  Depending on how handy you are with tools and how creative you are, this is where you can really branch out on your own and design this any way you want using whatever materials suit you.  You could make it out of wood, plastic, metal, 3D print it, whatever you have the skills and resources to do.

For this tutorial, I will be doing this very simply using mostly cardboard so that anybody could build this with limited resources or limited experience with tools or building.  The “body” for our finish line will be a 6x6x6 cardboard box that you can pick up at Walmart. If you want you can use some spray paint to paint the box before you start building if you want it to look a certain way when you get done.  For this tutorial I’m just going to leave it the way it is so you can see exactly what I’m doing and so I can make any notes, etc. on the box for instructional purposes.

If you look inside the box, you’ll find a flap where the box has been glued together.  We are going to take the box apart so that we can work on the inside “guts” easily and also so we can get back into it after we are done.



Take a knife or razor blade and cut through the glue holding the box together at the inside flap and unfold it.  The side of the box with the flap will be the front. The flap will fold over the top and give us somewhere to attach the top of the box too.



At this point we are also going to cut off the two side flaps.  Set these aside as we will use one of them later.






First we need to cut some holes in the bottom of the box for our paddles to hang down through and swing freely.  The following picture is a template with measurements on it that I will use to mark out the holes on the bottom of the box.



You can make a template out of paper like I did, or you can just make the measurements and draw where the holes would be directly on the box.  Either way, get the rectangles where the holes should be drawn on the box and then use a razor blade or xacto knife to cut them out.





Next we need to make the support for the break beam sensors.  To do this I used one of the flaps that we cut off earlier.  The following picture is a template with the measurements on it that I will use to make the support.




You can make a template out of paper like I did, or you can just make the measurements and craw it out directly on the flap.  Either way, get the support drawn and cut out.



Now use hot glue (or your favorite alternative adhesive) to glue two 90 degree metal brackets to the support.



Next we will attach the sensors.



I am using some double sided tape, but you could hot glue them as well.  Cut one inch strips of the double sided mounting tape and place them on each side of the slits in the support.


Then stick the break beam sensors on each side.  Make sure to line up the small bulbs as best as you can.  The sensors have a small hole in them so you can use a nail or toothpick to stick through the hole in both sensors to line them up if you want.


At this point I decided to add a little more durability to the sensor support so I glued a craft stick to the top.  The top was rather thin and felt a little flimsy so craft stick would just give it some added rigidness.



Find the center of the bottom of your box and then glue the support down using the brackets.



Next we’ll glue the bracket on that will hold the paddles.



Now take a ⅜ inch dowel stick and cut off a 4 inch piece. This is what your paddles will swing on.





To make the paddles, measure 2 inches from one end of a large tongue depressor type craft stick and make a mark.   Drill a hole at the mark using a ¼ inch drill bit. 




After I finished making the finish gate I found something very curious.  It acted as if the beam was passing through  the wood paddles.  I can't imagine that was the case, however, I went back in and covered the paddles with duct tape (black electrical tape worked as well) and it worked great, so at this point I would suggest you put some tape around the top of the paddles where they will be blocking the beam.  Perhaps the beam was creeping around the curved top of the craft stick.  At any rate, the tape should make it work just fine.



Now finish the paddle assembly by sliding the dowel stick through the holes in the metal brackets as well as the holes in the craft sticks and then gluing the dowel to the metal brackets so it will not slide out.


Make sure the emitter/detector bulbs are completely blocked by the craft sticks, if you need to move the sensors down a bit you should have a little extra double sided tape below to be able to move them down.  Just make sure you move them down the same and the bulbs are still lined up. 

Now that we have the paddle and sensor assembly put together we can close up the box. Fold up the flaps on the bottom and then glue the side flaps to it.  I chose to use Elmers glue for this.  I also used tape to hold it while the glue was drying as well as added some extra tape for support.




Now we are going to make a stand for the finish line, and it is important to get the finish line as level as possible so that the paddles hang straight down.  If they do not, then they may not block the sensors.  If once you get the stand on and you notice that the paddles do not hang straight down, then make any adjustments you can to get things level, but if you still can’t get them to block the sensors, you can just tape a small piece of paper or cardstock to the top of the paddle until the sensors are blocked.

Next let’s make the stand for the finish line.  If you have a more permanent set up you could use some wood and attach the finish line permanently to your track.  In this tutorial, however, we are keeping it easy and making this finish line to accommodate multiple setups. For the support we will use another 6x6x6 Walmart box.

Cut off all the flaps and then measure to the middle of one of the sides and cut it in half.







Next glue four 90 degree metal angle brackets to the sides of the box to support the sides and give it a square shape.




Now measure down 5 inches on each side and draw a line.  This line will help guide you where to attach the finish gate.



Glue the finish line to the stand using the lines to guide you and make the finish line as level as possible. Again, I used Elmers glue for this and reinforced it with tape. 





Now we are going to make a little shelf to put the arduino and battery pack on.  Use two of the flaps that we cut off of the stand.  Tape them together to form one piece.  This will rest on top of the  paddle/sensor assembly as well as the two flaps that are folded up from the bottom.  You may have to trim this shelf a bit to fit.  I also cut a bit of the back side so that it would be easy to grab and pull out if I need to get back into the paddle/sensor assembly.




Poke a hole somewhere towards the middle to feed the wires from the sensor through.




Now feed the wires through and set the shelf down on top of the paddle/sensor assembly.







Now that we have the shelf in place we can work on getting the LEDs installed. These are what will light up and tell us the winner.  LED have two wire leads that come from them.  Usually they have a longer lead and a shorter one.  The shorter one is the one that we will connect to the negative or ground side.  The longer one is the positive connection.  You can find some LEDs here. https://www.amazon.com/gp/product/B01N4JA54A/ref=ox_sc_act_title_2?smid=A2O4FZXIRZDLHA&psc=1

You will need some wire to connect the LEDs to the arduino.  If you have some small wire laying around that you could use that is fine, but if not, you can get on Amazon and order some small jumper wires like this (https://www.amazon.com/WayinTop-Preformed-Breadboard-Solderless-Prototyping/dp/B07PTYBFDT/) or this (https://www.amazon.com/Solderless-Flexible-Breadboard-Jumper-100pcs/dp/B005TZJ0AM/).



The jumper wires are really your best bet because they make it easy to connect to the Arduino.  The jumper wires are a little more stiff and are the perfect size for the Arduino, where more flexible wire is harder to get into the connections on the Arduino. I'm actually going to do both.  The extra wire gives me a little more room to play with as I get all the wires connected to the Arduino, and the jumper wire makes it easy to connect to the Arduino.


Take your wire and connect it to the LEDs.  Normally I would solder these together and use heat shrink tubing, but I’m assuming that you don’t have a soldering iron or soldering skills, so just use some pliers to twist them together and then use some vinyl electrical tape to keep it together and insulate it.



Measure and draw a line centered on the front of your box.  Now draw a line that is 1.5 inches from the top of your box.  From the center line measure 1 inch from the center on each side and put a mark.  Poke a hole at each mark with your pencil.  Go slow and work the hole open a little bit at a time checking to see if the LED fits in.  Make the hole just large enough that the LED fits into it tightly.


Tape the LEDs into the holes on the inside.



I used some of 3M's velcro-like strips on the top and the flap so I can open and close the top.



Putting it all together...It’s Alive!
We are now ready to get everything hooked up and bring this thing to life.  First let’s look at everything that needs to be hooked to the Arduino and where it will go, then we will look at each thing individually and the best way to get it connected.
The red wires from all the sensors will all be connected to the “5V” connection.
The black wires from all the sensors will all be connected to the “GND” connection.
The white wire from the lane 1 sensor will be connected to the “2” connection.
The white wire from the lane 2 sensor will be connected to the “3” connection.
The “positive” wire (the one connected to the longer lead on the LED) from the lane 1 LED will be connected to the “12” connection.
The “positive” wire (the one connected to the longer lead on the LED) from the lane 2 LED will be connected to the “13” connection.
The “negative” wires (the wire connected to the shorter lead on the LED) from both LEDs will be connected to the “GND” connection.
The red wire from the battery box will be connected to the “Vin” connection.
The black wire from the battery box will be connected to the “GND” connection.

You have probably noticed that in some cases several things need to be connected to the same spot, but all those wires are not going to fit into the tiny hole on the Arduino, so it is best to connect these all to one wire, and then connect that wire to the arduino.  As mentioned earlier, sometimes very flexible wire can be hard to push into the arduino. So I will be connecting all my wires to these “jumper” wires and then connect them to the arduino.

First connect all the red wires coming from the sensors together.  Then take that connection and connect it to the “5V” connection on the Arduino.



 Next connect all the black wires from the sensors and the negative wires (short lead) from the LEDs together.  Take that connection and connect it to the one of the “GND” connections.



Connect the white wire from the lane 1 sensor (you may have to pull the shelf back out and follow the wires to see which white wire is which) to a jumper wire, then connect it to the “2” connection.

Do the same for the white wire from the lane 2 sensor and connect it to the “3” connection.


Connect the “positive” wire (long lead) from the LED for lane 1 to a “jumper” wire and then connect it to the “12” connection.


Connect the “positive” wire (long lead) from the LED for lane 2 to a “jumper” wire and then connect it to the “13” connection.




Now we need to hook up some power.  I used a battery box with an on/off switch.  You can find one here. https://www.amazon.com/gp/product/B01DEYV00W/ref=ox_sc_act_title_3?smid=A28O9CKQZW4GJU&psc=1
Now take the red wire from the battery box and connect it to the “Vin” connection.
Take the black wire from the battery box and connect it to the open “GND” connection.



Now that the Ardino is all connected I placed it in a small plastic crayon box that I got from Walmart.    Place the arduino and the battery box on your shelf and we should be all set.




Put some batteries in the battery box, turn it on, and you should be in business...IT’S ALIVE!!!!



Now it's your turn. Build your's exactly like this one...or get creative and create your own version.  Be sure to post a link in the comments below to your own creation based on this basic design so others can get ideas and see what is possible.

Have fun! Looking forward to seeing what you create!



1 comment:

  1. Hi, can this be extended to a 6 lane finish line? is the programming of the Arduino the same?

    Many thanks

    ReplyDelete