0% found this document useful (0 votes)
4 views20 pages

ET3491 LAB Program

The document provides various programming examples for controlling LEDs, interfacing with LCDs, and implementing mini projects using Raspberry Pi and IoT technologies. It includes detailed objectives and hardware specifications for projects like a garbage segregator, color-based product sorting, fire detection, vehicle number plate detection, and a smart lock system. Each project aims to utilize technology for practical solutions in waste management, automation, and security.

Uploaded by

mariaftina99
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views20 pages

ET3491 LAB Program

The document provides various programming examples for controlling LEDs, interfacing with LCDs, and implementing mini projects using Raspberry Pi and IoT technologies. It includes detailed objectives and hardware specifications for projects like a garbage segregator, color-based product sorting, fire detection, vehicle number plate detection, and a smart lock system. Each project aims to utilize technology for practical solutions in waste management, automation, and security.

Uploaded by

mariaftina99
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

LED & Flashing of LED’s

PROGRA M:

#include<lpc214x.h>
int i;
int main()
{
IODIR0=(1<<3);
while(1)
{
IOSET0=(1<<3);
for(i=0;i<120000;i++);
IOCLR0=(1<<3);
for(i=0;i<120000;i++);
}
}

FLASHING OF LED:
PROGRAM:

TYPE-I:

#include<lpc214x.h>
int i;
int main()
{
IODIR0=0x000000FF;
while(1)
{
IOSET0=0x000000AA;
for(i=0;i<120000;i++);
IOCLR0=0x000000AA;
for(i=0;i<120000;i++);
}
}
TYPE-II:

#include<lpc214x.h>
int i,b;
int main()
{
IODIR0=0x000000FF;
while(1)
{
for(b=0;b<8;b++)
{
IOSET0=(1<<b);
for(i=0;i<120000;i++);
IOCLR0=(1<<b);
for(i=0;i<120000;i++);
}

}
}

TYPE-III

#include<lpc214x.h>
int i;
int main()
{
IODIR0=(1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7);
while(1)
{
IOSET0=(1<<0);
for(i=0;i<120000;i++);
IOCLR0=(1<<0);
for(i=0;i<120000;i++);
IOSET0=(1<<1);
for(i=0;i<120000;i++);
IOCLR0=(1<<1);
for(i=0;i<120000;i++);
IOSET0=(1<<2);
for(i=0;i<120000;i++);
IOCLR0=(1<<2);
for(i=0;i<120000;i++);
IOSET0=(1<<3);
for(i=0;i<120000;i++);
IOCLR0=(1<<3);
for(i=0;i<120000;i++);
IOSET0=(1<<4);
for(i=0;i<120000;i++);
IOCLR0=(1<<4);
for(i=0;i<120000;i++);
IOSET0=(1<<5);
for(i=0;i<120000;i++);
IOCLR0=(1<<5);
for(i=0;i<120000;i++);
IOSET0=(1<<6);
for(i=0;i<120000;i++);
IOCLR0=(1<<6);
for(i=0;i<120000;i++);
IOSET0=(1<<7);
for(i=0;i<120000;i++);
IOCLR0=(1<<7);
for(i=0;i<120000;i++);
}
}
FRONT AND BACK LED:

#include<lpc214x.h>
int b,i;
int main()
{
IODIR0=0x000000FF;
while(1)
{
for(b=0;b<8;b++)
{
IOSET0=(1<<b);
for(i=0;i<120000;i++);
IOCLR0=(1<<b);
for(i=0;i<120000;i++);
}
for(b=7;b>=0;b--)
{
IOSET0=(1<<b);
for(i=0;i<120000;i++);
IOCLR0=(1<<b);
for(i=0;i<120000;i++);
}
}
}
Switch Controlled LED1

PROGRA M:

#include<lpc214x.h>
int i,b;
int main()
{
IODIR0=0x000000FF;
IODIR0=~(1<<16);
while(1)
{
if((IOPIN0&(1<<16))==0)
{
for(b=0;b<8;b++)
{
IOSET0=(1<<b);
for(i=0;i<120000;i++);
IOCLR0=(1<<b);
for(i=0;i<120000;i++);
}
}
else
{
IOCLR0=0x000000FF;
}
}
}
Switch Controlled LED2

PROGRAM:
#include<lpc214x.h>
int i,b;
int main()
{
IODIR0=0x000000FF;
IODIR0=~(1<<16)&~(1<<23);
while(1)
{
if((IOPIN0&(1<<16))==0)
{
for(b=0;b<8;b++)
{
IOSET0=(1<<b);
for(i=0;i<120000;i++);
IOCLR0=(1<<b);
for(i=0;i<120000;i++);
}
}
else if((IOPIN0&(1<<23))==0)
{
for(b=7;b>=0;b--)
{
IOSET0=(1<<b);
for(i=0;i<120000;i++);
IOCLR0=(1<<b);
for(i=0;i<120000;i++);
}
}
else
{
IOCLR0=0x000000FF;
}}}
Interfacing of LCD

