Discussion in "Embedded GSM Development" started by    muahaha_psp    Apr 6, 2010.
Tue Apr 06 2010, 07:18 AM
#1
hi, can i ask a question...i have a circuit that consist from a sim300 gsm module that connected to pic16f877a by using max232. my circuit design is to detect if an sensor is triggered (ir), then the microcontroller will send sms to the user. i have acomplished this feature and my other problem is i cannot send sms to the microcontroller to switch on a relay to trigger a 5v relay that connected to my output (light). can u help me?
Tue Apr 06 2010, 08:09 AM
#2
post your program here for more help.

what are AT Commands you are using for this job...

[Topic moved to Embedded GSM Development Forum]
Tue Apr 06 2010, 08:20 AM
#3
this is my program.

#include <16f877A.h> //ic driver
#use delay(clock=20000000) //clock speed
#fuses hs,noprotect,nowdt,nolvp //ic setting
#use rs232 (baud=115200,xmit=PIN_C6,rcv=PIN_C7,PARITY=N,stream=GSM) //Serial Com Port for GSM

#byte PORTA=5 //define port address
#byte PORTB=6
#byte PORTC=7

#define led1 PIN_A0 //define pin
#define led2 PIN_A1
#define InfraRed PIN_B0
#define buzzer PIN_C0
#define light PIN_C1


//sensor
long timer=0;
int alarm=0;



//GSM register
int GSM_getsms=0;

//Serial register
char rx_buff;
char rx[80];
int rx_set=0;
int rx_cnt=0;

#int_rda //Serial interrupt to collect gsm data
void serial_isr (){

rx_buff=getc(); //collect sms command
if(rx_buff==0x0A){ //start byte
rx_cnt=0; //reset counter
}
rx[rx_cnt]=rx_buff; //move received data to array
rx_cnt++; //counter +1

if(rx[0]==0x0A && rx_buff==0x0D){ //end byte receive
rx[0]=0;
rx_set=1; //valid set data received
}
}

void main () //main program
{

set_tris_a(0x00); //define io pin; 1:input;0:output
set_tris_b(0xFF); //A0-A3:output,B0-B5:input,c0-c2:output
set_tris_c(0x00);

port_b_pullups(true); //enable pull up at port b

setup_port_a(NO_ANALOGS); //no analog signal

PORTA=0; //off all leads
PORTB=1;
PORTC=0; //off all portc output

enable_interrupts(GLOBAL);

fprintf(GSM,"AT+CMGD=1\r"); //Delete message, \r: return key
delay_ms(1000);

do
{
{
if(input(InfraRed)==0){
delay_ms(1000);
fprintf(GSM,"AT+CMGS=\"+60137546293\"");
fputc(0x0D,GSM); // command for enter
delay_ms(1000);
fprintf(GSM,"Infrared Sensor Activated : House Door Opened! ");
fputc(0x1A,GSM); // command for ctrl+Z
delay_ms(1000);
fputc(0x0D,GSM); // command for enter
delay_ms(1000);
output_low(InfraRed); // Switch off InfraRed PORT
fprintf(GSM,"AT+CMGD=1");
delay_ms(1000);
fputc(0x0D,GSM);
delay_ms(1000);
}

if(input(InfraRed)==0){
alarm=1;
}
if(input(InfraRed)==1){
alarm=0;
}
if(input(InfraRed)==0){
output_high(led1);
}
if(input(InfraRed)==1){
output_low(led1);
}
if(alarm==1){
output_high(buzzer);
}
if(alarm==0){
output_low(buzzer);
}


if(rx_set==1){
rx_set=0; //reset

if(rx[3]=='T' && rx[4]=='I'){ //SMS received +CMTI: "SM",1
printf("AT+CMGR=1\r"); //Get SMS
}
if(GSM_getsms==1){ //Get Message
GSM_getsms=0;


if(rx[1]=='1'){ // Light

if(rx[2]=='0'){
output_low(light);
output_low(led2);
}
if(rx[2]=='1'){
output_high(light);
output_high(led2);
}
}
}

delay_ms(2000); //wait for GSM process
printf("AT+CMGD=1\r"); //Free memory
delay_ms(1000);
}

if(rx[3]=='G' && rx[4]=='R'){ //Prepare get SMS +CMGR:
GSM_getsms=1;
}

rx[4]=0; //Free memory
rx[5]=0;
}

timer++;
}while(TRUE);
}



