Go Down

Topic: Arduino DUE and SIM800l EVB (Read 945 times) previous topic - next topic

kldnz

Hello,

Okay so, I have an arduino due board, that I'm using for my project,

And bought a SIM800lEVB GSM module to connect to it. The issue I'm having is I do not know, if I'm making the wiring bad or something. It has 5Vin pin, GND, then Vdd pin, Tx, RX, gnd again, and RST

As I found on the internet the connection should be like connect the 5Vin pin to 5V on arduino, ten gnd to gnd and then tx and rx I connected them to TX0 and RX0 but it seems that these are used as programing ports. So I wonder if that is what I'm doing wrong.

The power light lighs up, and another one blinks on the GSM module so everything seems fine with that. The sim card in the GSM module is active.

And here is the code I'm using:
/*
Code to run on the Smoke detection, SMS sending
*/


int smokeA0 = AD0;
int smokeA1 = AD1;
int smokeA2 = AD2;
int smokeA3 = AD3;
int smoke_limit = 250;
void setup() {
  Serial.begin(9600);   // Setting the baud rate of GSM Module 
  pinMode(smokeA0, INPUT);
  pinMode(smokeA1, INPUT);
  pinMode(smokeA2, INPUT);
  pinMode(smokeA3, INPUT);
  Serial.println("AT+CSCLK=1"); // set GSM module to sleep
}

void loop() {
  int analogSensor1 = analogRead(smokeA0);
  int analogSensor2 = analogRead(smokeA1);
  int analogSensor3 = analogRead(smokeA2);
  int analogSensor4 = analogRead(smokeA3);
  if(analogSensor1 || analogSensor2 || analogSensor3 || analogSensor4 > smoke_limit){ // if any of sensors are above the smoke_limit - execute these commands
    Serial.println("AT+CSCLK=0");  // wake the GSM module
    sendMessageThroughModule();
    Serial.println("AT+CSCLK=1");  // put it back to sleep
  }
  delay(100);
}
void sendMessageThroughModule(){
  Serial.println("AT+CMGF=1");    //Sets the GSM Module in Text Mode
  delay(1000);  // Delay of 1000 milli seconds or 1 second
  Serial.println("AT+CMGS=\"73XXXXXXXXX\"\r"); // Replace with mobile number
  delay(1000);
  Serial.println("SMOKE DANGER");// The SMS text you want to send
  delay(1000);
  Serial.println((char)26);// ASCII code of CTRL+Z
  delay(1000);
}

I commented everything that goes with the smoke detector and left only the GSM functionality to send the sms. But never did receive a sms to the mobile number that I have typed in.

Any help appreciated.

ard_newbie


I guess you could use Serial1 (RX1, TX1) instead of Serial by connecting rx to TX1 and tx to RX1( See Greynomad DUE pinout diagram).

Try this code (not tested though):
Code: [Select]

// Connect tx to RX1, rx to TX1
 
#define Serial Serial1

uint8_t smokeA0 = A0;
uint8_t smokeA1 = A1;
uint8_t smokeA2 = A2;
uint8_t smokeA3 = A3;
uint16_t smoke_limit = 250;
void setup() {
  Serial.begin(9600);   // Setting the baud rate of GSM Module 
  //pinMode(smokeA0, INPUT);
  //pinMode(smokeA1, INPUT);
  //pinMode(smokeA2, INPUT);
  //pinMode(smokeA3, INPUT);
  Serial.println("AT+CSCLK=1"); // set GSM module to sleep
}

void loop() {
  uint16_t analogSensor1 = analogRead(smokeA0);
  uint16_t analogSensor2 = analogRead(smokeA1);
  uint16_t analogSensor3 = analogRead(smokeA2);
  uint16_t analogSensor4 = analogRead(smokeA3);
 
  if((analogSensor1 || analogSensor2 || analogSensor3 || analogSensor4) > smoke_limit){ // if any of sensors are above the smoke_limit - execute these commands
    Serial.println("AT+CSCLK=0");  // wake the GSM module
    sendMessageThroughModule();
    Serial.println("AT+CSCLK=1");  // put it back to sleep
  }
  delay(100);
}
void sendMessageThroughModule(){
  Serial.println("AT+CMGF=1");    //Sets the GSM Module in Text Mode
  delay(1000);  // Delay of 1000 milli seconds or 1 second
  Serial.println("AT+CMGS=\"73XXXXXXXXX\"\r"); // Replace with mobile number
  delay(1000);
  Serial.println("SMOKE DANGER");// The SMS text you want to send
  delay(1000);
  Serial.println((char)26);// ASCII code of CTRL+Z
  delay(1000);
}





kldnz

Will test it out after work,

Another questions am I doing the wiring wrong?

As I found on the internet

I have connected the wiring like
GSM MODULE                           ARDUINO DUE

5Vin                   >>>>>>>>          5V pin on arduino
GND >>>>>>>>>>>>>>>>>>> GND
VDD>>>>>>>>>>>>>>>>>>> Did not connect
TX >>>>>>>>>>>>>>>>>>>> From the code you sent I will connect it to RX1
RX >>>>>>>>>>>>>>>>>>>>> From the code you sent I will connect to TX1
GND >>>>>>>>>>>>>>>>>>>> GND
RST >>>>>>>>>>>>>>>>>>>> Did not connect

Is the wiring correct? Or should I change something up?

ard_newbie

#3
Dec 15, 2017, 10:52 am Last Edit: Dec 15, 2017, 11:36 am by ard_newbie

If your module outputs 5V from tx, you will need a logic level shifter since the DUE is 3.3V compliant only.

Edit: Use a separate power supply to power SIM800Levb, it draws too much current.

kldnz

Well the way I have connected it, The power led on the GSM module was blinking...

http://www.ayomaonline.com/wp-content/uploads/2015/11/57.jpg

It has these kind of pins, the module is exact as the picture shows....

And from the tutorials I have read the VDD does not need to be connected.

The power led lights up when connected. and other one blinks....
The thing is I have a circuit built... and making a shift down or shift up converted would mean I would have to redo it all... or connect it external....

Have anyone ever used this kind of GSM module? As this is my first time using arduino in general I'm not quite sure how to make it work... Is it possible to supply the power through due module without any external assistance?

kldnz

After doing some digging around the internet I found out that on SIM800L EVB there is a some kind of convertor, so the pins needed are only 5V, 2GND, TX and RX. And it should work if the power leds blink. and they do blink.

So I think it should be fine with the code correction. Going to test it out in 6hours or so and will let you guys know here if the issue still persists. So this could be used in future if it works. :)

kldnz

#6
Dec 15, 2017, 10:51 pm Last Edit: Dec 15, 2017, 11:54 pm by kldnz
Hmmm it seems that you were correct and it indeed drains to much current since it powers off.... And I do not receive any message.. what kind of battery should I use? How much current? 5V 2A?

Okay so I'm using a 5V gsm module if I would connect it through a https://www.sparkfun.com/products/12009
to the 3.3 pin it should work?

Also I'm using MQ-2 gas sensors they seem to operate on 5V to so connecting through the shifter should work too? Waiting for a reply...

kldnz

Ordered the converter... any tips how it should be connected so the GSM module would work? Please help me... I need this by Thursday :D

Go Up