This research paper presents an autonomous UAV equipped with an optical flow sensor for positioning and navigation. The system provides collision avoidance for UAVs by controlling their six degrees of freedom through an external computer system. The optical sensor helps the UAV navigate in non-GPS environments like deep seas and caves. It uses the OV7076 optical sensor, which transmits and receives signals from the ground to track the UAV's position with low error of about 30 cm. The system was tested successfully in navigating through "Nikalaus Houses".