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 :
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.