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

    Temperature sensor with CORE2 AWS

    Scheduled Pinned Locked Moved Core2 for AWS
    2 Posts 2 Posters 5.4k Views 1 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.
    • P Offline
      pradeep
      last edited by

      Im using Grove - Temperature Sensor V1.2 with M5Stack AWS Edu kit,...im using the same example code given by seeeds wiki. It perfectly worked with my arduino.. But in m5stack it gives nan, and the raw values are 3400.00,3900.66 likes this, can anyone help me to resolve this...
      .................................Code.....................................
      // Demo code for Grove - Temperature Sensor V1.1/1.2
      // Loovee @ 2015-8-26

      #include <math.h>

      const int B = 4275; // B value of the thermistor
      const int R0 = 100000; // R0 = 100k
      const int pinTempSensor = A0; // Grove - Temperature Sensor connect to A0

      #if defined(ARDUINO_ARCH_AVR)
      #define debug Serial
      #elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
      #define debug SerialUSB
      #else
      #define debug Serial
      #endif

      void setup()
      {
      Serial.begin(9600);
      }

      void loop()
      {
      int a = analogRead(pinTempSensor);

      float R = 1023.0/a-1.0;
      R = R0*R;
      
      float temperature = 1.0/(log(R/R0)/B+1/298.15)-273.15; // convert to temperature via datasheet
      
      Serial.print("temperature = ");
      Serial.println(temperature);
      
      delay(100);
      

      }
      ................................................................................

      1 Reply Last reply Reply Quote 0
      • R Offline
        rashedtalukder
        last edited by

        Hi Pradeep, different hardware will have different pin assignments. Your sensor should be connected to Port B if it's using the ADC and pinTempSensor should be set to pin 36.

        Head of the AWS IoT EduKit program and AWS employee. Not an M5Stack employee.

        1 Reply Last reply Reply Quote -1

        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