i use ccs programming for this.....the idea is to send sms to trigger certain relay like example to on light bulb,...can anybody help me? about the sms that microcontroller send to user handphone to inform about the sensor triggerd i've already accomplished..only this one keep delaying my work..ur opinion is greatly needed...

Get Social

Information

Powered by e107 Forum System

Conversation

Tue May 03 2016, 11:52 AM
Cecylka
Ogromne dzięki za ten artykuł. Treść stoi na nader wysokim poziomie i wiem, co mówię, albowiem sam interesuję się podobnymi zagadnieniami. W związku z tym jeśli ktoś chce się dowiedzieć więcej na temat opisanego przedmiotu to zachęcam do odwiedzin - kredyt123.pl - kredyt hipoteczny
Mon May 02 2016, 06:33 PM
Mirela
Wielkie dzięki za powyższy post. Treść stoi na niesłychanie wysokim poziomie i wiem, co mówię, gdyż sam interesuję się podobnymi zagadnieniami. Wobec tego jeżeli ktoś chce się dowiedzieć więcej w temacie opisanego przedmiotu to zachęcam do wejścia - kredyt123.pl - oddłużanie - Klaudyna -
ExperimenterUK
Thu Apr 28 2016, 01:15 AM
We don't provide project reports. We try to help you do your project
Wed Apr 27 2016, 06:02 PM
abebe tigabu
help me by sending final thesis project automatoc green house effect control by arduino or by at89c51 microcontroller
Mon Apr 25 2016, 03:40 AM
abhinav kumar
Hey there, i want to project report on the RFID BASED SECURITY SYSTEM using AVR microcontroler.please mail as soon as possible. Thank you
Mon Apr 18 2016, 01:07 PM
umesh parekh
i want c code for rfid based car parking system using 8051 and parking slot indicator.if u have please email me
Mon Apr 18 2016, 10:35 AM
Prakash Rao
i need to work on OCR for Numbers, could not find any such projects done using 8051
Wed Apr 13 2016, 07:27 PM
Sanket GUPTA
hey i am new to embedded system and i want to pursue ms in embedded, i have 2 years before i can apply for ms.. in two years can i gain sufficient knowledge. i know c and c++
ExperimenterUK
Wed Apr 13 2016, 05:15 PM
@Suraj.. the method will work ,but edit to suit your compiler
Wed Apr 13 2016, 01:05 AM
Suraj Sridhar
Can I use the LCD Device driver code for STM32F401RET6?

Downloads

Comments

pd
Sun May 01 2016, 01:35 AM
uk2308
Fri Apr 29 2016, 12:27 PM
legomaniak
Thu Apr 28 2016, 03:26 PM
APEGEEKZ
Mon Apr 25 2016, 01:54 PM
aishwar
Sun Apr 24 2016, 10:58 AM
nitring
Sun Apr 24 2016, 09:38 AM
Yuri_Golden
Fri Apr 22 2016, 05:15 PM
asif1990
Fri Apr 22 2016, 12:31 AM

Online

Guests: 43, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 37759
Newest member: pd
Forum Activity
Karan123 Avatar
Posted By Karan123
Sat Apr 30 2016, 08:10 AM
Hi,C2000 has quite big series from TI.Which C2000 ...
uk2308 Avatar
Posted By uk2308
Fri Apr 29 2016, 12:33 PM
i need to know the harware connection of c2000 wit...
legomaniak Avatar
Posted By legomaniak
Thu Apr 28 2016, 03:29 PM
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Apr 28 2016, 01:12 AM
Did you read / understand my last post to your oth...
APEGEEKZ Avatar
Posted By APEGEEKZ
Mon Apr 25 2016, 02:54 PM
im sending mail using sim900 to gmail but its thro...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sun Apr 24 2016, 06:51 PM
This file was hosted by Rapidshare.comRapidshare.c...
aishwar Avatar
Posted By aishwar
Sun Apr 24 2016, 11:02 AM
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Apr 22 2016, 07:29 PM
You will have to post your code and Proteus projec...
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Apr 22 2016, 07:19 PM
If the temperature is below the set point, "if (te...
Yuri_Golden Avatar
Posted By Yuri_Golden
Fri Apr 22 2016, 05:33 PM
Hey Guys, I searched in the forum about a similar ...