0

I am working on a project that uses SMS to push data to a blockchain.

I bought a GSM 900A Module and connected it to Raspberry Pi 3b+. The connections are as shown in this picture : https://i.stack.imgur.com/tX8lX.png

I am using a 5V 1A adapter to power the GSM Module. I copied this code off of this tutorial for the GSM Module and executed it on the Pi :

Python version : 2.7

from serial import Serial

import os, time   # Enable Serial Communication

port = Serial("/dev/ttyS0", 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 

This error gets thrown when I execute the code :

Traceback (most recent call last):

File "code.py", line 5, in <module>

port = Serial("/dev/ttyS0", baudrate=9600, timeout=1)

File "/home/pi/.local/lib/python2.7/site-packages/serial/serialutil.py", line 240, in __init__

self.open()

File "/home/pi/.local/lib/python2.7/site-packages/serial/serialposix.py", line 268, in open

raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))

serial.serialutil.SerialException: [Errno 2] could not open port /dev/ttyS0: [Errno 2] No such file or directory: '/dev/ttyS0'

Please ask for any further information that is required.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.