https://hwstartup.wordpress.com/2013/03/11/how-to-run-an-arduino-on-a-9v-battery-for-weeks-or-months/ An explainer on how to optimize an arduino, hardware and software-wise, to make it last as long as possible while running on batteries.