🤖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

    Units
    2
    4
    475
    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
      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
        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
          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
            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
            • First post
              Last post