This paper presents the analysis, design, and the implementation of a system for detecting an electrical outlet that will allow a mobile robot to independently recharge its own energy supply. The system is implemented with a robotic arm, a zoom camera, a standard web camera and a laser distance sensor. Utilizing the eye-in-hand configuration the camera is mounted on end-effectors of the robotic arm. The image-based visual servo will control robot joint angles directly using measured image features. The image analysis is performed using Pattern algorithm. The robotic arm will start scanning the area trying to find an outlet. The system uses a template to be compared with the image coming from the camera; the zoom of the camera moves according to the distance of the object, which allows the system to compare with only one size template. Once the outlet has been identified, the coordinates x, y and z are sent to the robot. The robot will automatically move as close as necessary to the outlet then the robotic arm maneuvers using visual servoing until the plug face is perfectly aligned to the outlet; finally the plug/unplug system will be activated. Some simulation and experimental results will be given in the paper.