Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    TSL2591 runtime error: Overflow reading light channels

    Scheduled Pinned Locked Moved MicroPython
    tsl2591i2clibraryruntime error
    6 Posts 3 Posters 64 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T Offline
      tttadam
      last edited by

      Hello there! :)
      I have a TSL2591 light sensor with this library. I use this sensor to mesure light from a special kind of partly infra led lamp.
      Based on the datasheet this sensor should be good up to 88000 lux which is huge. But I get Overflow errors from around 2940 lux.
      This is one okay measurement, above that its runtime error(overflow):

      Total light: 2935.916 lux
      infrared light: 11313
      Visible light: 741434001
      full spectrum(IR+ visible) light: 741445314
      

      Can you gave me a tip, what am I do wrong?
      Thank you! :)

      1 Reply Last reply Reply Quote 0
      • T Offline
        tttadam
        last edited by

        I digged into the library little bit, and I found out the the error is raised because channel_0 is ?too low? and channel_0 is getting his value from here _TSL2591_REGISTER_CHAN0_LOW = const(0x14).
        Not much, but still digging.

        1 Reply Last reply Reply Quote 0
        • T Offline
          tttadam
          last edited by

          I took out the checks where the overflow exception is rased. And after 3000 lumen the values start to decrease... so I turn up the know on the lamp, goes up to 3000 then down to -1600.

          1 Reply Last reply Reply Quote 0
          • T Offline
            tttadam
            last edited by

            I tried to mess around with gain. Tried out every possibility, but no luck.

            1 Reply Last reply Reply Quote 0
            • J Offline
              Jose Castaneda
              last edited by

              I am running into the same issue. Did you find any solution?

              1 Reply Last reply Reply Quote 0
              • T Offline
                tuftec
                last edited by

                It looks like you are using signed intergers/numbers for the reading from the light sensor. When it reaches the half way value it wraps around and goes negative.

                If you simply define the data as an unsigned type does it fix the issue.

                1 Reply Last reply Reply Quote 0

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better 💗

                Register Login
                • 1 / 1
                • First post
                  Last post

                Pycom on Twitter

                Pycom