IMG_20190423_084454

First up on my list of learning about this Botletics LTE shield was how to pull data. Fortunately for me, the LTE demo sketch included a method for downloading something from the internet. It works like this:

// The code below was written by Adafruit and only works on some modules
case ‘w’: {
// read website URL
uint16_t statuscode;
int16_t length;
char url[80];
flushSerial();
Serial.println(F(“URL to read (e.g. dweet.io/get/latest/dweet/for/sim7500test123):”));
Serial.print(F(“http://”)); readline(url, 79);
Serial.println(url);
Serial.println(F(“****”));
if (!fona.HTTP_GET_start(url, &statuscode, (uint16_t *)&length)) {
Serial.println(“Failed!”);
break;
}
while (length > 0) {
while (fona.available()) {
char c = fona.read();

// Serial.write is too slow, we’ll write directly to Serial register!
#if defined(__AVR_ATmega328P__) || defined(__AVR_ATmega168__)
loop_until_bit_is_set(UCSR0A, UDRE0); /* Wait until data register empty. */
UDR0 = c;
#else
Serial.write(c);
#endif
length–;
if (! length) break;
}
}
Serial.println(F(“\n****”));
fona.HTTP_GET_end();
break;
}

As the code states, it was originally written by Adafruit, and some portions of this code (the Adafruit Fona library) were updated by Timothy Woo of Botletics) and it allows you to look up a URL and download it. So, I tested Google. It downloaded it like so:

googleWebsite

And I copied/pasted it into a text file, and saved it as html, which opened in a browser, like this:

googletest

So, that works. Granted, using this method was extremely slow. I am using a serial monitor connection over USB at a 9600 baud rate, which really took a while to catch all of the data. You could literally watch the characters being written on the screen. However, I think the modem is much faster, just my interface to it is not as quick. I’ll have to play with it some more, but it was nice to be able to download a web page at least!

Linux – keep it simple.

4 Replies to “LTE shield for Arduino: Web Page Download!”

    1. Yes, next post will cover using the internet, but you can choose from different plans for pricing. Currently, on this developer plan, I get 1 mb of data free every month. It is a few cents for each additional mb. I’ll look it up.

    2. So I double checked, on a developer plan, called the “maker” plan, you can have up to 25 devices active. They each come with 1 mb free data per month, and it is .60c each additional mb used, and .19c per sent text. Received texts are free. It also cost $1.25 per month per active sim card.

      One great feature is that you can set limits for general use or the devices specifically. Instead of auto billing, I use an account with them, where I put in $10, and as long as the account has money, they will provide service.

    3. Oh, and yes, you can upload or download with the data, so I made a couple of test posts, and then also downloaded a few web pages. The chip supports TCP/IP traffic.

Leave a Reply to AlaskaLinuxUser Cancel reply

Your email address will not be published. Required fields are marked *