Watch the video on How to simulate the Ultrasonic Distance Sensor on Tinkercad
If you want to make it with components
Materials Needed:- TinkerCAD account (free to sign up)
- Computer with internet access
- Arduino Uno board
- HC-SR04 Ultrasonic Distance Sensor
- Breadboard and jumper wires
Log in to your TinkerCAD account and start a new project.
- Log in to your TinkerCAD account and start a new project.
Search for the components in the TinkerCAD component library:
- Drag and drop an "Arduino Uno" onto the workplane.
- Drag and drop an "HC-SR04 Ultrasonic Distance Sensor" onto the workplane.
- Connect the components using jumper wires. Connect VCC and GND of the sensor to the respective pins on the Arduino. Connect the Trig pin of the sensor to a digital pin, say Pin 2, and the Echo pin to another digital pin, say Pin 3.
- Search for the components in the TinkerCAD component library:Drag and drop an "Arduino Uno" onto the workplane.Drag and drop an "HC-SR04 Ultrasonic Distance Sensor" onto the workplane.Connect the components using jumper wires. Connect VCC and GND of the sensor to the respective pins on the Arduino. Connect the Trig pin of the sensor to a digital pin, say Pin 2, and the Echo pin to another digital pin, say Pin 3.
Open the Arduino IDE and paste the code.
Step 3: Simulating the CircuitGo back to the main workspace.
- Go back to the main workspace.
Click the "Start Simulation" button to simulate the circuit.
- Click the "Start Simulation" button to simulate the circuit.
Once the simulation starts, open the Serial Monitor:
- Click on the Arduino Uno component.
- In the right-hand panel, click on the "Code" tab.
- Scroll down and find the "Serial Monitor" section. Click on the "Open Serial Monitor" button.
- Once the simulation starts, open the Serial Monitor:Click on the Arduino Uno component.In the right-hand panel, click on the "Code" tab.Scroll down and find the "Serial Monitor" section. Click on the "Open Serial Monitor" button.
Observe the distance readings in the Serial Monitor as they update.
- Observe the distance readings in the Serial Monitor as they update.
- While the simulation is running, you can manually adjust the distance between the ultrasonic sensor and a virtual object to observe changes in the distance readings.
Congratulations! You've successfully interfaced an ultrasonic distance sensor in Autodesk TinkerCAD. This virtual simulation helps you understand how the components work together and how the sensor measures distance based on the time taken for sound waves to travel and return.
Feel free to experiment with different distances and modify the code to enhance your learning experience.
Comments