Wouldn’t it be cool to build an Arduino Speed Measuring Device simply and learn from it?
We’ve seen in previous posts how we can use the ultrasonic sensor transducer HC-SR04 to measure distances using the ultrasonic waves by sending ultrasonic wave then receiving it using this sensor and by knowing the speed of sound we can determine the distance the wave has traveled and here is on Tinkercad simulation software we are using the same sensor with Arduino UNO to measure the speed of objects this time.
Here is how you can start building your own Arduino Speed Measuring Circuit using Ultrasonic wave and the HC-SR04 Transducer.
As we are using Tinkercad Simulation, we don’t need to buy any components or even software. Tinkercad is a free online environment. It comes with many Arduino Boards, power supplies, sensors and actuators.
So, the only thing you need to use is to go www.tinkercad.com and build our circuits.
You may also want to build your real circuit so here are the needed components:
Arduino UNO
Amazon UK, Amazon DE , Banggood
HC-SR04 Ultrasonic Transducer
Circuit ConnectionHere is the HC-SR04 ultrasonic sensor it has two elements one element called trigger that’s the ultrasonic transmitter and hat’s the receive element called echo.
VCC connected to 5+ volts and ground connected to the GND and here is the TRIG or transmit pin connected to Arduino to pin number 5.
And the ECHO connected to pin number 6.
HC-SR04 ARDUINO
GND GND
VCC VCC
ECHO 6
TRIG 5
CodeOn the upper right Code tab, click the dropdown menu and select the text only. When you’re prompted to the caution that you are going to deleted all the Blocks, you click Continue.
Then you paste the above code in the software sheet.
First we start by defining the triggering pin number five and the echo pin number six and the variables that we use in our program.
The duration the distance the speed and we define the pin mode for triggering as an output the echo or the receive pin we define it as input.
We define the Baud Rate for the serial monitor to be 9600.
In the loop function we call the calculate speed function and we start by defining the calculate distance function.
We calculate the distance using the bouncing wave that transmitted then receive wave and using the knowledge of the speed of the sound then we can know the distance and then we print it on the serial monitor.
The calculate speed function, we start by measuring two distances. The first distance and the second distance then we know the difference between the two distances and then we divide it by the time then we get the speed and print it on the serial monitor
Now, you’re ready to start the circuit execution.
SimulationNow, click the Start Simulation button to start the simulation.
You see that Arduino is connected to the USB port on the screen and it indicates that it’s powered and started software execution.
Read this project on AeroArduino.com from here.
You can Find interactive Tinkercad Model and you can copy it here.
Video
Comments