Hey Mark, if it helps any I figured out the Pi/Python/Sim7000 code. However, besides this being the first time I’ve coded in Python, I’m a lousy programmer to begin with, just wanted to warn you!
Ok, so below is the code that worked for me, using a Pi4, the Sim7000 board I linked above, and a hologram sim:
import serial
import time
ser = serial.Serial('/dev/ttyS0',9600,timeout=0)
def Sim7000_do(AT_command, tsec=0.1):
AT_command = AT_command + "\r"
ser.write(AT_command.encode())
time.sleep(tsec)
while (ser.inWaiting() > 0):
print(ser.readline().strip())
print()
def Sim7000_data(the_data, tsec=0.1):
print(the_data)
ser.write(the_data.encode())
time.sleep(tsec)
while (ser.inWaiting() > 0):
print(ser.readline().strip())
print()
print("running...")
print()
Sim7000_do("ATE1") #echo on
Sim7000_do("AT+CREG?") #see if registered, 0,5?
Sim7000_do("AT+SAPBR=3,1,\"APN\",\"hologram\"") #set access point name
Sim7000_do("AT+SAPBR=1,1") #open profile 1 above
Sim7000_do("AT+SAPBR=2,1") #check if profile ok, ip address?
Sim7000_do("AT+FTPSERV=\"ftp.servername.com\"") #ftp url
Sim7000_do("AT+FTPUN=\"ftp_id\"") #id
Sim7000_do("AT+FTPPW=\"ftp_pw\"") #pw
Sim7000_do("AT+FTPTYPE=\"A\"") #text mode
Sim7000_do("AT+FTPPUTPATH=\"/\"") #path on server
Sim7000_do("AT+FTPPUTNAME=\"data1.txt\"") #name on server
Sim7000_do("AT+FTPPUT=1",5) #open ftp session, wait 5 seconds
Sim7000_do("AT+FTPPUT=2,10",5) #will send 10 char of data, wait
datastring="yabbadabba" #data
Sim7000_data(datastring,5) #send data, wait again
Sim7000_do("AT+FTPPUT=2,0",5) #close ftp session, wait
Sim7000_do("AT+SAPBR=0,1") #close profile 1
Again, as mentioned above, I’m not a good programmer in any language!! Ran this about a dozen times, changing that data string and checking my account afterwards, all good.
btw, I did initially have problems with different baud rates between the program and the board, just look at AT+IPR in the AT manual. Can also give you more detail if needed.
Also, you might be interested in this Sim7000 hat I found for a raspberry pi:
Sim7000G Pi Hat
Would make for a much nicer setup than the board I used above. Ordered one for myself, thinking of making of hotspot with it, fun stuff!