Close Menu
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
Facebook X (Twitter) Instagram
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us
Facebook X (Twitter) Instagram Pinterest YouTube LinkedIn
How To Electronics
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
How To Electronics
Home » Getting Started with Arduino IoT Cloud with ESP8266
ESP8266 Projects IoT Projects

Getting Started with Arduino IoT Cloud with ESP8266

Mamtaz AlamBy Mamtaz AlamUpdated:August 20, 20226 Mins Read
Share Facebook Twitter LinkedIn Telegram Reddit WhatsApp
Arduino IoT Cloud ESP8266
Share
Facebook Twitter LinkedIn Pinterest Email Reddit Telegram WhatsApp

Overview: Arduino IoT Cloud with ESP8266

Basically, this is the getting started about Arduino IoT Cloud where we will learn about using the Arduino IoT Cloud with ESP8266.

Recently the Arduino Community launched their IoT platform called Arduino IoT Cloud. The Arduino IoT Cloud provides an end-to-end solution that makes building connected projects easy for makers, IoT enthusiasts, and professionals from start to finish. The platform enables different methods of interaction, including HTTP REST API, MQTT, command-line tools, Javascript, and WebSockets. You can connect multiple devices to each other and allow them to exchange real-time data. You can also monitor data from anywhere using a simple user interface. To learn more about the Arduino IoT Cloud, you can go through the documentation part.

Arduino IoT Cloud ESP8266 Demo

In this getting started tutorial, we will control an LED from the Arduino IoT Cloud Dashboard. Similarly, we will send the sensor data to the cloud dashboard and visualize it in various beautiful widgets. You can also do the Home Automation Project using Arduino IoT Cloud.




Bill of Materials

While before getting started with Arduino IoT Cloud, we need some hardware. The first component that we need is the ESP8266 Based Board. I prefer Wemos D1 Mini Board for this purpose. You can also use NodeMCU Board. We will also need a sensor. For the demo, I am using an MPU6050 Gyroscope Accelerometer sensor that can measure tilt angle. To use the switch feature you can use a 5mm LED of any color along with a 220-ohm resistor.

You can purchase all these components from Amazon.

S.N.Components NameQuantityPurchase Links
1NodeMCU ESP8266 Board1Amazon | AliExpress
2LED 5mm Any Color1Amazon | AliExpress
3MPU6050 Gyroscope Accelerometer Sensor1Amazon | AliExpress
4Jumper Wires20Amazon | AliExpress
5Breadboard1Amazon | AliExpress
6USB Cable1Amazon | AliExpress

Circuit & Hardware

Make a simple connection as shown in the image above. Connect the MPU6050 to the I2C Pin and LED to any digital pin like GPIO0.




Setting up Arduino IoT Cloud DashBoard

Let us set up the Arduino IoT Cloud dashboard. To do that visit the Arduino Digital Store Link.

You need to create an Arduino account or simply sign in if you created the account earlier. Click on IoT Cloud. You will be taken to the dashboard where you need to set up everything.


Creating Thing

Click on Create Thing now. You can see here the setup section as well as the sketch and serial monitor section.

You need to add a variable now & give it any name. For example for controlling an LED, I will give it the name LED. From the variable type, select anything like Light as we need to send the 1 and 0 commands. The variable will be automatically declared as Cloud Light LED. You can assign the variable permission as either read-write or read-only. So for LED, you can assign Read & Write both. Finally, Click on Add Variable. This will create a variable successfully.

Similarly, add another variable for MPU6050 as we need to measure the tilt angle. So click on add variable and give it any name like X. From the variable list, select angle. So a variable will be automatically declared. Assign the permission as read-only since we are only reading the sensor value. Finally, click on add variable. So the 2nd variable for angle will be added.

Assign another two variables for the Y and Z angles as well.




Setting Up Device

Now we need to set up the device. To do that select Device. Since ESP8266 is a 3rd party device, we will select a 3rd party device. From the list select ESP8266 Board. And from the model select your ESP8266 Type. Then, Click on Continue.

Name the device anything you would like.

A device ID and a Secret Key have been generated. These are very important while parameters in coding. You need to copy it or simply click on download the PDF.

Go back to the dashboard and click on Continue. So you are finally done with the device setup.


Setting Up Network

Now we also need to configure the Network. So click on Network Setup. Enter the WiFi SSID, Password & Secret Key here that you downloaded earlier. Then click on save.


Setting Up Dashboard

Go to the dashboard to set up the widgets.

Click on this edit sign. Then click on Add here. From this widget list, select switch as we want to turn ON & OFF the LED. Give any name to the switch. Then link a variable as LED from the list. Then, click on Link Variable.

Similarly, add another three widgets for X angle, Y Angle & Z Angle. You can select Gauge, Chart, or Numeric Value for each three variables. Give widget any name, then select a linked variable. From the value range, select the minimum and maximum angle range from 0 to 360.

So, our widget display dashboard is ready now.



Source Code/Program

