martes, 20 de septiembre de 2011

New version

Based on the circuit and program published in previous posts I made some improvements with the following results.
At first only use one input and one output, but nothing prevents you from adding more inputs and more outputs.
In general the system allows you to enable or / disable an output by sending an sms.
When an input is activated, it sends a sms at two cellphone with the word "Panic".
You can ask the system a report about the status of inputs and outputs by sending a sms.
The entire system is programmed by sending a sms, when I refer to program, means that to change the system password, I need to send a sms and the same for changing cell phone numbers used by the system to send a sms when an input is activated.
The password and the cell phone numbers are stored in the EEPROM of the pic.

The syntax of the message being sent is: Command # Password.
Command
Action
On
Set output
Off
Reset ouput
Estado
Ask a system  report
Pwd
Change the password
Num1
First cellphone number is stored
Num 2
Second cellphone number is stored


Example 1:The default system password is 1234 to change it to 5555 send the sms:

Pwd5555#1234
The system forwards the following sms: "The new password was accepted"

Example 2: To store the first cellphone number in eeprom send the sms:

Num1+59812345678#1234 (+598 international prefix of my country and 12345678 cell phone number).

The system forwards the following sms: "The new phone number was accepted"

Example 3: To turn on the output send the sms

On#1234

The system forwards the following sms: 
Input - Ouput
1           1
D          A
D= Disable  A= Active

Example 4: To ask a system report send the following sms:

Estado#1234
The received sms is the same of example #3

IMPORTANT!! For each command to be sent, the system resoponds with a sms.
The interesting thing is that the system always answers to the phone that sent the command, in particular, any one who knows the command and password can use the system.
I think this is a good thing because the numbers of users are unlimited.
If someone forgot the password can be reset and return to the default password by following this procedure: turn off the system and connect the input to ground then turn on and wait 10 second the password will change to 1234, don't forget to disconnect the input.

Nueva version

Basándome en el circuito y programa publicados en entradas anteriores hice algunas mejoras obteniendo los siguientes resultados.
En principio solo uso una entrada y una salida, pero nada impide que se puedan agregar más entradas y más salidas.
En general el sistema permite activar u/o desactivar una salida con el envío de un sms.
Cuando se activa la entrada, se envía un sms a 2 celulares con la palabra "Pánico".
Se le puede solicitar al sistema que nos envíe un sms con el estado en el que se encuentra la entrada y la salida,
Todo el sistema se programa a través del envío de sms, cuando me refiero a programar, significa que para cambiar la clave del sistema, debo mandar un sms y lo mismo para cambiar los números de celular al cuál se envía un sms cuando se activa la entrada
La clave mas los números de celular se almacenan en la eeprom del pic.

La sintaxis del mensaje que se le envía es la siguiente: Comando#Clave.



Comando
Acción
On
Activa la salida
Off
Desactiva la salida
Estado
Pide un reporte al sistema del estado de entrada/salida
Pwd
Cambio de clave
Num1
Graba  primer número de celular
Num 2
Graba segundo número de celular


 Ejemplo 1: la clave del sistema por defecto es 1234 para cambiarla a 5555 se debe enviar el sms:

Pwd5555#1234.

El sistema reenvía el siguiente sms: "La nueva clave fue aceptada"

Ejemplo 2: para grabar el primer numero de celular al cuál se le envía el mensaje de pánico se debe enviar el sms:

Num1+59812345678#1234 (+598 es la caracteristica internacional de mi país y 12345678 sería el número de celular), es lo mismo para grabar el segundo número de celular pero enviando el comando Num2.

El sistema reenvía el siguiente sms: "El nuevo numero de celular fue aceptado"

Ejemplo 3: para activar la salida se envía el sms:

On#1234
El sistema reenvía el siguiente sms:

Entrada - Salida
1              1
D              A
D= Desactivada  y A= Activada
Ejemplo 4: para pedir un reporte del estado de entrada/salida se envía el sms:

Estado#1234
El sistema reenvía un sms igual al del ejemplo 3.

IMPORTANTE!!: por cada comando que se le envíe, el sistema contesta con un sms.
Lo interesante de todo es que siempre le contesta al celular que le envió el comando,  en concreto, cualquier usuario que conozca el comando y la clave puede usar el sistema, con esto se logra que no se tenga un número limite de usuarios.

Si se olvidaron de la clave se puede retornar a la clave 1234, la forma de hacerlo es: se apaga el aparato se pone a tierra la entrada se enciende y se esperan 10 segundos, luego se desconecta la entrada de la tierra y queda cambiada la clave.

La foto de abajo es la placa prototipo en ella se puede ver el módulo gsm conectado a la placa, lo dos integrados que se ven son: el pequeño es un Max232 y el otro es un pic 16F886 que funciona con el oscilador interno.
Uno de los led es para indicar el estado de la salida, y el otro lo uso como monitor para saber cuando se recibe un sms o cuando se está enviando uno.