PROGRAM:

#include<lpc214x.h>
#include <lcd.h>

intmain()
{
LCD_INIT();
LCDSTR(0x00000084,"[Link]");
LCDSTR(0x000000C2,"ENGGCOLLEGE");
while(1)
{
}
}

OUT PUT:

80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F

C0 C C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
1
Interfacing of Matrix Keyboard

PROGRAM:

#include <lpc214x.h>
#include <lcd.h>
#include<keyboard.h>

intmain()
{
LCD_INIT();
LCDSTR(0x00000080,"Matrix Keypad");
LCDSTR(0x000000C0,"KeyPressed:");
while(1)
{
IO0CLR=CLR;
IO0SET = C1;
delay_ms(10);
if(scan(R1))LCDSTR(0x000000CC,"0");//K1
if(scan(R2))LCDSTR(0x000000CC,"4");//K5
if(scan(R3))LCDSTR(0x000000CC,"8");//K9
if(scan(R4))LCDSTR(0x000000CC,"C");//K13
IO0CLR = CLR;
IO0SET=C2;
if(scan(R1))LCDSTR(0x000000CC,"1");//K2
if(scan(R2))LCDSTR(0x000000CC,"5");//K6
if(scan(R3))LCDSTR(0x000000CC,"9");//K10
if(scan(R4))LCDSTR(0x000000CC,"D");//K14
IO0CLR = CLR;
IO0SET=C3;
if(scan(R1))LCDSTR(0x000000CC,"2");//K3
if(scan(R2))LCDSTR(0x000000CC,"6");//K7
if(scan(R3))LCDSTR(0x000000CC,"A");//K11
if(scan(R4))LCDSTR(0x000000CC,"E");//K15
IO0CLR = CLR;
IO0SET=C4;
if(scan(R1))LCDSTR(0x000000CC,"3");//K4
if(scan(R2))LCDSTR(0x000000CC,"7");//K8
if(scan(R3))LCDSTR(0x000000CC,"B");//K12
if(scan(R4))LCDSTR(0x000000CC,"F");//K16
}
}
Interfacing of Stepper Motor
PROGRA M:

#include<lpc214x.h>
#include <delay.h>

int main()
{
IODIR0=(1<<16)|(1<<17)|(1<<18)|(1<<19);
while(1)
{
//FORWARDDIRECTION
IOCLR0=(1<<16);
IOCLR0=(1<<17);
IOSET0=(1<<18);
IOSET0=(1<<19);
delay_ms(10);
IOCLR0=(1<<16);
IOSET0=(1<<17);
IOSET0=(1<<18);
IOCLR0=(1<<19);
delay_ms(10);
IOSET0=(1<<16);
IOSET0=(1<<17);
IOCLR0=(1<<18);
IOCLR0=(1<<19);
delay_ms(10);
IOSET0=(1<<16);
IOCLR0=(1<<17);
IOCLR0=(1<<18);
IOSET0=(1<<19);
delay_ms(10);
}
}
PROGRAM:
#include<lpc214x.h>
#include <delay.h>

int main()
{ IODIR0=(1<<16)|(1<<17)|(1<<18)|(1<<19);
while(1)
{
//REVERSEDIRECTION
IOSET0=(1<<16);
IOCLR0=(1<<17);
IOCLR0=(1<<18);
IOSET0=(1<<19);
delay_ms(10);
IOSET0=(1<<16);
IOSET0=(1<<17);
IOCLR0=(1<<18);
IOCLR0=(1<<19);
delay_ms(10);
IOCLR0=(1<<16);
IOSET0=(1<<17);
IOSET0=(1<<18);
IOCLR0=(1<<19);
delay_ms(10);
IOCLR0=(1<<16);
IOCLR0=(1<<17);
IOSET0=(1<<18);
IOSET0=(1<<19);
delay_ms(10);
}
}
Mini projects for IOT:
1. Garbage Segregator and Bin Level Indicator
2. Colour based Product Sorting
3. Image Processing based Fire Detection
4. Vehicle Number Plate Detection
5. Smart Lock System

Objective:

To apply the knowledge, they gained in doing the experiments.

Team constitution:

A team size may be from 3 to 4 students.

Guidelines:

 Students shall from a group and can do their mini project.

 Student must buy their own hardware setup for doing Mini projects.

 If they are utilizing the college resource, they should get approval from HoD.

 At the end, are port along with hard ware must be submitted to college.

 If required students need to present their work as presentation.


Garbage Segregator and Bin Level Indicator

Objective:

With progress in human technology we have seen a substantial progress in the amount of waste
generated. Recycling is the only way to manage this huge amount of waste. But recycling requires garbage to
be segregated. Without segregation garbage cannot be recycled because different type of garbage requires
different recycling processes.

