Arduino and SIM900 GSM GPRS 3G Temperature and Humidity logging, Mobile stats

DIY, IoT Platform, , , , , , , , ,

With Arduino UNO R3,  SIM900 Shield AND DHT22 you can log temperature and humidity data outside, in room, greenhouse, lab, cooling room or any other places completely free. This example we will use to log room temperature and humidity.

Device will be connected to internet via GPRS 2G, so can be used even without existing Router or wired internet connection. Best for fields, vineyard or similar places without fixed internet connection.

You will be able to check latest readings on your mobile phone, desktop or any other device with browser.

1. You need hardware parts to make logging device

You can purchase needed devices here (minimal required):

Also nice to have:

This also tested/works with industrial AM2305 sensor:

2. Add your device to LoggingPlatform

Here you can add your device to get api keys needed later: https://loggingforest.com/index.php/page/pricing

3. Hardware connection

Insert SIM into GSM module Shield

Connect Shield to Arduino

Connect Power adapter and USB to PC

Connect DHT22 Out to GSM shield PIN 10

Connect DHT22 + to GSM shield 3V

Connect DHT22 – to GSM shield GND

Connect LED if you want status indication, not required

Diagram example:

 

4. Upload software needed to device (Windows Guide)

Download and install Arduino IDE: https://www.arduino.cc/en/main/software

Connect device to USB on your Windows PC, and install drivers if needed

Run Arduino IDE

Select COM port (this is usually larger number if you don’t have other devices connected):

Select Board type:

Download and open source code:

You need to have libraries:

SoftwareSerial.h – this is usually included in Arduino IDE

and

DHT.h – you can download here  and copy to your arduino library folder like: C:\arduino-1.6.8\libraries

SIM900 code for logging is available here

Open this SIM900 code with Arduino IDE:

Change this parameters.

APN you can get from your SIM card provider

And other from loggingforest platform: https://loggingforest.com/index.php/page/pricing :

Some code notices:

Standard libraries for SIM900 doesn’t work properly for repeatable  tasks like logging, so we communicate directly with serial SIM900 AT Commands

If you using different shield maybe you need to define different RX, TX pins in code

When using (not debugging or testing) you should disable DEBUG_EN, change from true to false

For manually network selection with SIM900, if you living on country border, you can uncomment this lines and define network code provided in serial, so like:

network code like 21910 for A1 can be found in COPS line:

If your code stuck on TEST AT, means that you power adapter doesn’t give enough power for SIM900, best to use 5V 2A or 9V 1A.

Some sim providers may require USER and PWD for apn connection, you can also define in code.

After that your device will start sending data to loggingforest and you can see it there

In loggingforest device edit just define parameters name and values:

Click on preview:

And you will see nice data:

Feel free to comment and share your logger

 

Facebook Comments