Hey, I am trying to lower current draw for battery purposes. I've attached my code and a schematic I drew up showing how everything is wired. Everything works as expected. Motors turn a valve that open and close and then the Arduino sleeps. The mic5225 is supposed to be capable of a 29uA quiescent current, but during sleep my current draw is around 1.5mA. Does anybody notice any problems with my schematic or code that would be a problem?
int openValve = 7; //
int closeValve = 8;
void setup() {
pinMode(openValve, OUTPUT);
pinMode(closeValve, OUTPUT);
//SETUP WATCHDOG TIMER
WDTCSR = (24);//change enable and WDE - also resets
WDTCSR = (33);//prescalers only - get rid of the WDE and WDCE bit
WDTCSR |= (1<<6);//enable interrupt mode
//Disable ADC - don't forget to flip back after waking up if using ADC in your application ADCSRA |= (1 << 7);
ADCSRA &= ~(1 << 7);
//ENABLE SLEEP - this enables the sleep mode
SMCR |= (1 << 2); //power down mode
SMCR |= 1;//enable sleep
}
void loop() {
digitalWrite(openValve,HIGH);// open the valve
delay(6000); // wait for valve to open
digitalWrite(openValve,LOW); // valve is open. Stop sending signal.
digitalWrite(closeValve,HIGH);// close the valve
delay(6000);// wait for valve to close
digitalWrite(closeValve,LOW);// valve is closed. Stop sending signal.
MCUCR |= (3 << 5); //set both BODS and BODSE at the same time
MCUCR = (MCUCR & ~(1 << 5)) | (1 << 6); //then set the BODS bit and clear the BODSE bit at the same time
__asm__ __volatile__("sleep");//in line assembler to go to sleep
}
ISR(WDT_vect){
}