connecting GSM with Arduino

Discussion in 'Embedded Systems and Microcontrollers' started by bobparihar, Dec 23, 2014.

  1. bobparihar

    Thread Starter Member

    Jul 31, 2014
    93
    0
    i have tried interfacing of gsm 900 module with Arduino uno
    after reading some tutorial on the internet i found that sending "AT" as an AT command will give OK as a Result by the GSM Module

    so i tried to send AT serially But I did not received any OK

    heres my code

    Code (Text):
    1.  
    2. #include <LiquidCrystal.h>
    3. LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
    4.  
    5. int led = 8;
    6. // incoming serial byte
    7. int inByte;
    8. void setup()
    9. {
    10. lcd.begin(16, 2);
    11. // initialize the led pin as an output.
    12. pinMode(led, OUTPUT);
    13. // start serial port at 9600 bps
    14. Serial.begin(9600);
    15. // wait for a while till the serial port is ready
    16. delay(100);
    17. // send the initial data once //
    18. Serial.print(" AT");
    19. }
    20.  
    21.  
    22.  
    23. }
    24. void loop()
    25. {
    26. // if we get a valid byte, read analog ins:
    27. if(Serial.available())
    28. {
    29. // get incoming byte:
    30.  
    31.  
    32. inByte= Serial.read();
    33. Serial.write(inByte);
    34. lcd.print(inByte);
    35. // send the same character back to serial port
    36.  
    37. // blink the LED once //
    38. digitalWrite(led, LOW);
    39. delay(100);
    40. }
    41. else
    42. digitalWrite(led, HIGH);
    43. while(1);
    44. }
    45.  
    i did noticed that something is received as LED on pin 8 glows once
    but why the recieved character cant be seened on lcd or either on the serial monitor screen????

    Moderators note: please use code tags for pieces of code
     
    Last edited by a moderator: Dec 23, 2014
  2. sirch2

    Well-Known Member

    Jan 21, 2013
    1,008
    351
    Is it valid to write an int to the LCD? What if the int represents the ascii code of a non-printable character?

    How is you serial monitor set up? You seem to be using Serial to communicate with the GSM module, so it may be best to use another port for the serial monitor, or if you want serial over USB use other pins for the GSM and bit-bang the AT commands.
     
  3. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,377
    494
    Yep. You need to send char to the lcd.
     
Loading...