Intelligent robot operating autonomously in an unknown environment is an important research hotspot in the field of artificial intelligence, in which the smart avoidance technology has been well focused on. To deal with the issue of excessive input/output variables, slow response and “curse of dimensionality” of traditional fuzzy algorithm, a hierarchical fuzzy controller has been designed. The input variables are grouped into three sub-fuzzy systems of the first layer. Then the output of first layer becomes the resource of second layer's fuzzy controller which eventually puts out the velocity of robot's wheels. Through differential drive of two wheels, the robot achieves the goal of obstacle avoidance efficiently. The MATLAB experimental result shows that the fuzzy rules number has greatly reduced and the hierarchical fuzzy algorithm has advantages of simple calculation, quick response and high precision.