Hi All,
I am doing simple alarm base on Arduino and NOKIA. Arduino should send me SMS text when sensor detect motion. Also Arduino should be able to reboot if I send sms text to NOKIA connected direct to Arduino. First part, I mean sending SMS working without any issue, I make it base on this topic How to use Nokia F-bus to send an SMS message « insideGadgets
I have problem with receive SMS theoretically the simplest part :). I am able to get SMS by using simple code
byte msg[] = {
0x1E, 0x00, 0x0C, 0xD1, 0x00, 0x07, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x60, 0x00, 0x72, 0xD5 };
void setup() {
Serial.begin(115200);
delay(100);}
void loop() {
for (int x = 0; x < 128; x++) {
Serial.write("U"); }
for (int x = 0; x < (sizeof(msg) / sizeof(byte)); x++) {
Serial.write(msg[x]); }
while (1) {
while (Serial.available() > 0) {
int incomingByte = Serial.read();
Serial.print(incomingByte, HEX);
Serial.print(" "); } }}
Thx to it I can see that I received SMS frame with massage “Silas”, I can see it on serial and I know that “Silas” is "D3 34 3B 3C 7" and I can see it three times in received frame.
1E C 0 2 0 31 1 8 0 10 2 4 0 7 91 84 6 1 0 3 F0 0 10 17 48 4 0 0 5 B 91 84 87 82 89 9 F9 0 0 0 0 41 70 1 71 11 13 80 D3 34 3B 3C 7 1 46 0 FA 6D 1E C 0 2 0 31 1 8 0 10 2 4 0 7 91 84 6 1 0 3 F0 0 10 17 48 4 0 0 5 B 91 84 87 82 89 9 F9 0 0 0 0 41 70 1 71 11 13 80 D3 34 3B 3C 7 1 46 0 FA 6D 1E C 0 2 0 31 1 8 0 10 2 4 0 7 91 84 6 1 0 3 F0 0 10 17 48 4 0 0 5 B 91 84 87 82 89 9 F9 0 0 0 0 41 70 1 71 11 13 80 D3 34 3B 3C 7 1 46 0 FA 6D 1E C 0 D 0 B 1 8 0 52 2 3 2 8 1 1 47 0 59 5A 1E C 0 D 0 B 1 8 0 52 2 3 2 8 1 1 47 0 59 5A 1E C 0 D 0 B 1 8 0 52 2 3 2 8 1 1 47 0 59 5A 1E C 0 D 0 B 1 8 0 52 2 3 2 8 1 1 40 0 5E 5A 1E C 0 D 0 B 1 8 0 52 2 3 2 8 1 1 40 0 5E 5A 1E C 0 D 0 B 1 8 0 52 2 3 2 8 1 1 40 0 5E 5A 1E C 0 A 0 15 1 8 0 71 1 0 1 B 1 2 2E 7D DF DE 62 F0 30 0 0 1 41 0 FC 31 1E C 0 A 0 15 1 8 0 71 1 0 1 B 1 2 2E 7D DF DE 62 F0 30 0 0 1 41 0 FC 31 1E C 0 A 0 15 1 8 0 71 1 0 1 B 1 2 2E 7D DF DE 62 F0 30 0 0 1 41 0 FC 31
What I want to do is to enable green LED when receive SMS “Silas” or red LED if massage don
t meet my needs, so I wrote another program
byte msg[] = {
0x1E, 0x00, 0x0C, 0xD1, 0x00, 0x07, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x60, 0x00, 0x72, 0xD5 };
#define red 11
#define green 10
void setup() {
Serial.begin(115200);
delay(100);
pinMode(red, OUTPUT);
pinMode(green, OUTPUT);
digitalWrite(red, LOW);
digitalWrite(green, LOW);
}
void loop() {
for (int x = 0; x < 128; x++) {
Serial.write("U");
}
for (int x = 0; x < (sizeof(msg) / sizeof(byte)); x++) {
Serial.write(msg[x]);
}
while (1) {
while (Serial.available() > 0) {
if(Serial.find("D3 34 3B 3C 7")){
digitalWrite(green, HIGH); delay (1000);}
else
digitalWrite(red, LOW); delay (1000);
}
} }
Problem is that when I am sending SMS “Silas” nothing happened, strange is that when I copy above frame and paste it to Arduino via putty by open serial port then green light is ON, which means it should work also when phone send the same frame, but it is not working and now I am stuck, any idea what I am doing wrong ? Why when I am sending the frame program is working and when NOKIA send it program is not working ?