Spray pyrolysis in solar cells and gas sensors