Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. TMT6000

TMT6000

Scheduled Pinned Locked Moved Troubleshooting
6 Posts 2 Posters 1.4k Views 1 Watching
  • 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.
  • S Offline
    S Offline
    stress nero
    wrote on last edited by
    #1

    @stress-nero said in TEMT6000:

    Hello first time user here, I have been trying to build a 4in1 light, motion, tem/hum using a nano, temt6000, dht22, and sr501 using the examples and already made sketches i can combine everything, but i am not sure if i am entering the info for the temt6000 correctly. Can someone take a look please```
    Insert Code Here

    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    
    #include <SPI.h>
    #include <MySensors.h>  
    #include <DHT.h>
    
    #define CHILD_ID_HUM 0
    #define CHILD_ID_TEMP 1
    #define CHILD_ID_MOTION 2
    #define CHILD_ID_LIGHT 3
    
    #define LIGHT_SENSOR_ANALOG_PIN 0
    int lastLightLevel;
    
    #define HUMIDITY_SENSOR_DIGITAL_PIN 4
    
    #define DIGITAL_INPUT_SENSOR 2   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
    
    
    DHT dht;
    float lastTemp;
    float lastHum;
    boolean metric = false; 
    
    unsigned long interval= 3000;//dht.getMinimumSamplingPeriod(); // the time we need to wait
    unsigned long previousMillis=0; // millis() returns an unsigned long.
    unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds)
    
    MyMessage msgHum(CHILD_ID_HUM, V_HUM);
    MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
    MyMessage msgMot(CHILD_ID_MOTION, V_TRIPPED);
    MyMessage msg(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
    uint16_t lastlux;
    
    void setup()  
    { 
      dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 
    
     // metric = getConfig().isMetric;
    
     pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
     }
    
    void presentation()  
    { 
      // Send the Sketch Version Information to the Gateway
      sendSketchInfo("4-1 Sensor", "1.0");
    
      // Register all sensors to gw (they will be created as child devices)
      present(CHILD_ID_HUM, S_HUM);
      present(CHILD_ID_TEMP, S_TEMP);
      present(CHILD_ID_MOTION, V_TRIPPED);
      present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
    }
    
    void loop()      
    {  
      // Read digital motion value
      boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH;
       
    // only run loop if time has passed. 
    unsigned long currentMillis = millis(); // grab current time       
    
     // check if "interval" time has passed
     if ((unsigned long)(currentMillis - previousMillis) >= interval) {
    
     
           send(msgMot.set(tripped?"1":"0")); 
                  
      
          #ifdef MY_DEBUG
           Serial.print("Motion: ");
           Serial.println(tripped);
          #endif
    
    
    
     
      
      // Fetch temperatures from DHT sensor
      float temperature = dht.getTemperature();
      if (isnan(temperature)) {
          Serial.println("Failed reading temperature from DHT");
      } else if (temperature != lastTemp) {
        lastTemp = temperature;
        if (!metric) {
          temperature = dht.toFahrenheit(temperature);
        }
        send(msgTemp.set(temperature, 1));
        #ifdef MY_DEBUG
        Serial.print("T: ");
        Serial.println(temperature);
        #endif
      }
     
      // Fetch humidity from DHT sensor
      float humidity = dht.getHumidity();
      if (isnan(humidity)) {
          Serial.println("Failed reading humidity from DHT");
      } else if (humidity != lastHum) {
          lastHum = humidity;
          send(msgHum.set(humidity, 1));
          #ifdef MY_DEBUG
          Serial.print("H: ");
          Serial.println(humidity);
          #endif
      }   
     // Read lux from TEMT6000
      float lightLevel = analogRead(LIGHT_SENSOR_ANALOG_PIN) *  9.;  // 1000/1024
      if (int(lightLevel - lastLightLevel) > 10 || int(lastLightLevel - lightLevel) > 10) {
          send(msg.setSensor(CHILD_ID_LIGHT).set(lightLevel,1));
          lastLightLevel = lightLevel;
     }
    
       // save the "current" time
       previousMillis = millis();
    
     }  
    
      // Sleep until interrupt comes in on motion sensor. Send update every two minute.
      //sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME);
    
    }
    

    0_1499978821740_upload-a3bebffe-d25d-49db-8ffb-1a043392c708

    sorry for the double post.

    mfalkviddM 1 Reply Last reply
    0
    • S stress nero

      @stress-nero said in TEMT6000:

      Hello first time user here, I have been trying to build a 4in1 light, motion, tem/hum using a nano, temt6000, dht22, and sr501 using the examples and already made sketches i can combine everything, but i am not sure if i am entering the info for the temt6000 correctly. Can someone take a look please```
      Insert Code Here

      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      #include <SPI.h>
      #include <MySensors.h>  
      #include <DHT.h>
      
      #define CHILD_ID_HUM 0
      #define CHILD_ID_TEMP 1
      #define CHILD_ID_MOTION 2
      #define CHILD_ID_LIGHT 3
      
      #define LIGHT_SENSOR_ANALOG_PIN 0
      int lastLightLevel;
      
      #define HUMIDITY_SENSOR_DIGITAL_PIN 4
      
      #define DIGITAL_INPUT_SENSOR 2   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
      
      
      DHT dht;
      float lastTemp;
      float lastHum;
      boolean metric = false; 
      
      unsigned long interval= 3000;//dht.getMinimumSamplingPeriod(); // the time we need to wait
      unsigned long previousMillis=0; // millis() returns an unsigned long.
      unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds)
      
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      MyMessage msgMot(CHILD_ID_MOTION, V_TRIPPED);
      MyMessage msg(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
      uint16_t lastlux;
      
      void setup()  
      { 
        dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 
      
       // metric = getConfig().isMetric;
      
       pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
       }
      
      void presentation()  
      { 
        // Send the Sketch Version Information to the Gateway
        sendSketchInfo("4-1 Sensor", "1.0");
      
        // Register all sensors to gw (they will be created as child devices)
        present(CHILD_ID_HUM, S_HUM);
        present(CHILD_ID_TEMP, S_TEMP);
        present(CHILD_ID_MOTION, V_TRIPPED);
        present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
      }
      
      void loop()      
      {  
        // Read digital motion value
        boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH;
         
      // only run loop if time has passed. 
      unsigned long currentMillis = millis(); // grab current time       
      
       // check if "interval" time has passed
       if ((unsigned long)(currentMillis - previousMillis) >= interval) {
      
       
             send(msgMot.set(tripped?"1":"0")); 
                    
        
            #ifdef MY_DEBUG
             Serial.print("Motion: ");
             Serial.println(tripped);
            #endif
      
      
      
       
        
        // Fetch temperatures from DHT sensor
        float temperature = dht.getTemperature();
        if (isnan(temperature)) {
            Serial.println("Failed reading temperature from DHT");
        } else if (temperature != lastTemp) {
          lastTemp = temperature;
          if (!metric) {
            temperature = dht.toFahrenheit(temperature);
          }
          send(msgTemp.set(temperature, 1));
          #ifdef MY_DEBUG
          Serial.print("T: ");
          Serial.println(temperature);
          #endif
        }
       
        // Fetch humidity from DHT sensor
        float humidity = dht.getHumidity();
        if (isnan(humidity)) {
            Serial.println("Failed reading humidity from DHT");
        } else if (humidity != lastHum) {
            lastHum = humidity;
            send(msgHum.set(humidity, 1));
            #ifdef MY_DEBUG
            Serial.print("H: ");
            Serial.println(humidity);
            #endif
        }   
       // Read lux from TEMT6000
        float lightLevel = analogRead(LIGHT_SENSOR_ANALOG_PIN) *  9.;  // 1000/1024
        if (int(lightLevel - lastLightLevel) > 10 || int(lastLightLevel - lightLevel) > 10) {
            send(msg.setSensor(CHILD_ID_LIGHT).set(lightLevel,1));
            lastLightLevel = lightLevel;
       }
      
         // save the "current" time
         previousMillis = millis();
      
       }  
      
        // Sleep until interrupt comes in on motion sensor. Send update every two minute.
        //sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME);
      
      }
      

      0_1499978821740_upload-a3bebffe-d25d-49db-8ffb-1a043392c708

      sorry for the double post.

      mfalkviddM Offline
      mfalkviddM Offline
      mfalkvidd
      Mod
      wrote on last edited by
      #2

      @stress-nero what is the purpose of the double post? Which one should I delete?

      S 1 Reply Last reply
      0
      • mfalkviddM mfalkvidd

        @stress-nero what is the purpose of the double post? Which one should I delete?

        S Offline
        S Offline
        stress nero
        wrote on last edited by
        #3

        @mfalkvidd the one in development when i posted i did not realize that it was under development, and can you help me sorting the tmt6000 sersor out for the sketch.

        mfalkviddM 1 Reply Last reply
        0
        • S stress nero

          @mfalkvidd the one in development when i posted i did not realize that it was under development, and can you help me sorting the tmt6000 sersor out for the sketch.

          mfalkviddM Offline
          mfalkviddM Offline
          mfalkvidd
          Mod
          wrote on last edited by
          #4

          @stress-nero sorry I don't even know what a tmt6000 is.

          S 1 Reply Last reply
          0
          • mfalkviddM mfalkvidd

            @stress-nero sorry I don't even know what a tmt6000 is.

            S Offline
            S Offline
            stress nero
            wrote on last edited by
            #5

            @mfalkvidd it's a ambient light sensor. I was going to use a esp8266 with these to make a 5in1 node inspired by a video i saw with just header wires , but decided to use arduino nano instead. What i posted seems to work ok but being brand new i figure i would let someone else take a look and see if everything was ok with what i have so far or if i could make it better.
            https://www.sparkfun.com/products/8348

            S 1 Reply Last reply
            0
            • S stress nero

              @mfalkvidd it's a ambient light sensor. I was going to use a esp8266 with these to make a 5in1 node inspired by a video i saw with just header wires , but decided to use arduino nano instead. What i posted seems to work ok but being brand new i figure i would let someone else take a look and see if everything was ok with what i have so far or if i could make it better.
              https://www.sparkfun.com/products/8348

              S Offline
              S Offline
              stress nero
              wrote on last edited by
              #6

              @stress-nero the light values was fixed bad jump wire position,
              ![alt text](0_1500037741362_upload-bc52de37-cdbc-47f8-aed4-288746977651 image url)

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              17

              Online

              11.7k

              Users

              11.2k

              Topics

              113.1k

              Posts


              Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • MySensors
              • OpenHardware.io
              • Categories
              • Recent
              • Tags
              • Popular