Changes between Version 5 and Version 6 of TipsAndTricks


Ignore:
Timestamp:
2014-01-24 06:51:30 (11 years ago)
Author:
axill
Comment:

case 3 from MDoc about battery power added

Legend:

Unmodified
Added
Removed
Modified
  • TipsAndTricks

    v5 v6  
    4848---- 
    4949 
     50== Case # 3== 
     51 
     52'''Powering things from battery''' 
     53 
     54'''Task:'''   ''Tips to achieve long battery life.  This consolidates information from a great post from @a-lurker and others around the web trying to the longest battery life possible.'' 
     55http://forum.micasaverde.com/index.php/topic,20078.0.html 
     56 
     57'''Solution:''' 
     581.   Disable or remove  the on-board regulator.  This draws excessive current; 
     592.   Remove the power LED.  On some boards this is done by disabling the Regulator; 
     603.   Power directly off the battery or use a Switching Regulator such as: 
     61https://www.sparkfun.com/products/10967 
     62 
     63http://www.pololu.com/product/798 
     644.   SLEEP whenever possible.  
     65- Wake up using the WDT 
     66 
     67{{{ 
     68sleep.sleepDelay(SLEEP_TIME * 1000); //sleep for: sleepTime 
     69}}} 
     70- Or use an interrupt if using a button or sensor. 
     71See http://code.mios.com/trac/mios_arduino-sensor/browser/VeraArduino/Arduino/libraries/Vera/examples/RelayWithButtonActuator/RelayWithButtonActuator.ino 
     725.   Disable the BOD (Brow out detection).  Sleep library does this or can be done in software: 
     73<Enter Sleep Mode> 
     74 
     75{{{ 
     76// turn off brown-out enable in software 
     77MCUCR = bit (BODS) | bit (BODSE); 
     78MCUCR = bit (BODS); 
     79}}} 
     80<Sleep the CPU  within 3 clock cycles of above code> 
     816. Turn of A/D Convertors :  (Again Hek already does this in Sleep Library) 
     82 
     83{{{ 
     84// disable ADC 
     85ADCSRA = 0; 
     86}}} 
     877.   Set unused input or output pins to LOW; 
     888.   Lower your clock frequency. This has to be done by burning your fuses. Be careful and check the clock frequency of the radio you're using; 
     899.   To send the Battery level to the Gateway: 
     90To measure the battery internally (when connected directly to a battery): 
     91{{{ 
     92// Read the Battery 
     93long readVcc() { 
     94    long result; 
     95    // Read 1.1V reference against AVcc 
     96    ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1); 
     97    delay(2); // Wait for Vref to settle 
     98    ADCSRA |= _BV(ADSC); // Convert 
     99    while (bit_is_set(ADCSRA,ADSC)); 
     100    result = ADCL; 
     101    result |= ADCH<<8; 
     102    result = 1126400L / result; // Back-calculate AVcc in mV 
     103    return result; 
     104} 
     105}}} 
     106{{{ 
     107// Send the Battery Percentage to the Gateway 
     108#define VBatMax 3.1             // The voltage of New Batteries 
     109#define VBatDropout  1.8    // The battery dropout voltage 
     110gw.sendBatteryLevel((readVcc()-(Dropout*1000)) /(((VBatMax-Dropout) *10))); 
     111}}} 
     112 
     113To measure the battery voltage when using a Switching Regulator: 
     114See a-lurker's post: http://forum.micasaverde.com/index.php/topic,20078.0.html 
     115 
     116'''Comments:''' 
     117 
     118For reference here are some good sights: 
     119 
     120http://maniacbug.wordpress.com/2011/10/19/sensor-node/ 
     121 
     122http://www.gammon.com.au/forum/?id=11497 
     123 
     124http://hwstartup.wordpress.com/2013/03/11/how-to-run-an-arduino-on-a-9v-battery-for-weeks-or-months/ 
     125 
     126http://hwstartup.wordpress.com/2013/04/15/how-to-run-an-arduino-clone-on-aa-batteries-for-over-a-year-part-2/ 
     127 
     128http://www.thalin.se/2013/04/arduino-pro-mini-low-power-modification.html 
     129 
     130http://www.rocketscream.com/blog/2011/07/04/lightweight-low-power-arduino-library/ 
     131 
     132---- 
     133 
    50134... more cases to came soon