Arduino Projects

Email in to send Arduino Sensors Data “2010 Express”


Email in

Email in to send Arduino Sensors Data– In this tutorial, you will learn how to design your own computer application in to monitor the temperature and humidity values and then send these values on specific email id. With the help of this project, the temperature and humidity values can be monitored from anywhere around the world.

In this project, the famous DHT11 temperature and humidity sensor are used with the Arduino. The Arduino Uno is used to access the Temperature and Humidity values and then using the Serial Communication the temperature and humidity values are sent in a string message to the designed computer application. These values are displayed on the screen and are also sent to the destination email id.

Let’s get started!!!

Amazon Links:

Arduino Uno

Arduino Nano

Mega 2560:

Other Tools and Components:

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines


Please Note: these are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!

At first, you will find this project quite impractical, as you will need a computer or a laptop connected with the Arduino Uno or Mega all the time. Who connects a computer 24 hours with the Arduino Uno just to monitor the Temperature and Humidity? While there are so many breakout boards that can be used to send the sensors data to any email id around the world. There are Ethernet cards, ESP8266 wifi modules, Nodemcu ESP8266, etc. All these modules can be directly interfaced with the Arduino Uno or Mega and you never need a computer to send an email. I have been using Nodemcu ESP8266 for Real Time sensors monitoring, but there are situations when you need a computer application like for example a SCADA system, where you process all the data and then send the end results on an email ID.

When you start comparing both the options and as you dig deeper you will understand how important this project is. The computer application designed for monitoring and sending an email can be used in infinite ways. The application designed in this Tutorial can be used without the Arduino. This application can be easily modified and can be used in student’s attendance system, this application can be used in the products inquiry system, and this project can be used in all those places where you need to send an email. This application can also be used for marketing, as this is an automatic email sending system.

The software’s used in this project are

Arduino IDE

Visual Basic.Net “” 2010 Express Edition.

DHT11 sensor Pinout:

Email in

This is the DHT11 temperature and humidity sensor which is used in this project for building the Real-Time weather station. DHT11 Sensor has a total of 4 pins. Pin number 1 is the VCC, pin number 2 is the data, pin number 3 is not connected while pin number 4 is the Ground.

The other useful information about the DHT11 sensor can be found in its datasheet. For example its applications, Features, Dimensions, Product parameter, Electrical characteristics, Pin description, and data format, etc. It’s a good designing practice to study the datasheet of the electrical component before you start using it any circuit.

For the easy connections, I highly recommend firs you need to fix this sensor on the Vero Board, Solder its legs and the 10-kilo resistor. Then solder jumper wires. This way you can easy interface the DHT11 temperature and humidity sensor with the Arduino Uno or Mega.

Email in

Circuit Diagram:

Email in

The connection of the DHT11 temperature and humidity sensor with the Arduino Uno or Mega is really simple. As you can see in the circuit diagram above, a 10 kilo Ohm resistor is connected between pin number 1 and pin number 2. As I said earlier the pin number 3 of the dht11 sensor is not used. Pin number 4 of the DHT11 temperature and humidity sensor is connected with the Arduino’s Ground, while pin number 2 is connected with the Arduino’s pin number 12.

Email in Arduino and Programming:

 Email in– In this Project, two programs are used, one program is written for the Arduino and the other program is the computer application designed in using 2010 Express Edition.

DHT11 Arduino Programming:

#include "DHT.h"

#define DHTPIN 12     // what pin we're connected to

//Uncomment whatever the type of sensor we are using. 
#define DHTTYPE DHT11   // DHT 11 
//#define DHTTYPE DHT22   // DHT 22  (AM2302)
//#define DHTTYPE DHT21   // DHT 21 (AM2301)

// Connect pin 1 (on the left) of the sensor to +5V
// NOTE: If using a board with 3.3V logic like an Arduino Due connect pin 1
// to 3.3V instead of 5V!
// Connect pin 2 of the sensor to whatever your DHTPIN is 
// pin3 of the sensor is not connected
// Connect pin 4 (on the right) of the sensor to GROUND
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor

// Initialize DHT sensor for normal 16mhz Arduino
// NOTE: For working with a faster chip, like an Arduino Due or Teensy, you
// might need to increase the threshold for cycle counts considered a 1 or 0.
// You can do this by passing a 3rd parameter for this threshold.  It's a bit
// of fiddling to find the right value, but in general the faster the CPU the
// higher the value.  The default for a 16mhz AVR is a value of 6.  For an
// Arduino Due that runs at 84mhz a value of 30 works.
// Example to initialize DHT sensor for Arduino Due:

