Secret Silent SMS Alarm

by jckelley in Circuits > Microcontrollers

1496 Views, 19 Favorites, 0 Comments

Secret Silent SMS Alarm

CoverImage_Smsalarm.jpg

You know how in the bank heist movies there is that secret button underneath the counter for the teller to press? It triggers a silent alarm (so the robbers can't react) to the police who when come over in a jiffy to save the day.

Well, while I'm not protecting a bank, I have realized that I do need a silent alarm. There is this one person at work who is just a huge talker. Sometimes I just need an escape from him, but how do I send out the SOS without letting him know?

That's where the LinkIt One comes in. When you combine it with a Grove Touch Sensor, you can create a silent alarm that, when pressed, sends out a text to a friend to come "take you to an important meeting" in order to escape the chatty Kathy's of the world.

Requirements and Supplies

TOOLS

  • Duct Tape or Glue

MATERIALS

1 SeeedStudio Grove touch Sensor

1 LinkIt One Board by MediaTek (Including Power cable and GSM antenna)

1 Sim card (Pre-paid or a dummy for practice

Some tape

PROCEDURES

Step 2: Configure your LinkIt One Board to work with the SIM Card and support GSM

Step 3: Insert your SIM card

Step 4: Connect Grove Touch Sensor

Step 5: Code Touch Sensor Logic

Step 6: Code GSM Message Logic

Step 7: Deployment and Going Forward

Configure Your LinkIt One Board

WP_20151019_012.jpg

We'll need to modify some of the switches on the LinkIt One board in order to make it work. Along with the image attached, make sure that you have done the following

1. Set the MS -- UART switch to UART

2. Set the USB -- BAT switch to USB

3. Set the SPI -- SD switch to SPI

Insert Your SIM Card

WP_20151019_011.jpg
WP_20151019_010.jpg

I know that most people probably don't have a pre-paid SIM card laying around. If you are just prototyping and want to see a proof of concept, feel free to remove it from your current cell phone (or one of your friends) just to try it out. If you get serious and want to make this a full-time gig, you will have to pony up for a pre-paid SIM.

Inserting the SIM card is a fairly straight forward process. Flip over your LinkIt One and look at the smaller big metal piece. You can see in the figure where I inserted my SIM card if you are confused.

After you have inserted the SIM card, be sure to attach your GSM antenna that came with your LinkIt One kit. This will allow you to get a cell signal.

Connect Grove Touch Sensor

WP_20151022_002.jpg
WP_20151022_005.jpg

Connecting your Grove Touch sensor is pretty straightforward. You plug in the Grove slot into the LinkIt One Board and you're pretty much set to go. The one catch is you also have to solder on the 'INT' pin and connect it to the LinkIt One. I have included a picture of the 'INT' here for reference. You'll want to quickly solder a pin onto that and attach it to pin 7.

Code Touch Sensor Logic

First, let's code the logic that says when we touch certain 'plates' on our touch sensor we want the LinkIt One to react and perform another set of logic (sending an SOS message to our friend).

You can go ahead and just copy and paste the code from below, but I would also recommend you take a look at the Grove Touch Sensor Wiki to learn more about how to interact with the sensor.

<p>#include defs.h<br>#include i2c.h
#include  i2c_touch_sensor.h</p><p>#include mpr121.h
#include types.h
#include  Wire.h</p><p>// IMPORTANT: in this case, INT pin was connected to pin7 of the LinkIt One 
// (this is the interrupt pin)
i2ctouchsensor touchsensor; // keep track of 4 pads' states
//boolean padTouched[4];
long previousMillis = 0;
long interval = 100;
void setup() 
  {    
    Serial.begin(9600); // for debugging   
    Serial.print("begin to init");  
    Wire.begin(); // needed by the GroveMultiTouch lib     
    touchsensor.initialize(); // initialize the feelers     </p><p style="margin-left: 20.0px;">    // initialize the containers     
    for(int i=0; i<=3; i++) 
    {          
   		padTouched[i]=false;     
    }
  
  }
void loop()
{     
   unsigned char MPR_Query=0;
   unsigned long currentMillis = millis();
 if(currentMillis - previousMillis > interval)
  {
    previousMillis = currentMillis;
    touchsensor.getTouchState();
  }
 for (int i=0;i<12;i++)
 {
</p><p>if (touchsensor.touched&(1<<i>  {
  Serial.print("pin ");
        Serial.print(i);
        Serial.println(" was  touched");
         }
 }
}</i></p>

SMS Texting Logic

Now we'll add in the code that allows us to send an SMS alert to a pre-arranged friend anytime we're in need of a "Call on Line 1" kind of interruption. It's actually fairly simple. All we need to do is include the LGSM library and then create a few lines of code to send out a text.

<p>#include defs.h<br>#include i2d.h
#include i2c_touc_sensor.h
#include mpr121.h
#include types.h
#include  Wire.h
#include LGSM.h
// IMPORTANT: in this case, INT pin was connected to pin7 of the LinkIt One 
// (this is the interrupt pin)
i2ctouchsensor touchsensor; // keep track of 4 pads' states
//boolean padTouched[4];
long previousMillis = 0;
long interval = 100;
void setup() 
  {    
    Serial.begin(9600); // for debugging   
    Serial.print("begin to init");  
    Wire.begin(); // needed by the GroveMultiTouch lib     
    touchsensor.initialize(); // initialize the feelers     </p><p>    // initialize the containers     
    for(int i=0; i<=3; i++) 
    {          
   		padTouched[i]=false;     
    }
  
  }
void loop()
{     
   unsigned char MPR_Query=0;
   unsigned long currentMillis = millis();
 if(currentMillis - previousMillis > interval)
  {
    previousMillis = currentMillis;
    touchsensor.getTouchState();
  }
 for (int i=0;i<12;i++)
 {
 if (touchsensor.touched&(1<<i))</p><p></p><p style="margin-left: 20.0px;">        LSMS.beginSMS("5551112222"); //Insert phone number you wish to notify
		LSMS.print("PLEASE COME TO MY DESK WITH EXCUSE FOR ME TO LEAVE");
		LSMS.endSMS();
         }
 }
}</p>

Deployment and Going Forward

WP_20151023_001.jpg

Simply deploy your code to the LinkIt One board and you are all set! No more long awkward conversations! Whenever you put your fingers on any of these sensors, you'll have sent a silent help message to a nearby friend!

Hopefully this has proved to be a good introduction to the LinkIt One board's capabilities with GSM and SeeedStudio technology. Here are just a few ideas on how you can go forward with this project:

  • Code logic so that tapping different sequences of plates text different people
  • Add a small LED to the project to notify you when text message is sent.
  • Build a water balloon cannon to pop out of your desk and surprise your victim.