Escolar Documentos
Profissional Documentos
Cultura Documentos
BOARD SIM908
Use
This is the documentation for SIM908 V1 Board.
When the module power up, it will display "...." in default, this is a correct message.
GPS
If you use a power-required GPS antenna (we also sell this one), considering short-connect the pin 75 and 76 to power
up the GPS antenna.
To power up GPS, first command is "AT+CGPSPWR=1" to power up, then use "AT+CGPSRST=1" to reset it, preferably
use "AT+CGPSIPR=9600" to set GPS baud rate to 9600 permanently, then you don't have re-setup your serial software
again but simply turn the board switch to GPS channel. Extra command "AT+CGPSINF=32" can receive the geophagy
information, or use NEMA GPS tool to read data will be better.
GPS locating time vary from 2-10 minutes sometimes, but it is strongly depends on the environment, make sure the sky
is on the top of your GPS antenna, use NEMA tool to see the satellites show up slowly.
GSM
To make a call, use command "ATD13725585994;", don't forget the ";", use "ATH" to hang off.
Pin RI can indicate the incoming call with a TTL signal, this can also connect to a MCU port
Board provide VCHG battery charge pin, as well as a temperature check pin for battery, when a lithium battery attach
between pin VCHG and GND, it will be charged by a provided 4.2 volt.
Pin Definitions
Updates
Version 1.1: * Change main power LDO, may have better performance * Add extra power pins and Uart pins * Fit into a case
design. Version 1.2: Add extra logic level UART pins for Arduino or Raspberry Pi such 5V or 3v3 devices
Settings:
Switch ARD/RPI should be set to ARD for Arduino or RPI for Raspberry PI
Wiring: 5V to VCC of SIM908, GND to GND of SIM908, pin 3 to RX of SIM908, pin 2 to TX of SIM908
Serial connect resistors 1-2K or use a level shifter to protect sim908 pins if you are using for long term
The available code is for function: making call, text message, hang off the call and using GPS
Be aware to change the phone number and the content of text message, feel free to further modify the code.
#include <SoftwareSerial.h>
#include <String.h>
SoftwareSerial mySerial(2, 3);
void setup()
{
mySerial.begin(9600);
Serial.begin(9600);
delay(500);
Serial.println("Here is the menu for pre-wrote function:");
Serial.println("T for texting a message");
Serial.println("D for making a calle");
Serial.println("H for hanging the call");
Serial.println("O for turn on GPS");
Serial.println("G for check GPS status");
Serial.println("^^feel free to modify the code");
}
void loop()
{
//after start up the program, you can using terminal to connect the serial of gprs
shield,
//if you input 't' in the terminal, the program will execute SendTextMessage(), it will
show how to send a sms message,
//if input 'd' in the terminal, it will execute DialVoiceCall(), etc.
if (Serial.available())
switch (Serial.read())
{
case 'T':
SendTextMessage();
break;
case 'D':
DialVoiceCall();
break;
case 'H':
HangVoiceCall();
break;
case 'O':
GPSON();
break;
case 'G':
GPS();
break;
}
if (mySerial.available())
Serial.write(mySerial.read());
}
///SendTextMessage()
///this function is to send a sms message
void SendTextMessage()
{
mySerial.print("AT+CMGF=1\r");
delay(300);
mySerial.println("AT+CMGS=\"13725585994\"");//send sms message, be careful need to add a
country code before the cellphone number
delay(300);
mySerial.println("How are you2");//the content of the message
delay(300);
mySerial.println((char)26);//the ASCII code of the ctrl+z is 26
delay(300);
mySerial.println();
}
///DialVoiceCall
///this function is to dial a voice call
void DialVoiceCall()
{
mySerial.println("ATD13725585994;");//dial the number
delay(100);
mySerial.println();
}
void HangVoiceCall()
{
mySerial.println("ATH\r");//dial the number
delay(100);
mySerial.println();
}
void ShowSerialData()
{
while (mySerial.available() != 0)
Serial.write(mySerial.read());
}
void GPSON()
{
mySerial.println("AT+CGPSPWR=1\r");//dial the number
delay(1000);
mySerial.println();
mySerial.println("AT+CGPSRST=1\r");//dial the number
delay(1000);
mySerial.println();
}
void GPS()
{
mySerial.println("AT+CGPSINF=0\r");//dial the number
delay(1000);
mySerial.println();
mySerial.println("AT+CGPSSTATUS?");//dial the number
delay(100);
ShowSerialData();
delay(1000);
}