String TextForSms ;
String humidity = " Humidity: %";
String temperature = "   Temperature";
String sign = " *C";

void setup() {
  Serial.println("DHT11 test!");

void loop() {
  // Wait a few seconds between measurements.

  // Reading temperature or humidity takes about 250 milliseconds!
  // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  int h = dht.readHumidity();
  // Read temperature as Celsius
  int t = dht.readTemperature();
  // Read temperature as Fahrenheit
  int f = dht.readTemperature(true);
  // Check if any reads failed and exit early (to try again).
  if (isnan(h) || isnan(t) || isnan(f)) {
    Serial.println("Failed to read from DHT sensor!");

  // Compute heat index
  // Must send in temp in Fahrenheit!
  int hi = dht.computeHeatIndex(f, h);

//  Serial.print("Humidity: "); 
//  Serial.print(h);
//  Serial.print(" %\t");
//  Serial.print("Temperature: "); 
//  Serial.print(t);
//  Serial.print(" *C ");
  TextForSms = TextForSms + "Humidity: ";
  TextForSms = TextForSms + "%    Temperature: ";
  TextForSms = TextForSms + "*C";
  TextForSms = " ";
   if ( t > 37 )
   Serial.println("Temperature Exceeded"); 
//  TextForSms.concat(humidity);
//   TextForSms.concat(h);
//   TextForSms.concat(temperature);
//    TextForSms.concat(t);
//    TextForSms.concat(sign);
//    Serial.println(TextForSms);
//  Serial.print(f);
//  Serial.print(" *F\t");
//  Serial.print("Heat index: ");
//  Serial.print(hi);
//  Serial.println(" *F");


For the Program Explanation watch Video Tutorial given at the end of this Article.

Email Sending Application Programming:

' import libraries
Imports System.Runtime.InteropServices
Imports System.Threading
Imports System.IO
Imports System.Net
Imports System.Net.Mail
Imports System.Net.NetworkCredential
Imports System.Reflection
Imports System.Text
Imports Microsoft.Win32

Imports System.IO.Ports

Public Class Form1

    ' thread-safe calling for thread_hide
    Delegate Sub Change()

    Private Declare Function InternetGetConnectedState Lib "wininet.dll" (ByRef lpdwFlags As Int32, ByVal dwReserved As Int32) As Boolean

    Delegate Sub SetTextCallback(ByVal [text] As String)
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        SerialPort1.PortName = "com5"
        SerialPort1.BaudRate = "9600"
        SerialPort1.DataBits = 8
        SerialPort1.Parity = Parity.None
        SerialPort1.StopBits = StopBits.One
        SerialPort1.Handshake = Handshake.None
        SerialPort1.Encoding = System.Text.Encoding.Default
    End Sub

    Private Sub DataReceived(ByVal sender As Object, ByVal e As SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
            Dim mydata As String = ""
            mydata = SerialPort1.ReadExisting()

            If txtOutput.InvokeRequired Then
                txtOutput.Invoke(DirectCast(Sub() txtOutput.Text &= mydata, MethodInvoker))
                txtOutput.Text &= mydata
            End If
        Catch ex As Exception
        End Try
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If InStr(txtOutput.Text, "Exceeded") Then

            CheckBox1.Checked = True
        End If

    End Sub

    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        If CheckBox1.Checked = True Then

            Dim smtp As New SmtpClient
            Dim message As New MailMessage
            Dim username As String
            Dim password As String
            Dim destination As String
            Dim subject As String
            Dim lngFlags As Integer

            username = "[email protected]"
            password = "yourpassword"
            destination = "[email protected]"
            subject = "Temperature Exceeded!!!!!"
            smtp.Host = ""
            smtp.EnableSsl = True
            smtp.Port = 587
            smtp.Credentials = New Net.NetworkCredential(username, password)

            message.From = New MailAddress(username)
            message.Subject = subject
            message.Body = txtOutput.Text
            If InternetGetConnectedState(lngFlags, 0) Then ' checks if internet connection is available or not

                txtOutput.Text = ""
                CheckBox1.Checked = False

                txtOutput.Text = txtOutput.Text + "" + vbNewLine + " net connection not available" + vbNewLine + ""

            End If

        End If
    End Sub

End Class

For the practical demonstration and step by step, explanation watch the following video tutorial.

Watch Video Tutorial:

Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button