Some new stuff
  1. Arduino Park Control
  2. Arduino USB2serial programming the bare bone
  3. Arduino Projects Videos added
  4. Arduino Xbee projects
  5. Arduino dB Meter 
  6. Trying to get the IOIO going. 
  7. IOIO is going....bluetooth
  8. Attiny 2313 bluetooth bee RC car
  9. Compass and temperature added
  10. AVR programmer
  11. USB2Serial and Ethernet POE
  12. Arduino LPG Sensor
  13. Program the Arduino Mini 05
  14. Lipo Rider Pro in action
  15. EZ Robot Builder kit arrived 10 Nov 2012
  16. Arduino VA Meter!
  17. 05 Nov 2012 Project Sentry Gun.
  18. Attiny85 PIR Sensor 10 Dec 2012 
  19. 0-30VDC3A and 2-28VDC10A bench PSU's
  20. 19 Dec 2012 Arduino Voltmeter LCD
  21. 29 Dec 2012 Arduino Tachometer&Speedometer LCD
  22. 03 Jan 2013 Arduino AC Phase Control. 
  23. 18 Jan 2013 Arduino Distance Meter
  24. 22 Jan 2013 Arduino Digital Clock and Date
  25. 31 Jan 2013 Arduino Digital Clock and Date 8x2 LCD
  26. Feb 2013 LCD and Backpack
  27. Feb 2013 7 Segment Serial Clock Sparkfun. Distance Sensor with "newping" library
  28. Feb 2013 Lelo Remote
  29. 01/03/2013 Arduino Adafruit 7 Seg Digital Clock with RTC and backpack 
  30. Arduino Frequency Meter 26/03/2013
  31. Another RC  Car controlled by Arduino 06/04/2013
  32. My quadcopter project update 25 April 2013
  33. My Aqua Quad Copter Flying 26 April 2013enlightened
  34. Another monster RC truck;strong one! 11July2013cool
  35. X-Frame Quad Copter 31 July 2013cool
  36. Arduino GSM Sheild added.28/8/2013
  37. 1.8inch TFT screen 13/09/2013cool
  38. 04/11/2014 added PID Soldering Iron Control
  39. Added bluetooth servo control 04/11/2014
  40. ESP8266 first try.16/03/2015
  41. Arduino Uno Quadcopter 19 May 2015
  42. IOT WemosD1 Amp Meter

 

 



28 August 2013

I bought this Arduino sheild and expensive it is.

But, at least there is samples available from Arduino via the IDE Examples dropdown. This is not the situation with GBoard Pro from Iteedstudio. I just could get nothing to help me to get started regarding the GBoard pro

All the samples on the IDE work excellent on the Arduino sheild; making voice calls, receiving voice calls, sending and receiving sms's etc.

My next step will be to add the speaker /michrophone circiut towards the sheild.

Then it must be time for the 2.8 TFT touch screen.

3 August 2013

Arduino PIR Mobile Alarm with GSM Sheild sending a sms once the alarm is triggered

This is a typical mobile alarm for use in a caravan or single room and the alarm can be carried to another room etc. The idea is that once you have powered the alarm, you have a few seconds (varaiable) to leave the room or caravan and the alarm will then be set and GSM ready. Once the alarm is triggered after the delay, an SMS will be send to your cell phone number of choice and of course a personal message.When you return to your alarm system, onother delay in the code will allow you to power off your alarm in time.

What I have done is to make use of the Arduino sample code for sending SMS from theire website or you can use the example sketches from IDE.

Then I changed the code to accommodate my favourite Adafruit LCD 16x2 backpack I2C for communication towards the user of the alarm.

Wynand from H4H assisted me with some changes and while loop in the sketch.

The alarm is currently a james bond tone instruction/melody I got from the net else where. So you can of course replace  james bond melody with different tone instructions with something else.  

Here is the code:

