Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. brolly759
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    brolly759

    @brolly759

    4
    Reputation
    53
    Posts
    603
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    brolly759 Follow

    Best posts made by brolly759

    • RE: Low Power: How much current? [Solved]

      OK I am going to join the party as this is exactly what I have been testing this past week. I have a uCurrent Gold and running on an 8Mhz 3.3v Nano Pro from this site:

      https://www.sparkfun.com/products/11114

      I have un-soldered the smt jumper to bypass all voltage regulating and running off of 2 AA Batteries.

      I am using the BinarySwitchSleepSensor sketch from the MySensors library. This uses pin 2/3 as an interrupt and sleeps until a pin hits GND. It wakes up, sends the new state, and goes back to sleep. The sketch also makes pin 2/3 high and uses the internal pull-up resistor.

      Originally I was getting 23-24uA in sleep mode when GND was not connected to pin 2/3. 117uA when GND was connected to pin 2/3. We will refer to this as open and closed pin state.

      Here is my methods:
      I downgraded my version of Arduino IDE to 1.0.6 from the latest build 1.6.5 and here are my new numbers:

      2.5-2.7uA sleep mode - Open pin state
      98-100uA sleep mode - Closed pin state

      Then I deleted from the sketch the digitalWrite on pin 2/3 and used an external resistor thanks to the advice from AWI. I plugged in an 10M Resistor to pin 2 to VCC and GND was the switch. Here are my new numbers:

      2.5-2.7uA sleep mode - Open pin state
      3.1-3.2uA sleep mode - Closed pin state

      So far today I have not gotten any false positives in my setup which is freaking amazing.

      Now I used a quick sketch "DallasTemperatureSensor" from the MySensors library to test what my current would be in sleep mode with a watchdog timer. I did NOT connect a temp sensor but my sleep current is: 7.6uA - 7.8uA.

      I hope this helps and if you need any testing let me know.

      I have a post on the Arduino forums here:
      http://forum.arduino.cc/index.php?topic=341958.msg2360300#msg2360300

      You can see me talking to the guy who actually wrote up the gammon website and you can ask him things directly if you ever wanted too. Very helpful guy!

      posted in Hardware
      brolly759
      brolly759
    • RE: Low Power: How much current? [Solved]

      So an update, you can find all the sleep functions in the MySensor.cpp file.

      posted in Hardware
      brolly759
      brolly759
    • RE: Low Power: How much current? [Solved]

      YESSSSSSSSSSSSSSS!!!!! I got sleep down to 1.5ua - 1.6uA with NO hardware changes!!!!! WOOOT sorry, kinda excited here lol

      posted in Hardware
      brolly759
      brolly759
    • RE: Low Power: How much current? [Solved]

      Okay, so originally I was getting 2.7-2.9uA with Arduino/NRF. Stock MySensors library and Arduino 1.0.6 IDE. ( I am using the BinarySwitchSleep Sketch from MySensors lib)

      To get even lower power.... If you open up mysensors.cpp the sleep function is there. For the BinarySwitchSleep sketch you are looking for this sleep function as there are a few:

      You want to add this:

      SPI.end();	
      	for (byte i = 9; i <= 13; i++)
          {
          pinMode (i, OUTPUT);    
          digitalWrite (i, LOW); 
          }  // end of for loop
      

      to this:

      bool MySensor::sleep(uint8_t interrupt, uint8_t mode, unsigned long ms) {
      	// Let serial prints finish (debug, log etc)
      	bool pinTriggeredWakeup = true;
      	Serial.flush();
      	RF24::powerDown();
      	attachInterrupt(interrupt, wakeUp, mode);
      	if (ms>0) {
      		pinIntTrigger = 0;
      		sleep(ms);
      		if (0 == pinIntTrigger) {
      			pinTriggeredWakeup = false;
      		}
      	} else {
      		Serial.flush();		
      		LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
      	}
      	detachInterrupt(interrupt);
      	return pinTriggeredWakeup;
      }
      

      and it will look like this:

      bool MySensor::sleep(uint8_t interrupt, uint8_t mode, unsigned long ms) {
      	// Let serial prints finish (debug, log etc)
      	bool pinTriggeredWakeup = true;
      	Serial.flush();
      	RF24::powerDown();
      	attachInterrupt(interrupt, wakeUp, mode);
      	
      	SPI.end();
      	
      	for (byte i = 9; i <= 13; i++)
          {
          pinMode (i, OUTPUT);    
          digitalWrite (i, LOW); 
          }  // end of for loop
      
      	if (ms>0) {
      		pinIntTrigger = 0;
      		sleep(ms);
      		if (0 == pinIntTrigger) {
      			pinTriggeredWakeup = false;
      		}
      	} else {
      		Serial.flush();		
      		LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
      	}
      	detachInterrupt(interrupt);
      	return pinTriggeredWakeup;
      }
      

      Because you are shutting off and turning all pins low, you will need to add this to the beginning of your program loop to reinitialize the NRF:

      void loop() 
      {  
        sensor_node.begin();
      

      If you add just the SPI.end(); your current will be 2uA.
      If you add both SPI.end(); and LOW pin loop, your current will be 1.5uA

      posted in Hardware
      brolly759
      brolly759

    Latest posts made by brolly759

    • RE: Low Power: How much current? [Solved]

      @NeverDie I never had issues with Gammon's code on v1.6.5 . I had issues with the mysensors v1.4 library with v1.6.5 of Arduino IDE. My power problems went away when I switched to v1.5 of mysensors library. I have stopped troubleshooting for now as I am slightly burnt out but my last test on v.1.6.5 with v1.5 MySensors gave me strange results sometimes. If I edited any files in the sleep mode functions I would not be able to go back to sleep. I was draw a constant ~3mA.

      Congrats though and welcome to the club. I think I am going to just combine nRF Mesh + gammon's code to make my own mesh network setup. (When I actually know programming) 😉

      posted in Hardware
      brolly759
      brolly759
    • RE: Low Power: How much current? [Solved]

      No idea why but every so often I have to uninstall Arduino, delete the libraries and basically start over. Getting frustrating and I might go back to 1.0.5 + v1.4 lib.

      posted in Hardware
      brolly759
      brolly759
    • RE: Low Power: How much current? [Solved]

      Correct, I was able to use radio pin to shut it off (pin 4) manually in v1.4 library. I cant inject the code in v1.5. If I can put the code in the sleep function somewhere, it is not easy to find anymore.

      posted in Hardware
      brolly759
      brolly759
    • RE: Low Power: How much current? [Solved]
      void RF24::powerDown(void)
      {
        ce(LOW); // Guarantee CE is low on powerDown
        write_register(CONFIG,read_register(CONFIG) & ~_BV(PWR_UP));
        digitalWrite(4, LOW);
      

      No matter where I put it... the NRF will not fall back asleep. It stays @ 4mA

      posted in Hardware
      brolly759
      brolly759
    • RE: Low Power: How much current? [Solved]

      The new sleep library is all over the place and I cannot make heads or tails of it.

      I am using IDE 1.6.5 and MySensors v1.5 and I am getting 2uA in sleep mode with my modified BinarySensorSwitch sketch.

      I want to be able to shutdown the radio pin and LOW all the pins but I don't know where to add it. Anywhere I add, the radio stays high forever basically. Any idea's?

      posted in Hardware
      brolly759
      brolly759
    • RE: Low Power: How much current? [Solved]

      I am using v1.6.5. I burned the bootloader for Pro Mini, still no change.
      Sleep mode: 17.9uA

      FYI, when upgrading from v1.4 to v1.5 of MySensors lib, DO NOT overwrite all the files, Delete the folder, add the new v1.5 I had a lot of errors just now

      I switched to v1.5 with v1.6.5 and I am getting 2uA in oState now. Now I am trying to play with the new sleep settings. will give an update soon.

      posted in Hardware
      brolly759
      brolly759
    • RE: Low Power: How much current? [Solved]

      I just upgraded to Arduino IDE 1.6.5:

      Board: "Arduino Pro or Pro Mini"
      Processor: "Atmega328 (3.3V, 8MHz)

      Sleep current: 19uA.

      Using previous IDE I was @ 100nA.

      Here is the sketch I am using:

      #include <MySensor.h>
      #include <SPI.h>
      
      #define SKETCH_NAME "Binary Sensor"
      #define SKETCH_MAJOR_VER "1"
      #define SKETCH_MINOR_VER "0"
      
      #define PRIMARY_CHILD_ID 3
      #define SECONDARY_CHILD_ID 4
      
      #define PRIMARY_BUTTON_PIN 2   // Arduino Digital I/O pin for button/reed switch
      #define WIRELESS_POWER 4
      
      MySensor sensor_node;
      
      // Change to V_LIGHT if you use S_LIGHT in presentation below
      MyMessage msg(PRIMARY_CHILD_ID, V_TRIPPED);
      
      void setup()  
      {  
        pinMode(WIRELESS_POWER, OUTPUT);
        digitalWrite(WIRELESS_POWER, HIGH);  
        sensor_node.begin(); 
        pinMode(PRIMARY_BUTTON_PIN, INPUT);
       
         // Send the sketch version information to the gateway and Controller
        sensor_node.sendSketchInfo(SKETCH_NAME, SKETCH_MAJOR_VER"."SKETCH_MINOR_VER);
      
        // Register binary input sensor to sensor_node (they will be created as child devices)
        // You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage. 
        // If S_LIGHT is used, remember to update variable type you send in. See "msg" above.
        sensor_node.present(PRIMARY_CHILD_ID, S_DOOR);  
      }
      
      void loop() 
      {
        digitalWrite(WIRELESS_POWER, HIGH);
        delay(5);  
        sensor_node.begin();
          
        uint8_t value;
        static uint8_t sentValue=2;
      
        sensor_node.sleep(5);  
        value = digitalRead(PRIMARY_BUTTON_PIN);
        
        if (value != sentValue) {
           // Value has changed from last transmission, send the updated value
           sensor_node.send(msg.set(value==HIGH ? 1: 0));
           sentValue = value;
        }
      
        sensor_node.sleep(PRIMARY_BUTTON_PIN-2, CHANGE, 0);
      } 
      
      posted in Hardware
      brolly759
      brolly759
    • RE: Low Power: How much current? [Solved]

      @NeverDie my 2 AA battery setup right now are @ 3.452v

      posted in Hardware
      brolly759
      brolly759
    • RE: Low Power: How much current? [Solved]

      This is so frustrating, you know that?

      So I reseated my cables to make sure I am getting the best connection. Now my current is the last configuration is:

      sleep current oState: ~105nA
      sleep current cState: ~457nA

      @NeverDie my 2 AA battery setup right now are @ 3.452v

      posted in Hardware
      brolly759
      brolly759
    • RE: Low Power: How much current? [Solved]

      @NeverDie Good catch, I just checked the version.h file. v1.4.1

      #define LIBRARY_VERSION "1.4.1"
      

      In the utilities folder in MySensors library, all the files like RF24.h, LowPower.h are provided by the MySensors library. So I am assuming they were up to date when the MySensors library was created.

      @scalz Even though its not full 3.3v it should be fine. The power range for NRF is 1.9v - 3.6v

      My next project is to figure out battery monitoring as low as possible. 😉 I know there are 2 ways, internal 1.1v reference or voltage divider. Can I do a voltage divider on an output pin and shut the output pin off when not using it?

      posted in Hardware
      brolly759
      brolly759