Nokia F-bus and receive SMS message issue

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 ?

Anybody can help ?

Are you trying to send the message to yourself ? Or from a phone ?

Your loop function will run very often. I don't understand why you are trying to send a long outgoing message so often.

I have never heard of this serial.find( ) function . What exactly is it looking for ? A sequence of FIVE bytes with the hexadecimal values 0xD3 0x34 0x3B 0x3C 0x07 is a very different thing to an array with 15 chars in it 'D' '3' ' ' '3' '4' etc.

michinyon:
Are you trying to send the message to yourself ? Or from a phone ?

Your loop function will run very often. I don't understand why you are trying to send a long outgoing message so often.

I have never heard of this serial.find( ) function . What exactly is it looking for ? A sequence of FIVE bytes with the hexadecimal values 0xD3 0x34 0x3B 0x3C 0x07 is a very different thing to an array with 15 chars in it 'D' '3' ' ' '3' '4' etc.

Hi michinyon

At the very beginning I would like to thank you for trying to help me. Below you can see answered for you questions:

  1. I am trying to receive massage on arduino that was sent to the phone connected direct to Arduino by serial port.
  2. This loop is just for testing purpose, I want to learn how to read data that sending phone connected to Arduino serial.
  3. serial.find( ) function is here Serial.find() - Arduino Reference it should be able to find specific string of data sent on Arduino serial port. In my case those data are sending by phone.
  4. In this case function serial.find() looking for string "D3 34 3B 3C 7" which is coded by FBUS protocol and after decode give us word Silas.

If my explanation is not good enough please let me know then I wiil try to explain it in more details.

I think I know why this is not working; I assume that NOKIA via serial send to Arduino data in HEX which is wrong, so this is the reason it is not working. Can you tell me in what format data are sending via serial, is it ASCI ? I have to know that, if I know it then I will know what exactly should I put into serial.find() function. Is there any way to print on serial data in RAW version to see what exactly is sene by NOKIA to Arduino?

OK my HEX string should be translated to ASCII but what format should I use in function:

serial.find(“0×44, 0×33, 0×20, 0×33, 0×34, 0×20, 0×33, 0×42,
0×20, 0×33, 0×43, 0×20, 0×37,”)

or without “,”

serial.find(“0×44 0×33 0×20 0×33 0×34 0×20 0×33 0×42
0×20 0×33 0×43 0×20 0×37?)

or ….

You can delete this topic, I found solution. Also I am very unhappy because of your support.