Power Efficiency

I am working on a project that uses an UNO, GSM module and a magnetic sensor that alerts the user when the sensor is opened. I need this system to be powered for a number of weeks. I have currently tested using a 9v battery (which I know is not the most efficient) and it only lasted ~8 hours. I have added the low power library to help with some power consumption. I need help to understand what would be the most efficient way to power such a project. Please see code below.

#include <SoftwareSerial.h>
#include <LowPower.h>

SoftwareSerial SIM800L(10, 11); // RX, TX

const int magnet = 8; // magnet connected to pin 8

int state; // 0 = closed, 1 = open

int count = 1; // set counter value

void setup()
  Serial.begin(9600); // setting baud rate of Arduino
  Serial.println("Initializing Arduino...");
  SIM800L.begin(9600); // setting baud rate of GSM module
  Serial.println("Initializing GSM Module...");
  Serial.println("Trap Active!");
	pinMode(magnet, INPUT_PULLUP); // initialize magnet as an input

  pinMode(13,OUTPUT); // initialize LED as an output

void loop()
  digitalWrite(13,HIGH); // set LED on
  digitalWrite(13,LOW); // set LED off
  LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF); // ADC & BOD disabled for 8 secs
  state = digitalRead(magnet); // reading the state of magnet pin
	if (state == HIGH && count == 1){ // HIGH = open & counter = 1
	  Serial.println("TRAP ALERT!");
		SendMessage(); // execute send message
		Serial.println("Notification Sent");
    count++; // increment counter

void SendMessage()
  SIM800L.write("AT+CMGF=1"); SIM800L.println(); // setting GSM module to text mode
	SIM800L.write("AT+CMGS="); SIM800L.write('"'); SIM800L.write(""); SIM800L.write('"'); SIM800L.println(); // number to receive message
	SIM800L.write("TRAP ALERT!"); // message content
	SIM800L.println(char(26)); // ASCII code of ctrl+z

A few random thoughts that may help you:

  1. A plain old Arduino UNO board is not a good candidate for a battery powered project. The 328P micro is fine, it’s all the other stuff that will sap your battery power.
  2. Can you put the GSM module to sleep when you are not using it?
  3. Do you need to turn the LED on for 2 seconds after every 8 seconds of sleep?
  4. I think you may be able to use a pin change interrupt to detect the change of state of the magnetic sensor. This could wake the micro from an indefinite sleep, so you don’t need to manually poll the state of the sensor.

Hey Mark

Thanks for the reply.

  1. I know an UNO is probably over kill here but it’s the only thing I have available currently. Is there another board you could suggest that would be sufficient.
  2. I have not looked into this.
  3. Nope this was just for testing purposes and can be removed.
  4. Yes I was thinking similar to this. Would you know of an example that I could look at for reference?

Besides all this would you suggest maybe using something else like 4 AA batteries in series rather than one 9v battery or some sort of solar power. I forgot to mention this will be based outdoors so that could be an option.

Agree with Mark

An Arduino Pro mini 3.3V @ 8Mhz with slight modifications will sleep on a very very small current

You obviously will need to turn off the sim800 module

The magnet should be used to close a circuit that will wake up the whole system

This way you can sleep for weeks possibly and only consume power when waken up

@Fiscuries - FYI, I have a couple of custom boards that have no more than a 328P + the required Cs & Rs to make it work. They run off either 2xAA batteries or 3xAA batteries and power an RFM69 433MHz radio module and a DS18B20 temperature sensor. The wake every 8 seconds until 1 hour has elapsed and then they transmit battery voltage and ambient temperature to a “gateway” node. They’ve been doing this for 7 months now on the same set of AA batteries.

I think you need to see what voltage the sim800 needs? Is it 5V or 3.3V, or can it handle a range of voltages.

I found a SIM800L which seems to like 3.8V-4.2V (strange!), 2mA sleep current but up to 2A on Tx. The specs I saw talked about a UART interface that shouldn’t exceed 2.8V. Seems quite an oddball setup but then again I know less than zero about GSM modules :wink:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.