To move efficiently in an unknown environment, a mobile robot must use observations taken by various sensors to detect obstacles. This paper describes a new approach to detect obstacles for serpentine robot. It captures the image sequence and analyzed the optical flow modules to estimate the deepness of the scene. This avoids one or higher order differential in the traditional optical flow calculation. The data of ultrasonic sensor and attitude transducer sensor are fused into the algorithm to improve the real-time capability and the robustness. The detecting results are presented by fuzzy diagrams which is concise and convenient. Indoor and outdoor experimental results demonstrate that this method can provide useful and comprehensive environment perception for the robot.