pythonsmsesp32micropythonsim800l

send sms with sim800l and micropyhton


I wrote a program using the ESP32 board, sim800l and micropython to send a message to my phone, but it doesn't work, maybe there is a problem with my code and also the flashing light blinks once every second it means it doesnt connect to network, can anyone help me?

import machine
import time
uart = machine.UART(2, baudrate=9600, tx=17, rx=16)
def send_sms(number, message): 
   uart.write('AT+CMGF=1\r\n')
   time.sleep(1)

   uart.write('AT+CMGS="{}"\r\n'.format(number))
   time.sleep(1)

   uart.write('{}\r\n'.format(message))
   time.sleep(1)

   uart.write('\x1A')
   time.sleep(1)

number = '+1234567890'
message = 'Hello, this is a test message!'
send_sms(number, message)

Solution

  • If the "sim800L" does not connect to the network, it's not about your code. So you should check your power supply voltage level and the Antenna. It's better to don't keep the Antenna above the core chip.