GSM SIM900 Module Control relay

Wiring all same previous blog just add relay module

Connect 4 Relays module to Arduino Board

Wiring

4 Relays module     to       Board Arduino

Vcc                                     5 Volt

IN1                                     Pin 4

IN2                                     Pin 5

IN3                                     Pin 6

IN4                                     Pin 7

GND                                   GND

Concept

Idea

Send sms

a1  relay  IN1 on

a?  relay  IN1 off

b1  relay  IN2 on

b?  relay  IN2 off

c1  relay  IN3 on

c?  relay  IN3 off

d1  relay  IN4 on

d?  relay  IN4 off

x1  All relay  on

x?  All relay  off

Library

https://drive.google.com/open?id=1MwINDk0QBViC31dtLt47_aGRQZvwQkhq

VDO

 

Code

#include "SIM900.h"

#include <SoftwareSerial.h>

//If not used, is better to exclude the HTTP library,

//for RAM saving.

//If your sketch reboots itself proprably you have finished,

//your memory available.

//#include "inetGSM.h"

//If you want to use the Arduino functions to manage SMS, uncomment the lines below.

#include "sms.h"

SMSGSM sms;

//To change pins for Software Serial, use the two lines in GSM.cpp.

//GSM Shield for Arduino

//www.open-electronics.org

//this code is based on the example of Arduino Labs.

//Simple sketch to send and receive SMS.

int numdata;

boolean started=false;

char smsbuffer[160];

char n[20];

void setup()

{

  pinMode(4, OUTPUT);

  pinMode(5, OUTPUT);

  pinMode(6, OUTPUT);

  pinMode(7, OUTPUT);

  digitalWrite(4, HIGH);

  digitalWrite(5, HIGH);

  digitalWrite(6, HIGH);

  digitalWrite(7, HIGH);

     //Serial connection.

     Serial.begin(9600);

     Serial.println("GSM Shield testing.");

     //Start configuration of shield with baudrate.

     //For http uses is raccomanded to use 4800 or slower.

     if (gsm.begin(2400)) {

          Serial.println("\nstatus=READY");

          started=true;

     } else Serial.println("\nstatus=IDLE");

     

     if(started) {

          //Enable this two lines if you want to send an SMS.

          if (sms.SendSMS("your phone number", "GSM SmartHome"))

          Serial.println("\nSMS sent OK");

     }

};

void loop()

{

     if(started) {

      

          //Read if there are messages on SIM card and print them.

          if(gsm.readSMS(smsbuffer, 160, n, 20)) {

            

               Serial.println(n);  //Print out phone number

               Serial.println(smsbuffer); // Text 

              char* ptr = smsbuffer;

  while ( strlen(ptr) >= 2 ) {

    if ( ptr[0] == 'a' ) {

      if ( ptr[1] == '1' )

        digitalWrite(4, LOW);

      else

        digitalWrite(4, HIGH);

    }

    if ( ptr[0] == 'b' ) {

      if ( ptr[1] == '1' )

        digitalWrite(5, LOW);

      else

        digitalWrite(5, HIGH);

    }

     if ( ptr[0] == 'c' ) {

      if ( ptr[1] == '1' )

        digitalWrite(6, LOW);

      else

        digitalWrite(6, HIGH);

    }

    if ( ptr[0] == 'd' ) {

      if ( ptr[1] == '1' )

        digitalWrite(7, LOW );

      else

        digitalWrite(7, HIGH);

    }

     if ( ptr[0] == 'x') {

      if ( ptr[1] == '1'){

        digitalWrite(4,LOW);

        digitalWrite(5,LOW);

        digitalWrite(6,LOW);

        digitalWrite(7,LOW);}

         

     else

     {

        digitalWrite(4,HIGH);

        digitalWrite(5,HIGH);

        digitalWrite(6,HIGH);

        digitalWrite(7,HIGH);

      }

     }

    

  

    ptr += 2;

  }

          }

          delay(1000);

     }

};

GSM sim900 + GPS real time location No wifi

This project will explain how to read GPS send to serial pin RX,TX of arduino  then GSM  connect software serial send location to your phone .

This project you can apply to security your car ,home security .

Image result for googlemap

Wiring

GPS to Arduino Nano

TX >>> RX

RX>>> TX

GSM to Nano

TX >>> pin7

RX>>> pin8

Make sure all ground common .


Click detail GSM Sim 900 :  https://goo.gl/MZjRei

GPS module : https://goo.gl/Yokhsb



Code


#include <TinyGPS.h>

#include <SoftwareSerial.h>
SoftwareSerial Gsm(7, 8);
char phone_no[] = "0843XXXXXX"; //replace with phone no. to get sms
TinyGPS gps;  //Creates a new instance of the TinyGPS object

void setup()

{

  Serial.begin(9600);
  Gsm.begin(9600);  

}

void loop()




