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.

LTE shield for Arduino: Web Page Download!

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://&#8221;)); 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.

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.

What exactly constitutes as open source hardware (OSHW)?

oshw-logo-200-px

There is a lot of buzz around the net on this idea of open source hardware (OSHW). However, the deeper that I look into it, the more tangled the web seems to be. I’ve been noticing that some sites tout equipment as OSHW because they have SOME open source hardware on-board. In other cases, the pieces/parts are all closed source hardware, but the schematic of the use of those parts is open, so that makes it open source hardware. It gets a little confusing.

Some of you are reading this, thinking, “What IS open source hardware, and why does it matter?” I guess it is time to get technical, here is the definition from https://www.oshwa.org:

Open Source Hardware (OSHW) is a term for tangible artifacts — machines, devices, or other physical things — whose design has been released to the public in such a way that anyone can make, modify, distribute, and use those things.

Well, that clears up the first part of our question. I guess now the second part to answer is: “Why does it matter?”

For the educated, you will find them placing tape over their computer cameras, using tor clients, chatting through XMPP, and generally taking a strong stance to protect their privacy.  You see, with all of this great technology, come great risk. That risk is this: someone could be spying on you.

Take, for example, Carrier IQ. (If you doubt that this is real, you can look it up on Google or any other search engine, because it does exist.) It was a great program designed for cell phone manufacturers so that they could get reports on what went wrong for the end user while using their phone. Say the camera app crashes, it could send a detailed report to the carrier (such as T-Mobile, AT&T, Verizon, etc.) to let them know that a user is having camera problems. As they collect this data, they can see statistically that all the users having this camera app crash are all using software version blah-blah.blah, and it trips on this line of code because of a kernel issue. Now armed with this information, the carrier can make modifications to the kernel, push out an update, and solve that issue for their phone users who want to take pictures with their camera.

Overall, the above paragraph sounds great. The end users get the camera working properly, and the carriers get happy customers, so everybody wins. Here’s where it gets touchy. What people came to realize is that the Carrier IQ software could also do things like: log every keystroke, take a picture and upload it to some carrier server, record audio, view your phone logs, etc., etc., etc. That’s where people took issue.

Granted, the example above was for software, and we are talking about hardware. However, hardware often faces similar issues. For troubleshooting purposes (we will give them the benefit of the doubt….) hardware will often have “back doors” or be “magic black boxes” that you don’t really understand or know about. Because the drawing, schematics, and software that runs on these smaller hardware items, such as modem chips, SoC’s, etc., are closed source, hidden from your view, you don’t know what is really going on under the hood.

So, a fictitious example:

What if you bought a *Name your car company* model: ZuperOne. Let’s say that, unbeknownst to you, every mile you drive, it sent your GPS position to the car factory, as well as what radio station you were listening to at the moment, what speed you were driving, if you were wearing your seat belt, and record from the microphone in the car, etc., all without letting you know.

What would they want that information for? Well, who knows, really. Perhaps they want to build better ZuperOne’s, or see what radio equalizers they should put in the next model. Maybe they want to evaluate engine performance by region compared to the recorded temperatures. That’s great, I guess.

But, what if they decided to sell your radio preferences to local stations? Or turn you over to the police for speeding? Or record your conversations in the car? Whoa! That would be bad, obviously. Your private life is just that, private, and it should stay that way.

The problem is that your privacy is being invaded, but you don’t even know it. Seems far fetched, but now replace that car with your cell phone. Built in hardware that is below the system level, available for the hardware manufacturer to use at their leisure.

So, back to the real world. What if the ZuperOne car was made OSHW? E.g., every part was specifically spelled out in the documents and drawing, all of the software was available for review, and you knew everything about the car? Then you would be informed that they are spying on you. You might not drive the same way, or go the same places. Or, you might ask your programming buddy to reprogram the source code to not transmit some (or all) of that data to the factory. Now you are not only informed, but you have modified it so you will not be spied on at all.

That is the goal of open source hardware. The OSHW stamp *SHOULD* mean that every part of something has been open sourced, allowing you to at least know what it is doing. In general, because they are open, they do not include any kind of spy ware, since you will obviously see it and not use it for that reason. Notice that it does not actually mean that there is no “back door” nor spyware, it just means that you are able to look at the code yourself and can see those issues, and that you have the means and permission to change them, if you want to.

So, what’s the issue? The problem that I’ve been running into is that some hardware is being manufactured, claiming to be open source hardware, only to find that it is *mostly* open source hardware. The question becomes, how much of a product needs to be OSHW for the entire product to be marked as OSHW? In my mind, it is black and white. To procure a OSHW stamp of approval and sale, the entire product must be made OSHW, and all of the components must be OSHW. But apparently, there are more than one opinions on that.

However, on the plus side, I have found one website that sells OSHW, and closed source hardware as well. However, they appear to be very diligent in marking and marketing each product as to it’s open source hardware status. I’ve also checked with a few other sites who have reviewed their products (since I’m not an engineer), and found them to be very reputable on what they mark as OSHW or not. That website is Olimex. There are probably others as well. If you know of one, be sure to drop a line in the comments. Although a little dated, there is also a wiki list of open source hardware projects that you can view.

Do I wear a tinfoil hat to bed every night? No. Just on Tuesdays (just kidding). But it would be nice to live in a world where your hardware wasn’t built to spy on you.

Linux – keep it simple.