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. Humidity repeater, easy question...?

Humidity repeater, easy question...?

Scheduled Pinned Locked Moved Troubleshooting
3 Posts 2 Posters 995 Views 2 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.
  • Mark SwiftM Offline
    Mark SwiftM Offline
    Mark Swift
    wrote on last edited by
    #1

    Hi Guys,

    I'm using the humidity sketch from the dev build. Quick question, to enable it as a repeater, so I simply add

    // Enabled repeater feature for this node
    #define MY_REPEATER_FEATURE

    and change

    sleep(SLEEP_TIME); // Sleep (non repeater) to wait(SLEEP_TIME); // Sleep (non repeater)

    Is that all that's required?

    Thanks,

    Mark

    1 Reply Last reply
    0
    • mfalkviddM Offline
      mfalkviddM Offline
      mfalkvidd
      Mod
      wrote on last edited by
      #2

      You should also change
      delay(dht.getMinimumSamplingPeriod());
      to use wait, otherwise the node might drop packages during this time.

      1 Reply Last reply
      0
      • Mark SwiftM Offline
        Mark SwiftM Offline
        Mark Swift
        wrote on last edited by Mark Swift
        #3

        @mfalkvidd I currently have this, what do you suggest I change?

        /**
         * The MySensors Arduino library handles the wireless radio link and protocol
         * between your home built sensors/actuators and HA controller of choice.
         * The sensors forms a self healing radio network with optional repeaters. Each
         * repeater and gateway builds a routing tables in EEPROM which keeps track of the
         * network topology allowing messages to be routed to nodes.
         *
         * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
         * Copyright (C) 2013-2015 Sensnology AB
         * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
         *
         * Documentation: http://www.mysensors.org
         * Support Forum: http://forum.mysensors.org
         *
         * This program is free software; you can redistribute it and/or
         * modify it under the terms of the GNU General Public License
         * version 2 as published by the Free Software Foundation.
         *
         *******************************
         *
         * REVISION HISTORY
         * Version 1.0 - Henrik EKblad
         * 
         * DESCRIPTION
         * This sketch provides an example how to implement a humidity/temperature
         * sensor using DHT11/DHT-22 
         * http://www.mysensors.org/build/humidity
         */
         
        // Enable debug prints
        // #define MY_DEBUG
        
        // Enable and select radio type attached
        #define MY_RADIO_NRF24
        //#define MY_RADIO_RFM69
        
        // Enabled repeater feature for this node
        #define MY_REPEATER_FEATURE
        
        #include <SPI.h>
        #include <MySensor.h>  
        #include <DHT.h>  
        
        #define CHILD_ID_HUM 0
        #define CHILD_ID_TEMP 1
        #define HUMIDITY_SENSOR_DIGITAL_PIN 3
        unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
        
        DHT dht;
        float lastTemp;
        float lastHum;
        boolean metric = true; 
        MyMessage msgHum(CHILD_ID_HUM, V_HUM);
        MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
        
        void setup()  
        { 
          dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 
          metric = getConfig().isMetric;
        }
        
        void presentation()  
        { 
          // Send the Sketch Version Information to the Gateway
          sendSketchInfo("Temperature + Humidity", "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);
        }
        
        void loop()      
        {  
          delay(dht.getMinimumSamplingPeriod());
         
          // 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
          }
          // sleep(SLEEP_TIME); // Sleep (non repeater)
          // wait(SLEEP_TIME); // Wait (repeater)
        }
        

        Edit: Apologies, I see what you're advising to do, I missed that line. I've made the change now.

        1 Reply Last reply
        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
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        17

        Online

        12.0k

        Users

        11.2k

        Topics

        113.4k

        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