Introduction: Presence Detector With "Nodo Limón"
The “Nodo Limón” has all applications of an Arduino Leonardo with the advantage of has a module GSM/GPRS Sim900 included, we can do SMS or we can call a cellular phone. In this time we will make a Presence detector. This is simple.
Components:
1 sensor PIR.
1 Nodo Limón.
3 female female cables.
1 USB mini USB cables.
1 power supply.
if you want get the Nodo Limón you can buy it in this link
Step 1:
We have to connect the sensor with the Nodo Limón; for this we will remove the dome of sensor to see the pinout of sensor.
Step 2:
The ground pin of the PIR will connect with the analog ground pin of the “Nodo Limón”.
Step 3:
The voltage pin of the PIR is connecting to the voltage pin of “Nodo Limón”.
Step 4:
The PIR output pin is connected to pin 5 Node Limón.
Step 5:
We have to load the program this is very simple first one: we have to connect the board to the computer and we load the program it’s similar to Arduino; we can use the Arduino’s IDE or other compilers that are compatible with Arduino.
Note: this the code.
#include
"GSM.h"
#define SMS_MAX_LEN3 100
#define SMS_MAX_LEN4 100
/*****************************Globals***********************************************/
GSM gsm;
int calibrationTime = 10;
long unsigned int lowIn;
int valor_limite= 200;
long unsigned int pause = 5000;
char mes;
boolean lockLow = true;
boolean takeLowTime;
int pirPin = 5;
int indicador =13;
void setup() {
Serial.begin(9600);
gsm.InitSerLine(115200);
gsm.TurnOn();
pinMode(pirPin, INPUT);
digitalWrite(pirPin, LOW);
pinMode(indicador, OUTPUT);
digitalWrite(indicador, LOW);
Serial.print(" calibrando sensor ");
for(int i = 0; i < calibrationTime; i++){
Serial.print(".");
delay(1000);
}
Serial.println(" hecho");
Serial.println("SENSOR ACTIVADO");
delay(50);
}
void loop() {
if(digitalRead(pirPin) == HIGH){
digitalWrite(indicador, HIGH); //LED visualiza el estado de la salida del sensor
if(lockLow){
//Se asegura de que esperar a que la transici�n a la baja antes de cualquier salida se hace otra:
lockLow = false;
//Cambie el numero de telefono por el numero autorizado
gsm.SendSMS("+523121125190","movement detected");
Serial.println("se detecto movimiento, mensaje enviado");
delay(50);
}
takeLowTime = true;
}
if(digitalRead(pirPin) == LOW){
digitalWrite(indicador, LOW); //LED visualiza el estado de la salida del sensor
if(takeLowTime){
lowIn = millis(); // guardar el momento de la transici�n de alta a baja
takeLowTime = false; // asegurarse de que esto s�lo se hace al comienzo de una fase de baja
}
//Si el sensor es baja para m�s de la pausa dada,
//Asumimos que el movimiento no m�s que va a pasar
if(!lockLow && millis() - lowIn > pause){
//Se asegura de este bloque de c�digo s�lo se ejecuta de nuevo despu�s de
//Una secuencia de movimiento se ha detectado nuevo
lockLow = true;
//Cambie el numero de telefono por el numero autorizado
gsm.SendSMS("+523121125190","The movement stopped");
Serial.println("El movimiento se detuvo, mensaje enviado");
delay(50);
}
}
}
Step 6:
We have to connect the board with the power supply.
The operation of the alarm is simple when the sensor detect movement the “Nodo limón” sends a SMS to the user. When movement finish the board sends other message to indicate the movement stopped.