Need help of my project


#1

Hi, I’m working on my final project which a passenger monitoring system. The system does the following: 1. Count the total number of passengers in a vehicle(data)
2. Count the number of available and occupied (data)
3. Send the needed data using GSM module.
ex. if send msg “status” i’ll receive the second data
if send “total” I’ll receive the first data.

I’m using arduino uno atmega 328p, Infrared sensor for each seat in a vehilce, and a gsm module.

I need a help in coding my prototype using only 2 sensors and gsm module


#2

you can use IR sensor to count the Passengers , and for GSM module it use AT command.

i can help you in GSM to send a SMS its easy,

and i don’t understand the msg status and total the GSM will send it or if you send status the GSM will send the number of passenger ??


#3

when i send message :“status” the gsm module will send a message indicating the nuber of vacant and occupied space.


#4

sorry for delay,
you want to send a " status" to GSM and GSM send indicating the nuber.
ok, you want to send for same number you send the SMS or for default number you bout it ??

for GSM you need to use AT command:
first you need to send “AT”
“AT”
this for make gsm ready to take the command.
then send “AT+ CMGF=1”
to enable SMS.
and to send SMS :
“AT+CMGS=“thenumber””
“the message”
and 0x1a to end the message.

/////////////////////////////////////
to take a SMS message:
“AT+CNMI=2,2,0,0,0”


#5

this a small code to try the command:

#include <SoftwareSerial.h>

SoftwareSerial GSMS(7,8);// 8 RX ,9TX
unsigned char A[64];
int count=0;
void setup() {
Serial.begin(9600);
GSMS.begin(9600);
GSMS.write(0xaa);
GSMS.write(0x11);
}

void loop() {
while(GSMS.available())
{
A[count++]=GSMS.read();
if(count == 64) break;
}
Serial.write(A,count);
clearBufferArray();
count=0;

if(Serial.available()){
byte b=Serial.read();
if(b == ‘*’)
GSMS.write(0x1a);
else
GSMS.write(b);
}
}

void clearBufferArray(){
for(int i=0; i<count; i++){
A[i]=NULL;
}
}