Hi Sirzbf,
I am confused with the commands:
FTPPUTNAME-----------------name of the file
FTPPUTPATH-----------------I think this is the path of FTP server(not the local computer one) where the file has to create, correct me if am wrong!!
FTPPUT-----------------------making ready for file loading
FTPPUT=2,1000--------------this will create file of 1000 bytes!
but i need to give path of local file from desktop
===================================================
And here is my python code It works well, but ftp file data need to entry in command prompt
import serial
import RPi.GPIO as GPIO
import os, time
GPIO.setmode(GPIO.BOARD)
# Enable Serial Communication
gsm = serial.Serial("/dev/ttyusb0", baudrate=9600, timeout=1)
print("opened port : "+gsm.portstr)
if gsm.isOpen():
#1
gsm.write(b'AT\r\n')
time.sleep(0.5)
#2
gsm.write(b'ATE0\r\n')
time.sleep(0.5)
#3
gsm.write(b'AT+SAPBR=3,1,"CONTYPE","GPRS"\r\n')
rcv = gsm.read(20)
time.sleep(0.5)
#4
gsm.write(b'AT+SAPBR=3,1,"APN","TATA.DOCOMO.INTERNET"\r\n')
time.sleep(0.5)
#5
gsm.write(b'AT+SAPBR=3,1,"USER",""\r\n')
time.sleep(0.5)
#6
gsm.write(b'AT+SAPBR=3,1,"PWD",""\r\n')
rcv = gsm.read(20)
time.sleep(3)
#7
gsm.write(b'AT+SAPBR=1,1\r\n')
time.sleep(3)
#8
gsm.write(b'AT+SAPBR=2,1\r\n')
time.sleep(1)
#9
gsm.write(b'AT+FTPCID=1\r\n')
time.sleep(0.5)
#10
gsm.write(b'AT+FTPMODE=1\r\n')
time.sleep(0.5)
#11
gsm.write(b'AT+FTPSERV="ftp.drivehq.com"\r\n')
time.sleep(0.5)
#12
gsm.write(b'AT+FTPPORT=21\r\n')
time.sleep(0.5)
#13
gsm.write(b'AT+FTPUN="******"\r\n')
rcv = gsm.read(20)
time.sleep(0.5)
#14
gsm.write(b'AT+FTPPW="******"\r\n')
rcv = gsm.read(20)
time.sleep(0.5)
#15
gsm.write(b'AT+FTPPUTNAME="Demo.txt"\r\n')
rcv = gsm.read(20)
time.sleep(0.5)
#16
gsm.write(b'AT+FTPPUTPATH="/"\r\n')
time.sleep(0.5)
#17
gsm.write(b'AT+FTPPUT=1\r\n')
time.sleep(1)
#18
gsm.write(b'AT+FTPPUT=2,74\r\n')
time.sleep(1)
gsm.write(b"This file is loaded from PYTHON script SIM900 GSM**************\r\n") //here i want load a file(*.txt) from "C:\data to load\new.txt"
#gsm.write(b'\x1a') //and file size may vary so what I have give at FTPPUT=2,xxx?
time.sleep(2)
#19
gsm.write(b'AT+FTPPUT=2,0\r\n')
time.sleep(6)
#20
gsm.write(b'AT+SAPBR=0,1,"CONTYPE","GPRS"\r\n')
time.sleep(1)
Please suggest any solution...........