With the development of industrial automation technology, the automated guided vehicle (AGV) has been widely used in industrial transport, warehouse logistics and other fields. As a new guidance model for AGV, the two-dimensional code guidance model has been discussed in many fields. Two-dimensional code guidance model is a type of free path guidance technology. Under this guidance model, the work area of AGV can be divided into multiple rectangle regions, a two-dimensional code is deployed at each intersection of these regions, which carries the guidance information for its neighborhood regions. The AGV walks along a path which is obtained from the central server, and by scanning the two-dimensional code it encountered, it acquires the way to the next node in the path, until it reaches the endpoint. This guidance model has many advantages, such as low-cost, high re-usage, high flexibility etc., it is a competitive technology to replace the traditional track bedding and laser guidance technology. Although the use of the two-dimensional code technology avoids or solves a lot of problems compared to the traditional guidance technologies, there are still many potential problems to be tackled, such as matching the actual environment, arranging AGV in place etc. Especially, because there is no track for the AGV to follow, a new path planning algorithm should be designed to solve the above problems. In this paper, we propose a path planning algorithm under the two-dimensional code guidance model. It allows us to find an optimal path for the AGV to follow from the start point to the end point. To demonstrate the feasibility and advantages of this solution, a simple simulation platform is built and the algorithm is tested and verified by experiments.