This work reports the use of a smartphone's ambient light sensor as a valuable tool to study and characterize the efficiency of an optical source. Here, we have measured both luminous efficacy and efficiency of several optical sources (incandescent bulb and halogen lamp) as a function of the electric power consumed and the distance to the optical detector. The illuminance of LEDs as a function of the distance to the optical detector is characterized for different wavelength emissions. Analysis of the results confirms an inverse-square law of the illuminance with the detector-source distance and shows good agreement with values obtained by classical experiments. This experience will trigger awareness in students in terms of sustainability, light propagation and efficiency of different optical sources.