Skip to main content

Soil Moisture sensor with Arduino in Tinkercad | how to use soil moisture sensor in Tinkercad

  Soil Moisture sensor with Arduino in Tinkercad | how to use soil moisture sensor in Tinkercad Circuit diagram: Arduino Sketch: // C++ code // int moisture_data = 0; void setup() {   pinMode(A0, INPUT);   Serial.begin(9600);   pinMode(12, OUTPUT);   pinMode(6, OUTPUT); } void loop() {   moisture_data = analogRead(A0);   Serial.println(moisture_data);   if (moisture_data < 21) {     digitalWrite(12, HIGH);     digitalWrite(6, HIGH);   } else {     digitalWrite(12, LOW);     digitalWrite(6, LOW);   }   delay(10); // Delay a little bit to improve simulation performance }

Getting Started with the Arduino IoT Cloud using Esp32 & DHT-11

 

Getting Started with the Arduino IoT Cloud using Esp32

Introduction:

The Internet of Things has given rise to plenty of exciting new projects for makers. It's both interesting and practical to be able to develop remote sensors and gadgets.

Allowing IoT devices from multiple manufacturers to interact with your innovations will open up a lot of possibilities, including some you might not have considered before.

In this getting started guide of Arduino IOT cloud we will learn about how to use Arduino IOT cloud with Esp32 board.

Arduino IOT cloud

What is Arduino IOT cloud?

Arduino IoT Cloud is a web-based service that allows users to create connected devices quickly, easily, and securely. Multiple devices can be linked together and data can be exchanged in real-time. Users can also able to monitor the data using a simple user interface from anywhere. one can also use the android application for monitoring and controlling the devices.

Because Arduino IoT Cloud is completely integrated into the Arduino Create ecosystem, one can easily create a template code in Arduino IoT Cloud web-based editor and upload it to your board.

 

















Setting up the Arduino IOT cloud account

How to set up an Arduino IOT cloud account?

A few basic steps are required to set up the Arduino IoT Cloud and explore the various capabilities available. So, let's look at how to get from point A to point B!

 Creating an Arduino Account

For using Arduino IOT cloud Platform we need to sign up for the Arduino account just click the below link

https://id.arduino.cc/?iss=https%3A%2F%2Flogin.arduino.cc%2F

Go to Arduino IoT Cloud

Now you have successfully signed up for the Arduino account, you can access the Arduino IOT cloud by clicking the link https://create.arduino.cc/iot











Creating a thing

how to create a thing in Arduino IoT cloud?

Inside creating thing in Arduino IoT cloud there are 3 steps we need to complete

  Adding Variable

2.                 Adding Device

3.                 Setting up the Wi-Fi credentials.

The way to the Arduino IOT cloud begins with creating a new thing. in this section need to select the device that we are going to use, in our case we are using  3rd party device that is Esp32 board.

Next, we will select the Wi-Fi network to which our board is going to connect, after this, we need to create variables to store the temperature and humidity so that we can monitor the sensor data over the dashboard.

This is the area where whatever changes that we have made are automatically generated into the Arduino Sketch file.

Let's follow the picture step to add a Variable.







This is where you'll make changes to the parameters of the variables.

Begin by naming the variable in the same way that you would any other variable in Arduino programming. Here I am declaring the variable name temperature for storing the temperature value.

After that, we can choose a variable type. There are several types to pick from, including several "special" types you've probably never seen before.

After that, we can choose a variable type. There are various sorts to pick from, including several "special" types you've probably never seen before.

Here I am choosing the temperature in degree Celsius as a variable type

After you've chosen a type, you'll see the variable declaration printed below it, in the same format as an Arduino project.

The variable permission must be addressed next. Here you have two options:

 read and write

Only read

You'll need to pick Read & Write for an LED because you'll need to be able to write to it to control it. If this had been a sensor like our DHT-11 read-only would work.

Finally, there's the Update Policy variable. You have two options once more:

On change — When something changes, update the variable.

Periodically - Update the variable after a set amount of time has passed.

       Do the same thing for the humidity variable

Write the name of the variable as humidity and then select the variable type relative humidity

And click on add variable.

after that add the last variable that is message ad select the variable type as a character string.




















Adding the device

How to add the device in Arduino IoT cloud

Now click on the Setup 3rd party device










SSelect the esp32 dev module











Next, rename the device

By default, Arduino IoT cloud selects the name of the board also you can write your name of the board.











You'll now be provided with a screen that reads "Secret Key." You'll need to copy this key because it's the only place you'll see it. You can copy it by clicking the symbol next to it or downloading the key as a PDF document.

