LTE Project renamed “Bone Phone”!

Well, today is my last post on the LTE project. After showing it to my co-workers, it has now been renamed the “bone phone” because of it’s unique shape and color! I’ve also included the README.md at the end of this post with the full story.

To God be the glory, I learned a lot, and made a lot of functions with this phone. The main points are:

  • Send Text messages to any valid number
  • Receive and read text (SMS only) messages from anyone
  • Reply or delete text messages
  • Turn LTE on/off
  • Turn GPS on/off
  • Get your current location
  • Send your current location to someone else via text
  • Compass heading (must be moving to be accurate, based on GPS)
  • Status Bar with battery, GPS, cellular, and messages stats
  • Current local time

There was a lot more things that I wanted to do with this project. unfortunately, I ran out of memory:

Sketch uses 26938 bytes (83%) of program storage space. Maximum is 32256 bytes.
Global variables use 1567 bytes (76%) of dynamic memory, leaving 481 bytes for local variables. Maximum is 2048 bytes.
Low memory available, stability problems may occur.

As you can see from the warning, I’m running out of dynamic memory, or ram. I’ve tried adding a few more things, but anything I add tips it over the edge. Even just a few bytes added seems to make the device slow down so much that it is unusable. You are supposed to leave 512 bytes for running the program, and I’m only leaving 481, which slows it down a bit. But, be sure to check out the project on my GitLab for all the files, the pictures, videos, and 3d printer cad drawings and program! It’s all up for you to work on and improve!

Thanks for following along with me on this project! It’s been a really great learning experience! Not only that, but to God be the glory, it even works! You can read more about it in the readme if you’d like. This readme also includes operating instructions. (It’s easier to read by following the link to the mark down document, but I’ll post it here in case you need it.)

# LTE project (nickname: “Bone Phone”)

You can read more about this project on my blog: https://thealaskalinuxuser.wordpress.com
Just search for “LTE project” to see how you can build this open source hardware texting phone for yourself!

This phone can send and receive text messages. Runs off of a 9 volt battery, and has six buttons.

# Operating instructions:

1. Turn on the Bone Phone by flipping the power switch to the “on” position.
2. Once it boots up, you will be presented with the main screen. On every screen, use the numbered button that corosponds to the menu item to select it.
3. Any screen that has you input text or numbers, use the buttons to navigate, 1 is up, to scroll through the numbers or letters, 2 is down, to scroll through the numbers and letters. Whatever letter or number you select is not saved to that spot until you use button 3 (left) or button 4 (right), at which point the letter/number is saved/entered.
4. Some screens tell you to push the select button (button 5) to do special functions. If needed, the screen will display the action you should take.
5. At any time, you can press the “home” button (button 6), which will take you back to the main menu.

# Features

– Send/receive text messages
– Turn on/off data or gps
– View GPS location and send as text
– Compass heading screen if GPS is on
– View network info.
– Using serial over USB, you can do many more features such as download web pages, upload to the web, and more.

# Notes

– I tested this with StraightTalk and Hollogram.io simcards. Both worked, but only the hollogram card would allow data if using the serial over USB connection. Both worked for texting.
– When sending a text to a number, you need either of these two formats: +19078675309 or 19078675309. Some phones will not accept unless you have the “+” sign in front of the number. So far, all phones accept the text when you use the “+” sign.
– The device has 2 batteries. One 9 volt battery, which is disposable, and non-chargable. The second battery is a 3.7 volt battery for the modem, which is charged by power from either board input or the 9 volt battery. The power battery percentage from the phone on the status bar is actually for the modem battery, and doesn’t tell you how much battery power you have left in the 9 volt battery, unfortunately.
– The serial over USB works, and you can talk to the board that way, sending and receiving texts, etc.
– The included truth table outlines the different screens and button combinations.
– The bone phone was also supposed to have a mini browser/ftp/http get/put method, as well as a game, but I ran out of memory on the device. Come on, I only had 32 kb of space and 2 kb of ram to work with!

# About – Or, Why “bone phone”?

Well, the design is somewhat dog bone treat shaped, to protect the buttons. Add to that the fact that the original that I 3d printed was white, it did look like a big bone. While showing it to my co-workers one day, one of them said it’s a bone. One then said it was a bone phone. They then all started laughing and we nicknamed it the bone phone.

