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. Announcements
  3. 💬 Battery Powered Sensors

💬 Battery Powered Sensors

Scheduled Pinned Locked Moved Announcements
battery
347 Posts 55 Posters 67.0k Views 53 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.
  • GertSandersG GertSanders

    @Efflon

    VCC pin is directly connected to the MCU.

    The RAW or IN pin is connected to the regulator input. Th eregulator output is connected to VCC pin and thus to the MCU power input pin.

    On a 3V3 promini you can give between 3V3 and 12V (on most promini's, some can handle up to 16V) on the RAW or IN pin. The regulator on the promini will bring that down to 3V3 (which you will be able to measure on the VCC pin).

    By giving 3V3 on the VCC pin, some power is lost via the output pin of the regulator (through the regulator) towards the GND pin of the regulator. This should be minimal, but on bad regulators it can be enough to drain a battery in weeks. So yes, I would cut the regulator output line when giving power via VCC.

    Cutting the line of the powerLED (on either side of it, doesn't matter) will make sure that the LED does not drain the battery either. This LED can pull between 5 -15mA depending on the protection resistor that sits in series with it.

    So VCC pin and RAW pin are NOT the same.

    EfflonE Offline
    EfflonE Offline
    Efflon
    wrote on last edited by
    #69

    @GertSanders Thanks for you explanation. I thought vvc on the short end next to rx was going through the voltage regulator just as RAW. Anyhow I have already de-soldered the LED's and are powering through vcc next to A3. Apparently my voltage regulators are bad so I'll cut the lines and give it a try and hope power consumption stays low.

    1 Reply Last reply
    1
    • maghacM Offline
      maghacM Offline
      maghac
      wrote on last edited by
      #70

      I've used the Vcc library to read the battery level without voltage divider or any other external components. Is this not a reliable way to measure?

      1 Reply Last reply
      0
      • maghacM Offline
        maghacM Offline
        maghac
        wrote on last edited by
        #71

        I'll answer myself - no, the Vcc lib is not realiable :) I had a sensor that died yesterday and it reported 100% battery until the end...

        AWIA 1 Reply Last reply
        0
        • maghacM maghac

          I'll answer myself - no, the Vcc lib is not realiable :) I had a sensor that died yesterday and it reported 100% battery until the end...

          AWIA Offline
          AWIA Offline
          AWI
          Hero Member
          wrote on last edited by
          #72

          @maghac The Vcc library is reliable. It uses the internal 1.1 v reference of the MCU to measure the voltage on the Vcc pin. If your sensor keeps reporting 100% I guess you either power the arduino through a regulator (or the raw pin) or missed something in the Vcc initialisation/ calibration.

          1 Reply Last reply
          1
          • maghacM Offline
            maghacM Offline
            maghac
            wrote on last edited by
            #73

            @AWI It's possible that I missed something in the code. I am powering the arduino directly on VCC though and I'm not using a regulator.

            Will have another look tonight.

            1 Reply Last reply
            0
            • A Offline
              A Offline
              aclertant
              wrote on last edited by
              #74

              Do you think that the use of a piezo electric switch is possible ?
              I found one that deliver 24v and 0,2A... The goal would be to create wireless switch...

              AWIA gohanG 2 Replies Last reply
              0
              • A aclertant

                Do you think that the use of a piezo electric switch is possible ?
                I found one that deliver 24v and 0,2A... The goal would be to create wireless switch...

                AWIA Offline
                AWIA Offline
                AWI
                Hero Member
                wrote on last edited by
                #75

                @aclertant Interesting idea... Energy harvesting with piezo-electric components is certainly possible. From MySensors point of view the energy (very very little) has to be stored and boosted to power the radio and mcu for message processing. There are a few examples of "harvesting" remotes (i.e. Philips HUE) but I am not sure if these use a piezo element.

                1 Reply Last reply
                0
                • H Offline
                  H Offline
                  hiddenuser
                  wrote on last edited by
                  #76

                  I removed the both the LED and the Voltage Regulator of an Arduino pro min 3.3v . The simple sketch on it's own works fine. However when I connect an NRF24L01 it does not communicate back to the gateway.. :(

                  1 Reply Last reply
                  0
                  • A aclertant

                    Do you think that the use of a piezo electric switch is possible ?
                    I found one that deliver 24v and 0,2A... The goal would be to create wireless switch...

                    gohanG Offline
                    gohanG Offline
                    gohan
                    Mod
                    wrote on last edited by
                    #77

                    @aclertant
                    If you look at enocean products there are already commercial energy harversting switches in case you don't find a way to make it.

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      aclertant
                      wrote on last edited by
                      #78

                      @gohan yes it's exactly what I'd like to do ;)

                      I should forget to use an arduino in fact... just send one command using... a pic ? or something else...

                      The enocean switch is really cool, but quiet expensive :(

                      1 Reply Last reply
                      0
                      • gohanG Offline
                        gohanG Offline
                        gohan
                        Mod
                        wrote on last edited by
                        #79

                        Like all commercial products they cost because they have been developed, tested and produced. So it's up to you if you want to spend time tinkering or go with an already working solution :-)

                        A 1 Reply Last reply
                        0
                        • gohanG gohan

                          Like all commercial products they cost because they have been developed, tested and produced. So it's up to you if you want to spend time tinkering or go with an already working solution :-)

                          A Offline
                          A Offline
                          aclertant
                          wrote on last edited by
                          #80

                          @gohan @AWI
                          we need something like this but for NRF24L01 module.
                          https://github.com/SmingHub/Sming
                          Do you think that possibly exist or there is a huge problem ? Like no eeprom or something like that ?

                          1 Reply Last reply
                          0
                          • gohanG Offline
                            gohanG Offline
                            gohan
                            Mod
                            wrote on last edited by
                            #81

                            You see, enocean protocol has been developed from the start to be used with devices that use energy harvesting, so you can't think to use general purpose HW (like esp8266, FRF24, Arduino boards) that is not optimized very low power consumption (look at all the mods required to make a mini pro last months on battery with a reed switch and a nrf24 module); with piezo-electric components the amount of energy is really really tiny so you need super optimized HW to work with that.
                            The link you posted is about something that works on a ESP8266 but that works over wifi, that is for sure not the best energy efficient system.

                            1 Reply Last reply
                            0
                            • N Offline
                              N Offline
                              napo7
                              Hardware Contributor
                              wrote on last edited by
                              #82

                              There is a much more efficient way (and cost-less) to measure VBATT :
                              https://provideyourown.com/2012/secret-arduino-voltmeter-measure-battery-voltage/
                              It doesn't need any external resistor, so there will be no current flowing even when the Atmega is asleep.

                              AWIA 1 Reply Last reply
                              0
                              • N napo7

                                There is a much more efficient way (and cost-less) to measure VBATT :
                                https://provideyourown.com/2012/secret-arduino-voltmeter-measure-battery-voltage/
                                It doesn't need any external resistor, so there will be no current flowing even when the Atmega is asleep.

                                AWIA Offline
                                AWIA Offline
                                AWI
                                Hero Member
                                wrote on last edited by
                                #83

                                @napo7 This has been mentioned in this topic. @Yveaux Vcc library is the easiest way to handle this.

                                N 1 Reply Last reply
                                0
                                • AWIA AWI

                                  @napo7 This has been mentioned in this topic. @Yveaux Vcc library is the easiest way to handle this.

                                  N Offline
                                  N Offline
                                  napo7
                                  Hardware Contributor
                                  wrote on last edited by
                                  #84

                                  @AWI Ahh Sorry ! Didn't seen the comment !
                                  I thought it was never mentioned since the how-to still refers to resistor divider method (which is, IMO a bad method since it will draw current...)
                                  I'll have a look at Yveaux's lib.

                                  1 Reply Last reply
                                  0
                                  • H Offline
                                    H Offline
                                    hiddenuser
                                    wrote on last edited by hiddenuser
                                    #85

                                    I have used resistor ( 470K+1M ) to measure the voltage on a 5 minute interval. The Soil sensor is out in the garden where the container housing the arduino pro min gets exposed to sun. The voltage reading is high during 1 PM to 4 PM, when its under the sun. I am not sure if this is because of the heat.

                                    0_1488370532353_Voltage Graph.JPG

                                    The code is given below. Please note I multiply my actual voltage with calibration variable. however during the high voltage time the calibration variable does not seem to work.

                                    • Battery powers the soil sensor.
                                    • The voltage regulator has been removed.
                                    • MCU powered using vcc pin.
                                    //#define MY_DEBUG
                                    #define MY_RF24_PA_LEVEL RF24_PA_LOW
                                    #define MY_BAUD_RATE 38400
                                    #define MY_RADIO_NRF24
                                    #define VIEW_READING
                                    
                                    #include <MySensors.h>
                                    #include <SPI.h>
                                    #include <math.h>
                                    
                                    
                                    #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
                                    #define N_ELEMENTS(array) (sizeof(array)/sizeof((array)[0]))
                                    #define NUM_READS 10
                                    #define CHILD_ID_MOISTURE 0
                                    #define CHILD_ID_BATTERY 1
                                    #define SLEEP_TIME 300000//10000 // Sleep time between reads (in milliseconds), was 10000
                                    #define STABILIZATION_TIME 500 // Let the sensor stabilize before reading default BOD settings
                                    #define VOLTAGE_PIN A0
                                    
                                    
                                    int index;
                                    long buffer[NUM_READS];
                                    const long Known_Resistor = 4700;
                                    
                                    /// @brief Structure to be used in percentage and resistance values matrix to be filtered (have to be in pairs)
                                    typedef struct {
                                      int moisture; //!< Moisture
                                      long resistance; //!< Resistance
                                    } values;
                                    
                                    
                                    MyMessage soil_msg(CHILD_ID_MOISTURE, V_LEVEL);
                                    MyMessage voltage_msg(CHILD_ID_BATTERY, V_VOLTAGE);
                                    
                                    
                                    void presentation() {
                                      sendSketchInfo("Soil Moisture", "2.0");
                                      present(CHILD_ID_MOISTURE, S_MOISTURE);
                                      present(CHILD_ID_BATTERY, S_MULTIMETER);
                                    }
                                    
                                    
                                    void setup() {
                                      pinMode(6, OUTPUT);
                                      pinMode(7, OUTPUT);
                                      digitalWrite(6, LOW);
                                      digitalWrite(7, LOW);
                                    }
                                    
                                    
                                    
                                    
                                    void loop() {
                                      //float dryLevel = readNoMoisture();
                                      long moistureLevel = readAggSoilMoisture();
                                    
                                      //float coeff = 100.00 / float(dryLevel);
                                      float voltage = readVoltage() * 1.57368; 
                                    
                                      float batteryPcnt = voltage / 3.3 * 100;
                                    
                                    #ifdef VIEW_READING
                                      Serial.print("--Voltage:"); Serial.println(voltage);
                                      Serial.print("--Battery %:"); Serial.println(batteryPcnt);
                                      Serial.print("--Soil Sensor value:"); Serial.println(moistureLevel );
                                    #endif
                                    
                                      send(soil_msg.set(moistureLevel, 1));
                                      sendBatteryLevel(batteryPcnt);
                                      send(voltage_msg.set(voltage, 3), 1);
                                    
                                    
                                    
                                      sleep(SLEEP_TIME);
                                    }
                                    
                                    float readVoltage() {
                                      analogReference(INTERNAL);
                                      fakeRead(VOLTAGE_PIN);
                                      int sensorValue = analogRead(VOLTAGE_PIN);
                                      float voltage = sensorValue * 0.003363075;
                                      analogReference(DEFAULT);
                                      fakeRead(VOLTAGE_PIN);
                                      return voltage;
                                    
                                    }
                                    
                                    void fakeRead(int pin) {
                                      for (int counter = 0; counter < 5; counter++) {
                                        analogRead(pin);
                                        delay(STABILIZATION_TIME);
                                      }
                                    }
                                    
                                    
                                    // Averaging algorithm
                                    void addReading(long resistance)
                                    {
                                      buffer[index] = resistance;
                                      index++;
                                      if (index >= NUM_READS) {
                                        index = 0;
                                      }
                                    }
                                    
                                    long average()
                                    {
                                      long sum = 0;
                                      for (int i = 0; i < NUM_READS; i++) {
                                        sum += buffer[i];
                                      }
                                      return (long)(sum / NUM_READS);
                                    }
                                    
                                    int readAggSoilMoisture()
                                    {
                                    
                                      measureRawSoilMoisture(6, 7, A1);
                                      long read1 = average();
                                    
                                      measureRawSoilMoisture(7, 6, A2);
                                      long read2 = average();
                                      long sensor1 = (read1 + read2) / 2;
                                      return int( ((sensor1 / (float)Known_Resistor) * 100.00));
                                    }
                                    
                                    
                                    
                                    void measureRawSoilMoisture (int phase_b, int phase_a, int analog_input)
                                    {
                                      // read sensor, filter, and calculate resistance value
                                      // Noise filter: median filter
                                    
                                      for (int i = 0; i < NUM_READS; i++) {
                                    
                                        // Read 1 pair of voltage values
                                        digitalWrite(phase_a, HIGH);                 // set the voltage supply on
                                        delayMicroseconds(25);
                                        int supplyVoltage = analogRead(analog_input);   // read the supply voltage
                                        delayMicroseconds(25);
                                        digitalWrite(phase_a, LOW);                  // set the voltage supply off
                                        delay(1);
                                    
                                        digitalWrite(phase_b, HIGH);                 // set the voltage supply on
                                        delayMicroseconds(25);
                                        int sensorVoltage = analogRead(analog_input);   // read the sensor voltage
                                        delayMicroseconds(25);
                                        digitalWrite(phase_b, LOW);                  // set the voltage supply off
                                    
                                        // Calculate resistance
                                        // the 0.5 add-term is used to round to the nearest integer
                                        // Tip: no need to transform 0-1023 voltage value to 0-5 range, due to following fraction
                                        long resistance = abs(Known_Resistor * (supplyVoltage - sensorVoltage ) / sensorVoltage) ;
                                    
                                      
                                        delay(1);
                                        delay(STABILIZATION_TIME);
                                        addReading(resistance);
                                     
                                      }
                                    
                                    }
                                    
                                    
                                    
                                    
                                    1 Reply Last reply
                                    0
                                    • Moebius LutchingM Offline
                                      Moebius LutchingM Offline
                                      Moebius Lutching
                                      wrote on last edited by Moebius Lutching
                                      #86

                                      Using voltage divider still might be necessary if you don't have battery directly connected to the MCU VCC, for example using step-up/down regulator to power the MCU. In this case you still can use a voltage divider and have a P+N Mosfet to control the current going through the voltage divider, so no leak to ground.

                                      In practical terms you basically use another GPIO to enable or disable it the Mosfet when needed. I saw that on the Whisper Node board I'm using and seems to be effective (reference: https://bitbucket.org/talk2/whisper-node-avr#markdown-header-voltage-monitor)... In any case using high value resistors (over 100K) will reduce any current draw. Finally a small capacitor can be used to stabilize the voltage.

                                      1 Reply Last reply
                                      0
                                      • Jarno BurgerJ Offline
                                        Jarno BurgerJ Offline
                                        Jarno Burger
                                        wrote on last edited by
                                        #87

                                        I have a DHT11 + NRF24L01 + Pro Mini 3.3v 8Mhz
                                        All is working fine when on usb cable.. but it fails when connected to 2x 1.5 AA batteries..
                                        what could be wrong ?

                                        1 Reply Last reply
                                        0
                                        • gohanG Offline
                                          gohanG Offline
                                          gohan
                                          Mod
                                          wrote on last edited by
                                          #88

                                          Dht 11 operating voltage is 3.3 to 5v, so 2 AA batteries are not enough. Better look at other more reliable sensors that can operate at lower voltages

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


                                          16

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 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