{

  bool newData = false;
  unsigned long chars;
  unsigned short sentences, failed;

  // For one second we parse GPS data and report some key values

  for (unsigned long start = millis(); millis() - start < 1000;)

  {

    while (Serial.available())

    {
      char c = Serial.read();
      Serial.print(c);
      if (gps.encode(c))
        newData = true;  

    }

  }

  if (newData)      //If newData is true
  {
    float flat, flon;
    unsigned long age;
    gps.f_get_position(&flat, &flon, &age);
    Gsm.print("AT+CMGF=1\r");
    delay(400);
    Gsm.print("AT+CMGS=\"");
    Gsm.print(phone_no);
    Gsm.println("\"");

    delay(300);
    Gsm.print("http://maps.google.com/maps?q=loc:");
   // Gsm.print("Latitude = ");
    Gsm.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
    //Gsm.print(" Longitude = ");
    Gsm.print(",");
    Gsm.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
    delay(200);
    Gsm.println((char)26); // End AT command with a ^Z, ASCII code 26
    delay(200);
    Gsm.println();
    delay(20000);
  }

  Serial.println(failed);
 // if (chars == 0)
   // Serial.println("** No characters received from GPS: check wiring **");
}





VDO

Build mini CNC step by step Using Arduino UNO + Shield CNC + A4988 stepping motor drive

Hard ware

 

 

Hardware list

1. 2x old CD-Rom

2.Arduino UNO

3. CNC Shield

4. A4988 stepping motor drive

5. Wire

Step

1.Add grbl-mi to Arduino sketch
  เพิ่ม โปรแกรม grbl-mi ลงใน โปรแกรม Arduino

2.Add MI Inkscape Extension
 เพิ่่ม MI Inkscape Extension ลงในโปรแกรม Inkscape

3.Inkscape in attach no need install.
โปรแกรม Inkscape ใช้ได้เลยโดยไม่ต้อง Install

4.UGCS for run CNC
โปรแกรม UGCS สำหรับควบคุม CNC

Add grbl Library

Add MI Inkscape Extension

 

Link Software

All Program :   https://drive.google.com/open?id=1i1WOzN0RH0kaNp0T9LAvTxPWyOmxiTWC

UGCShttps://drive.google.com/open?id=1iiPgCxtbIL0MtxZL0zQ0YwOxZVu45r80

VDO

 

Firebase + Arduino + Multi Input/Output

ESP8266 Node MCU : https://goo.gl/fmXdoB

 

 

Part#1

Load Fire base library for Arduino from link below
https://github.com/firebase/firebase-arduino

Add Fire base Zip file to Arduino Library

Make sure you add successfull

 

Part#2 Firebase server configuration

1. Search google : firebase

 

Code

Code from IDE sketch

File >> Example >> FirebaseArduino

// Copyright 2015 Google Inc.//// Licensed under the Apache License, Version 2.0 (the "License");// you may not use this file except in compliance with the License.// You may obtain a copy of the License at////     http://www.apache.org/licenses/LICENSE-2.0//// Unless required by applicable law or agreed to in writing, software// distributed under the License is distributed on an "AS IS" BASIS,// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.// See the License for the specific language governing permissions and// limitations under the License.//
// FirebaseRoom_ESP8266 is a sample that demo using multiple sensors// and actuactor with the FirebaseArduino library.


#include <ESP8266WiFi.h>#include <FirebaseArduino.h>


#define FIREBASE_HOST "example.firebaseio.com"
#define FIREBASE_AUTH "token_or_secret"
#define WIFI_SSID "SSID"
#define WIFI_PASSWORD "PASSWORD"
const int grovePowerPin = 15;
const int vibratorPin = 5;
const int lightSensorPin = A0;
const int ledPin = 12;const int buttonPin = 14;
const int fanPin = 13;


void setup() 

{  Serial.begin(9600);
  pinMode(grovePowerPin, OUTPUT);  
digitalWrite(grovePowerPin, HIGH);
  pinMode(vibratorPin, OUTPUT);  
pinMode(lightSensorPin, INPUT); 
 pinMode(ledPin, OUTPUT);  
pinMode(buttonPin, INPUT); 
 pinMode(fanPin, OUTPUT);
 

 // connect to wifi.  
WiFi.begin(WIFI_SSID, WIFI_PASSWORD); 
 Serial.print("connecting");  
while (WiFi.status() != WL_CONNECTED)
{Serial.print(".");    delay(500);  } 
Serial.println();  Serial.print("connected: "); 
Serial.println(WiFi.localIP());
Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);  Firebase.set("pushbutton", 0);  
Firebase.set("sunlight", 0); 
 Firebase.set("redlight", 0);  
Firebase.set("cooldown", 0); 
 Firebase.set("brrr", 0);}
int button = 0;float light = 0.0;

void loop() 

{  

digitalWrite(ledPin, Firebase.getInt("redlight")); 
 digitalWrite(fanPin, Firebase.getInt("cooldown"));  
digitalWrite(vibratorPin, Firebase.getInt("brrr"));  
int newButton = digitalRead(buttonPin); 


 if (newButton != button) 
{    button = newButton;    
Firebase.setInt("pushbutton", button);  }  
float newLight = analogRead(lightSensorPin);  
if (abs(newLight - light) > 100) 
{    light = newLight;    F
irebase.setFloat("sunlight", light);  } 
(200);}



VDO