I have some code that I was doing some stability testing with that started getting “+CME ERROR: 707” when attempting an outbound https request over cellular. This code ran for about a week without any issues, then I started getting the CME ERROR 707 a few days ago.
Rebooting the Pico worked to restore the connection initially (for about 48 hours), but now all I get is CME ERROR 707.
I reset the Pico using the UF2 reset procedure, reloaded the pico_lte code library (from Github) and went back to the example “post.py” code - I still get CME ERROR 707.
Anyone else experienced this before?
Update: This is the code which is having issues, in case it’s important:
url="<webhook url>"
device_name = "<device name in Home Assistant>"
import os
import time
import math
from machine import ADC
from pico_lte.core import PicoLTE
from pico_lte.common import debug
from pico_lte.utils.status import Status
def get_volt():
R1 = 10040
R2 = 2208
pot = ADC(27)
pot_val = pot.read_u16()
vout = ((pot_val/65535) * 3.3)/ (R2/(R1+R2));
return vout
def dms2dd(degrees, minutes, seconds, direction):
degmin = minutes+"."+seconds
dd = float(degrees) + float(degmin)/60;
if direction == 'S' or direction == 'W':
dd *= -1
return dd;
def decode(coord):
x = coord.split(".")
head = x[0]
tail = x[1]
deg = head[0:-2]
min = head[-2:]
sec = tail[:4]
dir = tail[-1:]
return dms2dd(deg, min, sec, dir)
def get_temp():
sensor_temp = machine.ADC(4)
conversion_factor = 3.3 / (65535)
reading = sensor_temp.read_u16() * conversion_factor
temperature = 27 - (reading - 0.706)/0.001721
ftemp = temperature * 9 / 5 + 32
return ftemp
fix = False
picoLTE = PicoLTE()
led = machine.Pin(22, machine.Pin.OUT)
picoLTE.peripherals.adjust_neopixel(0, 0, 0)
led.off()
while True:
# First go to GNSS prior mode and turn on GPS.
picoLTE.gps.set_priority(0)
time.sleep(3)
picoLTE.gps.turn_on(accuracy=3)
debug.info("Trying to fix GPS...")
for _ in range(0, 45):
result = picoLTE.gps.get_location()
debug.info(result)
if result["status"] == Status.SUCCESS:
debug.debug("GPS Fixed. Getting location data...")
loc = result.get("value")
debug.info("Lat-Lon:", loc)
loc_message = ",".join(word for word in loc)
resp = result["response"][0].split(',')
fix = True
break
time.sleep(2) # 45*2 = 90 seconds timeout for GPS fix.
if fix:
# Go to WWAN prior mode and turn on GPS.
picoLTE.gps.set_priority(1)
picoLTE.gps.turn_off()
lat = decode(loc[0])
lon = decode(loc[1])
temp = get_temp()
volt = round(get_volt(),2)
payload = "latitude="+str(lat)+"&longitude="+str(lon)+"&device="+device_name+"&accuracy="+str(resp[3])+"&speed="+str(resp[7])+"&direction="+str(resp[6])+"&provider="+str(temp)+"&battery="+str(volt)
debug.info(payload)
picoLTE.network.register_network()
picoLTE.http.set_context_id()
picoLTE.network.get_pdp_ready()
picoLTE.http.set_custom_header()
debug.info("Sending message to the server...")
picoLTE.http.set_server_url(url)
result = picoLTE.http.post(timeout=15, data=payload)
debug.info(result)
if result["status"] == Status.SUCCESS:
debug.info("Message sent successfully.")
led.on()
fix = False
picoLTE.network.deactivate_pdp_context()
cnt = 30 # Start at 30 minute update intervals
else:
cnt = 1 # Start at 1 minute update intervals
if (float(resp[7]) > 0):
cnt = 1 #Once a minute updates if moving
while (cnt > 0):
cnt = cnt - 1
if (get_temp() > 95 and cnt > 5):
cnt = 5 #Once every 5 minutes if too warm
time.sleep(60) # 60 seconds between each request.
led.off()