-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't send SMS #4
Comments
Hi @git-oliver Can you share your logs including the full error messages you get. Also confirm that you have followed the setup instructions in the doc, including removing the Pin as the script does not support that and disabling serial console. Also from the link you shared seems like you are using a sim800l module that does not have a voltage regulator , i wouldnt advice using 5v, see here https://lastminuteengineers.com/sim800l-gsm-module-arduino-tutorial/#supplying-power-for-sim800l-module |
So first I changed the voltage to 4V. Thats recommended.
Is this inital state correct ?? If I now run the python code
with python 2.7.16 or 3.7.3 the output is
The ERROR comes from file
Somehow the if-Statement (line 79) failed... |
This is my output after disabling serial console
Make sure after disabling serial console this is the output
It's also important to check following
Can you try to run the script( import serial
import time
NUMBER = "1234567890"
s = serial.Serial("/dev/serial0", 115200)
def get_at_response(sleep = 0.5):
#give modem enough time to reply
time.sleep(sleep)
r = s.read_all()
if not r:
print("[AT] ERR <Response Timeout>")
return None
r = r.decode()
print("[AT RX]: ", r)
return r
def write_at(cmd):
cmd = b"AT" + cmd.encode("UTF-8") + b"\r\n"
print("[AT TX]: ", cmd.decode())
s.write(cmd)
def send_sms(msg):
print("> ", msg)
msg = msg + "\x1A"
s.write(msg.encode())
#echo off
write_at("E0")
get_at_response()
#set error codes to verbose
write_at("+CMEE=2")
get_at_response()
#get the status of SIM presense
write_at("+CPIN?")
get_at_response()
# caller line identification
write_at("+CLIP=1")
get_at_response()
# Set preferred message format to text mode
write_at("+CMGF=1")
get_at_response()
#send sms
write_at("+CMGS=\"%s\""%NUMBER)
if get_at_response(0.1) :
send_sms("Test")
# you may have to increase the sleep here to depending on the signal strength
get_at_response(60) You should get a response like
|
Antenna and 2G GSM support are warranted. After disabling the serial console I get the output:
My
If I run your python script multiple times I get different outputs. Another output is
I believe my module is the problem. I will buy a better module soon... |
i dont know what could be the issue, you could try printing the raw bytes without decoding, comment out this line The reason you get different inputs with the script could be
You can also try to debug your modem with a microcontroller, see https://github.com/vshymanskyy/TinyGSM heres an example with esp32 but the concept is the same https://randomnerdtutorials.com/esp32-sim800l-send-text-messages-sms/ or https://lastminuteengineers.com/sim800l-gsm-module-arduino-tutorial/ |
Same issue here. I can readsms but send always return "Error'. I use sim800l module. And it looks very unstable in response, for example sometimes i can read sms sometimes not. I use 5v input. |
[AT RX]:
It stucks here and timeout. However, sometimes the receiving end can get the sms. |
hi. I have also experienced the same issue, its usually because of bad 2G connection, SIM800l only connects to 2G which is being phased out in a lot of areas. Make sure your subscriber still supports 2G, connect a 2G antenna to the module, check voltage and current requirements, low power is also a common issue for this especially when an antenna is not connected. Also if your module does not have a voltage regulator use the correct voltage to avoid damaging it or undefined behavior (like this one https://lastminuteengineers.com/sim800l-gsm-module-arduino-tutorial/#supplying-power-for-sim800l-module ) |
Thanks for helping me. Tanks for all :) |
Hello,
I try to send an sms with the python code below. I use the "SIM800L GPRS GSM Module" [1] with 5V. I have double checked the connection and have one GND only.
I tried it with python 2.7.16 and 3.7.3
I always get an ERROR on "send_sms"...
What am I'm doing wrong ?? I get the same error, even if I remove the "sim800l.setup()".
[1] https://www.google.com/search?q=SIM800L+GPRS+GSM+Module&client=firefox-b-d&tbm=isch&source=iu&ictx=1&fir=eSmeUzNvPs3r2M%252Cak_jUtfyMKpvRM%252C_&vet=1&usg=AI4_-kSwRDCnyhMak3Mgerc_miL-RAXoTA&sa=X&ved=2ahUKEwipov-9v-TtAhXDKewKHfUhC0sQ9QF6BAgKEAE#imgrc=eSmeUzNvPs3r2M
The text was updated successfully, but these errors were encountered: