IoT Basics and Smart Sensors - EXP 3

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

IoT basics and Smart Sensors

Department of Electronics and Telecommunication Engineering


Third Year
Semester V
A Y. 2022-23

IoT basics and Smart Sensors


Experiment No. 3

Name:

Division:

Roll No.:

Date of Performance:

Date of Submission:

Grade:

Sign:

Department of Electronics and Telecommunication Engineering Third Year Semester V 12


IoT basics and Smart Sensors

Experiment No. 3

Aim: Simulate the interfacing of a Zigbee module with Arduino Uno prototyping board to
control a 5V DC motor.

Simulation Platform: Proteus Design Suite 8.12

Theory:
Zigbee Module

ZigBee modules provide cost-effective wireless connectivity to devices in ZigBee mesh networks.
Utilizing the ZigBee PRO Feature Set, these modules are interoperable with other ZigBee devices,
including devices from other vendors. The most common factor in determining whether to use ZB
is the potential need to tie-in with other ZigBee-compatible networks or mesh networking.
● Digital I/O: 15
● ADC Channels: (4) 10-bit ADC inputs
● Data Rate: RF 250 Kbps, Serial up to 1 Mbps
● Range: Indoor 200 ft (60 m), Outdoor (LOS) 4000 ft (1200 m)
● Transmit Power: 3.1 mW (+5 dBm)
● Channels: 16 channels
● Encryption: 128-bit AES
● Voltage requirements: 2.1 to 3.6 VDC
● Current requirements: ~33 mA @ 3.3VDC (transmit), ~28 mA @ 3.3VDC (receive), <1 uA
@25ºC (sleep)
Zigbee is an IEEE 802.15.4-based specification for a suite of high-level communication protocols
used to create personal area networks with small, low-power digital radios, such as for home
automation, medical device data collection, and other low-power low-bandwidth needs, designed
for small scale projects which need wireless connection. Hence, Zigbee is a low-power, low data
rate, and close proximity (i.e., personal area) wireless ad hoc network.

Department of Electronics and Telecommunication Engineering Third Year Semester V 13


IoT basics and Smart Sensors

Arduino Uno

Arduino Uno is a microcontroller board based on the ATmega328P. It has 14 digital input/output
pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic resonator
(CSTCE16M0V53-R0), a USB connection, a power jack, an ICSP header and a reset button. It
contains everything needed to support the microcontroller.
Proteus Design Suite 8.12
It is a simulation platform that can be used to simulate different electronic circuits. The
microcontroller simulation capabilities of Proteus VSM enable true end-to-end learning for modern
electronic systems. The whole learning process takes place in software with the schematic capture
module serving as the ‘virtual hardware’ and the VSM Studio IDE module enabling firmware
development and compilation.

Circuit Diagram:
Remote Control

Department of Electronics and Telecommunication Engineering Third Year Semester V 14


IoT basics and Smart Sensors

Procedure:
1. Open a new project in Proteus Design Suite.
2. Import the libraries of Arduino Uno, XBee Zigbee module and L293d motor driver module.
3. Once imported, make the connections as shown in the circuit diagrams.
4. Upload the codes in Arduino Uno.
5. Start the simulation of both the circuits.

Code:
Code for keypad circuit:
#include <Keypad.h>

const byte ROWS = 4; //four rows


const byte COLS = 4; //three columns
char keys[ROWS][COLS] = {
{'7','8','9', '/'},
{'4','5','6','x'},
{'1','2','3','-'},
{'*','0','#','+'}
};
byte rowPins[ROWS] = {13, 12, 11, 10}; //connect to the row
pinouts of the keypad
byte colPins[COLS] = {9, 8, 7, 6}; //connect to the column pinouts
of the keypad

Department of Electronics and Telecommunication Engineering Third Year Semester V 15


IoT basics and Smart Sensors

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS,


COLS );

int KeyCheck = 0;

void setup()
{
Serial.begin(9600);

void loop()
{
char key = keypad.getKey();

if (key)
{
if(key == '1'){KeyCheck = 1; Serial.print("1");}
if(key == '2'){KeyCheck = 1; Serial.print("2");}
if(key == '3'){KeyCheck = 1; Serial.print("3");}

if(key == '4'){KeyCheck = 1; Serial.print("4");}


if(key == '5'){KeyCheck = 1; Serial.print("5");}
if(key == '6'){KeyCheck = 1; Serial.print("6");}

if(KeyCheck == 0){Serial.print(key);}
KeyCheck = 0;
}

Code for motor driver circuit:


int Motor1 = 7;
int Motor2 = 6;
int Motor3 = 5;
int Motor4 = 4;

int DataCheck = 0;

void setup()
Department of Electronics and Telecommunication Engineering Third Year Semester V 16
IoT basics and Smart Sensors

{
Serial.begin(9600);
pinMode(Motor1, OUTPUT);
pinMode(Motor2, OUTPUT);
pinMode(Motor3, OUTPUT);
pinMode(Motor4, OUTPUT);

digitalWrite(Motor1, HIGH);
digitalWrite(Motor2, HIGH);
digitalWrite(Motor3, HIGH);
digitalWrite(Motor4, HIGH);

Serial.print(" ");
Serial.println();
Serial.println(" ");
Serial.println();
Serial.println();
Serial.println();

void loop()
{
if(Serial.available())
{
char data = Serial.read();
Serial.print(data);
Serial.print(" ======== > ");

if(data == '1'){DataCheck = 1; digitalWrite(Motor2,


LOW);digitalWrite(Motor1, HIGH); Serial.println("First Motor is
moving in Clockwise Direction.");}
if(data == '2'){DataCheck = 1; digitalWrite(Motor1,
LOW);digitalWrite(Motor2, HIGH); Serial.println("First Motor is
moving in Anti-Clockwise Direction.");}
if(data == '3'){DataCheck = 1; digitalWrite(Motor1,
LOW);digitalWrite(Motor2, LOW); Serial.println("First Motor is
Stopped");}

Department of Electronics and Telecommunication Engineering Third Year Semester V 17


IoT basics and Smart Sensors

if(data == '4'){DataCheck = 1; digitalWrite(Motor3,


LOW);digitalWrite(Motor4, HIGH); Serial.println("Second Motor is
moving in Clockwise Direction.");}
if(data == '5'){DataCheck = 1; digitalWrite(Motor4,
LOW);digitalWrite(Motor3, HIGH); Serial.println("Second Motor is
moving in Anti-Clockwise Direction.");}
if(data == '6'){DataCheck = 1; digitalWrite(Motor3,
LOW);digitalWrite(Motor4, LOW); Serial.println("Second Motor is
Stopped.");}

if(DataCheck == 0){Serial.println("Invalid Command. Please Try


Again !!! ");}
Serial.println();
DataCheck = 0;
}

Screenshot of the experiment execution:

Observations:
It is observed that the remote control circuit can remotely control the DC motor circuit. The two DC
motors in the circuit perform according to the keys pressed on the keypad of the remote control
circuit.

Department of Electronics and Telecommunication Engineering Third Year Semester V 18


IoT basics and Smart Sensors

Key of the keypad Functions performed by the motor

1 First motor is moving clockwise

2 First motor is moving anti-clockwise

3 First motor is stopped

4 Second motor is moving clockwise

5 Second motor is moving anti-clockwise

6 Second motor is stopped

Conclusions:
On the basis of the observations, it can be concluded that the zigbee module can be used to
remotely control any kind of control system depending on the applications.

Department of Electronics and Telecommunication Engineering Third Year Semester V 19

You might also like