Building Intrusion Detection System with Arduino and Ultrasonic Sensor

Procedure

  • Source
  • Target

NOTE: First make the connections, then move to code compilation.

1. Drag and drop the components in the workspace to create the circuit.

2. Connect Pin(Vcc) of Ultrasonic with Pin4 of breadboard.

3. Connect Pin(Gnd) of Ultrasonic with Pin3 of breadboard.

4. Connect Pin(Trig) of Ultrasonic with Pin1 of breadboard.

5. Connect Pin(Echo) of Ultrasonic with Pin2 of breadboard.

6. Connect Pin11 of Arduino with Pin1 of breadboard.

6. Connect Pin6 of Arduino with Pin2 of breadboard.

7. Connect Gnd Pin of Arduino with Pin5 of breadboard.

8. Connect Pin(5V) of Arduino with Pin6 of breadboard.

9. After connections click on the CHECK button to check the connections.

10. For the code compiler:

  • Set pinMode of trig_pin as “OUTPUT” first.
  • Set digitalWrite of trig_pin as “LOW”.
  • Set digitalWrite of trig_pin as“HIGH”.
  • Set pulseIn of Echo_pin as “HIGH”.

11. Now, click on COMPILE button to compile the code.

12. Click on RESET button to reload the webpage