***************************************************************************************************************************************************
ATENÇÃO: ESTE TUTORIAL FOI ATUALIZADO, VOCÊ PODE ACESSÁ-LO CLICANDO AQUI.
***************************************************************************************************************************************************
Neste tutorial, vamos mostrar como utilizar o Cellular Shield com Arduino. Com este shield pode fazer e receber ligações, mandar e receber mensagens e permite receber o mandar dados.
Para usar o Cellular Shield é necessário um chip de celular (SIM Card), pode ser pré ou pós-pago.
Aqui vamos mostrar apenas como utilizá-lo mandando ou recebendo mensagens, pois o método é praticamente o mesmo nas outras operações. Para saber mais informações, clique aqui.
Antes de mais nada. É necessário ver o esquemático da placa:
Podemos ver que podemos escolher, quais entradas podem ser modificadas, de fábrica o Shield vem com as conexões para Software Serial, sendo as portas digitais 2 e 3 do arduino. Pode-se mudar apenas mudando os jumpers soldados na placa como mostrado na figura abaixo:
Ao tirar as soldas e soldar os pads da direita e do meio, você mudará para os pinos digitais 0 e 1, onde se encontra o RX e TX do Arduino. Mas como neste tutorial, vamos utilizar como veio de fábrica, então não é necessário fazer este processo.
O Shield vem apenas com uma antena soldada na placa, caso queira utilizar o alto-falante e o microfone, é necessário soldá-los na placa nos pinos mostrados na figura abaixo:
Os pinos SPK_P e SPK_N são os pinos para o alto-falante. Os pinos MIC_P e MIC_N são os pinos para o microfone. E o GND que é o comum (terra).
Agora, precisamos saber um pouco sobre a lista de comandos para poder fazer as comunicações.
Alguns comandos que vamos utilizar neste tutorial:
Para saber mais sobre outros comandos, clique aqui.
Agora, baixe a programação exemplo encontrada aqui. Mude os paramêtros em vermelho (para a IDE versão 1.0):
/
SparkFun Cellular Shield - Pass-Through Sample Sketch
SparkFun Electronics
Written by Ryan Owens
3/8/10
Description: This sketch is written to interface an Arduino Duemillanove to a Cellular Shield from SparkFun Electronics.
The cellular shield can be purchased here: http://www.sparkfun.com/commerce/product_info.php?products_id=9607
In this sketch serial commands are passed from a terminal program to the SM5100B cellular module; and responses from the cellular
module are posted in the terminal. More information is found in the sketch comments.
An activated SIM card must be inserted into the SIM card holder on the board in order to use the device!
This sketch utilizes the NewSoftSerial library written by Mikal Hart of Arduiniana. The library can be downloaded at this URL:
http://arduiniana.org/libraries/NewSoftSerial/
This code is provided under the Creative Commons Attribution License. More information can be found here:
http://creativecommons.org/licenses/by/3.0/
(Use our code freely! Please just remember to give us credit where it's due. Thanks!)
*/
#include <SoftwareSerial.h> //Include the NewSoftSerial library to send serial commands to the cellular module.
#include <string.h> //Used for string manipulations
char incoming_char=0; //Will hold the incoming character from the Serial Port.
SoftwareSerial cell(2,3); //Create a 'fake' serial port. Pin 2 is the Rx pin, pin 3 is the Tx pin.
void setup()
{
//Initialize serial ports for communication.
Serial.begin(9600);
cell.begin(9600);
//Let's get started!
Serial.println("Starting SM5100B Communication...");
}
void loop() {
//If a character comes in from the cellular module...
if(cell.available() >0)
{
incoming_char=cell.read(); //Get the character from the cellular serial port.
Serial.print(incoming_char); //Print the incoming character to the terminal.
}
//If a character is coming from the terminal to the Arduino...
if(Serial.available() >0)
{
incoming_char=Serial.read(); //Get the character coming from the terminal
cell.print(incoming_char); //Send the character to the cellular module.
}
}
/* SM5100B Quck Reference for AT Command Set
*Unless otherwise noted AT commands are ended by pressing the 'enter' key.
1.) Make sure the proper GSM band has been selected for your country. For the US the band must be set to 7.
To set the band, use this command: AT+SBAND=7
2.) After powering on the Arduino with the shield installed, verify that the module reads and recognizes the SIM card.
With a terimal window open and set to Arduino port and 9600 buad, power on the Arduino. The startup sequence should look something
like this:
Starting SM5100B Communication...
+SIND: 1
+SIND: 10,"SM",1,"FD",1,"LD",1,"MC",1,"RC",1,"ME",1
Communication with the module starts after the first line is displayed. The second line of communication, +SIND: 10, tells us if the module
can see a SIM card. If the SIM card is detected every other field is a 1; if the SIM card is not detected every other field is a 0.
3.) Wait for a network connection before you start sending commands. After the +SIND: 10 response the module will automatically start trying
to connect to a network. Wait until you receive the following repsones:
+SIND: 11
+SIND: 3
+SIND: 4
The +SIND response from the cellular module tells the the modules status. Here's a quick run-down of the response meanings:
0 SIM card removed
1 SIM card inserted
2 Ring melody
3 AT module is partially ready
4 AT module is totally ready
5 ID of released calls
6 Released call whose ID=<idx>
7 The network service is available for an emergency call
8 The network is lost
9 Audio ON
10 Show the status of each phonebook after init phrase
11 Registered to network
After registering on the network you can begin interaction. Here are a few simple and useful commands to get started:
To make a call:
AT command - ATDxxxyyyzzzz
Phone number with the format: (xxx)yyy-zzz
If you make a phone call make sure to reference the devices datasheet to hook up a microphone and speaker to the shield.
To send a txt message:
AT command - AT+CMGF=1
This command sets the text message mode to 'text.'
AT command = AT+CMGS="xxxyyyzzzz"(carriage return)'Text to send'(CTRL+Z)
This command is slightly confusing to describe. The phone number, in the format (xxx)yyy-zzzz goes inside double quotations. Press 'enter' after closing the quotations.
Next enter the text to be send. End the AT command by sending CTRL+Z. This character can't be sent from Arduino's terminal. Use an alternate terminal program like Hyperterminal,
Tera Term, Bray Terminal or X-CTU.
The SM5100B module can do much more than this! Check out the datasheets on the product page to learn more about the module.*/
Conecte o Shield e coloque um cartão SIM no Shield. Agora, abra a IDE do arduino e cole o código. Conecte o Arduino no PC e na IDE do Arduino selecione a versão da placa Arduino (UNO, Duemilanove, etc) e a porta (COMx, ttyUSBx, ttyACMx, etc). Clique em UPLOAD.
Para utilizá-lo é necessário um programa de acesso a Serial, pois o Serial Monitor não detecta certos comandos (CTRL+Z). Aqui vamos utilizar o PUTTY.
Abrindo o PUTTY, selecione Serial, depois a porta em que o Arduino está conectado e a velocidade que é 9600. e por fim clique OPEN. Irá abrir a tela abaixo:
Ao abrir o tela, o Arduino irá conectar e mostrará os paramêtros da tela acima:
Pronto, seu Cellular Shield está pronto para o uso. Agora, para mandar uma mensagem SMS digite os comandos:
Agora para receber mensagem SMS, utilize os seguintes comandos:
E é isso! Esperamos que tenha gostado! Se tiver dúvidas, poste aqui mesmo neste blog! Caso tenha sugestões para tutoriais, clique aqui! Para ver outros tutoriais e projetos desenvolvidos pela equipe LdG e por outros garagistas, clique aqui e aqui, respectivamente! Até a próxima!
Referências:
http://www.labdegaragem.org/loja/index.php/31-shields/cellular-shie...
http://www.sparkfun.com/products/9607
http://www.sparkfun.com/datasheets/DevTools/Arduino/cellular%20shie...
http://www.sparkfun.com/Code/Cellular_Shield_Passthrough.zip
http://www.sparkfun.com/datasheets/CellularShield/SM5100B%20Datashe...
http://www.sparkfun.com/datasheets/CellularShield/SM5100B%20AT%20Co...
http://www.sparkfun.com/datasheets/CellularShield/SM5100B%20SMS%20A...
http://www.sparkfun.com/datasheets/CellularShield/SM5100B%20TCPIP%2...
Comentar
Antenas de modem não servem...
Se você reparar bem o encaixe da antena do arduino é femea logo a antena que voce tem de por é uma macho..
ela tem um ferrinho no meio
http://bimg1.mlstatic.com/antena-433mhz-sma-macho-para-modulo-trans...
oque aconselho voce fazer corte um pedaço de fio de cobre em um tamanho de + - 0.8cm e coloque no buraquinho que tem no meio dela... se não não adianta nada voce colocar a antena. abrss
dsclp o portugues e não explicar bem estou no com 1 poco de pressa qla q coisa manda msg ai.
coloquei sim
daquelas de molden, e é uma antena daqueles que tem maiores.
desculpe pelo spam
só to desesperado
Cara você colocou antena nisso ai ?
e pfvr para de mandar spam você mandou a mesma coisa praticamente 3x!!!
MEU arduino FICA só EM EMERGENCIA
meu shield celular fica só em emergencia
e comprei aqui no lab de garagem...
me ajudem por favor!!
Gente, agora eu preciso configurar o IMEI da minha placa, aonde vai esta informação no programa?
GENTE, FICA DANDO +SIND: 7 QUE É APENAS DISPONIVEL PARA CHAMADA DE EMERGENCIA... COMO FAÇO PARA ELE DAR +SIND: 11?
Como vou executar uma chamada de voz para um numero ja cadastrado no codigo, dentro de uma condicao de um sensor qualquer, esse codigo so explica como enviiar sms.
Tudo certo! Então me conta uma coisa, quanto sai o Kit desse post! o Arduino + Cellular Shield ( O que compõe o Celluar Shield). Aguardo resposta!
Bem-vindo a
Laboratorio de Garagem (arduino, eletrônica, robotica, hacking)
© 2024 Criado por Marcelo Rodrigues. Ativado por
Você precisa ser um membro de Laboratorio de Garagem (arduino, eletrônica, robotica, hacking) para adicionar comentários!
Entrar em Laboratorio de Garagem (arduino, eletrônica, robotica, hacking)