We have used sol–gel spin-coating method to prepare nano-crystalline TiO2 films for two kinds of polyaniline-based solar cell. The junctions thus obtained show rectifying behaviour. Their I–V characteristics indicate that a built-in electric field has been created at the nano-crystalline TiO2/polyaniline interface. Their I–V characteristics and energy conversion efficiency under simulated solar irradiation are measured and discussed.