Adruino Speed Tracker

Introduction: Adruino Speed Tracker

Here is a little project that is potentially applicable to any toy race track with a car that has a length greater than 4 cm +/- 0.50 cm. The purpose of the project is to track the speed of a toy car using IR sensors and receivers that are connected to a breadboard and Arduino board. Using IR sensors, a little bit of Arduino coding knowledge, an LCD display, and some lego pieces, you can successfully make an Arduino speed tracker.

Step 1: Materials

- Arduino UNO & Genuino UNO x 1

- LCD 16x2 with I2C module x 1

- IR sensor (Receiver 3 leg) x 2

- IR LED x 2

- 5mm Green LED x 1

- Breadboard (Regular) x 1

- Male/Male Jumper Wires

- Arduino IDE to code

Step 2: Assembly

Start the project off by collecting all your materials. Here is a step by step demonstration to know specifically how to plug in all of the components. Step one, plugin both IR sensors at opposite ends of your breadboard and place the IR receivers parallel to the sensors. Then get your wires/cables and make connections to ground and VCC, and for the third leg on the IR sensors, attach a cable connecting IR sensor A to pin5 on the Arduino and connect IR sensor B to pin3.

Step 3: Add Green LED

Now, to signal the user that the tracker is ready to go, the green LED comes into action. You can place this wherever you want on the breadboard as long as it does not interfere with the other components. Simply put the negative leg of the LED to ground and the positive leg through a 2.7k ohm resistor to pin12 on the Arduino. (All pins are already stated in the code)

Step 4: Add LCD L2C Model

Finally, the last component to add to the circuit is the liquid crystal display to show what the speed of the car is and when each IR sensor picks up a signal. Because this LCD model has an l2C connected to it, wiring is incredibly easy with only 4 connections, two on the breadboard and two on the arduino. Connect the LCD's VCC pin to the breadboard's power line, and the ground pin to the ground line. Then make a connection between the LCD's SCL pin to the arduino's pin A5 and the SDA pin to pin A4.

Step 5: Final Circuit Result and Code

Now that you have made all of the wired connections, you can now upload the code to your arduino uno. If you don't already have the Arduino IDE, here is the link to download it: . Once you have it installed and configured, copy and paste the code to your program and upload it to the board.

Here is this code:



LiquidCrystal_I2C lcd(0x27,20,4);

const int ledPin = 12; byte irPinA = 5; byte irPinB = 3; byte irValA; byte irValB; float diff; float vel; unsigned long timeFirst; unsigned long timeScnd; float speedConst = 453.6;

byte customChar0[8] = { B01000, B01100, B01110, B01111, B01110, B01100, B01000, B00000 };

void configLCD(){ lcd.createChar(0, customChar0); lcd.setCursor(0,0); lcd.write(0); lcd.write(0); lcd.write(0); lcd.setCursor(3,0); lcd.print("SPEED TEST"); lcd.setCursor(13,0); lcd.write(0); lcd.write(0); lcd.write(0);

lcd.setCursor(0,1); lcd.print("Speed:");


void setup() { pinMode(irPinA, INPUT); pinMode(irPinB, INPUT); pinMode(ledPin, OUTPUT); Serial.begin(9600); lcd.init(); lcd.backlight(); configLCD(); digitalWrite(ledPin, HIGH);

} void(* resetFunc) (void) = 0;

void loop() { irValA = digitalRead(irPinA); if (irValA == LOW){ irValB = digitalRead(irPinB); timeFirst = millis(); lcd.setCursor(0,0); lcd.print(" "); lcd.setCursor(2,0); lcd.print("Start "); digitalWrite(ledPin, LOW); delay(3); if (irValB == LOW){ lcd.setCursor(0,0); lcd.print(" "); timeScnd = millis(); lcd.setCursor(2,0); lcd.print("Start->End "); diff = timeScnd - timeFirst; vel = speedConst / diff;

if(diff > 1000){

lcd.setCursor(2,0); lcd.print("Car Not Found"); delay(2000); resetFunc(); } lcd.setCursor(6, 1); lcd.print(vel); lcd.print("km/h"); delay(2000); lcd.clear(); configLCD(); digitalWrite(ledPin, HIGH); } } }

Step 6: End Result With Code

Be the First to Share


    • Halloween Contest

      Halloween Contest
    • Back to School: Student Design Challenge

      Back to School: Student Design Challenge
    • 3D Printed Student Design Challenge

      3D Printed Student Design Challenge


    Penolopy Bulnick
    Penolopy Bulnick

    1 year ago

    This is neat! Nice job on your first Instructable :)