- Ultrasonic Sensor HC-SR04
- Arduino UNO R4
- Jumper wires
- Visuino program: Download Visuino
- Connect Ultrasonic module pin (VCC) to Arduino pin [+5V]
- Connect Ultrasonic module pin (GND) to Arduino pin [GND]
- Connect Ultrasonic module pin (ECHO) to Arduino pin digital (2)
- Connect Ultrasonic module pin (TRIG) to Arduino pin digital (3)
Start Visuino as shown in the first picture Click on the "Tools" button on the Arduino component (Picture 1) in Visuino When the dialog appears, select "Arduino UNO R4 WiFi" as shown on Picture 2
Step 4: In Visuino Add & Set Components3 More Images
- Add "Ultrasonic Ranger(Ping)" component
- Add "Analog To Integer" component
- Add "Integer Multi Source" component
- Select "MultiSource1" and in the properties window set "Output Pins" to 3
- Select ArduinoUNO R4 WiFi board and in the properties window expand Modules>Display and select Elements and click on the 3 dots button, in the Elements window drag "Fill Screen" to the left side and drag "Draw Text" to the left side and in the properties window select "Text" and click on the pin icon and select "String SinkPin"
- Close the Elements window
- Connect "UltrasonicRanger1" pin [Echo] to Arduino digital pin [2]
- Connect "UltrasonicRanger1" pin [Ping-Trigger] to Arduino digital pin [3]
- Connect "UltrasonicRanger1" pin [Out] "AnalogToInteger1" pin [In]
- Connect "AnalogToInteger1" pin [Out] to "MultiSource1" pin [In]
- Connect "MultiSource1" pin [0] to ArduinoUNO R4 WiFi > Display > "Fill Screen1" pin [clock]
- Connect "MultiSource1" pin [1] to ArduinoUNO R4 WiFi > Display > "Draw Text1" pin [Text]
- Connect "MultiSource1" pin [1] to ArduinoUNO R4 WiFi > Display > "Draw Text1" pin [clock]
In Visuino, at the bottom click on the "Build" Tab, make sure the correct port is selected, then click on the "Compile/Build and Upload" button.
Step 7: PlayIf you power the Arduino module the LEDs on the Arduino Display will start to indicate the distance of the obstacle detected by ultrasonic sensor.
Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this tutorial, you can download it and open it in Visuino: https://www.visuino.com
Comments
Please log in or sign up to comment.