Sends a Sms With Temperatur on Time

5,995

41

12

Introduction: Sends a Sms With Temperatur on Time

About: electronic beginner + Do things for fun, interest, play My answer is only from my own knowledge as status beginner and the internet search engine

The idea is to get a temperatur sms from my fathers house.

Nothing fancy just quick putting parts together.

The parts are :

  • Geekcreit® ATmega328P Nano V3 Controller Board Compatible Arduino
  • DIY NANO IO Shield V1.O Expansion Board For Arduino
  • DS1307 Based RTC IIC / I2C Real Time Clock Module and DS18b20
  • SIM800L Quad-band GSM / GPRS
  • LM2596 Mini DC-DC Converter Adjustable Step Down Power Supply Module
  • Thermistor NTC MF52AT temperature

First at all a lot off reading and searching.

Befor I finally use the Geekcreit® Nano, I test all parts with a Arduino Uno.

Step 1: Get the SIM800l to Work

One main point is the power for the Sim800L.

I use a LM2596 Mini DC-DC converter, adjusted to 3.7 volts and a separate power supply.

To test connection with AT+ commands this side is very usable :

Quickstart SIM800 (SIM800L) with Arduino

With Disable pin code using gsm modem at commands I got ride of the sim pin code.

The next consideration which library. The internet offers different solution.

My solution is the library from Mattias Aabmets : AspenSIM800

His exampel : Send_SMS.ino used I as basic programm and one by one connect all the other parts together.

The Tx pin and Rx pin are code to :

RX_PIN 10 of Arduino. Must be connected to the TX pin of the SIM800 module.
TX_PIN 11 of Arduino. Must be connected to the RX pin of the SIM800 module.

It is always good idea to read the *.ccp and *.h files in the libraries.

They contains many interesting hints and knowledge.

Step 2: Get the RTC DS1307 With DS18B20 Sensor to Work

I used this side side : simtronyx - the blog for the DS1307 and DS18B20.

The clock has a I2C bus connection and that is for the Arduino Uno : A4 (SDA) - A5 (SCL)

The DS18B20 I connected to D3.

I read that in a SMS you can't send Floats only String, so I had to translate floats to string.

That I do with this code snippet I found :


MyString1 = String(currentTemp, 2); //Convert float to String

MyString1 = (MyString1 + " C - RoomTemperatur :) ");

// convert string to char starts here

// Length (with one extra character for the null terminator)

int str_len1 = MyString1.length() + 1; // Prepare the character array (the buffer)

char char_array1[str_len1]; // Copy it over

MyString1.toCharArray(char_array1, str_len1); // convert string to char ends her

I will be honest I don't how it works, but it work.

Step 3: Get the Thermistor NTC MF52AT to Work

I worked befor with a thermistor so it was the easy part.

But also here you can finde different solution.

In the finaly code you can finde mine.

Her you can also finde the translation Floats to String.

Soldered some wire and the 10 k ohm resistor to the thermistor.

Step 4: Get All to Work Together

So I wrote all programm parts together.

Now I had to figure out how send one SMS every day, at the same time.

I read about diffrent idea's, some with a TimerAlarm and other approach.

But I found a simple solution some place in the arduino forum :

if (now.hour() == 8 && now.minute() == 00 && now.second () == 59)

{

SIM.smsSend(addr, char_array); // thermistor

delay(500); SIM.smsSend(addr, char_array1); // DS18B20 }

But why now.second = 59 because it sends a whole minut SMS. It does for me but try out yourself.

After some test I uploaded the programm to the Geekcreit® Nano.

This is mayby not the best programm writing :) but it does the desired.

Because the Geekcreit® ATmega328P Nano has some Arduino IDE problems, I upload by terminal( Linux Mint) throw the USBtinyisp with this: avrdude -c usbtiny -p atmega328p -U flash:w:SomeHexFile.hex


Step 5: It Worked

Yes it worked out and it is placed in the house.

Every day at 6:00 am I get a SMS with the temperatur.

Be the First to Share

    Recommendations

    • Make it Glow Contest

      Make it Glow Contest
    • First Time Author Contest

      First Time Author Contest
    • PCB Challenge

      PCB Challenge

    12 Discussions

    0
    henrikostrov
    henrikostrov

    Question 1 year ago on Step 4

    hi i have a broblem my gsm god or the gsm. h library dosent like the rtc clock whath he uses aswell its giveing really wierd error messages put each code seperetly works fine whats is the problem

    0
    SebastianB2
    SebastianB2

    Answer 1 year ago

    Hello Henrik it is difficult to help I you not show your program and the weird error messages.
    With kind greetings from Denmark

    0
    nanoprof
    nanoprof

    Question 1 year ago

    Bonjour,impossible de compiler pour aucune carte? Une idée? Merci d'avance

    0
    SebastianB2
    SebastianB2

    Answer 1 year ago

    Google translate :
    Je pense que le problème est que la bibliothèque de Mattias Aabmets: AspenSIM800 ne fonctionne pas avec Arduino ide 1.8.2.
    Vous devez vous occuper d'une nouvelle bibliothèque pour le module SIM800 et réécrire le programme
    -----------------------
    I think the problem is that the library from Mattias Aabmets : AspenSIM800 don't work together with the Arduino ide 1.8.2.
    You have to look after a new library for the SIM800 modul and rewrite the programm

    Greetings

    0
    anastasistef
    anastasistef

    1 year ago

    Hello
    Because I would like to place this project in a
    hive and would like to save the battery energy.

    I would be grateful if you could add the ability to put the
    system into energy-saving mode to have
    the battery longer life.

    Best Regards

    0
    SebastianB2
    SebastianB2

    Reply 1 year ago

    Hello,
    you can maybe use the Adafruit Watchdog Library or similar.
    Or search for " arduino sleep "
    Greetings

    0
    AyO6
    AyO6

    1 year ago

    I have arduino mega whats pin i use for simm 800 please ?

    0
    SebastianB2
    SebastianB2

    Reply 1 year ago

    TxD pin to digital 51 and RxD pin to 50 so you have to change the pin in the sketch.
    Maybe this video on YouTube will help :

    0
    AyO6
    AyO6

    1 year ago

    Do u. Receive one sms on phone or two sms!?

    0
    SebastianB2
    SebastianB2

    Reply 1 year ago

    I think i made it to receive 2 SMS, I do not use it any more, the house where I used it is sold.case
    for 2 SMS you have to make to time events.
    As an example :

    // first SMS :
    if (now.hour() == 8 && now.minute() == 00 && now.second () == 59) {

    SIM.smsSend(addr, char_array); // thermistor
    delay(500);
    SIM.smsSend(addr, char_array1); // DS18B20
    }
    //second SMS :
    if (now.hour() == 8 && now.minute() == 05 && now.second () == 59) {

    SIM.smsSend(addr, char_array); // thermistor 2
    delay(500);
    SIM.smsSend(addr, char_array1); // DS18B20 2
    }

    0
    MillennialDIYer
    MillennialDIYer

    3 years ago

    So do you need an active SIM card for this to work?

    0
    SebastianB2
    SebastianB2

    Reply 3 years ago

    Yes, I bought the cheapest. The SIM800l modul has only 2g as I know, but that is enough for send sms. The 2g net still operates in Denmark.