How to Send Data to Cloud (ThingSpeak) using ESP8266?

IoT Extension
Description
Learn how to connect it to evive using the ESP8266 module. Get a comprehensive guide on using PictoBlox to program evive and send data to a ThingSpeak channel.

What is the Internet of Things (IoT)?

An internet connection is a wonderful thing, it gives us all sorts of benefits that just weren’t possible before. If you’re old enough, think of your cellphone before it was a smartphone. You could call and you could text sure, but now you can read any book, watch any movie, or listen to any song all in the palm of your hand. And that’s just to name a few of the incredible things your smartphone can do.

The point is that connecting thing to the internet yields many amazing benefits. We’ve all seen these benefits with our smartphones, laptops, and tablets, but this is true for everything else too. And yes, I do mean everything.

The Internet of Things is actually a pretty simple concept, it means taking all the things in the world and connecting them to the internet.

IoT is a system of interrelated

  1. Sensors
  2. Actuators
  3. Objects
  4. Animals or people

All things are provided with a unique identifier and have the ability to transfer data over the internet. No requirement of human-to-human or human-to-computer interaction

Classification of Things

In the Internet of Things, all the things that are being connected to the internet can be put into three categories:

  1. Things that collect information and then send it.
  2. Things that receive information and then act on it.
  3. Things that do both.

And all three of these have enormous benefits that feed on each other.

Collecting and Sending Information

This means sensors. Sensors could be temperature sensors, motion sensors, moisture sensors, air quality sensors, light sensors, you name it. These sensors, along with a connection, allow us to automatically collect information from the environment which, in turn, allows us to make more intelligent decisions.

On the farm, automatically getting information about the soil moisture can tell farmers exactly when their crops need to be watered. Instead of watering too much (which can be an expensive over-use of irrigation systems and environmentally wasteful) or watering too little (which can be an expensive loss of crops), the farmer can ensure that crops get exactly the right amount of water. More money for farmers and more food for the world!

Receiving and Acting on Information

We’re all very familiar with machines getting information and then acting. Your printer receives a document and it prints it. Your car receives a signal from your car keys and the doors open. The examples are endless.

ThingSpeak

ThingSpeak is an open-source IoT application and API to store and retrieve data from things. 

Applications

  1. Sensor logging applications
  2. Location tracking applications
  3. The social network of things with status updates

Creating Channel on ThingSpeak

  1. Create a ThingSpeak account.
  2. Create a new channel:
    Create Channel
  3. You can store up to 8 fields on 1 channel. We will store 1 parameter:
    ThingSpeak Create Channel
  4. When a new channel is created, you can see four graphs for each parameter:
    ThingSpeak Graph
  5. Get the Channel ID of your Channel (To be used while connecting to the channel):
  6. Get the Read and Write API from API tab:
    API Keys

Connecting evive to the Internet

To connect evive to the internet we will use the ESP8266 module.

Connect ESP8266 Module to its header on evive:

WiFi ESP8266

PictoBlox Program

In this example, we will be sending data to the potentiometer data to the ThingSpeak channel we have created.

  1. Open PictoBlox.
  2. Select the board as evive:
    Selecting Board
  3. Connect the evive.
    Select Port
  4. Add the Internet of Things extension in PictoBlox by clicking on the add extension button in the bottom left corner.
    Load Extensions
  5. Create the following script using when evive starts up block:
    sending data to ThingSpeak
  6. Upload the code onto evive:
    Upload Code

You can download the PictoBlox program from here: IoT – Sending data on cloud (ThingSpeak)

When you start your evive, you will see two things happening:

  1. M1 LED glowing:
    1. Yellow: Connected to Wi-Fi.
    2. Red: Not connected to Wi-Fi. Check if your Wi-Fi name and password are correct.
  2. M2 LED glowing:
    1. Yellow: Connected to ThingSpeak.
    2. Red: Not connected to ThingSpeak.

Output

Conclusion

The Internet of Things (IoT) is a revolutionary way for us to permanently connect all of the things in the world to the Internet, allowing us to collect and share data in ways never before possible. Through the use of sensors, actuators, objects, and even animals or people, IoT allows us to collect, store and analyze data, and then act on it. This could be beneficial in any number of industries, from agriculture to the medical field.

By connecting evive to the internet using the ESP8266 module, and then using PictoBlox to program it, we can easily send data to our ThingSpeak channel. In this way, we can start to explore the potential of the Internet of Things.

Table of Contents