-
Notifications
You must be signed in to change notification settings - Fork 58
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
How to post stream instead of upload to file via FTP. #40
Comments
Hi! thanks. I think so, you only have to fetch the bytes in chunks from the stream and use the example provided in the documentation. unsigned int RX_PIN = 7;
unsigned int TX_PIN = 8;
unsigned int RST_PIN = 12;
const char BEARER[] PROGMEM = "gprs-service.com";
const char FTP_SERVER[] PROGMEM = "ftp.server";
const char FTP_USER[] PROGMEM = "user";
const char FTP_PASS[] PROGMEM = "pass";
FTP ftp(9600, RX_PIN, TX_PIN, RST_PIN);
ftp.putBegin(BEARER, "example.txt", FTP_SERVER, FTP_USER, FTP_PASS);
ftp.putWrite("hello!", sizeof("hello!"));
ftp.putEnd(); Look at the unsigned int RX_PIN = 7;
unsigned int TX_PIN = 8;
unsigned int RST_PIN = 12;
const char BEARER[] PROGMEM = "gprs-service.com";
const char FTP_SERVER[] PROGMEM = "ftp.server";
const char FTP_USER[] PROGMEM = "user";
const char FTP_PASS[] PROGMEM = "pass";
FTP ftp(9600, RX_PIN, TX_PIN, RST_PIN);
int readBytes = 100; // For this example
char buff[readBytes];
ftp.putBegin(BEARER, "example.txt", FTP_SERVER, FTP_USER, FTP_PASS);
while (stream.available()) {
int bytesRead = stream.readBytes(buff, readBytes);
ftp.putWrite("hello!", sizeof("hello!"));
}
ftp.putEnd(); Also, check this example where I do the same, but using a |
@carrascoacd Is it working with esp32 SIM800L |
Could you share the logs of the error you are getting, please? I think you are having problems because you are using the standard SoftwareSerial library which is not working on ESP32. Try using this https://github.com/plerup/espsoftwareserial instead, and let me know if it works for you :) |
@carrascoacd Thanks for your helps, below i am getting error when use only this includings. when i build this with out any serial at start i gets error. `#include <Ftp.h> void setup() } void loop() { } ` Arduino: 1.8.12 (Windows 10), Board: "AI Thinker ESP32-CAM" C:\Arduino\libraries\ArduinoSIM800L-master\src\Http.cpp:50:21: error: array must be initialized with a brace-enclosed initializer const char* OK_[] = "OK";
C:\Arduino\libraries\ArduinoSIM800L-master\src\Http.cpp: In member function 'Result HTTP::setHTTPSession(const char*)': C:\Arduino\libraries\ArduinoSIM800L-master\src\Http.cpp:186:46: error: no matching function for call to 'HTTP::sendCmdAndWaitForResp(char [128], const char* [3], int)' if (sendCmdAndWaitForResp(buffer, OK_, 2000) == FALSE)
In file included from C:\Arduino\libraries\ArduinoSIM800L-master\src\Http.h:31:0,
C:\Arduino\libraries\ArduinoSIM800L-master\src\Sim800.h:120:9: note: candidate: int SIM800::sendCmdAndWaitForResp(const char*, const char*, unsigned int)
C:\Arduino\libraries\ArduinoSIM800L-master\src\Sim800.h:120:9: note: no known conversion for argument 2 from 'const char* [3]' to 'const char*' C:\Arduino\libraries\ArduinoSIM800L-master\src\Ftp.cpp:48:21: error: array must be initialized with a brace-enclosed initializer const char* OK_[] = "OK";
exit status 1 This report would have more information with |
Thanks for sharing, the board you use is nice. How do you power it / what kind of battery do you use? @rtarta please, please try this branch and check if it works. I don't have the real physical device, but it compiles TM #42 |
@carrascoacd My friend, i made a little bit change on SIM800.h over SoftwareSerial. I turned it to HarwareSerial over any pin to connect Esp32Cam. But i can not manage to send image file over GPRS. |
Are you powering the SIM800L with a dedicated LiPo battery?
Show me your design please in case I can help you.
…On Thu 16 Apr 2020, 2:09 a.m. Rahmi Tuğrul Altın ***@***.***> wrote:
@carrascoacd <https://github.com/carrascoacd> My friend, i made a little
bir change on SIM800.h over SoftwareSerial. I turned it to HarwareSerial
over any pin to connect Esp32Cam. But i can not manage to send image file
over GPRS.
Esp32 cam taking image and write it into SD card, when i start to read it
i locks sd card reading. Now i do not knwo what to do. if need i can share
SIM800.h file. I have manage to send file over HttpPost via Wifi with esp32
you can check it from there
<https://rahmitugrulaltin.blogspot.com/2020/04/esp32-camera-taking-picture-and-send-to.html>.
In this HttpLibrary i can set directly file in to post request.
I do not know what to do :(
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#40 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABBWFOF6VCO4ZX2ZRJ7R753RMZEEDANCNFSM4L3ZSFXQ>
.
|
@carrascoacd We are powering the sim800 with LM2596 . My circut is same as [this](url I am using power supplier with LM2596. |
Try this: FTP ftp(9600, RX_PIN, TX_PIN, RST_PIN);
ftp.putBegin(BEARER, "example.txt", FTP_SERVER, FTP_USER, FTP_PASS);
ftp.putWrite("hello!", sizeof("hello!"));
ftp.putEnd(); And check if it creates a new file. Please, send me the logs of the serial monitor. SIM800L should be powered with a LiPo battery of 3.7V because of the high current spikes, I think you are not powering it right and because of it, the execution blocks. |
@carrascoacd Dear Friend i manage to send file to remote server with other library(ArduinoHttpClient) but not ftp. With your library i could also create small data on remote ftp but my file size min 10 Kb. Thanks your supports. |
Could you share the code you use to upload the file with my library?
…On Sat 18 Apr 2020, 7:47 p.m. Rahmi Tuğrul Altın ***@***.***> wrote:
@carrascoacd <https://github.com/carrascoacd> Dear Friend i manage to
send file to remote server with other library(ArduinoHttpClient) but not
ftp. With your library i could also create small data on remote ftp but my
file size min 10 Kb. Thanks your supports.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#40 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABBWFOFGVUKKYOZ2UAN75ODRNHRUFANCNFSM4L3ZSFXQ>
.
|
Hi, thanks for your code. |
Hi! you can follow this example where I read an image from the SD card and upload it in batches to the FTP server https://github.com/carrascoacd/ArduinoSIM800L/blob/master/examples/WeatherStationExample.ino#L83 You could increase the Important note. You will need enough SRAM as the FTP library will need at least 512 bytes (since it uses pages of that size to r/w to the SD card). I had many many problems with the 2KB that ATMega328p provides, it was not enough. In order to make it works:
If you use ArduCAM mini, it has an internal buffer so you don´t need the SD card as a middleman. |
Hi, thanks a lot for taking the time to respond to my question. I have already created a sketch but it is not working. It freezes on ftp.putBegin( (see below) My Sketch:
Console display:
the image is preloaded. As I said I have another sketch that uses AT commands and I can transfer this image (8K) to my FTP server but some 50% of the times it arrives incomplete (parts of it). I am using an ESP32 variant (TTGO Call that has a built in SIM800L). Thanks in advance |
Hi, I've adapted my sketch to the link you provided as below:
It is still freezing as console printout below:
What do you think may be the problem? |
Hi Paulo, could you uncomment this line and share the serial output again, please? I think your SIM800L module is not powered, have you tried this? Add it into the
|
Hi Antonio, thanks again for your help. Indeed I forgot to include the lines you pointed out.
The Adjusted sketch is as below:
Thanks again |
I can't see the debug traces, think I have to add a debug trace for ESP32, this is not working, so change that line by
by
|
Hi, I did the change (pDBG(c)) but the sketch fails to compile. Error compiling for ESP32. It seems as the sketch runs it is not even reaching the Serial.print(c); maybe it is not even successfully initializing the modem.
|
Hi, some more tests.
Console output:
|
My library uses the Try changing this line
by
Then I think you will need to change the constructor as well, so modify this line:
by
then this line
by
Edit: Maybe you have to include the |
Could you share your results in this new issue #43? I think we are talking about a different topic here now |
Hello thanks for your works, is it possible in your code to post file as stream as below could you check it is possbile ?
https://github.com/espressif/arduino-esp32/blob/master/libraries/HTTPClient/src/HTTPClient.cpp#L583
The text was updated successfully, but these errors were encountered: