Saturday, June 3, 2023

Optics Flow-Based Motion Detection

Ashwini Kumar Sinha

- Advertisement -

Many time we need motion detection and also want to track the displacement of object and their movement, For human motion detention is easy to do as microwave radar and PIR motion sensors are there that tracks human motion and alert but for nonliving or simple object motion tracking is bit difficult and these are often used and needed in robotics or in drone-like in drone we use the object motion detection to move drone or make the drone follow the motion of any moving vehicle or any object or to hover drone on a particular object its also useful in optical flow based positioning system. In-camera we can use it to stabilize the camera lens according to face or object movement using optical flow so today we will design a simple system that tracks the motion and gives us displacement data based on optical flow. It helps us in making cameras that shoot video based on the movement of any animal or object or alerts if there is any slight movement in objects using optics flow. 

Bill Of Materials


- Advertisement -

First we need to install the ESP 32 board to Arduino IDE and then open the library manager and search ADNS 3080 library and install that after installation include te ADNS code then define the NS pin number for sensor here I have used the pin 5 for that then we create the setup function where we will start the serial port with a baud rate of 9600 or any other baud rate of your choice and then we will create the loop function where we will check the optical flow sensor data and process the frames from the optical flow sensor and try to get the motion data if there is motion then we will also try to get the displacement in 2D x and y axis.

Fig 2. Code
Fig 2. Code


Now we connect the optical flow sensor module with esp 32 according to the following circuit diagram 

Fig 3. Connection


Fig 4. Serial terminal showing the motion data

Now upload the code by selecting the right port and board and then press the boot button to bring the ESP 32 board into boot mode to upload the code. Now after uploading the code open the serial monitor and then move the hand or object in the front optical flow sensor it will show you the motion and the displacement data in the x and y axis in the serial monitor.



What's New @

Truly Innovative Tech

MOst Popular Videos

Electronics Components

Tech Contests