🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Change NCIR 2 from C to F

    Scheduled Pinned Locked Moved Units
    4 Posts 2 Posters 2.3k Views
    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.
    • R Offline
      reptilepvp
      last edited by

      How would I go about changing the NCIR 2 unit to read from celsius to fahrenheit? Any help would be great

      felmueF 1 Reply Last reply Reply Quote 0
      • felmueF Offline
        felmue @reptilepvp
        last edited by

        Hello @reptilepvp

        according to its datasheet the used sensor MLX90614 is Celsius only.

        That said, there is a quite simple formula to convert Celsius into Fahrenheit. Have you tied that?

        (0 °C × 9/5) + 32 = 32 °F

        Thanks
        Felix

        GPIO translation table M5Stack / M5Core2
        Information about various M5Stack products.
        Code examples

        R 1 Reply Last reply Reply Quote 0
        • R Offline
          reptilepvp @felmue
          last edited by

          @felmue I apologize for sounding stupid & not doing my research. But could you possiblely show me where I need to put that in my code? I thought I put the formula in right. But I guess not .

          i2c0 = I2C(0, scl=Pin(1), sda=Pin(2), freq=100000)
          ncir2_0 = NCIR2Unit(i2c0, 0x5A)
          ncir2_0.set_buzzer_control(0)
          ncir2_0.set_rgb_led(0xcc33cc)
          ncir2_0.set_emissivity_value(0.95)

          def loop():
          global DopeMete, Battery, Temperature, label5, label0, line0, label1, line2, label2, line1, label3, label4, i2c0, ncir2_0
          M5.update()
          label2.setText(str("%.2f"%float((((ncir2_0.get_temperature_value) * 9) / 5 + 32))))
          label3.setText(str(ncir2_0.get_emissivity_value))
          label4.setText(str(ncir2_0.get_button_status))
          label5.setText(str(Power.getBatteryLevel()))

          felmueF 1 Reply Last reply Reply Quote 0
          • felmueF Offline
            felmue @reptilepvp
            last edited by

            Hello @reptilepvp

            just try something like below:

            label2.setText(str(((ncir2_0.get_temperature_value) * 9) / 5 + 32))
            

            Note: untested as I do not have the necessary hardware to verify.
            Thanks
            Felix

            GPIO translation table M5Stack / M5Core2
            Information about various M5Stack products.
            Code examples

            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
            • First post
              Last post