Speed Sensor

Hello! Using an Arduino, I have created a speed sensor that will measure speed in meters/second and activates a buzzer along with a RGB led. Additionally, a push button is added to reset the velocity reading back to zero. This project takes inspiration from "Arduino speed detector" made by yashastronomy on Arduino Project Hub.
Supplies

Adding Power and Ground to the Breadboard


Firstly, you will need to connect two jumper cables to the power and ground of the Arduino. They are labeled 5V and GND respectively and can be found on the left side of the Arduino Uno. The jumper wire connected to 5V will be connected to the + rail of the breadboard and the jumper wire connected to the GND will connect to the - rail of the breadboard. Once that is done, grab two extra wires and add a wire to the top + rail and connect it to the bottom + rail. Then, connect the second extra wire and connect it to the top - rail and the connect the other side to the bottom - rail.
Connecting the Push Button





Next, grab a 10KΩ resistor and connect it to the - rail of the breadboard. Additionally, connect a small jumper wire from the + rail of the breadboard to a contact that is near the 10KΩ resistor. It is important to note that a push button contains only two terminals, Terminal 1a, Terminal 1b and Terminal 2a and Terminal 2b. As an example of these terminals, there could be a power connection to Terminal 1a and this power will transfer to Terminal 2b. Using this, the terminal of the push buttons, Terminal 1a and Terminal 2a are connected to the jumper wire and the resistor. Using terminal 2b, another jumper wire is attached to Arduino Digital Pin 2.
Connecting the Buzzer






Next, place a 330Ω resistor on the + rail of the breadboard along with a jumper wire on the - rail of the breadboard. Now, you can connect the buzzer with the positive pin being connected to the 330Ω resistor and the negative pin being connected to the jumper wire. Afterwards, connect a jumper wire from Arduino Digital Pin 6 to the positive pin of the buzzer.
Connecting the RGB Led





Since we are using a Common Anode RGB, a 330Ω resistor will be connected to the + rail of the breadboard. Next, the common (longest leg of the RGB Led) will be connected to the resistor. Connect a jumper wire from Arduino PWM Pin 9 to the red pin of the RGB Led. Next, connect a jumper wire from Arduino Pulse Width Modulation (PWM) Pin 10 to the blue pin of the RGB Led. The green pin of the RGB Led is not utilized in this code, meaning you won't have to attach a jumper wire. It is important that the RGB Led is connected to PWM pins, as PWM is used to regulate the voltage being sent to each pin of the RGB Led, allowing for a controlled brightness or color.
Connecting the IR Proximity Sensors






The IR Proximity Sensor will contain three pins, GND, VCC and SIG. To connect these pins, all six of the female to male jumper wires are used. GND stands for ground and can be directly connected to the - rail of the breadboard. VCC stands for power and can be directly connected to the + rail of the breadboard. Finally, SIG stands for signal and can be connected to Arduino Analog Input Pin A0. The same steps will follow for the second IR Proximity Sensor, however SIG will be connected to Arduino Analog Input Pin A1.
Distance the Two IR Proximity Sensors

Using a ruler, you can distance the two IR Proximity Sensors to a certain length that you can choose. For my setup, I chose 20CM (0.2M). You can adjust the code for your configured distance.
Uploading the Code to the Circuit
Here is the code that I have created. There are comments included so you can understand and adjust the code to your liking.
Downloads
Explanation of Code



The first screenshot shows the different components being connected to their individual Arduino pins. Void setup() {, is used to initialize and configure the different components (ex. redPin of RGB Led being used to output light).
The second screenshot shows the function of the RGB Led. Inside of this function, it allows the user to write the RGB Led pins to a specific voltage, making use of the PWM pins.
The third screenshot shows the main body of the code inside of void loop () {. This code starts off with the push button setting the RGB Led to an off state when the button is not pressed. Once the first sensor detects an object, it will begin a time incrementation every millisecond. Once the second sensor detects an object, it will end the time incrementation and divide by 1000 to turn millisecond's to seconds. From here, "speeds" will use the speed formula of distance/time to calculate the speed in meters/second. Serial.println will display the calculated speed. If the speed is greater than 0.5, the RGB led will activate causing it to flash red and blue, along with the buzzer siren going off. The else code is used to reset the time incrementation back to zero once the push button is pressed.
Completed Circuit

Here is a video of the completed circuit and its completed schematic.