#define NO_SOUND 0 // make the rests in music
#define NOTE_B0  31
#define NOTE_C1  33
#define NOTE_CS1 35
#define NOTE_D1  37
#define NOTE_DS1 39
#define NOTE_E1  41
#define NOTE_F1  44
#define NOTE_FS1 46
#define NOTE_G1  49
#define NOTE_GS1 52
#define NOTE_A1  55
#define NOTE_AS1 58
#define NOTE_B1  62
#define NOTE_C2  65
#define NOTE_CS2 69
#define NOTE_D2  73
#define NOTE_DS2 78
#define NOTE_E2  82
#define NOTE_F2  87
#define NOTE_FS2 93
#define NOTE_G2  98
#define NOTE_GS2 104
#define NOTE_A2  110
#define NOTE_AS2 117
#define NOTE_B2  123
#define NOTE_C3  131
#define NOTE_CS3 139
#define NOTE_D3  147
#define NOTE_DS3 156
#define NOTE_E3  165
#define NOTE_F3  175
#define NOTE_FS3 185
#define NOTE_G3  196
#define NOTE_GS3 208
#define NOTE_A3  220
#define NOTE_AS3 233
#define NOTE_B3  247
#define NOTE_C4  262
#define NOTE_CS4 277
#define NOTE_D4  294
#define NOTE_DS4 311
#define NOTE_E4  330
#define NOTE_F4  349
#define NOTE_FS4 370
#define NOTE_G4  392
#define NOTE_GS4 415
#define NOTE_A4  440
#define NOTE_AS4 466
#define NOTE_B4  494
#define NOTE_C5  523
#define NOTE_CS5 554
#define NOTE_D5  587
#define NOTE_DS5 622
#define NOTE_E5  659
#define NOTE_F5  698
#define NOTE_FS5 740
#define NOTE_G5  784
#define NOTE_GS5 831
#define NOTE_A5  880
#define NOTE_AS5 932
#define NOTE_B5  988
#define NOTE_C6  1047
#define NOTE_CS6 1109
#define NOTE_D6  1175
#define NOTE_DS6 1245
#define NOTE_E6  1319
#define NOTE_F6  1397
#define NOTE_FS6 1480
#define NOTE_G6  1568
#define NOTE_GS6 1661
#define NOTE_A6  1760
#define NOTE_AS6 1865
#define NOTE_B6  1976
#define NOTE_C7  2093
#define NOTE_CS7 2217
#define NOTE_D7  2349
#define NOTE_DS7 2489
#define NOTE_E7  2637
#define NOTE_F7  2794
#define NOTE_FS7 2960
#define NOTE_G7  3136
#define NOTE_GS7 3322
#define NOTE_A7  3520
#define NOTE_AS7 3729
#define NOTE_B7  3951
#define NOTE_C8  4186
#define NOTE_CS8 4435
#define NOTE_D8  4699
#define NOTE_DS8 4978

//array of notes
int melody[] = {
  /*NOTE_G4,NOTE_G4,NO_SOUND,NOTE_G4,NOTE_G4,NO_SOUND,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_G4,
   NOTE_B3,NOTE_G3,NOTE_C4,NOTE_G3,NOTE_CS4,NOTE_G3,NOTE_C4,NOTE_G3,NOTE_B3,NOTE_G3,NOTE_C4,NOTE_G3,NOTE_CS4,NOTE_G3,NOTE_C4,NOTE_G3,
   NOTE_E4,NOTE_F4,NOTE_F4,NOTE_F4,NOTE_F4,NOTE_E4,NOTE_E4,NOTE_E4,
   NOTE_E4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_E4,NOTE_E4,NOTE_E4,*/
   //Introduction
  NOTE_E4,NOTE_F4,NOTE_F4,NOTE_F4,NOTE_F4,NOTE_E4,NOTE_E4,NOTE_E4,
  NOTE_E4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_E4,NOTE_E4,NOTE_E4,
  NOTE_E4,NOTE_F4,NOTE_F4,NOTE_F4,NOTE_F4,NOTE_E4,NOTE_E4,NOTE_E4,
  NOTE_E4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_E4,NOTE_E4,NOTE_E4,
  NOTE_DS5,NOTE_D5,NOTE_B4,NOTE_A4,NOTE_B4,
  NOTE_E4,NOTE_G4,NOTE_DS5,NOTE_D5,NOTE_G4,NOTE_B4,
  NOTE_B4,NOTE_FS5,NOTE_F5,NOTE_B4,NOTE_D5,NOTE_AS5,
  NOTE_A5,NOTE_F5,NOTE_A5,NOTE_DS6,NOTE_D6,NO_SOUND
};

