Hello innovators,
In the previous blog you have seen the introduction of the Internet of Things(
What is IOT ?), now I'm going to release some more series of blogs regarding the IoT. This is not an internet-connected prototype but its worth for IOT beginner so keep watching this space.
You can find complete sketch
CODE
Let's get started. In this blog I'm going to explain how to detect objects using an ultrasonic sensor, ultrasonic sensor will detect the movement and object & trigger some action to servo motor which is also connected with the same device.
WHAT
In this blog I'm going to explain how to detect the object. If any object detected within 20 cm range by sensor it will open the gate for few defined seconds. After that gate will be closed automatically. If object will remain in front of the sensor gate will be remained open unless object gets away from sensor 's sensing area i.e 20 cm for this example.
WHO
Let's visit the list of tools, hardware and software we have used in this demo
Hardware
- Ultrasonic Sensor - To detect object we are going to use an ultrasonic sensor.
- Microcontroller - Arduino UNO will be used
- Jumper wires - We will use some jumper wires to connect the sensor and the microcontroller
- Servo motor - For open and close gate(Lego gate)
Software
- IDE - To write code here we have used Arduino IDE
- Code & Language - C++ Sketch
HOW
- Input - Ultrasonic sensor
- Ultrasonic sensor is connected to microcontroller 's pin. When any object movement or detection will be found within 20 cm range by ultrasonic sensor it will send signal to connected pin of microcontroller
- Microcontroller
- Microcontroller will keeps watch on input pin in loop
- When it detects any sinal from connected pin we have written code and uploaded to microcontroller that when it detects any signal from input pin it will send signal to output pin.
- Out put pin will be ON for 2 seconds
- After 2 seconds, next iteration of microcontroller loop will be executed and it will set trigger pin LOW and will check the status of Input pin to open or close the gate.
- Output - Servo motor
- We have connected output pin to servo motor. We are rotating servo motor for 95 degrees, so gate can be opened
CIRCUIT DIAGRAM