Power failure SMS alert using Arduino and GSM shield

Hi all, first post (just getting ready to order the arduino starter kit).
I have an idea for a project that I'd like some opinions on, as follows:

I'd like to setup a system so that I'd get an SMS from a GSM shield if there was a power outage.
The biggest problem that I see so far is that if there's a power outage then the GSM shield will lose power too.
Could I use some sort of a power supply with a battery or capacitor that would provide the GSM shield with enough power to send the SMS (2A I believe)?

Someone already setup this and posted the video to youtube (- YouTube) however they didn't give any instructions (it seems to me that the GSM shield may still be powered off the USB)?

Thanks for any help...

Don't use a capacitor for a few seconds, use a battery bank that last for example half an hour.

Perhaps with supercapacitors it is possible, but you have to build a circuit yourself.
You can make something yourself with batteries, but perhaps one of those power banks for mobile devices can be used.

What about a 12V car battery. With a fuse and DC-DC converter.

The power bank for mobiles is a great idea, I never thought of that. I must look into that. Presumably the arduino will lose power as soon as the power failure occurs, if so then I'd need to power the arduino and the gsm shield for long enough to send the SMS...

It is the same as a UPS (uninterruptable power supply).

You don't have to switch between mains power and batteries, you can run everything from the batteries, and have a charger to keep the batteries fully charged.

Our alarm system uses a 12V sealed lead gel battery.

If you have a diode between the charger and the battery (so that the battery cannot back-feed to the charger) then you can use the Arduino to monitor the voltage upstream of the diode. If the power supply fails that voltage will drop but the Arduino will continue running from the battery.

Just ensure that the Arduino pins never get more than 5v or less the 0v.

...R

Ok, so this is what I have, now I just need to figure out how to connect everything and how to program it:

