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.

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.

Trial run of SIM 7000A LTE and GPS shield for Arduino

I wanted to start playing around with cellular devices and using them with the Arduino. So, I bought a Botletics SIM7000 LTE CAT-M1 NB-IoT Cellular + GPS + Antenna Shield Kit for Arduino (SIM7000A)  that works in my locale. There are different modules, SIM7000 A,C,E, etc. that work in different places, so I picked up this one which works with AT&T as well as Verizon LTE bands in my area.

So far, I’m just getting started, and I haven’t done much yet. You can head over to the wiki to see the available open source software and examples are available. I love Open Source Hardware (OSHW)! It is really nice buying a piece of equipment and seeing all of the available diagrams, schematics, software, etc., all laid out for you to use.

In any event, I’m just getting started with this, and so far all I’ve done is register my new Hologram.io sim card, and set it up with an LTE demo sketch. Essentially, the demo sketch allows you to connect over USB with the Arduino serial monitor and use a text based menu interface to play around with the modem, without having to know all of the AT commands.

Here’s a screenshot of my Hologram dashboard:

dashboard

Of course there is more information on the upper parts of the page, but I felt it was probably wise not to include my IEMI and other information on this shot. The dashboard is really intuitive. As for Hologram.io itself, so far so good. When I signed up they sent me a free card in the mail, as well as gave me 1 MB of free data a month to play with. Sending text messages to the device is free, but sending a text from the device costs 19 cents each. Overall, the monthly charge is $1.50/month to keep the card active. I think it is 40 cents for each additional MB of data I use.

The price seems a bit much for each SMS sent, but it is nice to allow me to play with this without having to get a $30+/month sim card for another carrier. I was going to try some of my other sims in it from my other phones, but you do need a phone sim that specifically does CAT-M1, which supposedly not all do.

One item of note is that the modem will not work without a battery while plugged into the Arduino. It turns out that the Arduino can’t supply enough juice during some operations that cause it to pull a little extra juice. These spikes are sporadic, and while the battery is plugged in, the battery is charged by the board, so my battery level keeps going up while plugged in.

The interesting thing about the battery is that I couldn’t get any place to ship me a battery in the mail to Alaska. Fortunately, I have several dead Android phones laying around and I pulled a 3.7v, 1400mAH battery out of one and was able to solder the wires to the terminals and hook it up that way. Check out the pictures if you want to see my handy work.

I’ll let you know as I try out a few of the features what I can come up with. I’m hoping to build some sort of rudimentary texting/web phone, and grow in some lower level cellular/gps knowledge. As always, you can follow along with my sketches on my GitLab!

Linux – keep it simple.

LCD Keypad Shield for Arduino

I’m not entirely new to the Arduino scene, but I’m certainly not an expert. With that, I’ve decided to pick up a few “toys”, such as shields and attachments for the Arduino with the hopes of using them to learn more about this handy little tool. One of those toys was an LCD keypad shield.

Essentially, it is an LCD display with 6 buttons. One of the buttons is the reset button for the Arduino, and the other 5 are labeled and arranged as up/down/left/right and select. As usual, before making any of my own projects with a new piece of equipment, I like to follow through someone else’s tutorial and see how everything works, and give the hardware a positive test.

That said, I followed the tutorial from dfrobot. It was very informative and worked like a charm. Essentially, when you push a button, it displays the button name on the LCD screen, giving a great hardware test of both the screen and buttons, but also showing how the shield works.

A couple of small notes for the uninformed, like myself, when I first powered it on, the LCD backlighting was bright, but nothing displayed. The potentiometer on the top left of the board is labeled as “brightness” on the diagram I saw, causing me to think it controlled backlight brightness. Rather, it controls the intensity of the LCD itself, and was turned all the way down, not allowing the letters to appear. A quick couple of turns with a screwdriver made short work of this problem.

I’m going to make a small “avoid the asteroid” arcade style game on this shield for the learning value. It should be a lot of fun! I’ll keep you posted!

Linux – keep it simple.