Today's overpopulation and fast urbanization present a significant challenge for developing countries in the form of excessive garbage generation. Managing waste is essential in creating sustainable and habitable communities, but it remains an issue for developing countries. Finding an efficient smart waste management system is a challenge in current research. In recent years, robots and artificial intelligence have influenced a wide range of industries, especially waste management. This research proposes a waste segregation system that integrates the robot arm and YOLOv6 object detection model to automatically sort the garbage according to its type and achieve real-time requirements. The proposed algorithm utilizes the pros of the hardware-friendly architecture of YOLOv6 while keeping high detection accuracy in detecting and classifying garbage. Moreover, the proposed system creates a 3D model of a 4 DOF robotic arm by CAD tools. A new approach based on a geometric method is proposed to solve the inverse kinematics problem in order to precisely calculate the proper angles of the robot arm's joints via a unique solution with less computational time. The proposed system is evaluated on a modified TrashNet dataset with seven garbage classes. The experiments reveal that the proposed algorithm outperforms the other recent YOLO models in terms of precision, recall, F1 score, and model size. Furthermore, the proposed algorithm consumes approximately fractions of a second for picking up and placing a single object in its proper basket.