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.

Radio check sat! Using 433MHz transmitter and receiver with Uno board….

transmitAndReceive

Now that picoEngine has reached version 1.0, I’m ready to work on a few other projects. Namely some electronic ones. Since Christmas, I’ve been holding on to a few Arduino Uno boards, and a pile of stuff for them. So, I broke out a few parts.

IMG_20190326_132946

I decided to start with the 433MHz transmitter and receiver.

There were several guides online, and I stole some code from them. I like starting any project with a known good source before stepping out into something I made, to make sure the hardware/software is set up properly. It was a great tutorial, and it worked.

However, there was one unexpected drawback: range. I knew these little transmitters and receivers were weak, but I didn’t realize that they literally only transmit an inch! As you can see in the picture, the Uno boards are almost touching just to transmit the data back and forth. I had purchased a few of these (three sets for myself, and two for my brother) with the intention of doing a few fun projects. Unfortunately, these wont transmit across my desk, let alone the parking lot, so I’ll need something else to work with.

But, these are still a fun learning tool, just a little lacking in the range department! Here are the sketches I used, keep in mind, you need the “radiohead library” installed in your IDE to make this work.

Transmitter:

#include <RH_ASK.h>
#include <SPI.h> // Not actually used but needed to compile

RH_ASK driver;

void setup()
{
Serial.begin(9600); // Debugging only
if (!driver.init())
Serial.println(“init failed”);
}

void loop()
{
const char *msg = “Hi World!”;
driver.send((uint8_t *)msg, strlen(msg));
driver.waitPacketSent();
delay(1000);
}

Receiver:

#include <RH_ASK.h>
#include <SPI.h> // Not actualy used but needed to compile

RH_ASK driver;

void setup()
{
Serial.begin(9600); // Debugging only
if (!driver.init())
Serial.println(“init failed”);
}

void loop()
{
uint8_t buf[12];
uint8_t buflen = sizeof(buf);
if (driver.recv(buf, &buflen)) // Non-blocking
{
int i;
// Message with a good checksum received, dump it.
Serial.print(“Message: “);
Serial.println((char*)buf);
}
}

I certainly like the simple code, since the radio head library does all the heavy lifting for you. Have any of you ever tried these out?

Linux – keep it simple.