I want to connect the GSM SIM 900A to a Raspberry Pi 3 but I don't where the problem is.
I used this configuration:
https://qph.fs.quoracdn.net/main-qimg-c124f9e741afd438969e869e52d0df6b
Then I wrote this code in Python 3:
import serial
import RPi.GPIO as GPIO
import os, time
GPIO.setmode(GPIO.BOARD)
# Enable Serial Communication
port = serial.Serial("/dev/ttyAMA0", baudrate=9600, timeout=1)
# Transmitting AT Commands to the Modem
# '\r\n' indicates the Enter key
port.write('AT'+'\r\n')
rcv = port.read(10)
print rcv
time.sleep(1)
port.write('ATE0'+'\r\n') # Disable the Echo
rcv = port.read(10)
print rcv
time.sleep(1)
port.write('AT+CMGF=1'+'\r\n') # Select Message format as Text mode
rcv = port.read(10)
print rcv
time.sleep(1)
port.write('AT+CNMI=2,1,0,0,0'+'\r\n') # New SMS Message Indications
rcv = port.read(10)
print rcv
time.sleep(1)
# Sending a message to a particular Number
port.write('AT+CMGS="XXXXXXXXXX"'+'\r\n')
rcv = port.read(10)
print rcv
time.sleep(1)
port.write('Hello User'+'\r\n') # Message
rcv = port.read(10)
print rcv
port.write("\x1A") # Enable to send SMS
for i in range(10):
rcv = port.read(10)
print rcv
but it seems like there is no connection between the raspberry pi and the model gsm and also when i put this code in python 3 it shows me a lot of erros
9600
is correct? I use a SIM900 module too and i communicate with the baudrate of115200
and everything works fine – bierschi Apr 12 '18 at 11:05