After you've double-checked that you have a copy of the secret key, you can go to the next step. Your ESP32 configuration will be finished.

It's now time to configure your network credentials. In the Network section, click the Configure button.


You'll notice that instead of two parameters, you'll need to offer three parameters.

1.               SSID name

2.               SSID password

3.               Secret key

Schematic [Esp32 & DHT11]         

Connection:

Dht11 sensor has 4 pins that are VCC, DATA, NC, GND

Connect VCC pin to Vin pin of the esp32 board, data into digital pin 13 of the esp32, and GND pin to GND pin of the esp32 board.

Connect the esp32 board to your desktop with an appropriate MicroUSB cable once everything is connected.

 Just click on sketch then

You'll be redirected to the simple sketch editor if you click the Sketch tab. You can continue working on your sketch here, or click the Open Full Editor button to launch a more powerful editor, akin to the Arduino IDE software.

Adding Arduino Sketch:

Simply click on the sketch and follow the prompts.

If you click the Sketch tab, you'll be sent to the simple sketch editor. You can either continue working on your sketch or click the Open Full Editor button to open a more capable editor, similar to the Arduino IDE software.

you need to do a few changes here like adding a library for the DHT-11 sensor.

The sketch framework is already developed, and it includes information about the cloud variable we just established in the header.

This variable is already defined in the thingProperties.h library, which is included with your sketch, so you don't need to specify it in your sketch. You may look at this file in the advanced editor; it contains definitions for your variable(s) as well as a declaration for a function connected with the variable change event. There's also information on the cloud and network connections.

you can copy the necessary part from the following code and paste it into your Arduino sketch and you are good to go

#include "arduino_secrets.h"

/* 

  Sketch generated by the Arduino IoT Cloud Thing "Temperature and Humidity monitoring"

  https://create.arduino.cc/cloud/things/b03581ea-7134-40e3-92db-cffc33abfa0b 

  Arduino IoT Cloud Variables description

  The following variables are automatically generated and updated when changes are made to the Thing

  CloudRelativeHumidity humidity;

  String msg;

  CloudTemperatureSensor temperature;

  Variables which are marked as READ/WRITE in the Cloud Thing will also have functions

  which are called when their values are changed from the Dashboard.

  These functions are generated with the Thing and added at the end of this sketch.

*/

#include "thingProperties.h"

#include "DHT.h"

#define DHTpin 13 // D4 on the nodemcu ESP8266

#define DHTTYPE DHT11

DHT dht(DHTpin,DHTTYPE);

void setup() {

  // Initialize serial and wait for port to open:

  Serial.begin(9600);

  // This delay gives the chance to wait for a Serial Monitor without blocking if none is found

  delay(1500); 

  // Defined in thingProperties.h

  initProperties();

  // Connect to Arduino IoT Cloud

  ArduinoCloud.begin(ArduinoIoTPreferredConnection)

  /*

     The following function allows you to obtain more information

     related to the state of network and IoT Cloud connection and errors

     the higher number the more granular information you’ll get.

     The default is 0 (only errors).

     Maximum is 4

 */

  setDebugMessageLevel(2);

  ArduinoCloud.printDebugInfo();

}

void loop() {

  ArduinoCloud.update();

  // Your code here   

   float hm= dht.readHumidity();

    Serial.print("Humidity ");

    Serial.println(hm);

    float temp=dht.readTemperature();

      Serial.print("Temperature ");

    Serial.println(temp);

    humidity=hm;

    temperature=temp;

    message="Temperature = " + String (temperature)+"  Humidity = " + String(humidity);

}

/*

  Since Humidity is READ_WRITE variable, onHumidityChange() is

  executed every time a new value is received from IoT Cloud.

*/

void onHumidityChange()  {

  // Add your code here to act upon Humidity change

}

/*

  Since Msg is READ_WRITE variable, onMsgChange() is

  executed every time a new value is received from IoT Cloud.

*/

void onMsgChange()  {

  // Add your code here to act upon Msg change

}

void dht_sensor_getdata()

  {

    float hm= dht.readHumidity();

    Serial.print("Humidity ");

    Serial.println(hm);

    float temp=dht.readTemperature();

      Serial.print("Temperature ");

    Serial.println(temp);

    humidity=hm;

    temperature=temp;

    message="Temperature = " + String (temperature)+"  Humidity = " + String(humidity);

  }

d     Creating Dashboard

The Dashboard is a graphical user interface that can be accessed via the web or a mobile application. Switches and displays can be added to the dashboard, and those features can be linked to variables that we have added.
To set the value of the temperature and humidity we will add  the variable we generated for our Thing That variable will be used by the code we've uploaded to our Arduino to show the data on pin no 13 of esp32.

