Since photovoltaic (PV) plants require periodic maintenance, using Unmanned Aerial Vehicles (UAV) for inspections can help reduce costs. The thermal and visual inspection of PV installations is currently based on UAV photogrammetry. A UAV equipped with a Global Positioning System (GPS) receiver is assigned a flight zone: the UAV will cover it back and forth to collect images to be later composed in an orthomosaic. The UAV typically flies at a height above the ground that is appropriate to ensure that images overlap even in the presence of GPS positioning errors. However, this approach has two limitations. Firstly, it requires to cover the whole flight zone, including "empty" areas between PV module rows. Secondly, flying high above the ground limits the resolution of the images to be later inspected. The article proposes a novel approach using an autonomous UAV equipped with an RGB and a thermal camera for PV module tracking. The UAV moves along PV module rows at a lower height than usual and inspects them back and forth in a boustrophedon way by ignoring "empty" areas with no PV modules. Experimental tests performed in simulation and an actual PV plant are reported.