I built this phone so I can learn about cell phones, c and c++ programming, and work with open source open hardware on a project. This bone phone met all those goals. This bone phone cannot make phone calls, but can send or receive texts.

# Hardware Components

The main board is an Arduino Uno (or knock off), and a Botletics LTE shield, both of which are open source hardware. There is also a Nokia 5110 screen, a slider (on/off) dpst switch, and 6 momentary switches, made by QTEATAK. There were also 6 550 ohm resistors, and a 3.7v lithium cell phone battery that I took out of an old HTC sense cell phone, but any 3.7volt LiPo/Li-ion battery would do.

I also included the files for the 3d printed case that I made. I used a glue gun and glue sticks to hold most of the components and wiring in place. Please see my website for tutorials about how it was put together.

The hardware used was specifically selected because it is all open source hardware.

“Open source hardware is hardware whose design is made publicly available so that anyone can study, modify, distribute, make, and sell the design or hardware based on that design.”

# License

My portion of the software is licensed under the Apache2.0 license:

Copyright 2019 by AlaskaLinuxUser (https://thealaskalinuxuser.wordpress.com)

Licensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
The software includes three libraries:

– The Adafruit Phona Library – Written by Limor Fried/Ladyada for Adafruit Industries. BSD license, all text above must be included in any redistribution. Which was modified by Botletics, maintaining the BSD license.
– The PCD8544 Library – The MIT License (MIT), Copyright (c) 2013 Carlos Rodrigues <cefrodrigues@gmail.com>
– The Arduino software serial library – GPL2.0

Linux – keep it simple.

Advertisements

LTE Project: GPS and Compass screens!

d

Another update on my LTE project. This one is fairly small, but I worked out the compass screen, which runs off of the GPS. You can see the whole commit here.  What is interesting about this is that I actually edited the library for the LTE shield itself to do what I wanted. Fortunately, it was pretty simple.

The problem is space. I’m running out of dynamic memory. I need to maintain around 500 bytes to run the sketch, but it is difficult when I start adding variables. The Arduino Uno only has 2 kb of ram. So, to call the GPS to get the heading, you need this:

boolean Adafruit_FONA::getGPS(float *lat, float *lon, float *speed_kph, float *heading, float *altitude,
uint16_t *year, uint8_t *month, uint8_t *day, uint8_t *hour, uint8_t *min, float *sec) {

But I only had room for one more float variable. But I found this in the library:

// only grab altitude if needed
if (altitude != NULL) {
// grab altitude
char *altp = strtok(NULL, “,”);
if (! altp) return false;
*altitude = atof(altp);
}

What does that mean? Well, a lot of variables in the above are allowed to be “null” or nothing. So, I edited the libraries/Botletics_SIMCom_Library_v1.0.0/Adafruit_FONA.h file from this:

boolean getGPS(float *lat, float *lon, float *speed_kph, float *heading, float *altitude,

To this:

boolean getGPS(float *lat, float *lon, float *speed_kph, float *heading, float *altitude = NULL,

Claiming the altitude is null. This is perfect because I can call one float, named heading, and then call the method with just one float instead of a bunch of them. Like this:

case 4:{ // Compass screen
                float heading;
                if (fona.getGPS(&heading, &heading, &heading, &heading)) {
                  lcd.setCursor(0, 1);
                  lcd.print("Heading: "); lcd.print(heading);
                }

So, even though I technically need a float for lat, long, heading, and altitude, now I am just using the heading one and letting it be overwritten by lat, long, etc., and the last one written is the heading! Yes, this is cheating, but praise God, it worked! This LTE project is really coming along!

Linux – keep it simple.

LTE Project: SMS, read and reply!

Of course the Botletics shield that houses the modem was able to receive sms messages the moment I put a sim card in it, but now I can read them on my device! That’s right! Using nothing but the interface and buttons on the device, I can select which message to read, I can view it, and then reply or delete it!

Originally, I was going to have a scrolling screen that you could use the buttons to scroll through and read the text messages. This had several advantages, like being able to see a conversation flow. However, it had some disadvantages too. Namely, I don’t have enough memory left on this thing to hold the messages in the Arduino’s ram.

That said, I needed to just read the message and display it to the screen. I already have a buffer for sending a text message, and a buffer for what phone number to send it to (2 char arrays, the message one is 140, and the phone number is 21). This actually worked out in my favor greatly. With the read screen, you get to choose a message number to read, so I made a small int to hold that number and you can use up and down to change it, or move it by 10 with left and right.

Once you settle on the message to read, you press select, which then reads that message from line into the phone number send char array, and the from message into the send message char array. These are simply displayed on the screen.

With that done, it is actually really easy to delete the message, since you have a message number already, so selecting to delete it, it already knows which one to delete!

Also, replying becomes easy, since the send to phone number is already saved in the send to phone number char array! Also the text message is saved their too, so you can read the message you were sent while you write the new message. I think it is great! The only problem is this: if your wife texts you and says “what should we have for dinner tonight?”, when you hit reply, you have to overwrite that whole message so you can say, “tacos”. So I’m not sure, I may want to blank it out instead, but for now, it’s pretty hand for testing, since I can just hit reply and send the same message back for testing purposes.

Be sure to check out the entire commit for all the good details I missed here!

Linux – keep it simple.

LTE Project: Sent a text message!

Today was a great day for my LTE project! Today I sent a text message using only the buttons on the device itself! It was great to be able to do that from the gui/interface without the need for a serial over USB connection!

So, how does it work? Well, you can check out the entire commit on my GitLab, but I’ll highlight the main parts here. First, I needed a way to type with only 6 buttons, one of them permanently being the “home” button, and one always being the “select/ok” button. So really just 4 buttons. With that in mind, I made a simple interface that I’ve seen before: Up/Down to cycle through the letters/numbers, and Left/Right to move which place you are typing at.

To make that work, I added an array of characters that you can cycle through, like so:

char letterNumbers[91] = {'0','1','2','3','4','5','6','7','8','9',' ','A','B','C','D','E','F','G',
  'H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e',
  'f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','`','~','!',
  '@','#','$','%','^','&','*','(',')','_','+','|','-','=',';',':',',','/','.','<','>','?'};

Notice that not every keyboard character is there. You have the forward slash, but not the back slash, due to an issue with char. I’m sure I can work it in, but I needed to get it working first, then I can edit it more later.

Then, I use a variable called curPos to mark which spot in the message you are, and numLetter to hold which number of the 91 characters you are trying to use. It looks like this:

case 30:{ // Screen 5 – Enter phone number screen.
// Up one character
if (numLetter >= 91){
numLetter = 0;
} else {
numLetter++;
}
break;
}
case 35:{
// Down one character
if (numLetter <= 0){
numLetter = 91;
} else {
numLetter–;
}
break;
}
case 40:{
// Left one position
if (curPos <= 0){
curPos = 0;
} else {
sendText[curPos] = letterNumbers[numLetter];
curPos–;
}
break;
}
case 45:{
// Right one position
if (curPos >= 21){
curPos = 21;
} else {
sendText[curPos] = letterNumbers[numLetter];
curPos++;
}
break;
}

It allows you to wrap around from character 91 back to character 0 in the list. Then when you press left or right, it saves the character you chose, say “A” in the spot where you were! It’s a little cumbersome, but it actually works!

The only thing I wonder is if the left button should be like delete, and leave a blank space instead of writing the current character and going left. I’m not sure which works better. I suppose a smart person can actually write the entire text backwards if they mess up and want to retype it…. maybe not.

It can be a little confusing, because it doesn’t save the letter/number/punctuation you have chosen until you move left or right, which appears like it is there, but it is not saved until you move off of it. You also can’t read what is under the “cursor” because it always displays the current chosen character you want to write. I’ll look at ways to fix that, but for now, it’s pretty functional, just not very pretty.

Linux – keep it simple.

LTE Project: Button it up.

Now that I shoved all the wires in there and soldered in the connections for the buttons, I was able to close the case. It still opens, you just have to unscrew the 4 screws to take it apart.

With that, I’ve also made progress on the button reading and programming. As we saw before, the program uses a “truth table” where based on the math formula of (btn# + screenNumber)*screenNumber = menu option, we can calculate all possible outputs and assign them to operations or values.

So, this is a compilation of four different commits:

  1. Update the truth table and screens.
  2. Adding button reading.
  3. Screen updates.
  4. Some small updates.

You can check out all of the above commits to see the process, but here I’ll cover the main part. This is the button reading function.

int read_LCD_buttons(){               // read the buttons
  adc_key_in = 0;
    //adc_key_in = analogRead(A0);       // read the value from the sensor 
    Serial.print("anolog0:"); Serial.println(adc_key_in);
    if (adc_key_in > 550)   return btnRIGHT;
    //adc_key_in = analogRead(A1);       // read the value from the sensor 
    Serial.print("anolog1:"); Serial.println(adc_key_in);
    if (adc_key_in > 550)   return btnUP;
    adc_key_in = analogRead(A2);       // read the value from the sensor 
    Serial.print("anolog2:"); Serial.println(adc_key_in);
    if (adc_key_in > 550)   return btnDOWN;
    adc_key_in = analogRead(A3);       // read the value from the sensor 
    Serial.print("anolog3:"); Serial.println(adc_key_in);
    if (adc_key_in > 550)   return btnLEFT;
    adc_key_in = analogRead(A4);       // read the value from the sensor 
    Serial.print("anolog4:"); Serial.println(adc_key_in);
    if (adc_key_in > 550)   return btnSELECT;
    adc_key_in = analogRead(A5);       // read the value from the sensor 
    Serial.print("anolog5:"); Serial.println(adc_key_in);
    if (adc_key_in > 550)   return btnBACK; 
    return btnNONE;                // when all others fail, return this.
}

At first, I have it log everything to serial so I can see what is happening. Essentially, I took a wire from 3.3vdc that goes to the button. Then the button goes to the analog input, with a jumper going to a resistor to ground. That way, when you are not pushing the button, then the analog pin is not floating, and reads 0. When you push a button, that input reads around 700. So, I put the threshold at greater than 550. This seems to work fairly well.

The only problem is that I didn’t arrange the buttons the way I thought that I was programming them to work. Rather than swap the button wires physically, I just re-ordered them in my program, saying one was two, etc.

Here is the call inside the loop, asking for which button is pressed:

int waiting = 0;
menuNumber = 0;
while ( waiting < 30 ){
waiting++;
delay(10);
lcd_key = read_LCD_buttons(); // read the buttons
// TESTING ONLY // Serial.print(lcd_key);
switch (lcd_key){

case btnUP:{
menuNumber = (1+screenNumber)*screenNumber;
break;
}
case btnDOWN:{
menuNumber = (2+screenNumber)*screenNumber;
break;
}
case btnLEFT:{
menuNumber = (3+screenNumber)*screenNumber;
break;
}
case btnRIGHT:{
menuNumber = (4+screenNumber)*screenNumber;
break;
}
case btnSELECT:{
menuNumber = 255;
break;
}
case btnBACK:{
menuNumber = 256;
break;
}
}
// TESTING ONLY // Serial.print(menuNumber);
}

The above call checks every 10 milliseconds to see if you pressed a button. After 30 checks, it continues through the process and refreshes the screens, etc. This works out to be about a half second, due to the length of the program. There is a small window of about a tenth of a second, where pushing a button doesn’t do anything, but I’ve found in test runs that it was really rare that pushing a button didn’t respond immediately.

If you don’t do this, it is refreshing the screen about 30 times a second as it rips through the program, and there is only a fraction of a second where pushing the button actually works. There is probably a better way to do this, but this works really well for my program.

Now I just need to make it send and receive text messages!

Linux – keep it simple.

LTE project button code

lteprojecta

Here’s the deal, I have a very small screen, with six available buttons. I need to make sure that if you press the button, it does the right thing for the screen it is currently on. How do I map the six buttons to the specific screen I’m on, with only 32 kb of programming space?

Well, brilliant or butchered, here’s what I did….

First, I decided on the flow of screens. Example, from the main screen (screen number 1), you can go to the texting screen (sn 6) or GPS screen (sn 3) or the “other programs” screen (sn 12). From the GPS screen, you can go to the location screen (sn 2), or the compass screen (sn 4). And from the texting screen, you can go to the read messages screen (sn 9), or the send messages screen (sn 7), the delete all messages screen (sn 8), and so on and so forth. All told, there is around 15 screens currently.

But how to map pushing the same four buttons for each screen number? There are probably better ways to do this, but I came up with a mathematical formula and a switch to handle this for me.

sn Button 1 Button 2 Button 3 Button 4 Button 5 Button 6
1 2 3 4 5
2 6 8 10 12
3 12 15 18 21
4 20 24 28 32
5 30 35 40 45
6 42 48 54 60
7 56 63 70 77
8 72 80 88 96
9 90 99 108 117
10 110 120 130 140
11 132 143 154 165
12 156 168 180 192
13 182 195 208 221
14 210 224 238 252
15 240 255 270 285
16 272 288 304 320
17 306 323 340 357
18 342 360 378 396
19 380 399 418 437

What the above table does, is utilize the following formula: “Screen number plus Button number is multiplied by Screen number.” With this formula, I then used the variable screen number, which I need for what screen text to display anyways, and made a switch that checks the math to see what button I am pushing. What is interesting about this is that you technically could do any operation from any screen, but the screen number will make the math work only for the operations you should do on that screen.

As you can see, screen number 2 and screen number 3 both share the number 12. In my small table, it is the only occurrence of the same number twice. Fortunately, it is okay, because I made screen 2 the location screen, which you get to from screen 3. So pushing that first button on screen 3 takes you mathematically to screen 2, and on screen 2, pressing the last button takes you mathematically to screen 2, which is where location information is displayed. So it is a little sloppy, but works out in the end.

Buttons 5 and 6 don’t work that way, though. They are special buttons that always return the same two numbers. The first one is the “home” button, which from any screen takes you back to the main menu. The second is the “select” button, which will be unique in use and will have to have a special case by case use. It’s actually not used on any screens thus far, so it is held in reservation for now. I was thinking of making it a modem power on/off switch, but we will see.

As always, you can check out the commit on my GitLab.

Linux – keep it simple.

LTE project gets a status bar!

In my continuing effort to learn about programming, cellular service, and Arduino, I’ve made a couple of great developments on my LTE project. Essentially, I’m turning these parts into a texting/gps device. I want to say a phone, but since it uses LTE only, it can’t actually make a phone call. So it is a “smart device” rather than a “smart phone”.

Of course, any useful device needs to have a status bar. And that is what I have done so far. The Nokia 5110 display, at the current font, supports 5 lines of text. So, I decided the top line will always be the status bar. Just like your smart phone, this device uses a status bar to tell you the “status” of everything you really, really need to know in one glance.

The first digits displayed are the battery percentage. If you don’t know how much time you have left on the device before it dies, it can be a little hard to use. Here you can see the magic behind the curtain:

// Get the battery percentage:
uint16_t vbat;
if (! fona.getBattPercent(&vbat)) {
Serial.println(F(“Failed to read Batt”));
lcd.print(“**% “);
} else {
Serial.print(F(“VPct = “)); Serial.print(vbat); Serial.println(F(“%”));
lcd.print(vbat); lcd.print(“% “);
}

Next up is the GPS indicator. Note that this doesn’t tell you if you have a lock, but does tell you if the battery draining GPS is turned on or off (GPS for on, — for off). Fortunately, the fona library includes a GPS status checking function, so we just call it, like so:

// Get the GPS status:
int statGPS = fona.GPSstatus(); Serial.print(F(“GPS status = “)); Serial.println(statGPS);
if (statGPS == 1) {lcd.print(“GPS “);} else {lcd.print(“— “);}

After that, we have the network status indicator. I’ll delve into that a bit more. It looks like the traditional multi-bar display, but unlike traditional ones on your smart phone, this actually is just full bars, or not. As you can see, you can get different letters for different status, or just the home made bar indicator glyph for roaming or home connections.

// Get the network status:
uint8_t n = fona.getNetworkStatus();
Serial.print(F(“Network status “));
Serial.print(n);
Serial.print(F(“: “));
if (n == 0) {Serial.println(F(“Not registered”)); lcd.print(“X”);}
if (n == 1) {Serial.println(F(“Registered (home)”)); lcd.write(0);}
if (n == 2) {Serial.println(F(“Not registered (searching)”)); lcd.print(“S”);}
if (n == 3) {Serial.println(F(“Denied”)); lcd.print(“D”);}
if (n == 4) {Serial.println(F(“Unknown”)); lcd.print(“?”);}
if (n == 5) {Serial.println(F(“Registered roaming”)); lcd.write(0);}
lcd.print(” “);

Finally, there is a number that tells you how many text messages you currently have.

// Get the number of SMS messages:
int8_t smsnum = fona.getNumSMS();
if (smsnum < 0) {
Serial.println(F(“Could not read # SMS”));
lcd.print(“-0- “);
} else {
Serial.print(smsnum); Serial.println(F(” SMS’s on SIM card!”));
lcd.print(smsnum);
}

You are welcome to check out the whole commit, but this is the gist of how the status bar works. Currently, the sketch takes up 78% of the Arduino’s memory. I think the direction I am going with this is trying to make a beginning to end, build at home smart device that allows you to at lease navigate by GPS, and send/receive text messages.

If wishes were fishes, and moose’s excuses, I guess we would all have full freezers. With that said, if I am able, I wish I could work in a couple other simple tasks as well, such as a way to play a simple game, perhaps check an email, or maybe a very rudimentary e-link style web browser. But I think that might be a whole lot more than I can realistically accomplish with so little memory on the device. We’ll see though!

Linux – keep it simple.

Arduino LTE Botletics shield and a Nokia 5110 display!

image2

Today was a lot of fun, and I mean a lot! I was able to connect not only the Botletics LTE shield, but also the Nokia 5110 screen to the Arduino, AT THE SAME TIME! I know, for the rest of the Arduino enthusiasts out there, this may seem like child’s play, but it was a big deal for me.

First, I was using the Botletics modified fona library, and with the soldered board pins, it can only connect to the Arduino one way. The problem was that I was also using the PCD8544 library to control the Nokia 5110 display, but some of the pins needed were the same ones for both devices. That certainly wouldn’t do. So, I edited the PCD8544.h file as follows:

PCD8544(uint8_t sclk = 3, // clock (display pin 2)
uint8_t sdin = 4, // data-in (display pin 3)
uint8_t dc = 5, // data select (display pin 4)
uint8_t reset = 12, // reset (display pin 8)
uint8_t sce = 13); // enable (display pin 5)

Changing these pin outs allowed me to control it with the remaining pins on the board. Now I can have both the display and the LTE shield at the same time! Essentially, the old PCD8544 library had used pins 3,4,5,6, and 7, for simplicity. I however couldn’t use 6 and 7, as those were taken by the LTE shield. So, I swapped them in the header file to point to pins 12 and 13, since they were not being used.

The only problem I ran into, though, was space. It takes a lot of space for the fona library to run the LTE shield. Originally, I was going to use the U8 library, but using those two together actually took 109% of the storage space on the Arduino Uno. I tried to trim down the portions of code for the fona side, but couldn’t get everything small enough. Fortunately, the PCD8544 library was much, much smaller, and I found that it even has a simpler interface for text only, which is mostly what I want to use the screen for.

With those two libraries pared up, I added some lines to my LTE demo sketch to allow me to display the battery information on the Nokia 5110 screen. All told the sketch uses 26470 bytes (82%) of the program storage space, the maximum is 32256 bytes. It worked great, looked good, and still leaves room for more programming.

You can check out the full commit, of course, but here is the portion about the screen:

case ‘b’: {
// read the battery voltage and percentage
uint16_t vbat;
if (! fona.getBattVoltage(&vbat)) {
Serial.println(F(“Failed to read Batt”));
} else {
lcd.setCursor(0, 0);
lcd.print(“Battery Status”);
Serial.print(F(“VBat = “)); Serial.print(vbat); Serial.println(F(” mV”));
lcd.setCursor(0, 1); lcd.print(“VBat = “); lcd.print(vbat); lcd.print(” mV”);
}

if (! fona.getBattPercent(&vbat)) {
Serial.println(F(“Failed to read Batt”));
} else {
Serial.print(F(“VPct = “)); Serial.print(vbat); Serial.println(F(“%”));
lcd.setCursor(0, 2); lcd.print(“VPct = “); lcd.print(vbat); lcd.print(“%”);
}

break;
}

Really simple commands to set up the cursor, and then just lcd.print to display information. I really like this simple screen library for text. It doesn’t handle graphics too well, though, which is what the U8 library excelled at.

So I guess now I need to work out some sort of menu system, as well as some sort of buttons if I want to turn this thing into a portable texting/gps/data interface device.

Linux – keep it simple.

Testing other SIM cards with the Arduino LTE shield from Botletics

IMG_20190423_084454

In the continuing process of testing out various aspects of using the Botletics LTE Arduino shield, I’ve decided to do a quick test with a few other SIM cards that I have available. I tested two other options, my Straight Talk SIM card, and a Freedom Pop SIM card. I was particularly interested in the Freedom Pop card, since that would allow me to have a free option for my board.

The first thing I did was add the following lines to my sketch, to handle the APN’s:

//fona.setNetworkSettings(F(“your APN”), F(“your username”), F(“your password”));
//fona.setNetworkSettings(F(“m2m.com.attz”)); // For AT&T IoT SIM card
//fona.setNetworkSettings(F(“telstra.internet”)); // For Telstra (Australia) SIM card – CAT-M1 (Band 28)
fona.setNetworkSettings(F(“hologram”)); // For Hologram SIM card
// WJH fona.setNetworkSettings(F(“fp.com.attz”)); // For Freedom Pop SIM card – Sort of works. Connects, but you need their app to text/call/sms/web/etc.
// WJH fona.setNetworkSettings(F(“tfdata”)); // For Straight Talk SIM card – sort of works. Connects and sends/receives SMS, but no web data.

That way, I just un-comment whichever option I need, and flash that to the board. Note that there are other options that I think you can pass for APN controls, but these three options (APN, user name, password) are the only ones this sketch accepts.

Here was the results of my test. Starting with Freedom Pop:

FONA> C
—> AT+CCID
<— ***************
SIM CCID = ***************
FONA> 1
—> AT+CPSI?
<— +CPSI: LTE CAT-M1,Online,310-410,0×9308,125708560,61,EUTRAN-BAND12,5110,3,3,-16,-98,-65,10
—> AT+COPS?
<— +COPS: 0,0,”AT&T”,7

OK FONA>
n
—> AT+CGREG?
<— +CGREG: 0,1
Network status 1: Registered (home)
FONA> i
—> AT+CSQ
<— +CSQ: 24,99
RSSI = 24: -66 dBm
FONA> R
—> AT+CMGF=1
<— OK
—> AT+CPMS?
<— +CPMS: “SM”,0,10,”SM”,0,10,”SM”,0,10
FONA> s
Send to #***************
Type out one-line message (140 char): test FP
—> AT+CMGF=1
<— OK
—> AT+CMGS=”<MYPHONE#>”
<— >
> test FP
^Z
Sent!
FONA> R
—> AT+CMGF=1
<— OK
—> AT+CPMS?
<— +CPMS: “SM”,0,10,”SM”,0,10,”SM”,0,10
FONA> w
URL to read (e.g. dweet.io/get/latest/dweet/for/sim7500test123):
http://www.google.com
****
—> AT+HTTPTERM
<— OK
—> AT+HTTPINIT
<— OK
—> AT+HTTPPARA=”CID”
<— OK
—> AT+HTTPPARA=”UA”
<— OK
—> AT+HTTPPARA=”URL”
<— OK
—> AT+HTTPACTION=0
<— OK
Status: 601
Len: 0
—> AT+HTTPREAD
<— OK
Failed!
FONA>

And Straight Talk:

FONA> n
—> AT+CGREG?
<— +CGREG: 0,1
Network status 1: Registered (home)
FONA> 1
—> AT+CPSI?
<— +CPSI: LTE CAT-M1,Online,310-410,0×9308,125708560,61,EUTRAN-BAND12,5110,3,3,-18,-98,-64,8
—> AT+COPS?
<— +COPS: 0,0,”HOME”,7

OK FONA>
w
URL to read (e.g. dweet.io/get/latest/dweet/for/sim7500test123):
http://www.google.com
****
—> AT+HTTPTERM
<— ERROR
—> AT+HTTPINIT
<— OK
—> AT+HTTPPARA=”CID”
<— OK
—> AT+HTTPPARA=”UA”
<— OK
—> AT+HTTPPARA=”URL”
<— OK
—> AT+HTTPACTION=0
<— OK
Status: 601
Len: 0
—> AT+HTTPREAD
<— OK
Failed!
FONA> s
Send to #***************
Type out one-line message (140 char): test 2 st
—> AT+CMGF=1
<— OK
—> AT+CMGS=”***************”
<— >
> test 2 st
^Z
Sent!
FONA>
+CMTI: “SM”,1
R
—> AT+CMGF=1
<— OK
—> AT+CPMS?
<— +CPMS: “SM”,2,30,”SM”,2,30,”SM”,2,30

Reading SMS #1
—> AT+CMGF=1
<— OK
—> AT+CSDH=1
<— OK
AT+CMGR=1
+CMGR: “REC UNREAD”,”+***************”,,”19/04/29,10:42:01-32″,145,4,0,0,”+12085978931″,145,13
test 2 st
***** SMS #1 (13) bytes *****
test 2 st
*****

Reading SMS #2
—> AT+CMGF=1
<— OK
—> AT+CSDH=1
<— OK
AT+CMGR=2
OK
Failed!
FONA>

What is more important is what all that garble means. Essentially, it boils down to this:

  • Freedom Pop connects instantly to the AT&T network. However, you can’t read data, and you can’t send or receive text messages.
  • Straight Talk connects instantly to the AT&T network. It does send and receive text messages, but it cannot use data. So, there is no way to support web interface or tunneling.

So, without further breaking it down, and just using the sketches as is, you can connect with both FP and ST, but only ST can send/receive text messages, and no data, so neither option seems to really work out of the box. If you’ve tried other options, be sure to let me know the results.

Linux – keep it simple.

Texting trouble with the LTE shield!

sim7000a

Next on my bucket list for things to test out with the Botletics LTE Shield was text messaging, or SMS. According to the demo, it was supposed to be really easy and straight forward, but it wasn’t.

First, I used the Hologram Dashboard to send an SMS message to the device. It “showed up” but I couldn’t read it:

FONA> R
—> AT+CMGF=1
<— OK
—> AT+CPMS?
<— +CPMS: “SM”,1,10,”SM”,1,10,”SM”,1,10

Reading SMS #1
—> AT+CMGF=1
<— OK
—> AT+CSDH=1
<— OK
AT+CMGR=1
OK
Failed!
FONA>

Then I tried sending one from the device:

FONA> s
Send to #<MYPHONENUMBER>
Type out one-line message (140 char): testing
—> AT+CMGF=1
<— OK
—> AT+CMGS=”<MYPHONENUMBER>”
<— >
> testing
^Z

Failed!
FONA>

And it wouldn’t send one either. I tried several variations of this for about an hour, and just wound up frustrated. Later, I took a look through prior issues, and I found another user who had the same problem. Turns out, in their situation, they originally connected to Verizon, and then couldn’t send or receive. Then they connected to AT&T, and they could send and receive. So, I took a look, and sure enough, I was connected to a Verizon network. I reset my board, and tried connecting again. This time (by no work of my own) it connected to an AT&T network, and I too could send and receive SMS messages! Check it out:

  • Sending – I received it on my phone in seconds!

FONA> s
Send to #<MYPHONENUMBER>
Type out one-line message (140 char): testing
—> AT+CMGF=1
<— OK
—> AT+CMGS=<MYPHONENUMBER>
<— >
> testing
^Z
Sent!
FONA>

  • Receiving – I sent the reply of “Cool!” from my phone.

FONA> r
Read #1
Reading SMS #1
—> AT+CMGF=1
<— OK
—> AT+CSDH=1
<— OK
AT+CMGR=1
+CMGR: “REC READ”,”+<MYPHONENUMBER>”,,”19/04/25,21:39:28+00″,145,4,0,3,”+19703769316″,145,5
FROM: +<MYPHONENUMBER>
—> AT+CMGF=1
<— OK
—> AT+CSDH=1
<— OK
AT+CMGR=1
+CMGR: “REC READ”,”+<MYPHONENUMBER>”,,”19/04/25,21:39:28+00″,145,4,0,3,”+19703769316″,145,5
Cool!
***** SMS #1 (5) bytes *****
Cool!
*****
FONA>

So, if you too are trying to follow the tutorial for the LTE demo using the Botletics SIM7000A shield, be sure you are hooked up to AT&T. Also, if you were hooked up to Verizon, be sure you unplug the Arduino, and the power supply/battery of the board. Otherwise, the modem might still be on!

Linux – keep it simple.