Click the Build Dashboard button on the Dashboard tab. The dashboard will be empty

The dashboard is blank and labelled "Untitled," and you'll need to switch to edit mode to change it .To enter edit mode, click the edit (pencil) symbol in the upper left corner.

You'll see an Add drop-down button once you're in edit mode. You'll be able to change the title of your dashboard as well.

The Add drop-down menu allows you to choose from a variety of Widgets, which are elements that you can place on your dashboard.

The first is a Switch, which appears to be a good choice for controlling an LED. When you select Switch, a new one will appear on your dashboard.

Now for monitoring the temperature we need to select the gauge widget and for humidity, we can percentage gauge or chart

To edit the Gauge, press the menu button on the Gauge. An editing window will appear.












You can give your gauge a name or leave it blank in this editor box. Because it displays  temperature , I named it temperature

To link a cloud variable to the gauge, select Linked Variable. You'll be taken to a new window where you can link to an existing cloud variable.

I choose my Thing as well as the temperature variable. Then I selected Link Variable from the drop-down menu. And now gauge is successfully monitoring my temperature.

Now we will do the same thing for 2nd parameter that we want to monitor that is

Humidity ,lets add percentage widget .












Then click on Link Variable and select the variable the drop-down menu. And now percentage widget is successfully link to humidity variable.

For video Tutorial the you can watch below video.



Comments

Popular posts from this blog

Water level monitoring system using IoT | IoT based water level using Nodemcu ESP8266 & ESP32

Water level monitoring system using IoT | IoT based water level using Nodemcu ESP8266 & ESP32 Hello Everyone! I have come up with new tutorial Water level monitoring system using IoT | IoT based water level using Nodemcu ESP8266 & ESP32 For Code & Circuit Diragram: In this video what you will learn about? 1. How to configure the new Blynk IoT Platform. 2. How to setup web dashboard 3. How to create template in blynk iot 4. How to interface ultrasonic sensor with node mcu esp8266. 5. How to read ultrasonic sensor with esp8266 1.You can Watch Playlist on New Blynk IoT Platfom New Blynk IoT platform with esp32 | how to setup automation in Blynk IoT app https://youtu.be/O2HZuu4KtIc 2.How to create events in blynk IoT platform | events in new Blynk IoT platform 🔥🔥 https://youtu.be/X5zVaGk8QV0 3.IoT Based smart garden monitoring system | Smart plant monitoring using Blynk IoT https://youtu.be/GTdxD5vQwy0 4.Water level monitoring system using IoT | IoT based

DS18B20 Temperature sensor with new Blynk IOT Platform | DS18B20 with Esp32 & Blynk IoT Cloud

DS18B20 Temperature sensor with new Blynk IOT Platform | DS18B20 with Esp32 & Blynk IoT Cloud   Hello Everyone! I have come up with new tutorial based on the all new Blynk IoT platform. which is DS18B20 Temperature sensor with new Blynk IOT Platform | DS18B20 with Esp32 & Blynk IoT Cloud #iot #blynk In this video what you will learn about? 1. How to configure the new Blynk IoT Platform. 2. How to interface DS18B20 sensor with esp32 4. How to configure mobile blynk IoT platform 5. How to setup Automation in Blynk IoT 1.You can Watch Playlist on New Blynk IoT Platfom New Blynk IoT platform with esp32 | how to setup automation in Blynk IoT app | #iot #blynk #esp32 https://youtu.be/O2HZuu4KtIc 2.How to create events in blynk IoT platform | events in new Blynk IoT platform 🔥🔥 #blynk #esp32 #iot https://youtu.be/X5zVaGk8QV0 3.IoT Based smart garden monitoring system | Smart plant monitoring using Blynk IoT #iot #blynk #esp32 https://youtu.be/GTdxD5vQwy0 4.Water

Soil Moisture sensor with Arduino in Tinkercad | how to use soil moisture sensor in Tinkercad

  Soil Moisture sensor with Arduino in Tinkercad | how to use soil moisture sensor in Tinkercad Circuit diagram: Arduino Sketch: // C++ code // int moisture_data = 0; void setup() {   pinMode(A0, INPUT);   Serial.begin(9600);   pinMode(12, OUTPUT);   pinMode(6, OUTPUT); } void loop() {   moisture_data = analogRead(A0);   Serial.println(moisture_data);   if (moisture_data < 21) {     digitalWrite(12, HIGH);     digitalWrite(6, HIGH);   } else {     digitalWrite(12, LOW);     digitalWrite(6, LOW);   }   delay(10); // Delay a little bit to improve simulation performance }