Is it possible to access light sensor raw data logs from an Android device (in my case, an LG Optimus)? If so, how is this possible and what format would the log be in?

  • 4
    What makes you sure that the data is logged and not just available as a service for subscription? Jun 16, 2013 at 12:07

4 Answers 4


The Android system monitors the light sensor (for things like auto-adjusting the backlight), but to my knowledge doesn't specifically log that data by default.

You can get an app like AndroSensor which allows access to all your phone sensors and can monitor and log the data for you.


Sadly, although Android does have light sensor data, it does not store it anywhere (as far as I'm aware anyway). Luckily, there is a very simple way of accessing and storing the data yourself!

Just follow the steps below, and you should be up and running with light sensor data in no time!

  1. Download Tasker from the Play Store
  2. Make a new .txt file in your documents folder and name it to Light_sensor_data.txt (You may need a file viewer/editor such as File Explorer).
  3. Open Tasker and click +EventSystemDevice Boot.
  4. Click on the gear (back) in the top left corner.
  5. A pop-up menu will appear. Tap on New Task and name it Light Sensor Data (Or whatever you want).
  6. Within the task, click on +FileWrite File.
  7. To the right of where it says File, there is a magnifying glass; Click on it.
  8. Now tap DocumentsLight_sensor_data.txt
  9. Click the "pencil" to the right of Text. Now scroll down the list that says Variable Select and find Light Level. It is close to the middle.
  10. Now click the Gear or Back button.
  11. Tap +TaskWait. If you need your results to update quickly, I would suggest setting MS to anywhere between 10 and 100, however this will use a lot of CPU so if you're ok with slower updating results, I would set Seconds to between 1 and 5.
  12. Once again, click on the Gear (back). Now select +TaskGoto and set Type to Action Number and Number to 1.
  13. Tap the Gear (back) twice to get to the Tasks screen. Now click Profiles at the top of the screen.
  14. Tap on +EventSystemDevice Boot and click the Gear (back). A menu should pop-up; select Light Sensor Data.
  15. On the Profiles tab there should be a On/ Off switch to the right of your Task. Turn it to Off and then back to On.
  16. Restart your device.

Important note: not only you must have a light sensor on your device, but it must also be enabled. You can check if it is enabled or not by hitting the three dots in the upper right corner of tasker → Preferences and selecting the monitor tab. Now scroll down to Light Sensor and ensure that Yes is selected.

Given that everything was setup properly, you should now be able to access light levels by reading Light_sensor_data.txt You can also read the light level data using Tasker and even create a pop-up displaying the current information.

Good luck, and I hope this helps you.

  • Are you somehow affiliated with Tasker? I ask this because all your answers involve the app and as the Help Center states: "The community here tends to vote down overt self-promotion and flag it as spam. Post good, relevant answers, and if some (but not all) happen to be about your product or website, that’s okay. However, you must disclose your affiliation in your answers." May 7, 2015 at 12:33
  • @onik No I am not in any way affiliated with tasker, it's just really the only part of android that I feel I know a lot about. Therefore, I mostly just answer questions that can be solved using it. As far as android goes, I sort of "specialize" in developing apps using tasker and plugins for it. But no, although I would like to work for them, I don't:) Nor do I have any affliations to anything related to tasker. If you look closely at my user icon, it says "IdeasEtc" thats my business. May 7, 2015 at 14:33

I have a rooted Samsun 7 device (sm-g935v) and I can read the raw data from: /sys/class/sensors/light_sensor/lux


Easy way to access it is to install Termux, a Linux terminal emulator that gives you access to the Linux commands on Android. On Samsung A3, you can access the data with

cat /sys/class/sensors/light_sensor/lux 
cat /sys/class/sensors/light_sensor/raw_data  #alternative 

You can install Python with Termux and write a Python script that will read the content of these files, and publish it on any Pub/sub system with MQTT. I've tried Mosquitto, and it works perfectly with Termux. You can even publish to cloud IOT of either AWS or Microsoft or Google. Any IoT broker will do.

You must log in to answer this question.