Guys,
I am trying go get a FOSS project going, namely a miniature, battery operated atmega32u4 node with a RFM12B module on it, called it 'Funky'.
I am very unexperienced, just recently started hobby level learning electronics, so please be forgiving.
Wiki page http://harizanov.com/wiki/wiki-home/funky-sensor-v2/
Schematic:
http://harizanov.com/wp-content/uploads/2013/03/IMG_2007-1024x768.jpg
So my trouble is that I can't get decent sleep currents, the lowest I get is 3mA using this Arduino code:
#include <avr/power.h>
#include <avr/sleep.h>
#include <JeeLib.h> // https://github.com/jcw/jeelib
#include "pins_arduino.h"
ISR(WDT_vect) { Sleepy::watchdogEvent(); } // interrupt handler for JeeLabs Sleepy power saving
#define myNodeID 27 // RF12 node ID in the range 1-30
#define network 210 // RF12 Network group
#define freq RF12_868MHZ // Frequency of RFM12B module
#define LEDpin 1
void setup() {
pinMode(LEDpin,OUTPUT);
digitalWrite(LEDpin,HIGH);
rf12_initialize(myNodeID,freq,network); // Initialize RFM12 with settings defined above
// Adjust low battery voltage to 2.2V
rf12_control(0xC040);
rf12_sleep(0); // Put the RFM12 to sleep
digitalWrite(LEDpin,LOW);
power_adc_disable();
power_usart0_disable();
//power_spi_disable();
power_twi_disable();
//Leave timer 0 going for delay() function
power_timer1_disable();
power_timer2_disable();
power_timer3_disable();
power_usart1_disable();
// Datasheet says that to power off the USB interface we have to do 'some' of:
// Detach USB interface
// Disable USB interface
// Disable PLL
// Disable USB pad regulator
// Disable the USB interface
USBCON &= ~(1 << USBE);
// Disable the VBUS transition enable bit
USBCON &= ~(1 << VBUSTE);
// Disable the VUSB pad
USBCON &= ~(1 << OTGPADE);
// Freeze the USB clock
USBCON &= ~(1 << FRZCLK);
// Disable USB pad regulator
UHWCON &= ~(1 << UVREGE);
// Clear the IVBUS Transition Interrupt flag
USBINT &= ~(1 << VBUSTI);
// Physically detact USB (by disconnecting internal pull-ups on D+ and D-)
UDCON |= (1 << DETACH);
digitalWrite(LEDpin,LOW);
cli();
SMCR |=(1<<SM1);//Power down
SMCR |=(1<<SE); //Enable sleep mode
__asm__ __volatile__ ("sleep" "\n\t" :: );
// I expect uA readings here, but get 3mA...
}
void loop() {
}
Any tips are welcome, is it a hardware design issue, or software consideration?
[edit] I realize I didn't mention it, but I power the board from a 3.3V source directly at the VCC pin.
I don't have the LTC3525 boost regulator circuitry poplated for this board build, jut the MCP1703. I tried completely unsoldering it after I programmed the board with the test sketch, but no improvement happened. I also experimented with fuses, disabling BOD, switching clock source from the external crystal to internal one.