1 x Arduino UNO (came with starter kit)
1 x Sainsmart TC35 GSM SMS wireless module
1 x AC/DC adapter for arduino (output 9V/1000mA
1 x Portable rechargable battery (6,000mAh, 2 USB outputs - 1 x 5V/1A and 1 x 5V/2.1A).

What I'm thinking of doing is this:
Have the UNO and the TC35 powered from the AC/DC mains adapter AND each powered separately from the portable battery when the adapter loses power.
When the mains is unplugged/power cut the UNO will detect this and send a command to the TC35, which in turn will send an SMS to a predefined phone number.

The questions I have at the moment are (please bear in mind that I'm new to all this):

  1. Is the 5V/1A enough to power the UNO and 5V/2.1A enough to power the TC35 and send an SMS when the adapter power is lost?
  2. How does the UNO "know" where it's getting it's power from, how will I incorporate this into the code so I can tell it to send a command to the TC35 when power is lost?
  3. The TC35 uses a serial connector - I assume I'll have to buy one, or is there any other way of connecting it to the UNO?

Thanks for taking the time to read this, feedback welcome...

BigCon:
2. How does the UNO "know" where it's getting it's power from, how will I incorporate this into the code so I can tell it to send a command to the TC35 when power is lost?

I don't think you have read the earlier replies carefully. Have another go.

In the concept you have in mind how and when will the battery be charged?

Arduinos can obviously be powered from a USB port. I imagine the datasheet for the TC35 will tell you how much power (volts and amps) it requires. If it does not need much power it can probably be powered from the Arduino.

...R

Ok, I had another read and I think I get the idea. Basically power the UNO from the portable battery (and also the TC35 if the power is enough, Google says 5V).
My idea was to leave the battery plugged in permanently - it came with a mains adapter and uses a USB to micro USB cable.
I'm not sure how I would install a diode between the charger and the battery?

BigCon:
Ok, I had another read and I think I get the idea. Basically power the UNO from the portable battery (and also the TC35 if the power is enough, Google says 5V).
My idea was to leave the battery plugged in permanently - it came with a mains adapter and uses a USB to micro USB cable.
I'm not sure how I would install a diode between the charger and the battery?

If the mains adatpter sends low voltage (i.e.SAFE to touch) DC to the battery you just need to put the diode in the positive wire and have the Arduino test the voltage upstream of the diode. Make sure to use a voltage divider to bring the test voltage below 5v.

If the mains plug sends mains voltage to the battery DO NOT fiddle with the wires.

Do the battery instructions say that it is safe to leave on charge continuously? For example my phone instructions forbid that.

I presume there is some purpose behind your project. Don't penny-pinch. A lead-acid battery with a suitable trickle charger is virtually bullet proof. The bigger the battery the less risk of overcharging.

...R

Robin2:
If the mains adatpter sends low voltage (i.e.SAFE to touch) DC to the battery you just need to put the diode in the positive wire and have the Arduino test the voltage upstream of the diode. Make sure to use a voltage divider to bring the test voltage below 5v.

Ok, so I've finally got some time to start playing around with the Uno and the TC35. I managed to get the setup to send SMS messages to my phone so that's a start.

The mains adapter does indeed supply low voltage (9V, 1000mA) to the input jack of the Uno or the TC35.
I'm still unsure of how to use a diode to monitor the voltage (or if I need a voltage divider).
What I'd like to do is keep it as simple as possible.
Is there any way of differentiating between the power supplies to the uno (for example, if the above adapter "dies" and the backup battery kicks in does the uno "know" - if so I could just write some code to tell the TC35 to send an SMS if this event happens)?
I need to keep the system as compact as possible too, so a motorcycle battery is a little too large.
I can use the standard 9V battery (PP3) as backup that could provide enough power to the Uno and the TC35 to send an SMS (this battery could be checked/replaced whenever it ran low, this interval would need to be determined).
What do you think of this?

I think you need to test with a PP3 battery. I would have thought it unlikely that it has enough capacity to power a TC35 when transmitting.

BigCon:
I'm still unsure of how to use a diode to monitor the voltage (or if I need a voltage divider).

The diode is to prevent the battery from sending power back to the mains unit when the mains supply fails. You also need a voltage divider so that the Arduino only sees 5v. Something like this crude diagram

9v +------------------------->|--------------- B+
MAINS R
x
UNIT R

  • --------------------------------------------- B-

The Rs are the resistors for the voltage divider between the +ve and -ve wires. Connect the Arduino detect pin to x.
The >| is the diode (and I regularly get the diagram the wrong way round).
The Arduino also takes its power at the points B+ and B-

...R

Robin2:
The diode is to prevent the battery from sending power back to the mains unit when the mains supply fails.

It was mentioned explicitly before, but not here, that this is only for a DC voltage source, not the actual mains voltages. I'm sure that when Robin says "mains unit" he's referring to the low voltage power source driven by the mains, but it doesn't hurt to say that explicitly. (Because it would hurt to send mains voltage into the Arduino input, even with a voltage divider!)

I seem to recall seeing some shields or Arduino compatible boards that had a connector for a LiPo battery and the circuitry to charge and monitor the battery. Such a board would make this whole project a lot easier. After a quick search, I'm not finding any, other than the Arduino Fio. While this isn't a form factor that works with normal shields, meaning a regular GPRS shield is out, I believe that there are GPRS modules available in an XBee form factor that would plug in directly to a Fio. If you don't already have all of the hardware, maybe something like that is an option?

ShapeShifter:
It was mentioned explicitly before, but not here, that this is only for a DC voltage source, not the actual mains voltages. I'm sure that when Robin says "mains unit" he's referring to the low voltage power source driven by the mains,

Very wise to repeat this.
I had mentioned it carefully in an earlier post.
I have added 9v to the diagram to remove any doubts.

...R

Ok, thanks again for the help and suggestions, it must be fustrating trying to explain this stuff to a newbie.
I was thinking, the system I'm trying to create the SMS alarm for has a two hour UPS built in, problem is that it could be weeks before the outage is noticed (the system is only used infrequently).
There is a spare socket on the UPS, so what I am thinking is that I'll power the UNO and the shield from the mains (with the appropriate adapter) and when the mains is unplugged, the UNO and the shield will switch over to the UPS and send the "check power" SMS.
Any easy way of wiring this?

BigCon:
I was thinking, the system I'm trying to create the SMS alarm for has a two hour UPS built in, problem is that it could be weeks before the outage is noticed (the system is only used infrequently).
There is a spare socket on the UPS, so what I am thinking is that I'll power the UNO and the shield from the mains (with the appropriate adapter) and when the mains is unplugged, the UNO and the shield will switch over to the UPS and send the "check power" SMS.
Any easy way of wiring this?

How does this relate to the problem we have already been helping with?

Why do I get the impression that you have not yet told us what you actually want to achieve?

There is a spare socket beside me here and I guess you know the same amount about that as I do about the spare socket on your UPS. How about posting a link to the datasheet or user manual for the UPS?

...R

BigCon:
There is a spare socket on the UPS, so what I am thinking is that I'll power the UNO and the shield from the mains (with the appropriate adapter) and when the mains is unplugged, the UNO and the shield will switch over to the UPS and send the "check power" SMS.
Any easy way of wiring this?

That spare socket, is it a power output socket? If so, the problem becomes trivial. Plug a power adapter (wall wart) into that power socket, and use that to power the Uno and shield. That way, the device always has power (at least as long as the UPS batteries hold.) The switchover from mains to battery is automatic - that's what the UPS does.

Now, take another power adapter, this one can be very small with a low current rating - you don't need much. This is plugged into the normal mains power, so that it turns off when power is lost. The output from that adapter is connected to an input of the Uno, either through a voltage divider or perhaps an opto-isolator. This lets the Uno know whether the mains are alive or not.

Using an opto-isolator may be overkill, but it's safer: cheap (small) adapters can often be poorly regulated at low currents, and this will be a very low current application. If just a resistor is used, the Uno input may be exposed to unwanted voltages. Also, this bypasses any concerns about common grounds between power supplies, especially when the UPS is on battery.

This simplifies the problem greatly: a normal power supply is used for the Uno, all of the battery details are handled by the UPS. The second power adapter gives an easy way to monitor actual power.

Another idea: many UPS systems have a serial or USB port that allows monitoring the status of the system. Can you connect to this port, and are the messages documented anywhere? This would not only allow you to monitor mains power, but would let you monitor the general health of the UPS: you could send out alerts as the battery power is getting low, or when the UPS recognizes various faults.

@Robin2 - I can't say what the system is that I am looking to add the power failure alarm sms to due to IP concerns.
However the UPS that it uses is this one => http://www.ht.com.au/part/Q7196-APC-Back-UPS-CS-650-UPS-650-VA/detail.hts
I like what Shapeshifter posted above, it seems like a nice solution (I probably should have given more info from the start but I didn't think it would have been tricky to setup what I needed).
So I'm going to get two of these => IEC socket
I already have a 3 pin plug to arduino supply that I'll connect to one of them, plugging the other end into the UPS.
Then I'll plug this into the supply side of the UPS => IEC Adapter so I can monitor the actual power supply.
Now I just need to research what an optp-isolator is and how I'll wire it into the setup!

I can't help feeling all my earlier advice was just a waste of time.

...R

Robin2:
I can't help feeling all my earlier advice was just a waste of time.

...R

Why would you think that, I'm still going to have to have monitor voltage like you suggested in post #4?