goto this link
https://thingspeak.com/login Click create one then fill all fields
We will define the channels by entering the a proper name, description, and up to 8 fields can be used to name the parameter. For the Field 1 and Field 2 we have named Temperature and humidity. These field values that you set can be modified later. These values will be in Degree Centigrade and Relative Humidity in %. Once you update the name, click on Save.
Once you have saved the channel, you will be automatically redirected to the “Private View” tab. Here the mapped fields are shown as a diagram. You will find the “Channel ID” (we will need it later). Below You will also see API Keys option.
Later, click on the “API Keys” tab. The two values of “Write API key” and “Read API key” are equally necessary for us to write or retrieve data. Copy these keys and keep it safe as we need to put it in the code.
import thingspeak import time import Adafruit_DHT channel_id = # put here the ID of the channel you created before write_key = # update the "WRITE KEY" in string form pin = 4 sensor = Adafruit_DHT.DHT11 def measure(channel): try: humidity, temperature = Adafruit_DHT.read_retry(sensor, pin) if humidity is not None and temperature is not None: print('Temperature = {0:0.1f}*C Humidity = {1:0.1f}%'.format(temperature, humidity)) else: print('Did not receive any reading from sensor. Please check!') # update the value response = channel.update({'field1': temperature, 'field2': humidity}) except: print("connection failure") if __name__ == "__main__": channel = thingspeak.Channel(id=channel_id, write_key=write_key) while True: measure(channel) #free account has a limitation of 15sec between the updates time.sleep(15)