In this post we are going to discuss how to upload temperature on thingspeak channel using sim 900 and arduino uno. As I had already uploaded the data on thingspeak channel using sim 900 and terminal software.
Introduction:
This project is a wireless temperature logger on thingspeak channel using gsm module and arduino.
For temperature sensor, we are using lm35, that gives output in millivolt which can be easily calibrated in terms of °C. We have to use adc module, since it's an analog sensor. Once the raw data is converted into temperature, we can upload the data.
Now, we are ready to upload the data on thingspeak channel. Thingspeak provides api for uploading of data. Before this, we have to use activate GPRS on sim900. We also to provide APN for accessing the internet. After activating the GPRS, we have to use GET like this:
Replace this api with yours, and data is the data you want to be upload. You can upload a number of field like temperature, pressure, humidity, etc.
Stuff you need:
- SIM900A
- Arduino uno
- LM35 (it's output is in degree celsius)
- 12 volt adapter (for GSM module)
- Jumper wires
- Account on thingspeak
Connections:
Arduino GSM module
Pin no. 7 ======> Tx
Pin no. 8 ======> Rx
Gnd ======> Gnd
Output of LM35 is connected to A0 of arduino uno.
Working:
Now coming to he working part, I am using sim900a module. It requires serial communication for its interfacing with arduino. It works on "AT" commands . Initially we can check our gsm modem using terminal software for quick testing as I had posted in the previous post. Now apn depends on the network operator e.g. I am using idea network and it's apn is "internet".
I will cover some important AT commands here:
AT // this is for testing whether our connection is correct or not
AT+CPIN? // whether sim is inserted or not
AT+CREG? // whether network is registered or not
AT+CGATT? // whether it is connected to internet or not
AT+CSTT="internet" // connect to this apm
AT+CIPSTART="TCP","api.thingspeak.com","80" // tcp is protocol, next is url that you want to hit and 80 is port for http
AT+CIPSEND // data can be transferred
GET http://api.thinkspeak.com/update?api_key=KTQXXXXXXXXXXXXX&field1=58 // there are two methods in http GET and POST, we are using GET
API should be correct and field1 is the data you want to upload. Field1 can be static data or it can be variable. You can also add more field.
After this we have to pass char 26 which indicates end of data.
Graph |
Check out the video:
i am getting AT+CIPSEND ERROR
ReplyDeleteMay be your apn is wrong or there is some problem with your url
Deletewhere can I get arduino code ??
ReplyDeletecould you please help??
Download source code from the link below:
ReplyDeletehttp://funwidelectronics.blogspot.in/2017/02/temperature-logger.html
how can I add more field ??
ReplyDeleteIf you wanna add more fields in thigspeak, there are options in the thingspeak page (private view)
Deletehow i can get continuous data reading?
ReplyDeleteHello. Thanks for your device! Thank you, I was able to collect this and I like it. I want to go further and upgrade the device so that the data is taken from several different sensors. But I do not have enough knowledge to change the code, please help. I need to understand how the string will change so that the variables can be sent to different fields.
ReplyDeleteThank you.
GET http://api.thinkspeak.com/update?api_key=KTQXXXXXXXXXXXXX&field1=58
DeleteCan you provide the code for 2 fields
ReplyDeleteI want code for this one
ReplyDeletei have connected the GSM modem to my PC and then i am send commands to the GSM Modem using terminal Software.
ReplyDeleteThis is what i am sending:
AT
AT+CPIN?
AT+CREG?
AT+CGATT?
AT+CIPSHUT
AT+CIPSTATUS
AT+CIPMUX=0
AT+CSTT=”www”
AT+CIICR
AT+CIFSR
AT+CIPSTART=”TCP”,”api.thingspeak.com”,”80″
AT+CIPSEND
GET http://api.thingspeak.com/update?api_key=X4L3QD19Q7YSLK3J&field1=125
#026
When i use GET instruction and then send 026 i get SEND OK from the modem and then CLOSED but thingspeak channel is not updated.
Please help