body, html {font-family: 'Open Sans', sans-serif;} #nav a, #nav span.in{font-family: 'Open Sans', sans-serif;} #title #tagline {font-family: 'Open Sans', sans-serif;} #main .gridItem h3 {font-family: 'Open Sans', sans-serif;}

SMS auto answer

New idea: I’m thinking all the time about, what could be my next Arduino cache. A Simon Says? Maybe the cachers here in the north of Germany would be very happy, but on YouTube you can find a lot of versions. Most in the States. I want to built something unique and the first time, because the „Arduino part“ of my Lili cache was already realized more than once (again in the States) as „Geocache reverted“. 

I just bought a GSM module for the Arduino (unfortunately „sold out“ at Amazon.com, but not at Amazon.de! Advantage Germany!!!)



and an idea is coming up: Cacher will go to a station and has to find out, that he has to key the number of his own mobile onto a keypad. After that the cache will send him a SMS containing the code to unlock or showing the coordinates of the next station or… I don’t know yet.

This idea is in a very first draft stage (far away from being „alpha"). But I think, it would be challenging. Especially for me. I need to understand programming the keypad and the GSM module as well. But there’s an advantage on my side. I don’t need to prepare a celebration with more than 400 (or already 500???) guests… On the other hand this advantage will disappear within some hours…


Sunday, 13.9.2015: One cache repaired, new idea on GSM Arduino

Yesterday I repaired station 3 of my Cash cache and brought the listing back to life…

In the meantime I searched the internet for more information about my GSM board. I found a lot of documentation. Unfortunately most in Chineese, what I’m not able to understand… But I found this (English) video on YouTube exactly about „my“ GSM board:


My idea how to use the GSM Arduino changed. 

Due to the fact that the Arduino with the GSM doesn’t need to be in or nearby the cache, it will stay in my office. (It took some time to realize, that working with GSM, this GSM Arduino can located be somewhere in the world… Ah, not really! Because of the roaming cost, it should stay somewhere in Germany. So it will be my office at home.) This will allow me, to use it not only for one time, but for multiple caches in future. The main principle:

  • Cacher will be at station X of cache Y
  • Cacher needs to solve a puzzle with the answer „1234“
  • mobile number of the GSM Arduino shown to the cacher
  • Cacher sending a SMS like this „Y-X-1234“
  • GSM Arduino sending a SMS back with the solution or the coordinates of the next station or…


What do you think about? Now I „only“ need to learn how to interact with the GSM board...

During the afternoon I started programming of the GSM Arduino. I’m waiting for a prepaid SIM, because all my are nanoSIMs. The SIM should arrive on Tuesday.

The sketch is prepared to be tested with hardware. What does this mean? I set everything up to receive a message for one single cache and one single station and the GSM Arduino should reply and sent an additional message to my own mobile, telling me, who has sent an SMS and for what cache / station. Compiling is without errors, so let’s see how it will work when wired to the hardware. 

The sketch you can pick from here (still a beta version…)

Because text (strings) will need a lot of memory, I’ll set this one up with an Arduino Due (€26,40) or Mega (€17,99). They’re offering plenty more space of RAM and Flash.

Both bought from Amazon as clones:



A click to the pictures will bring you to Amazon (Germany)...


Monday, 14.9.2015: GSM Arduino Sketch prototype finished - something learned...

Today I finished the prototype of my GSM Arduino sketch. Why prototype? Because I set up the sketch, but without hardware connected. Today the prepaid SIM arrived, but it will take up to 24 hours up it will be activated. 

I discussed some topics with a member of my staff, who’s an expert in electronics:

1. TC35 GSM board and Arduino Due - different voltages

The TC35 GSM module seems to be a „normal 5V“ device, while the Arduino Due is a 3,3 V device. So I had some fear, that I need to do something. But this is wrong: The Due will accept even 5V at his pins. But also the TC35 runs with 3,3 V. So from both sides „no problem“. When the TC35 is triggering „High voltage“ with 3,3 V, this is also accepted by a 5V Arduino as high…

2. TC35 GSM board and Arduino Due - GSM library

When I worked in Arduino IDE having my GSM sketch open, I chosed the Due as hardware. Error message saying, that the GSM.h library doesn’t work with the Due. Inside the Arduino forum I found, that that’s really the case and Arduino is promising to have the GSM.h library running on the Due since March 2013 (!!!) within (first weeks, later) months. It’s still not the case. So you should be quite careful, when deciding to do something on a Due.

3. My sketch on a Mega - plenty of space!

Have a look to this 2 screen shots:



With an Uno I have already used 79% of dynamic RAM and only 416 Bytes are still available. The compiler is stating a warning, that problems with stability might occur.

With a Mega2560 I have only used 19% of the dynamic RAM and 6.560 Bytes are still available. 

Due to the fact, that the Mega clone I’ve bought for € 18 while and an Uno clone is available for € 11, you should think twice, when buying an Uno… Especially strings inside the sketch (plenty of them in both of the sketches I wrote up to now) are quite RAM consuming…

Funny: The same sketch is using some few Bytes more on a Mega…


Tuesday 15.9.2015: nearly no time, but...

Today, as I fear like the full week, I have not time really to work on my hobby. I was thinking about to have a date and time stamp for the latest call (SMS) my GSM would receive. I spent some time on different threads inside the Arduino forum but at the end I discovered, that a library Time.h is existing, offering all I want.

So I’ll added a new part into my sketch: If in future I’ll call it from my mobile, it will not only answer to me (if online), but will send the latest number of the one, who sent a SMS with a time stamp, when he called.

In the late afternoon I drove to box to get 7 packages with >7 items for building this stuff. As I said: My credit card (or more precise - my bank account) is crying… Beside of some other stuff I just unboxed the Due and the Mega clones and both are looking pretty fine…

Because I don’t update my Arduino page, I just decided, to make this side public (means showing it inside the menu of my site…


Thursday, 17.9.2015: still no time, but a little bit progress…

What a shit! I really have to work to earn my money. In addition my job (as a volunteer) as the chairman of the board of the nursery my wife is leading becomes more and more time consuming, because we’re just doubeling the places for children. The new builing is just starting to grow…

But my sketch for the answering GSM Arduino is nearly finished. What does it mean? No errors when compiling. But uop to now I didn’t set up the hardware. All stuff is waiting on my desk…


But if the sketch will do, what I’m expecting, is more than on risk. As you’ll see, I’ll bring together 3 boards:

  • an Arduino Mega board
  • a TC35 GSM board and
  • a DS1307 Real Time Cloach board


The lastest version of my sketch you can pick here.


Because the condition of my father in law is decreasing very fast, my wife and me will stay on the isle of Usedom in the very North-East of Germany over the weekend. A 3,5 hours ride on Friday to the island and on Sunday back means, no time for any work on my hobby…


Saturday, 19.9.2015: On Usedom I fetched it...

Since yesterday afternoon my wife and me are staying at her parents at Ueckeritz on the most east island of Germany in the Baltic Sea. 


It’s just a 15 minutes ride by car to enter Poland at „Swienemünde“. Cigarettes are nearly 50% cheaper there and you can buy a lot of clothes at the open market. All is looking quite awful and the brands are all fakes. But the quality is extraordinary. During the past years I bought a lot of shirts, polos, sweaters etc. Most times for 1/4 to 1/5 of the original price of th brand (e.g. I like „Paul & Shark“ from Italy or „La Martina“ from Argentina). Never I regret a buy...


Weather is quite fine, I have to prepare everything in the kitchen, but I also found some time to think about the sketch, I included into mine. I had the problem with calling a subroutine and was quite frustrated, to perform that with a function, which must give back a value when I only wanted, the subroutine is doing something: Here’s an example, how I did it:


It worked, but from my point of view that was what we called „Spaghetti Code“ in the past. So I had a deep look to the „Send SMS“ sketch I integrated into my sketch. And suddenly I understood: 

The function (or subroutine as I would call it with my knowing from the dark years of programming roughly 40 years ago) must be a „void“ itself. Have a look here:


When I’ve fetched it, it was looking soon easy! 

Based on that, I’ll modified my GPS sketch and the GSM also… (Links were updated…)


Monday 22.9.2015: Confusion & I killed the GSM board & a new idea

Yesterday I spent some hours in setting up the hardware wiring but no success. Today Eric gave me a hint, which PINS to use for TX and RX for the GSM board with an Arduino Mega. Unfortunately I wasn’t able to test, because it seems, I killed the GSM board. The „connect LED“ is dead.

I spent such a lot of Euros in the past, that a new GSM board doesn’t impact my bank account so much. Ordered and I’ll report about the next steps.

A new idea came up: Building an Arduino with an air pressor sensor. When found, a LCD will ask the cacher to go up e.g. by 30 meters within the next 30 minutes. Maybe it’s a hill nearby, a tower of a church… When done, he’ll receive the next coordinates or a hint or… The sensor is already ordered. But wiill take time to arrive from China. Doesn’t matter, because there’re still a lot of things to do:

  1. Finalizing the Lili cache
  2. Repairing my Lego cache
  3. Bringing my GSM Arduino to life


Friday 25.9.2015: Still hoping...

In the meantime a new GSM board arrived and I had a lot of issues with it. One I solved, but the Arduino is still not communicating with the board. This is why I bought an USB-TTL adapter. (In the States you can get it from Amazon like me in Germany.)


I'll connect the GSM board with this adapter directly via USB to my iMac to check, whether the board is dead or I’m too blonde to built up hard- and software well. This test should be quite easy: Connecting, opening the Arduino IDE and keying some AT comands into the serial monitor. The GSM board should reply. (See roughly in the middle of the video, i linked above…)

Tomorrow the adapter will arrive. If the bord is dead, I’ll send both back to Amazon. If not, I’ll try to fix the problem. To be honest, at this moment I have no clue, what to do… If I won’t be successful in the short term, I’ll bring this adventure to an (unhappy) end by putting both of the boards into the bin…


Saturday, 26.9.2015: The GSM board is alive, but...

The USB TTL adapter arrived today. I connected the GSM board to it, plugged the USB in and opened the Arduino IDE. Tried to open the serial monitor, but failded. No serial port (a lot, but not the new one) detected. Quite frustrated I started Windows 7 (arrrgrrrh) with VMWare on my Mac, installed the Arduino IDE, looked to available USB devices, connected it and:


The GSM board is alive! 

Why Windows via VMWare is detecting an USB port, but basic OS X not, is a miracle for me. And I have no idea, what to do now…

Maybe I should really work on other things!


Successfull weekend (18.10.2015): 

Arduino SMS Answering Device in beta !

Last Friday I decided, to buy an Arduino GSM Shield 2. It’s much more expensive than the 3 clones (SainSmart TC35), which drove me and my collegue crazy. I gave a last chance to me, to built my SMS answering device with this shield. My expectation wasn’t really good, because the comments at Amazon were quite worse. But after some hours of programming it’s working. First have some looks to the hardware:


As you can see, I bent pin 2 (that’s the third one from left in the top row. The first pin is called 0) away, because I’ll use the shield with a Mega. The GSM.h library is using pin 2 and 3 for the board when connected with an Uno, while the Mega is using pin 10 and 3.



The shield is now on the Mega and a jumper wire is connecting pin 2 and 10.



Here you can see the SMS sent from the iPhone of my wife. Every SMS must have a structure like this:

#cccccc#aaaaaaaaaaaaa….aaa

Starting with a #

cccccc: is the 6 digit GeoCaching code of the cache

A # is separating the GeoCaching Code from the suggested answer.

aaaah…aa: is the suggested answer the cacher is sending to the device

If there’s no # at the beginning of the SMS, it will be rejected. Also the second # after the code is a must! In this example, „Test von Tina“ will be handeled as a correct answer. So the device answered back as shown. As you’ll see, I’m converting all lower letters to upper ones inside the sketch.




When I’m calling with my mobile the device, it will notice, that it’s me and report, who was the latest caller to the device.

I’ve planned to add a real time clock breack out to the hardware, to be able to set correct time stamps. But at this moment, I won’t do that just now, maybe later. I’ll start to properly built the hardware into a housing:



I’m just thinking about to add a bread board at least with one LED showing the GSM board is connected with GSM. I’ll work on it just after lunch...


And I finished it. The RTC already sticking on the bread board, but not used… I did it with 3 LEDs: When starting and there’s still no connection, the red and the yellow LEDs are on:


When connected and ready for receiving and sending SMS, the green LED is on (and the red and yellow ones off). When receiving a SMS the red LED will shorly turn on, when sendig a SMS the yellow one.

The resistors are resistors (68 Ohm for green, 150 Ohm for yellow and 180 Ohm for red), no diodes!!!


The wiring is explained on top of the sketch.

Finally I put it on the window sill of my office at home:


The current sketch is programmed for you to test it. (And alreday inside the DropBox under „joint caches“ ready to be copied by you). 

You need to send a SMS with exactly the content as shown (if different, you’ll receive a different answer). Please be sure, to put a blank after your nick, because your nick is only 5 characters:

Send SMS to: +4915162477196

Content: #WVTim__#Hello Olaf

Exactly like this. The „__“ is for 2 blanks. No additional blanks (for sure inside aaaaaaa they are allowed. So „ ello Olaf“ too), but no dot at the end… Try it. If you’ll receive no answer, it might be, I’m working on it. But next time it’s running, you’ll receive a reply…


Working on the SMS sketch, struggeling with RTC module, Mega burned, not enough time, this time…  (20.10.2015):

I worked on the beta version and added some features. 

Flashing LEDs: Overtime when the loop is coming to the end, a subroutine is called. This subroutine is working with 2 values. The first one is the the definition of the LED, which should flash and the second one is telling the subroutine, how often the LED should flash. I’m setting two counters for the total amount of SMS received and sent (since last start of the board). In addition I wrote the sketch in a way, that the flashes are grouped to 5. A 7 is shown like this: Flash-Break-Flash-Break-Flash-Break-Flash-Break-Flash-Long Break - Flash-Break-Flash-Break. 


RTC break out: Im working with this real time clock (RTC) module:

There’re a lot sketches available to work with this module. But many of them don’t work, because they’re using old libraries, no longer existing or once no longer valid. At the end I used this one. Most of the sketches are It took me a long time to discover, that most of the sketches a written for an Uno and with an Uno pins A4 and A5 are used. But on a mega board there’s separate pins for SDA and SLC (pins 20 and 21) available. 

The sketch worked quite fine. I only had the problem, that after answering with „y“ to key in the current date and time, the first read for the year was done automatically and the sketch was waiting for input of the month. I „repaired“ that quite ugly by having the „read year“ line doubled. After that, the separate sketch went perfectly.

In a next step I tried to integrate it into my SMS sketch. I „converted“ everything into subroutines. But it didn’t worked: I called the „set time part“ from inside the void setup and the result was, that the program no longer went through this part completely. As a work around I deleted the complete „set time part“, started the RTC only sketch, set the time, started the SMS part again. Not really elegant, but working.

Now I only integrated the „read time“ and „print time parts“. But again my sketch showed some crazy behavior: The void loop wasn’t running through it’s end but the void setup came up again and again. Up to now I didn’t found the reason…


Mega burning: During all that exercises suddenly the upload of the sketch to the Mega failed. Just prior the upload was finished, I received an error message saying that there’s a stack overflow on the board. I tried it several times - every time the same result. I googled and became aware that the board might be damaged. Ok, some minutes ago it was fine and now damaged? Fortunately I wasn’t owning only one Mega. I tried the other one and the sketch was uploaded without any error. So the first one seems to be really damaged. 

I continued working with the second one, but I wasn’t able to make it running. 

The Chineese clones are quite cheap, so I ordered 3 additional Megas for „emergency stocking“. Unfortunately the ones from Soundfounder aren’t available at Amazon at this moment, so I ordered clones from „SaintSmart“ (I have an Uno clone from SaintSmart and it’s running well.). And because the shopping cart was still quite empty and the Mega is out of stock at Arduino (why???) I added an original one in addition. In some days I will be prepared for everything.


Not enough time, this time: As you, Tim, I don’t have enough time this time. First there’s my job. In addition there’s some chaos at the nursery. Childs becoming ill (not a real problem when they’re staying at home), but first they’re infecting the staff. A lot of them also ill. Many things to manage because of the new building and doubling the size of the nursery. Last not least: One of the new employees showed a behavior on Monday, that I need to fire her yesterday, with direct leave after my wife handed over the written dismissal. Today there’s an info session with the parents. And I, as the chairman of the board, need to talk about some topics also. Especially those parts are becoming „my part", the parents might not love to hear. On Friday my wife and me are flying to her sons, family and especially granddaughters near Stuttgart. We’ll be back on Sunday. So no time for modifying sketches...


Working on the SMS project (22.10.2015):

The clip below is showing the Mega and the GSM shield on top of the damaged Mega. I had no time to replace it. More intresting are the LEDS:

The green one is showing that the board is connected to the GSM carrier.

Running through the loop, the red LED is flashing. It’s showing the amount of SMS received since last start of the board. The yellow LED is showing the same for the SMS sent by the board.



Finishing to work on the SMS project (26.10.2015):

Today I reworked at first the RTC part of the sketch. Everything went fine. Last time I included the RTC part to my SMS sketch. Now I did it the other way: I included the SMS part to the running RTC sketch. At the end, it seems to be the same. What happened:

  • I destroyed the boot loader again and had to refresh the Mega.
  • I discovered that the 3 LEDs are very very dim. So my hypothesis is that the GSM board is consuming most of the power of the 5V out of the Mega. (I was already wondering that the original Arduino GSM board doesn’t need any external power supply while the clones said, they’re needing stable 5V up to 
    >2A).


So I decided to keep the SMS answering device as it is. The real time isn’t a real need, it would have been a gimmick only.

I have 2 of this RTC break outs. I’ll need some ideas to include them into new projects...

In a nutshell: The SMS answering device is finished (with version 1.03 at this moment). I’ll start now to integrate it into existing caches as a replacement of the hints inside the listings.

Btw: I spent roughly 7 Euros in SMS up to now for testing. I reloaded the prepaid SIM to 18 Euros at this moment. I think, this will be enough for the next months.


Crazy Calculation by Arduino (11.11.2015):

At the moment I’m working to add a 4x20 LCD to the device. Beside other information I want to show how long the device is up and hiow long ago the last SMS was received. I was struggeling with the calculation and I found this crazy result:

Crazy Calc Sketch


Both variables a and b do have the same defintion (unsigned long) and the calculation should be the same. But that’s the result:

Crazy Calc Result


The second one is the correct one… Any ideas???


Prototype with 4 x 20 LCD (11.11.2015):

I’m working to integrate a 4x20 LCD to the hardware. Here’s a first view on the prototype:

IMG 1245

 

Meaning of the lines:

Line 1: Amount of SMS received and sent since last power on
Line 2: Time passed by since last SMS received
Line 3: Telephone number of the last sender of a SMS
Line 4: Time passed by since power on


I hope 2 new LCD will arrive tomorrow and I’ll find some time to built the final version…


You can pick the full sketch here



©  Olaf Goette 2008 - 2022