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. Hardware
  3. Battery Sensor with stepup and on/off transistor

Battery Sensor with stepup and on/off transistor

Scheduled Pinned Locked Moved Hardware
33 Posts 14 Posters 20.7k Views 8 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.
  • n3roN Offline
    n3roN Offline
    n3ro
    wrote on last edited by
    #1

    Hey Guys,

    Today I had an idea how you can save some power on battery sensors.

    I simply connected a transistor before a StepUp converter. So the stepup and the connected sensors only supplied with power when they are needed.

    My stepup + DHT11 has power consumption at 90 uA when sleeping. By disabling with the transistor it goes against 0.

    Do you think that might help a little?

    Best Regards,
    n3ro

    #include <SPI.h>
    #include <MySensor.h>
    #include <DHT.h>
    
    #define CHILD_ID_HUM 0
    #define CHILD_ID_TEMP 1
    #define HUMIDITY_SENSOR_DIGITAL_PIN 4
    #define STEPUP_PIN 5                 // Transistor connected PIN   
    unsigned long SLEEP_TIME = 10000; // Sleep time between reads (in milliseconds)
    
    MySensor gw;
    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()
    {
      gw.begin();
      dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN);
    
      // Send the Sketch Version Information to the Gateway
      gw.sendSketchInfo("Humidity", "1.0");
    
      // Register all sensors to gw (they will be created as child devices)
      gw.present(CHILD_ID_HUM, S_HUM);
      gw.present(CHILD_ID_TEMP, S_TEMP);
    
      metric = gw.getConfig().isMetric;
    }
    
    void loop()
    {
      stepup(true);
      delay(dht.getMinimumSamplingPeriod());
    
      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);
        }
        gw.send(msgTemp.set(temperature, 1));
    
      }
      Serial.print("T: ");
      Serial.println(temperature);
    
      float humidity = dht.getHumidity();
      if (isnan(humidity)) {
        Serial.println("Failed reading humidity from DHT");
      } else if (humidity != lastHum) {
        lastHum = humidity;
        gw.send(msgHum.set(humidity, 1));
      }
      Serial.print("H: ");
      Serial.println(humidity);
      stepup(false);
      gw.sleep(SLEEP_TIME); //sleep a bit
    }
    
    void stepup(boolean onoff)
    {
      pinMode(STEPUP_PIN, OUTPUT);      // sets the pin as output
      Serial.print("---------- StepUp: ");
      if (onoff == true)
      {
        Serial.println("ON");
        digitalWrite(STEPUP_PIN, HIGH);      // turn on
      }
      else
      {
        Serial.println("OFF");
        digitalWrite(STEPUP_PIN, LOW);       // turn off
      }
    }
    

    pimatic + MySensors + Homeduino + z-way
    https://github.com/n3roGit/MySensors_n3ro

    RJ_MakeR 1 Reply Last reply
    1
    • hekH Offline
      hekH Offline
      hek
      Admin
      wrote on last edited by
      #2

      Yep, will probably prolong battery life. Just remember that some sensors needs to be reinitialised when you power them on. I have not analysed what dht.setup() does in your case.

      n3roN 1 Reply Last reply
      0
      • hekH hek

        Yep, will probably prolong battery life. Just remember that some sensors needs to be reinitialised when you power them on. I have not analysed what dht.setup() does in your case.

        n3roN Offline
        n3roN Offline
        n3ro
        wrote on last edited by
        #3

        @hek In my tests its working with DHT11 and DHT22. Maybe a MQ-2 works too, but a MQ needs 2 minutes heatup time.. :-/

        pimatic + MySensors + Homeduino + z-way
        https://github.com/n3roGit/MySensors_n3ro

        1 Reply Last reply
        0
        • scalzS Offline
          scalzS Offline
          scalz
          Hardware Contributor
          wrote on last edited by
          #4

          Hi,

          your tests are interesting. I am trying to do same thing. But cannot test for the moment, I am waiting for components.
          I designed another little board with only dc booster and power management. then just connect to arduino existing node . I have to do some tests before release files. but if you want to test, you can see theory here http://forum.mysensors.org/topic/1419/sensor-board-with-booster-and-supervisor/1

          1 Reply Last reply
          0
          • n3roN n3ro

            Hey Guys,

            Today I had an idea how you can save some power on battery sensors.

            I simply connected a transistor before a StepUp converter. So the stepup and the connected sensors only supplied with power when they are needed.

            My stepup + DHT11 has power consumption at 90 uA when sleeping. By disabling with the transistor it goes against 0.

            Do you think that might help a little?

            Best Regards,
            n3ro

            #include <SPI.h>
            #include <MySensor.h>
            #include <DHT.h>
            
            #define CHILD_ID_HUM 0
            #define CHILD_ID_TEMP 1
            #define HUMIDITY_SENSOR_DIGITAL_PIN 4
            #define STEPUP_PIN 5                 // Transistor connected PIN   
            unsigned long SLEEP_TIME = 10000; // Sleep time between reads (in milliseconds)
            
            MySensor gw;
            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()
            {
              gw.begin();
              dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN);
            
              // Send the Sketch Version Information to the Gateway
              gw.sendSketchInfo("Humidity", "1.0");
            
              // Register all sensors to gw (they will be created as child devices)
              gw.present(CHILD_ID_HUM, S_HUM);
              gw.present(CHILD_ID_TEMP, S_TEMP);
            
              metric = gw.getConfig().isMetric;
            }
            
            void loop()
            {
              stepup(true);
              delay(dht.getMinimumSamplingPeriod());
            
              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);
                }
                gw.send(msgTemp.set(temperature, 1));
            
              }
              Serial.print("T: ");
              Serial.println(temperature);
            
              float humidity = dht.getHumidity();
              if (isnan(humidity)) {
                Serial.println("Failed reading humidity from DHT");
              } else if (humidity != lastHum) {
                lastHum = humidity;
                gw.send(msgHum.set(humidity, 1));
              }
              Serial.print("H: ");
              Serial.println(humidity);
              stepup(false);
              gw.sleep(SLEEP_TIME); //sleep a bit
            }
            
            void stepup(boolean onoff)
            {
              pinMode(STEPUP_PIN, OUTPUT);      // sets the pin as output
              Serial.print("---------- StepUp: ");
              if (onoff == true)
              {
                Serial.println("ON");
                digitalWrite(STEPUP_PIN, HIGH);      // turn on
              }
              else
              {
                Serial.println("OFF");
                digitalWrite(STEPUP_PIN, LOW);       // turn off
              }
            }
            
            RJ_MakeR Offline
            RJ_MakeR Offline
            RJ_Make
            Hero Member
            wrote on last edited by
            #5

            @n3ro What transistor are you using? I thought someone already did some testing and found that the start up power was too expensive in over the long run? (sleep Vs cold start) Maybe I misunderstood the result of their test though...

            RJ_Make

            n3roN 2 Replies Last reply
            0
            • RJ_MakeR RJ_Make

              @n3ro What transistor are you using? I thought someone already did some testing and found that the start up power was too expensive in over the long run? (sleep Vs cold start) Maybe I misunderstood the result of their test though...

              n3roN Offline
              n3roN Offline
              n3ro
              wrote on last edited by
              #6

              @ServiceXp is use this: LINK

              pimatic + MySensors + Homeduino + z-way
              https://github.com/n3roGit/MySensors_n3ro

              1 Reply Last reply
              0
              • RJ_MakeR RJ_Make

                @n3ro What transistor are you using? I thought someone already did some testing and found that the start up power was too expensive in over the long run? (sleep Vs cold start) Maybe I misunderstood the result of their test though...

                n3roN Offline
                n3roN Offline
                n3ro
                wrote on last edited by n3ro
                #7

                @ServiceXp could you already test cold start vs sleep?

                pimatic + MySensors + Homeduino + z-way
                https://github.com/n3roGit/MySensors_n3ro

                RJ_MakeR 1 Reply Last reply
                0
                • n3roN n3ro

                  @ServiceXp could you already test cold start vs sleep?

                  RJ_MakeR Offline
                  RJ_MakeR Offline
                  RJ_Make
                  Hero Member
                  wrote on last edited by
                  #8

                  @n3ro

                  I didn't do the testing, I just thought I remembered reading some information from someone who did. I can't find it though, so it may have been my imagination... :no_mouth:

                  RJ_Make

                  1 Reply Last reply
                  0
                  • ? Offline
                    ? Offline
                    A Former User
                    wrote on last edited by
                    #9

                    Hello n3ro ,

                    witch stepup converter you use? Where is your NRF24L01 connected? Sirctly to the battery? Can you explain your wirings? I plan a DHT22 sensor with NRF24L01 and 3.7V Lipo with charger

                    n3roN 1 Reply Last reply
                    0
                    • ? A Former User

                      Hello n3ro ,

                      witch stepup converter you use? Where is your NRF24L01 connected? Sirctly to the battery? Can you explain your wirings? I plan a DHT22 sensor with NRF24L01 and 3.7V Lipo with charger

                      n3roN Offline
                      n3roN Offline
                      n3ro
                      wrote on last edited by
                      #10

                      @ht81 Hey, the NRF is directly connected to the battery. only the DHT use the stepup.

                      i use this stepup: http://www.banggood.com/2Pcs-500mA-DC-DC-1V-5V-Converter-Step-Up-Module-Power-Module-p-945167.html

                      Just put a transistor in front of the stepup. this is all :)

                      pimatic + MySensors + Homeduino + z-way
                      https://github.com/n3roGit/MySensors_n3ro

                      Suresh MaliS 1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        ahhk
                        Hardware Contributor
                        wrote on last edited by ahhk
                        #11

                        Hi,

                        this is interesting. What about the HIGH-Levels in this scenario in genereal? DHT is powered at 3.3V and ATMEGA is powered by batterie (e.g. 2.8V?). Isn this a problem when the high levels are different? DHT high is higher then atmega-high-level (3.3V => e.g. 2.8V).
                        If not it could be a very nice solution to power only the sensors via a step-up-regulator - connected to arduino pin (or via transistor) :)
                        Greetings

                        Andreas

                        1 Reply Last reply
                        0
                        • n3roN Offline
                          n3roN Offline
                          n3ro
                          wrote on last edited by
                          #12

                          I use this setup at the moment and it works. the arduino is still alive :D

                          pimatic + MySensors + Homeduino + z-way
                          https://github.com/n3roGit/MySensors_n3ro

                          1 Reply Last reply
                          0
                          • ? Offline
                            ? Offline
                            A Former User
                            wrote on last edited by
                            #13

                            Hi,

                            how many batteries do you use? the Arduino requires at least 3.3V or? You stepup to 5V for the DHT22, right? Last question, how long works your node with a battery pack? 2 Month?

                            1 Reply Last reply
                            0
                            • n3roN Offline
                              n3roN Offline
                              n3ro
                              wrote on last edited by
                              #14

                              i have only a test setup at the moment with 2 AAA batteries. So i cant give you a battery lifetime :/

                              I use a arduino 3.3v and the stepup pushes the voltage to 5v for the DHT.

                              pimatic + MySensors + Homeduino + z-way
                              https://github.com/n3roGit/MySensors_n3ro

                              H 1 Reply Last reply
                              0
                              • n3roN n3ro

                                i have only a test setup at the moment with 2 AAA batteries. So i cant give you a battery lifetime :/

                                I use a arduino 3.3v and the stepup pushes the voltage to 5v for the DHT.

                                H Offline
                                H Offline
                                Harrdy
                                wrote on last edited by
                                #15

                                @n3ro said:

                                i have only a test setup at the moment with 2 AAA batteries. So i cant give you a battery lifetime :/

                                I use a arduino 3.3v and the stepup pushes the voltage to 5v for the DHT.

                                can you tell me why u push the voltage to 5v? the dht works great with 3.3v

                                n3roN 1 Reply Last reply
                                0
                                • H Harrdy

                                  @n3ro said:

                                  i have only a test setup at the moment with 2 AAA batteries. So i cant give you a battery lifetime :/

                                  I use a arduino 3.3v and the stepup pushes the voltage to 5v for the DHT.

                                  can you tell me why u push the voltage to 5v? the dht works great with 3.3v

                                  n3roN Offline
                                  n3roN Offline
                                  n3ro
                                  wrote on last edited by
                                  #16

                                  @Harrdy the stepup with 5v output is much cheaper ;)

                                  pimatic + MySensors + Homeduino + z-way
                                  https://github.com/n3roGit/MySensors_n3ro

                                  1 Reply Last reply
                                  0
                                  • ? Offline
                                    ? Offline
                                    A Former User
                                    wrote on last edited by
                                    #17

                                    Ok,
                                    is it possible to supply the arduino, NRF and DHT directly from an 3,7V LiPo? Your 2N2222A as an Switch for the DHT Power Pin? Can you tell me, what is the current consumption of NRF, and Arduino during Sleep mode by code "gw.sleep"

                                    n3roN 1 Reply Last reply
                                    0
                                    • ? A Former User

                                      Ok,
                                      is it possible to supply the arduino, NRF and DHT directly from an 3,7V LiPo? Your 2N2222A as an Switch for the DHT Power Pin? Can you tell me, what is the current consumption of NRF, and Arduino during Sleep mode by code "gw.sleep"

                                      n3roN Offline
                                      n3roN Offline
                                      n3ro
                                      wrote on last edited by n3ro
                                      #18

                                      @ht81

                                      hmm the max voltage of the NRF is 3.6v (https://www.sparkfun.com/datasheets/Components/SMD/nRF24L01Pluss_Preliminary_Product_Specification_v1_0.pdf)
                                      maybe the NRF is broker after 3.7v. i dont know...

                                      the 2N2222A turns the stepup on and off. the DHT is direct connected to the stepup.

                                      you can read many stuff about the power consumption of NRF+Arduino in the forum. With modified fuses and cutted LED+power regulator ~40uA

                                      pimatic + MySensors + Homeduino + z-way
                                      https://github.com/n3roGit/MySensors_n3ro

                                      1 Reply Last reply
                                      0
                                      • B Offline
                                        B Offline
                                        BastienVH
                                        wrote on last edited by
                                        #19

                                        @n3ro
                                        I have been looking into making some battery powered sensors.
                                        I have some questions about your setup, because I've been looking for some step up convertors but the 3.3v seems so expensive compared to the step up your using (I've only found this 3.3v one) which is 3+ times more expensive than this 5v one).

                                        Do you power your pro mini 3.3v from the 5v step up?
                                        Did you remove the on board power regulator (I'm thinking you haven't)?
                                        Does your DHT sensor work fine with 5v?

                                        I've been breaking my head over how to make the cheapest battery powered sensor possible, but it's been difficult since I'm very much still a noob.

                                        1 Reply Last reply
                                        0
                                        • GertSandersG Offline
                                          GertSandersG Offline
                                          GertSanders
                                          Hardware Contributor
                                          wrote on last edited by
                                          #20

                                          If one uses a LiPo battery giving (officially) 3.7V, it could be higher when it is new. I would suggest putting a Schottky diode (like 1N4001 of 1N4007) between positive of battery and VCC of NRF24. This way you force a voltage drop of minimal 0,5V and under load this goes up to 1V. The NRF24 works perfectly fine like this.
                                          I have a setup where I feed the atmega328p and a SIM800L with 4V, the NRF24 gets around 3.4V at startup, and under load around 3.1V

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


                                          23

                                          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