The source code for using the Arduino IoT Cloud with ESP8266 is easy to use as some of the commands and declarations are automatically generated.

Go to the sketch tab. So a default sketch based on different variables will be created. There are some header files defined and parameters are set for LED. So we need to modify the code.

The modified code for the 3 tabs are given below.

Main_Code.ino

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#include "arduino_secrets.h"
/*
  Sketch generated by the Arduino IoT Cloud Thing "Untitled"
  https://cloud.arduino.cc/
 
  Arduino IoT Cloud Variables description
 
  The following variables are automatically generated and updated when changes are made to the Thing
 
  CloudLight lED;
  CloudAngle x;
  CloudAngle y;
  CloudAngle z;
 
  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<Wire.h>
 
const int MPU_addr=0x68;
int16_t AcX,AcY,AcZ,Tmp,GyX,GyY,GyZ;
int minVal=265;
int maxVal=402;
double X;
double Y;
double Z;
 
void setup() {
  // Initialize serial and wait for port to open:
  Serial.begin(9600);
  pinMode (0, OUTPUT);
  Wire.begin();
  Wire.beginTransmission(MPU_addr);
  Wire.write(0x6B);
  Wire.write(0);
  Wire.endTransmission(true);
  // This delay gives the chance to wait for a Serial Monitor without blocking if none is found
  // 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();
  MPU6050_Read();
  // Your code here
  
  
}
 
void onLEDChange() {
  if (lED == 1)
  {
   digitalWrite (0, HIGH);
  }
  else
  {
    digitalWrite (0, LOW);
  }
  // Do something
}
 
void MPU6050_Read()
{
  Wire.beginTransmission(MPU_addr);
  Wire.write(0x3B);
  Wire.endTransmission(false);
  Wire.requestFrom(MPU_addr,14,true);
  AcX=Wire.read()<<8|Wire.read();
  AcY=Wire.read()<<8|Wire.read();
  AcZ=Wire.read()<<8|Wire.read();
  int xAng = map(AcX,minVal,maxVal,-90,90);
  int yAng = map(AcY,minVal,maxVal,-90,90);
  int zAng = map(AcZ,minVal,maxVal,-90,90);
  X= RAD_TO_DEG * (atan2(-yAng, -zAng)+PI);
  Y= RAD_TO_DEG * (atan2(-xAng, -zAng)+PI);
  Z= RAD_TO_DEG * (atan2(-yAng, -xAng)+PI);
  
  x=X;
  y=Y;
  z=Z;
  Serial.print("AngleX= ");
  Serial.println(X);
  Serial.print("AngleY= ");
  Serial.println(Y);
  Serial.print("AngleZ= ");
  Serial.println(Z);
  Serial.println("-----------------------------------------");
}


thingProperties.h

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Code generated by Arduino IoT Cloud, DO NOT EDIT.
 
#include <ArduinoIoTCloud.h>
#include <Arduino_ConnectionHandler.h>
 
 
const char THING_ID[]           = "3b2c44f9-e11e-4bea-9d37-e1ac566f55d3";
const char DEVICE_LOGIN_NAME[]  = "772ae50b-9678-465c-96c6-fa7c7d0d9aad";
 
const char SSID[]               = SECRET_SSID;    // Network SSID (name)
const char PASS[]               = SECRET_PASS;    // Network password (use for WPA, or use as key for WEP)
const char DEVICE_KEY[]  = SECRET_DEVICE_KEY;    // Secret device password
 
void onLEDChange();
 
CloudLight lED;
CloudAngle x;
CloudAngle y;
CloudAngle z;
 
void initProperties(){
 
  ArduinoCloud.setBoardId(DEVICE_LOGIN_NAME);
  ArduinoCloud.setSecretDeviceKey(DEVICE_KEY);
  ArduinoCloud.setThingId(THING_ID);
  ArduinoCloud.addProperty(lED, READWRITE, ON_CHANGE, onLEDChange);
  ArduinoCloud.addProperty(x, READ, ON_CHANGE, NULL);
  ArduinoCloud.addProperty(y, READ, ON_CHANGE, NULL);
  ArduinoCloud.addProperty(z, READ, ON_CHANGE, NULL);
 
}
 
WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, PASS);


arduino_secrets.h

1
2
3
#define SECRET_SSID "MyNetwork"
#define SECRET_PASS "12345678"
#define SECRET_DEVICE_KEY "9W5XHKSF8YAAO3OMDLFS"

To learn how to compile the code and how to install the driver on Chrome Browser, follow the detailed video tutorial below.



Testing Arduino IoT Cloud ESP8266

After uploading the code, you can open the Serial Monitor here. On the serial monitor, you can see the MQTT Connection is established and the device is connected to the WFi Network. It is also displaying the Tilt Angle for X, Y, and Z-Axis.

Arduino IoT Cloud ESP8266 Getting Started

Now go back to the dashboard to check the widget. As you can see all the data are uploaded here after a certain interval. To check the working tilt the sensor checks the value on the Serial Widget screen. Similarly, to turn ON and OFF the LED, send the command from the dashboard.

So this is how you can use the Arduino IoT Cloud with ESP8266 for your project.


Video Tutorial & Complete Guide

Using Arduino IoT Cloud with ESP8266 || Setup & Complete Guide
Watch this video on YouTube.

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Reddit Telegram WhatsApp
Previous ArticleUsing SD Card Module with Arduino | Read/Write/Data Logger
Next Article Home Automation with Arduino IoT Cloud using ESP32

Related Posts

IoT Based PM & Air Quality Monitoring System using ESP32

IoT Based PM & Air Quality Monitoring System using ESP32

DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

Updated:May 10, 20261K
IoT Activity Tracker with ESP32 & Accelerometer Gyroscope

IoT Activity Tracker with ESP32 & Accelerometer/Gyroscope

Updated:May 2, 2026

ESP32 IoT Vehicle Motion Analyzer with MPU6050 & LIS3MDL

Updated:April 27, 20261K
High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

Updated:April 27, 20262K
DIY Colorimeter using AS7265x Spectroscopy Sensor & ESP32

DIY Colorimeter using AS7265x Spectroscopy Sensor & ESP32

Updated:February 1, 20261K
Add A Comment

CommentsCancel reply

Latest Posts
IoT Based PM & Air Quality Monitoring System using ESP32

IoT Based PM & Air Quality Monitoring System using ESP32

May 31, 2026
DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

May 10, 2026
IoT Activity Tracker with ESP32 & Accelerometer Gyroscope

IoT Activity Tracker with ESP32 & Accelerometer/Gyroscope

May 2, 2026
A Guide to Sourcing Obsolete ICs for Vintage Projects

Beyond AliExpress: A Guide to Sourcing Obsolete ICs for Vintage Projects

April 21, 2026

ESP32 IoT Vehicle Motion Analyzer with MPU6050 & LIS3MDL

April 27, 2026
Building a Smart Sensor Node with a BLE Microcontroller

Building a Smart Sensor Node with a BLE Microcontroller

February 26, 2026
High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

April 27, 2026
DIY Colorimeter using AS7265x Spectroscopy Sensor & ESP32

DIY Colorimeter using AS7265x Spectroscopy Sensor & ESP32

February 1, 2026
Top Posts & Pages
  • 12V DC to 220V AC Inverter Circuit & PCB
    12V DC to 220V AC Inverter Circuit & PCB
  • ECG Graph Monitoring with AD8232 ECG Sensor & Arduino
    ECG Graph Monitoring with AD8232 ECG Sensor & Arduino
  • Buck Converter: Basics, Working, Design & Application
    Buck Converter: Basics, Working, Design & Application
  • IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
    IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
  • How to use INA226 DC Current Sensor with Arduino
    How to use INA226 DC Current Sensor with Arduino
  • ESP32 CAN Bus Tutorial | Interfacing MCP2515 CAN Module with ESP32
    ESP32 CAN Bus Tutorial | Interfacing MCP2515 CAN Module with ESP32
  • How to use Modbus RTU with ESP32 to read Sensor Data
    How to use Modbus RTU with ESP32 to read Sensor Data
  • IoT Based ECG Monitoring with AD8232 ECG Sensor & ESP32
    IoT Based ECG Monitoring with AD8232 ECG Sensor & ESP32
Categories
  • Arduino Projects (197)
  • Articles (60)
    • Learn Electronics (19)
    • Product Review (15)
    • Tech Articles (28)
  • Electronics Circuits (46)
    • 555 Timer Projects (21)
    • Op-Amp Circuits (7)
    • Power Electronics (13)
  • IoT Projects (204)
    • ESP32 MicroPython (7)
    • ESP32 Projects (81)
    • ESP32-CAM Projects (15)
    • ESP8266 Projects (76)
    • LoRa/LoRaWAN Projects (22)
  • Microcontrollers (38)
    • AMB82-Mini IoT AI Camera (4)
    • BLE Projects (18)
    • STM32 Projects (19)
  • Raspberry Pi (93)
    • Raspberry Pi Pico Projects (57)
    • Raspberry Pi Pico W Projects (12)
    • Raspberry Pi Projects (24)
Follow Us
  • Facebook
  • Twitter
  • Pinterest
  • Instagram
  • YouTube
About Us

“‘How to Electronics’ is a vibrant community for electronics enthusiasts and professionals. We deliver latest insights in areas such as Embedded Systems, Power Electronics, AI, IoT, and Robotics. Our goal is to stimulate innovation and provide practical solutions for students, organizations, and industries. Join us to transform learning into a joyful journey of discovery and innovation.

Copyright © How To Electronics. All rights reserved.
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us

Type above and press Enter to search. Press Esc to cancel.

Ad Blocker Enabled!
Ad Blocker Enabled!
Looks like you're using an ad blocker. Please allow ads on our site. We rely on advertising to help fund our site.