// note duration: 1 = whole note, 2 = half note, 4 = quarter note, 8 = eighth note, etc.
int noteDurations[] = {
  /*8,8,2,8,8,2,16,8,16,8,8,
   2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,
   8,16,16,8,4,8,8,8,
   8,16,16,8,4,8,8,8,*/
  8,16,16,8,4,8,8,8,
  8,16,16,8,4,8,8,8,
  8,16,16,8,4,8,8,8,
  8,16,16,8,4,8,8,8,
  8,2,8,8,1,
  8,4,8,4,8,8,
  8,8,4,8,4,8,
  4,8,4,8,3
};
#include
#include "Wire.h"
#include "LiquidCrystal.h"//Adafruit backpack Library
int pace      = 1450; // change pace of music("speedy")
int buttonPin = 12;     // the number of the pushbutton pin
int ledPin   =  13;      // the number of the LED pin
int alarmPin  = 11;
// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status
#include
#define PINNUMBER ""
// initialize the library instance
GSM gsmAccess; // include a 'true' parameter for debug enabled
GSM_SMS sms;
// char array of the telephone number to send SMS
// change the number 1-212-555-1212 to a number
// you have access to
char remoteNumber[20]= "0824427051";  
// char array of the message
char txtMsg[200]="ALARM at Chemcool's place!";
// A4 = SDA,A5 = SCL;backpack I2C
LiquidCrystal lcd(0);

void setup()
{
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);      
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT); 
   // initialize serial communications
  digitalWrite(buttonPin,HIGH);
  pinMode(alarmPin, OUTPUT);
  Serial.begin(9600);
  lcd.begin(16, 2);
  lcd.clear();
  lcd.print("SMS Alarm Sender");
  lcd.setCursor(0,1);
  lcd.print("By Chemcool 2013");
  delay(3000);
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("SMS# 0824427051");
  lcd.setCursor(0,1);
  lcd.print("Wait for GSM....");
  Serial.println("SMS Messages Sender");
  // connection state
  boolean notConnected = true;

  // Start GSM shield
  // If your SIM has PIN, pass it as a parameter of begin() in quotes
    while(notConnected)
  {
    if(gsmAccess.begin(PINNUMBER)==GSM_READY)
      notConnected = false;
    else
    {
      Serial.println("Not connected");
      lcd.clear();
      lcd.setCursor(0,0);
      lcd.print("Not connected");
      delay(1000);
    }
  }
  Serial.println("GSM initialized");
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("GSM ready,20secs");
  lcd.setCursor(0,1);
  lcd.print("to vacate room");
  delay(20000);
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("20 Sec's passed");
  }

void loop()
{
// read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);
  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) { 
  delay(20000);    
    // turn LED on:
  sendSMS();    
    digitalWrite(ledPin, HIGH);//LED trigger indication
    ALARM();//we call the alarm   
  } 
  else {
    // turn LED off:
    digitalWrite(ledPin, LOW); 
    sms.endSMS();
  }
}

void sendSMS(){

  Serial.print("Message to mobile number: ");
  Serial.println(remoteNumber);

  // sms text
  Serial.println("SENDING");
  Serial.println();
  Serial.println("Message:");
  Serial.println(txtMsg);

  // send the message
  sms.beginSMS(remoteNumber);
  sms.print(txtMsg);
  sms.endSMS(); 
  Serial.println(" COMPLETE! ");  
}


void ALARM() {
  
 // delay(30000);//this delay allow you to switch off alarm before trigger  
  
  for (int Note = 0; Note <54; Note++) {//counter of Notes (54 limit the array)
    int duration = pace/noteDurations[Note];//Adjust duration with the pace of music
    tone(11, melody[Note],duration); //Play note

// to distinguish the notes, set a minimum time between them.
    delay(duration*1.2);
  }
  lcd.clear();
  lcd.setCursor(0,0);
   while(true) {
  lcd.print("   Alarm was");
  lcd.setCursor(0,1);
  lcd.print("   triggered!");
  lcd.noDisplay();
  delay(500);
   // Turn on the display:
  lcd.display();
  delay(500);
  }
 }

Some piccies:

 

 

Back Back to top