NIELIT Gorakhpur · IoT Virtual Lab
Lab manual
23 experiments, from lighting your first LED to sending sensor data over WiFi and testing access-control security. Each one has the aim, parts, connections, theory, step-by-step procedure, what you should see, an observation table and viva questions. Press Open in the lab to load the ready-made circuit.
How to use the lab
- Open an experiment. Press Open in the lab. The circuit and code load in the editor.
- See the code. Press Code. Switch between Blocks and Text (C++) at the top of the code panel.
- Run it. Press Start simulation. While it runs, click sensors, knobs and buttons to change them.
- Watch the outputs. Use the Serial monitor, the Plotter and, for WiFi parts, the Network tab under the code.
- Change and save. Stop, edit the code or circuit, run again. Sign in and press Save to keep your work in My projects.
You can try every experiment without signing in. To save work, hand in assignments or use the IoT dashboard, sign in with your class code from your teacher.
Your lab record
Write each experiment in your practical file under these headings:
- Aim
- Components used
- Theory (in your own words)
- Circuit / connections
- Procedure
- Observation table
- Result
- Precautions for the real circuit
Precautions to remember for real hardware: always use a series resistor with an LED; never connect 5 V to a 3.3 V ESP pin; switch motors and lamps through a transistor or relay, never straight from a pin; disconnect power before changing wiring.
Unit 1 · Getting started
Circuits, digital outputs and inputs, and the serial monitor.
Aim
To light an LED from a battery through a current-limiting resistor on a breadboard, and to see why the resistor is needed.
Components
- 9 V battery
- Resistor
- LED
- Breadboard
Theory
An LED needs only about 2 V and 10–20 mA. The resistor drops the rest of the battery voltage and limits the current: R = (Vbattery − VLED) / I. Without it the current would be far too high and a real LED would burn out.
Procedure
- Open the experiment with Open in the lab.
- Press Start simulation. No code is needed: this is a plain circuit.
- Click the resistor and change its value. Watch the LED brightness.
- Click the LED and note the current shown in its panel, if shown.
- Stop the simulation.
What you should see
The LED lights. A smaller resistor makes it brighter; a larger one makes it dimmer.
Observation table
| S. No. | Resistor (Ω) | Observation |
|---|
| 1 | 220 | |
| 2 | 470 | |
| 3 | 1 k | |
| 4 | 10 k | |
Aim
To switch an LED on pin 13 on and off every second using code blocks.
Components
- Arduino Uno
- Breadboard
- LED
- Resistor
Connections
| Part | Arduino / board pin |
|---|
| LED (through resistor) | D13 |
Theory
A digital pin is either HIGH (5 V) or LOW (0 V). digitalWrite(13, HIGH) turns the LED on; a wait keeps it on before it is switched off again. setup() runs once, loop() runs forever.
Procedure
- Open the experiment and press Code to see the blocks.
- Press Start simulation. The LED blinks once per second.
- Stop. Change the wait from 1 s to 0.2 s and run again.
- In the code panel switch from Blocks to Text to see the same program in C++.
- Press Save if you are signed in.
What you should see
The LED on pin 13 (and the small "L" LED on the board) blinks at the rate you set.
Aim
To control three LEDs in a timed sequence like a traffic signal.
Components
- Arduino Uno
- Breadboard
- Red, yellow and green LEDs
- 3 resistors
Connections
| Part | Arduino / board pin |
|---|
| Red LED | D12 |
| Yellow LED | D11 |
| Green LED | D10 |
Theory
Each LED has its own output pin. The program switches one LED on, waits with delay(), switches it off and moves to the next, which gives a fixed sequence.
Procedure
- Open the experiment and press Code.
- Start the simulation and time each colour.
- Find the
delay() lines and match each one to a colour. - Change the timings to red 5 s, green 4 s, yellow 1 s, and run again.
What you should see
The LEDs light one at a time in the order red → green → yellow, with the times set in the code.
Observation table
| S. No. | Light | Observation |
|---|
| 1 | Red | |
| 2 | Green | |
| 3 | Yellow | |
Aim
To read a push button as a digital input and switch an LED with it.
Components
- Arduino Uno
- Push button
- LED
- Resistor
Connections
| Part | Arduino / board pin |
|---|
| Push button | D2 and GND |
| Blue LED | D9 |
Theory
With INPUT_PULLUP the pin is held HIGH by an internal resistor. Pressing the button connects it to GND, so it reads LOW. "Pressed" therefore means LOW.
Procedure
- Open the experiment and start the simulation.
- Click and hold the button: the LED lights. Release it: the LED goes off.
- Read the code and find
digitalRead(2) and the comparison with LOW.
What you should see
The LED is on only while the button is held.
Aim
To send text from the computer to the Arduino and back using the serial monitor.
Components
Theory
Serial communication sends data one bit at a time over TX/RX at a set speed (9600 baud here). Serial.available() tells the program that data has arrived.
Procedure
- Open the experiment and start the simulation.
- In the Serial monitor box type
hello and press Send. - Watch the reply and the board LED.
What you should see
The Arduino answers "You typed: hello" and the built-in LED changes state each time.
Unit 2 · Analog and PWM
Read voltages, make "analog" outputs with PWM, sound and motion.
Aim
To change LED brightness smoothly using pulse-width modulation.
Components
Connections
| Part | Arduino / board pin |
|---|
| Blue LED | D9 (PWM ~) |
Theory
A Uno cannot output a true analog voltage. PWM switches the pin on and off very fast; the fraction of time it is on (the duty cycle) sets the average voltage. analogWrite(pin, 0…255) sets the duty cycle. Only pins marked ~ (3, 5, 6, 9, 10, 11) support PWM.
Procedure
- Open the experiment and start the simulation.
- Watch the LED fade up and down.
- In the code, change the step size and see the speed change.
What you should see
The LED brightness rises and falls repeatedly.
Observation table
| S. No. | analogWrite value | Observation |
|---|
| 1 | 0 | |
| 2 | 64 | |
| 3 | 128 | |
| 4 | 255 | |
Experiment 7Potentiometer and analogRead
BeginnerAbout 20 min
Open in the labAim
To read a potentiometer with the ADC and use it to set LED brightness.
Components
- Arduino Uno
- Potentiometer
- LED
- Resistor
Connections
| Part | Arduino / board pin |
|---|
| Potentiometer wiper | A0 |
| LED | D10 (PWM ~) |
Theory
The 10-bit ADC turns 0–5 V into a number from 0 to 1023. Voltage = value × 5 / 1023. Dividing the value by 4 gives 0–255 for analogWrite().
Procedure
- Open the experiment and start the simulation.
- Click the knob and move its slider.
- Read the value and voltage in the serial monitor.
- Fill in the table for four knob positions.
What you should see
The serial monitor shows the value (0–1023) and the voltage; the LED gets brighter as the value rises.
Observation table
| S. No. | ADC value | Observation |
|---|
| 1 | 0 | |
| 2 | 256 | |
| 3 | 512 | |
| 4 | 1023 | |
Experiment 8Measure PWM with an oscilloscope
IntermediateAbout 25 min
Open in the labAim
To observe a PWM waveform on the virtual oscilloscope and measure its average voltage with the multimeter.
Components
- Arduino Uno
- Potentiometer
- LED
- Oscilloscope
- Multimeter
Connections
| Part | Arduino / board pin |
|---|
| Potentiometer | A0 |
| LED / scope / meter | D9 (PWM ~) |
Theory
The oscilloscope shows the voltage against time, so you can see the pulses. The multimeter shows their average. The average equals 5 V × duty cycle.
Procedure
- Open the experiment and start the simulation.
- Turn the knob and watch the pulse width change on the oscilloscope.
- Compare the multimeter reading with 5 × (duty cycle).
- Open the Plotter tab to see the values over time.
What you should see
Wider pulses give a higher multimeter reading and a brighter LED.
Observation table
| S. No. | Duty cycle (%) | Observation |
|---|
| 1 | 25 | |
| 2 | 50 | |
| 3 | 75 | |
| 4 | 100 | |
Aim
To generate musical notes with tone() on a piezo buzzer.
Components
Connections
| Part | Arduino / board pin |
|---|
| Buzzer | D8 |
Theory
tone(pin, frequency, duration) makes a square wave at the given frequency. Higher frequency means a higher note (A4 = 440 Hz).
Procedure
- Turn on your computer sound.
- Open the experiment and start the simulation.
- Find the note frequencies in the code and change one.
What you should see
The buzzer plays a short tune.
Aim
To position a servo motor at angles from 0° to 180° using the Servo library.
Components
Connections
| Part | Arduino / board pin |
|---|
| Servo signal | D9 |
Theory
A servo reads a pulse every 20 ms. The pulse width (about 0.5–2.5 ms) sets the angle. myServo.write(angle) produces the right pulse.
Procedure
- Open the experiment and start the simulation.
- Watch the arm sweep and the angle printed on the serial monitor.
- Change the step from 10° to 30°.
What you should see
The servo sweeps from 0° to 180° and back.
Unit 3 · Sensors and displays
Measure light, temperature, humidity and distance; show the results.
Experiment 11Night light with an LDR (blocks)
BeginnerAbout 20 min
Open in the labAim
To switch an LED on automatically when it gets dark, using a light sensor.
Components
- Arduino Uno
- Light sensor module (LDR)
- LED
- Resistor
Connections
| Part | Arduino / board pin |
|---|
| LDR output (AO) | A0 |
| White LED | D9 |
Theory
An LDR's resistance changes with light. The module turns this into a voltage on A0. The program compares the reading with a threshold and switches the LED.
Procedure
- Open the experiment and look at the blocks.
- Start the simulation and click the light sensor.
- Move its light slider down (dark) and up (bright).
- Find the threshold in the blocks and change it.
What you should see
The LED switches on when the light level falls past the threshold.
Observation table
| S. No. | Light level | Observation |
|---|
| 1 | Bright | |
| 2 | Dim | |
| 3 | Dark | |
Aim
To measure temperature with an LM35 and warn when it reaches 40 °C.
Components
- Arduino Uno
- LM35
- Green and red LEDs
- Resistors
Connections
| Part | Arduino / board pin |
|---|
| LM35 output | A0 |
| Green LED | D12 |
| Red LED | D13 |
Theory
The LM35 gives 10 mV per °C. Celsius = (reading × 5.0 / 1023) × 100.
Procedure
- Open the experiment and start the simulation.
- Click the LM35 and move its temperature slider.
- Compare the serial monitor value with the slider.
- Find
LIMIT_C and change it to 35.
What you should see
The serial monitor shows the temperature; green is on below the limit, red at or above it.
Observation table
| S. No. | Set temperature (°C) | Observation |
|---|
| 1 | 20 | |
| 2 | 30 | |
| 3 | 40 | |
| 4 | 50 | |
Experiment 13Weather station with LCD
IntermediateAbout 25 min
Open in the labAim
To read temperature and humidity from a DHT22 and show them on a 16×2 I2C LCD.
Components
- Arduino Uno
- DHT22
- 16×2 LCD with I2C
Connections
| Part | Arduino / board pin |
|---|
| DHT22 data | D2 |
| LCD SDA | A4 |
| LCD SCL | A5 |
Theory
The DHT22 sends its readings as a digital signal on one wire. The LCD uses I2C: two wires (SDA, SCL) and an address (0x27).
Procedure
- Open the experiment and start the simulation.
- Click the DHT22 and change temperature and humidity.
- Watch the LCD and serial monitor update.
What you should see
The LCD shows "Temp" and "Humidity" with the values you set.
Observation table
| S. No. | Temp / Humidity set | Observation |
|---|
| 1 | 25 °C / 40 % | |
| 2 | 30 °C / 60 % | |
| 3 | 35 °C / 80 % | |
Experiment 14Parking sensor (blocks)
IntermediateAbout 25 min
Open in the labAim
To measure distance with an ultrasonic sensor and beep faster as an object gets closer.
Components
- Arduino Uno
- HC-SR04 ultrasonic sensor
- Buzzer
- LED
Connections
| Part | Arduino / board pin |
|---|
| Ultrasonic TRIG / ECHO | D9 / D10 |
| Buzzer | D8 |
| Red LED | D12 |
Theory
The sensor sends a 40 kHz pulse and times the echo. Distance (cm) = time (µs) × 0.0343 / 2.
Procedure
- Open the experiment and look at the blocks.
- Start the simulation, click the sensor and move the distance slider.
- Note the distance at which beeping starts.
What you should see
The buzzer and LED warn when the object is close.
Observation table
| S. No. | Distance (cm) | Observation |
|---|
| 1 | 100 | |
| 2 | 50 | |
| 3 | 20 | |
| 4 | 5 | |
Aim
To show a potentiometer reading as a number and a bar graph on a 128×64 OLED.
Components
- Arduino Uno
- Potentiometer
- SSD1306 OLED (I2C)
Connections
| Part | Arduino / board pin |
|---|
| Potentiometer | A0 |
| OLED SDA / SCL | A4 / A5 |
Theory
The Adafruit SSD1306 library draws into memory; display.display() sends the picture to the screen over I2C (address 0x3C).
Procedure
- Open the experiment and start the simulation.
- Turn the knob and watch the number and the bar.
- Find
map(value, 0, 1023, 0, 124) and explain it.
What you should see
The OLED shows the value in large digits and a bar that grows with it.
Experiment 16Temperature-controlled fan
IntermediateAbout 25 min
Open in the labAim
To control a fan's speed from the temperature, using a transistor and PWM.
Components
- Arduino Uno
- LM35
- NPN transistor
- 5 V fan
- Resistor (1 kΩ)
Connections
| Part | Arduino / board pin |
|---|
| LM35 | A0 |
| Transistor base (1 kΩ) | D9 (PWM ~) |
Theory
An Arduino pin cannot supply a motor's current. The transistor acts as a switch driven by PWM. Below 30 °C the fan is off, from 30 to 40 °C it speeds up, above 40 °C it runs at full speed.
Procedure
- Open the experiment and start the simulation.
- Click the LM35 and move the temperature from 25 to 45 °C.
- Note the fan speed at each step.
What you should see
The fan starts at 30 °C and reaches full speed at 40 °C.
Observation table
| S. No. | Temperature (°C) | Observation |
|---|
| 1 | 25 | |
| 2 | 32 | |
| 3 | 36 | |
| 4 | 42 | |
Unit 4 · IoT and WiFi
Send readings to the IoT dashboard and control things from it.
Experiment 17IoT weather station (WiFi)
IntermediateAbout 30 min
Open in the labAim
To send DHT22 readings over WiFi (ESP-01) to a channel on the IoT dashboard.
Components
- Arduino Uno
- ESP-01 WiFi module
- DHT22
Connections
| Part | Arduino / board pin |
|---|
| ESP-01 TX / RX | D2 / D3 |
| ESP-01 VCC | 3.3 V |
| DHT22 data | D4 |
Theory
The Uno talks to the ESP-01 with AT commands over a serial link. The ESP-01 sends an HTTP request with a write key and the values as field1, field2.
Procedure
- Sign in. Open IoT dashboard and create a channel with field 1 Temperature and field 2 Humidity. Copy the write key.
- Open the experiment, press Code and paste the key into the WiFi/send blocks.
- Start the simulation and wait for the first send.
- Watch the readings and charts appear on the IoT dashboard.
What you should see
New entries appear on the dashboard; change the DHT22 values and see the chart follow.
Aim
To switch a lamp through a relay from a switch on the IoT dashboard.
Components
- Arduino Uno
- ESP-01
- Relay
- Lamp
Connections
| Part | Arduino / board pin |
|---|
| Relay | D7 |
Theory
The Arduino regularly reads the last value of field 5 with the channel's read key; 1 means on, 0 means off.
Procedure
- On the IoT dashboard create a channel with field 5 set to Switch.
- Open the experiment and enter the channel number and read key in the code.
- Start the simulation, then flip the switch on the dashboard.
What you should see
A few seconds after you flip the switch, the relay clicks and the lamp follows.
Aim
To program an ESP32 directly (no Uno) to blink an LED, read a knob and send it over WiFi.
Components
- ESP32 DevKit
- LED
- Potentiometer
Connections
| Part | Arduino / board pin |
|---|
| LED | GPIO2 |
| Potentiometer | GPIO34 |
Theory
In ESP32 mode the board runs the sketch itself. analogRead() gives 0–4095 (12 bits). The sketch joins the lab WiFi and sends the value to field 1.
Procedure
- Create an IoT channel and copy its write key.
- Open the experiment and paste the key into
WRITE_KEY. - Start the simulation; click the knob and change it.
- Check the dashboard for new values.
What you should see
The LED blinks, the serial monitor shows the readings and the dashboard receives them.
Experiment 20NodeMCU weather station
IntermediateAbout 25 min
Open in the labAim
To build a WiFi weather station on a NodeMCU (ESP8266) with an LCD.
Components
Connections
| Part | Arduino / board pin |
|---|
| DHT22 data | D5 |
| LCD SDA / SCL | D2 / D1 |
Theory
The NodeMCU runs the sketch itself with ESP8266 libraries. It reads the DHT22 every 2 s, shows the values on the LCD and sends them every 20 s.
Procedure
- Create an IoT channel and copy its write key.
- Open the experiment and paste the key.
- Start the simulation; change the DHT22 values.
What you should see
The LCD shows the readings and the dashboard updates every 20 s.
Unit 5 · Security and wireless control
Access control and Bluetooth, and the weaknesses to watch for.
Aim
To open a lock with a PIN on a 4×4 keypad and block guessing after 3 wrong tries.
Components
- Arduino Uno
- 4×4 keypad
- Relay and solenoid lock
- Buzzer
- Green and red LEDs
Connections
| Part | Arduino / board pin |
|---|
| Relay | D10 |
| Buzzer | D11 |
| Green / red LED | D12 / D13 |
Theory
A keypad is a matrix: the program scans rows and columns to find the pressed key. After 3 wrong PINs the keypad locks for 30 s, which makes trying all 10,000 four-digit PINs too slow (protection against brute force).
Procedure
- Open the experiment and start the simulation.
- Type 2580 and press #: the lock opens.
- Type a wrong PIN three times and see the lockout.
- Change
SECRET_PIN in the code.
What you should see
Right PIN: green LED and the lock opens. Wrong PIN: red LED and a beep; 3 wrong: 30 s lockout.
Aim
To allow only listed RFID cards to open a door, and to see why checking only the UID is weak.
Components
- Arduino Uno
- RC522 RFID reader
- Relay
- Buzzer
- LEDs
Connections
| Part | Arduino / board pin |
|---|
| RC522 SS / RST | D10 / D9 |
| Green / red LED | D7 / D6 |
| Buzzer | D5 |
| Relay | D4 |
Theory
Each card has a UID. The sketch compares it with an allowed list. The UID is not secret, so a copied card with the same UID also gets in; secure systems use cards with cryptographic authentication.
Procedure
- Open the experiment and start the simulation.
- In the reader's settings, present an allowed card, then an unknown card.
- Present the Copied card and note the result.
What you should see
Allowed and copied cards open the door; unknown cards are refused.
Aim
To switch an LED from a phone through an HC-05 Bluetooth module.
Components
- Arduino Uno
- HC-05
- Green and red LEDs
Connections
| Part | Arduino / board pin |
|---|
| HC-05 STATE | D4 |
| Green LED | D12 |
| Red LED (paired) | D13 |
Theory
The HC-05 is a serial-to-Bluetooth bridge: bytes sent from the phone arrive at the Arduino as serial data.
Procedure
- Open the experiment and start the simulation.
- Click the HC-05 and tick Phone paired.
- In the Bluetooth terminal send
1 and then 0.
What you should see
Sending 1 turns the green LED on, 0 turns it off; the red LED is on while paired.
Copyright NIELIT Gorakhpur · Open the lab · Policies · Open-source notices · Back to top