Friday, April 10, 2015

Interfacing SIM900A GSM Modem with Raspberry Pi

Interfacing SIM900A GSM Modem with Raspberry Pi
gsm_phone.py

import serial
import time
ser = serial.Serial('/dev/ttyUSB0',9600,timeout=1)
# 9600 is the default Baudrate for SIM900A modem
ser.flush()
ser.write('ATD9020XXXXXX;\r')
# AT command to call a number using GSM Modem
#ser.read(2)
# read 2 bytes of data from the serial port
time.sleep(10)
# wait for 10 seconds
ser.write('ATH\r')
# Hold the call
ser.close()
# close the serial port
connect RXD of USB2Serial to TXD of GSM Modem and TXD of Serial to RXD of GSM Modem. Also check if you can make a call to the modem and see whether a ring sound, so that network connection can be ensured.

You may use AT+CMGS=”phonenumber” for the sms

No comments:

Post a Comment