Also it is important to educate users and instruct them every time they come near the dustbin about
instructions about throwing the trash. For this purpose we design a garbage disposal system that uses multiple
dustbins with a voice based system that speaks to the user each time he she stands before the dustbin.

The system makes use of a camera to detect presence if any person in front of the dustbin. If a person
is detected, the system issues voice instructions to the user about throwing right garbage in the right bin. In
case the dust bin is full it instructs the user to find another dustbin to throw garbage in.

To develop this system we make use of a raspberry Pi controller. The controller is interfaced with a
camera and a voice speaker for detection and communication. The controller gets dustbin level input using
ultrasonic level sensors each having LED indicators interfaced to it. The level sensors are used to constantly
feed the raspberry pi with bin levels.

The raspberry pi is also interfaced with a Wifi module to transmit the level data over the internet. The
Level sensor panels are made to be easily mounted over any dust bin. This allows the system to be easily
screwed over any dust bin for instant installation.

The data is transmitted over IOT to IOT gecko platform which displays the bin level data over internet. This
indication can be used to alert the authorities that the garbage bins need to be emptied. Thus the system
automates garbage segregation and level monitoring to help counter the garbage crisis using IOT.

Note: The Dustbins are not included in this kit. The sensors can be mounted over any open
dustbins.

Components

RaspberryPi

Wifi Module
Ultrasonic Level

Sensors LED

Indicators

Camera

Speaker Wiring

Supporting Frame

Buttons &Switches

Screws & Bolts

Resistors Capacitors

Diodes IC‟s

Transistors

Connectors

PCB
Colour based Product Sorting
Objective:

Color Based Object Sorting has a wide usage in fruit sorting as well as candy sorting industries. This
system puts forward a mechanism to detect color and sort items through image processing. Once identified a
mechanism is used to sort the candies into particular bins baskets. We here demonstrate this mechanism using
a camera with electronic circuitry along with sorting mechanism using3 bins. The system uses raspberry pi
connected to a controller circuit to achieve this task. The controller circuit consists of a camera attached to it
that detects color of a small object in front of it. A motor is used to feed an object to the camera chamber. As
soon is the color is detected a signal is sent to the sorter mechanism which uses a motor to position the sorting
tube towards respective section. A feeder is then used to push the object towards the tubs so that it gets sorted
and next object is pulled in by the feeder. The action details are sent to the IOT server using iot gecko
platform to keep track of the number of objects sorted in each section. Thus, we achieve a completely
automated IOT based sorting system.

Hardware Specifications:

Raspberry Pi3

Camera

Servo Motor

LCD

Display

Resistors

Capacitors

Transistors

Cables and Connectors Diodes

PCB and Breadboards LED

Transformer/Adapter Push

Buttons

Switch
IC

IC Sockets

Connector Shaft

Bed Frame

Tubes

Screws & Joints

Supporting Frame

Software

Specifications

Programming Language:

Python

IOT Gecko

BLOCKDIAGRAM:
Image Processing based Fire Detection
Objective:

The main advantage of Image Processing Based Fire Detection System is the early warning
benefit. This system can be installed just about anywhere in a commercial building, malls and at
many more public places for fire detection. This system uses camera for detecting fires. So we do not
need any other sensors to detect fire. System processes the camera input and then processor processes
it to detect fires. The heat signatures and fire illumination patterns are detected in images to
determine if it is a fire and take action accordingly. On detecting fire system goes into emergency
mode and sounds an alarm. Also displays the status on the LCD display informing about the system.

Hardware Specifications:

RaspberryPi3 Camera

Buzzer

LCD Display

Resistors

Capacitors

Transistors

Cables and Connectors Diodes

PCB and Breadboards

LED

Transformer/Adapter

Push Buttons

Switch

IC

IC Sockets
Software Specifications:

Linux

Programming Language: Python

BLOCK DIAGRAM:
Vehicle Number Plate Detection

Objective:
SMART LOCK SYSTEM

Objective:

From connected cars to connected wearable’s to home security, the Internet of Things is rapidly marking its
presence in every field. Now we have IoT enabled home automation and security devices that can be controlled
from anywhere in the world using the Internet of Things. There are many kinds of Wi-Fi door lock available in the
market which makes your home more secure and saves time in finding the keys. Here we are also building a similar Wi-
Fi door lock which can be controlled from the Smartphone.

So in this project, we are going to make an IOT based Door Lock System using Node MCU, Solenoid
Lock, and Ad fruit IO. Here Node MCU will act as the main controller and connect the user to the door lock system
using the Internet. This allows the user to lock/ unlock his Home’s door lock by using a smart phone from anywhere in
the world.

Components Required:

Node MCU ESP8266

Solenoid Lock

Relay Module

Buzzer

You might also like