ArduinoGeneral

How to connect GPS/GPRS/GSM module3.0 with Leonardo

userHead Account cancelled 2014-07-07 02:58:42 2772 Views2 Replies
Dears,

Recently when I try to connect GPS/GPRS/GSM module 3.0 to a Leonardo. it does not work.

I do the following thing and rest the shield. the STAT light on. However when I try to send AT commend, it give me a a 'win error 1167', which meas 'The device is not connected'

I don't have a UNO at hand. Coud anybody help me.

Thanks


1. Turn the S1 switch to the Prog(right side) // #
2. Turn the S2 switch to the USB side(left side) // #
3. Set the UART select switch to middle one. // #
4. Upload the sketch to the Arduino board(Make sure turn off other Serial monitor ) , see following code
5. Turn the S1 switch to the comm(left side) // #
6. RST the board

void setup() {
//Init the driver pins for GSM function
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
//Output GSM Timing
digitalWrite(5,HIGH);
delay(1500);
digitalWrite(5,LOW); }

void loop() {
// Use these commands instead of the hardware switch 'UART select' in order to enable each mode
// If you want to use both GMS and GPS. enable the required one in your code and disable the other one for each access.

digitalWrite(3,LOW);//enable GSM TX?RX
digitalWrite(4,HIGH);//disable GPS TX?RX }
2014-07-07 22:42:28 Howdy!

This might also give you some ideas:
https://github.com/DFRobot/GPS-GPRS-GSM-Shield-V3.0/blob/master/gps_gsm_sim908/examples/gps_serial/gps_serial.ino

Note that is part of a library and you might need to download the other files as well

cheers~
userHeadPic Jose
2014-07-07 19:35:53 Hello,

It is not easy to adjust GSM module via AT command with Leonardo.
As Leonardo is using Serial1 port, not Serial port, so serial monitor can't communicate with module directly. and chip reset will be also a problem.
But you can try this code:
[code]void setup()  {   
  //Init the driver pins for GSM function   
  Serial.begin(9600);
  Serial1.begin(9600);
  pinMode(3,OUTPUT);   
  pinMode(4,OUTPUT);   
  pinMode(5,OUTPUT);   
  //Output GSM Timing     
  digitalWrite(5,HIGH);   
  delay(1500);   
  digitalWrite(5,LOW); 
  delay(5000);


void loop()     
{       
  digitalWrite(3,LOW);//enable GSM TX?RX   
  digitalWrite(4,HIGH);//disable GPS TX?RX 

  if (Serial.available()) //send AT command to Serial1 port
  {
    char a =Serial.read();
    Serial1.print(a);
  }
  if (Serial1.available()) // receive return data
  {
    char b =Serial1.read();
    Serial.print(b);
  }
} [/code]

userHeadPic Grey.CC