Professional Documents
Culture Documents
By connecting devices, we are gaining more control than we have ever had before.
We can adjust the thermostat from the office, check the security cameras from the
movie theater, or turn the lights off or close the garage door from just about
anywherewhether youre next door or across the world.
The ability to open an app on your smartphone and control devices from anywhere
is great, but gets more and more confusing as you begin to open one app for your
thermostat, another for your light bulbs, another for your security, another for your
TV, another for your vacuum
IOT not only simplifies your control over these devices, but it actually connects these
devices to each other as well, no matter the brand. With a single app from your
smartphone you can control everything. And the real magic happens when you
program these devices to perform a function based on the actions or location of
another device. Simply getting out of bed in the morning can trigger your music to
begin playing and your coffee maker to brew coffee. Closing the garage door on
your way to work can arm your security system and make sure all the lights and
TVs are off in the house. And returning home at night can turn on the lights, unlock
the door and turn to your favorite TV channel right as you walk in the door.
PROJECT DESCRIPTION
The main aim of the project is to control multiple electrical loads remotely over
internet falling under the basic principles of Internet of Things-IOT. For this real-
time scenario we use an Android app on any smart cell phone with user configurable
front end (GUI).
The data sent from the cell phone upon touch commands are sent through allotted IP
fed to it, to any nearby wireless modem which is then received by a Wi-Fi module
interfaced to a microcontroller of 8051 series, under TCP IP via networked wireless
modem environment.
Relays are then driven as per the command received at the controller end to handle
electrical loads. The real time data is also seen at the sending end upon a LCD display
interfaced to the microcontroller that displays the status of the loads too.
The power supply consists of a step down transformer 230/12V, which steps down
the voltage to 12V AC. This is converted to DC using a Bridge rectifier and it is then
regulated to +5V using a voltage regulator 7805 which is required for the operation
of the microcontroller , 3.3 volt for the Wi-Fi unit and other components
ADVANTAGES AND DISADVANTAGES OF UNDERGROUND OF
INTERNET OF THINGS
Advantages
Communication IoT encourages the communication between devices, also
famously known as Machine-to-Machine (M2M) communication. Because of
this, the physical devices are able to stay connected and hence the total
transparency is available with lesser inefficiencies and greater quality.
Time As hinted in the previous examples, the amount of time saved because
of IoT could be quite large. And in todays modern life, we all could use more
time.
Money The biggest advantage of IoT is saving money. If the price of the
tagging and monitoring equipment is less than the amount of money saved,
then the Internet of Things will be very widely adopted. IoT fundamentally
proves to be very helpful to people in their daily routines by making the
appliances communicate to each other in an effective manner thereby saving
and conserving energy and cost. Allowing the data to be communicated and
shared between devices and then translating it into our required way, it makes
our systems efficient.
Complexity The IoT is a diverse and complex network. Any failure or bugs
in the software or hardware will have serious consequences. Even power
failure can cause a lot of inconvenience.
Software required
Keil u Vision 3
The keil 8051 tool kit includes three main tools, assembler, compiler and linker.
An assembler is used to assemble your 8051 assembly program. A compiler is used
to compile your C source code into an object file. A linker is used to create an
absolute object module suitable for your in-circuit emulator.
Flash Magic
Flash Magic is a PC tool for programming flash based microcontrollers from NXP
using a serial or Ethernet protocol while in the target hardware. Flash Magic is an
application developed by Embedded Systems Academy to allow you to easily
access the features of a microcontroller device. With this program you can erase
individual blocks or the entire Flash memory of the microcontroller.
ORCAD
OrCAD is a proprietary software tool suite used primarily for electronic design
automation. The software is used mainly by electronic design engineers and
electronic technicians to create electronic schematics and electronic prints for
manufacturing printed circuit boards.
Hardware required
Multimeter
Make: Fluke
Model no: 115
Range: 0.00001%
Breadboard
Steel honeycombed, closed cell general purpose breadboard.
Relay
Make: Obsidian
Model: SKUOSDN6134267
Type: 8 pin DPDT PCB type 5 V
Features
Compatible with MCS-51 Products
4K Bytes of In-System Reprogrammable Flash Memory
Endurance: 1,000 Write/Erase Cycles
Fully Static Operation: 0 Hz to 24 MHz
Three-level Program Memory Lock
128 x 8-bit Internal RAM
32 Programmable I/O Lines
Two 16-bit Timer/Counters
Six Interrupt Sources
Programmable Serial Channel
Low-power Idle and Power-down Modes
The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer with
4K bytes of Flash programmable and erasable read only memory (PEROM). The
device is manufactured using Atmels high-density nonvolatile memory
technology and is compatible with the industry-standard MCS-51 instruction set
and pinout. The on-chip Flash allows the program memory to be reprogrammed in-
system or by a conventional nonvolatile memory programmer. By combining a
versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C51 is a
powerful microcomputer which provides a highly-flexible and cost-effective
solution to many embedded control applications.
The AT89C51 provides the following standard features: 4K bytes of Flash, 128
bytes of RAM, 32 I/O lines, two 16-bit timer/counters, a five vector two-level
interrupt architecture, full duplex serial port, on-chip oscillator and clock circuitry.
In addition, the AT89C51 is designed with static logic for operation down to zero
frequency and supports two software selectable power saving modes. The Idle
Mode stops the CPU while allowing the RAM, timer/counters, serial port and
interrupt system to continue functioning. The Power-down Mode saves the RAM
contents but freezes the oscillator disabling all other chip functions until the next
hardware reset.
Transistor 2N2222
Features of 2N2222
Fig5: Relays
Relays allow one circuit to switch a second circuit which can be completely
separate from the first. For example a low voltage battery circuit can use a relay
to switch a 230V AC mains circuit. There is no electrical connection inside the relay
between the two circuits; the link is magnetic and mechanical.
The coil of a relay passes a relatively large current, typically 30mA for a 12V
relay, but it can be as much as 100mA for relays designed to operate from lower
voltages. Most ICs (chips) cannot provide this current and a transistor is usually used
to amplify the small IC current to the larger value required for the relay coil. The
maximum output current for the popular 555 timer IC is 200mA so these devices
can supply relay coils directly without amplification.
Relays are usually SPDT or DPDT but they can have many more sets of
switch contacts, for example relays with 4 sets of changeover contacts are readily
available. For further information about switch contacts and the terms used to
describe them please see the page on switches.
Most relays are designed for PCB mounting but you can solder wires directly
to the pins providing you take care to avoid melting the plastic case of the relay.
Relay coils produce brief high voltage 'spikes' when they are switched off and
this can destroy transistors and ICs in the circuit. To prevent damage, connect a
protection diode across the relay coil.
The figure shows a relay with its coil and switch contacts. You can see a lever
on the left being attracted by magnetism when the coil is switched on. This lever
moves the switch contacts.
Fig7: Relay circuit
There is one set of contacts (SPDT) in the foreground and another behind them,
making the relay DPDT.
The relay's switch connections are usually labelled COM, NC and NO:
COM = Common, always connect to this; it is the moving part of the switch.
NC = Normally Closed, COM is connected to this when the relay coil is off.
NO = Normally Open, COM is connected to this when the relay coil is on.
Applications of relays
A dashpot is a piston filled with fluid that is allowed to escape slowly. The
time period can be varied by increasing or decreasing the flow rate. For longer
time periods, a mechanical clockwork timer is installed.
MICROPHONE
Fig8: Resistors
A resistor is a two-terminalpassiveelectronic component which implements
electrical resistance as a circuit element. When a voltage V is applied across the
terminals of a resistor, a current I will flow through the resistor in direct proportion
to that voltage. The reciprocal of the constant of proportionality is known as the
resistance R, since, with a given voltage V, a larger value of R further "resists" the
flow of current I as given by Ohm's law:
excess noise, and temperature coefficient are mainly dependent on the technology
used in manufacturing the resistor. They are not normally specified individually for
a particular family of resistors manufactured using a particular technology. A family
of discrete resistors is also characterized according to its form factor, that is, the size
of the device and position of its leads (or terminals) which is relevant in the practical
manufacturing of circuits using them.
Capacitors
This regulator has a ~1V linear drop-out, better than the 780X series'
2V. That means you must give it at least 4.3V to get a clean 3.3V out.
This regulator is often used to get a 5V power supply to a a clean 3.3V.
There is a constant 'quiescent' current draw of 5mA.
CLAPP CIRCUIT
Required Components
1K, 4.7K, 47K,
330 and 470 ohm resistors
Electric Condenser mic
Two BC547 transistors
LED
555 timer
9V Battery
10F and 2 100nF capacitors
This circuit (As shown below) is made with the help of Sound activated
sensor, which senses the sound of Clap as input and processes it to the
circuit in order to give the Output. When sound is given as the input to
the Electric Condenser Mic, it is changed into the Electrical Energy as
the LED turns on. LED turns ON, as we give sound input and it turns
OFF automatically after few seconds. Turn-On LED timer can be
changed by varying the value of 100mF capacitor as it is connected with
555 timer whose main purpose is to generate the pulse.
Although the name of the circuit is the Clap Switch, but you are not
restricted to give input as the Clap only. It can be any sound, having
same pitch as of Clap so this can also be called as Sound Operated
Switch. This circuit is mainly based on transistors, because the negative
terminal of Mic is directly connected with the transistor. In this circuit,
we havent used any Electronic Switch to turn on/off the circuit, so
when you are connecting the battery with the circuit, it means your
circuit is now turned ON and it will take the inputs in the form of Sound
Energy. You can modify this circuit by using Relay as Electronic Switch
to turn the circuit ON or OFF.
As soon as we give the sound input to the circuit, it amplifies the sound
signals and proceeds them to the 555 timers which generates the pulse to
the LED, making it turn ON. You are to make sure, that the negative
side of the Condenser mic is connected with the amplifier or the circuit
will heat-up and may not working with different models of transistors
etc. You cannot increase the sensitivity of the Condenser mic for long
usage, it has short range by default. It is also applicable for the LAMP,
so this circuit has many opportunities for modification
step down transformer: is one whose secondary voltage is less than its
primary voltage. It is designed to reduce the voltage from the primary
winding to the secondary winding. This kind of transformer steps
down the voltage applied to it.
As a step-down unit, the transformer converts high-voltage, low-current
power into low-voltage, high-current power. The larger-gauge wire used
in the secondary winding is necessary due to the increase in current. The
primary winding, which doesnt have to conduct as much current, may
be made of smaller-gauge wire.
There are two types of communications parallel and serial. Parallel data transfer
can be made through an 8-bit data line for faster communication.
RS-232C
Description/Ordering Information
The MAX232 is a dual driver/receiver that includes a capacitive voltage generator
to supply TIA/EIA-232-F voltage levels from a single 5-V supply. Each receiver
converts TIA/EIA-232-F inputs to 5-V TTL/CMOS levels. These receivers have a
typical threshold of 1.3 V, a typical hysteresis of 0.5 V, and can accept 30-V
inputs. Each driver converts TTL/CMOS input levels into TIA/EIA-232-F levels.
The driver, receiver, and voltage-generator functions are available as cells in the
Texas Instruments LinASIC. library
The figure shows the waveform on a single conductor to transmit a byte (say, 0x41)
serially. The upper waveform is the TTL-level waveform at the transmit pin of the
microcontroller. The lower waveform is the same waveform converted by the RS-
232 driver (MAX232) into RS-232C level. Thus to assure error-free transmission
over greater distances than would be possible with TTL levels.
Each byte is preceded by a start bit and followed by a stop bit. The start and stop
bits are used to synchronize the serial receivers. The data byte is always
transmitted with least-significant bit (LSB) first. For error checking, it is possible
to include a parity bit as well, just prior to the stop bit.
The bits are transmitted at specific time intervals determined by the baud rate of
the serial signal. The baud rate is the reciprocal of the time to send one bit. Error-
free serial communication requires the baud rate, number of data bits, number of
stop bits, and presence or absence of a parity bit to be the same at the transmitter
and receiver ends.
The information stored in the microcontroller is sent to the PC through the COM
port using the HyperTerminal program.
BASCOM
BASCOM-AVR is not only a BASIC Compiler, but also a comfortable Integrated
Development Environment (IDE) running under Windows 95 and Windows NT. Such
a development environment supports the whole process from coding and testing a
program to programming the used microcontroller. In this book the term BASCOM is
used when no distinction must be made between BASCOM-8051 and BASCOM-
AVR. In all cases where a distinction is necessary, a few changes only are required to
make the program work with the other family of microcontrollers. This is one
important advantage of high-level languages. So as to prevent that work with
BASCOM and the program examples in this book are mere dry homework, a demo of
BASCOM-8051 or BASCOM-AVR can be used for first tests. These BASCOM
demos can be downloaded free of charge from different URLs. For proper installation
of the required BASCOM IDE, make sure a printer is installed - the printer need not
necessarily be used or connected. The licence agreement must be accepted before one
of the BASCOM IDEs is installed
Working on Projects After the start of BASCOM you can create a new file by
selecting File>New or open an existing file by selecting File>Open. In the next step,
check such BASCOM Options like device selection, baud rate, clock frequency and
other relating options. A detailed explanation of these options will be given in the next
chapter. Now you may edit the BASIC source and compile it afterwards. As a rule,
the compiler detects here the first errors and the program must be debugged. The
BASIC source must be edited as long as the compilation is without any errors.
Normally, the process of editing, compiling and debugging needs to be repeated
several times. It makes no sense to debug all errors in one step. Editing several typing
errors in one step is no problem. But for more difficult errors, a separate compiler run
checks the validity of the changes carried out. It is always easier to debug a localized
error.
With the help of the internal BASCOM Simulator the program operation can be
checked without any hardware. The probably last task in a project is programming the
device that is used in the application hardware, followed by an excessive test of the
program on the target. The project proves to be successful if these tests document a
proper function in the target hardware. Otherwise, some steps must be repeated.
Before working with the BASCOM-AVR, the development environment will be
described by means of a small program example; the next chapter describes the
BASCOM options important to the BASCOM environment used and the target
hardware.
BASCOM Options
Each BASCOM offers a lot of options that must be defined by selection in the Option
menu. The options should be selected at the beginning of a project and saved. Later
changes of this setup will then only be required for details. The following description
applies to BASCOM-AVR. In BASCOM8051, selecting the various options is quite
similar. In the first step, the used microcontroller is defined by selecting
Options>Compiler>Chip. Let us use here an AT90S8515 without external RAM.
Figure 10 shows the parameters. On the right side you can see the available memory
of the selected microcontroller. Each parameter in a function needs two bytes of stack.
the stack size shows the number of reserved bytes for the stack. The value 32 is
default and remains unchanged here. Local variables are saved in a frame. The default
value is 50 and remains unchanged, too.
To simplify matters, all files on the left side should be selected. For simulations with
AVR Studio (AVR only), the related object file is required. Activating Size warning
reports an exceeding of the available program memory. The last option can be very
helpful. Some programmers require Bin or Hex files with swapped LSB and MSB. In
this case, activate the Swap Words option. The baud rate of serial communication
(RS232) depends on the clock frequency of the microcontroller. The clock frequency
and desired baud rate can be selected from menu Options>
Compiler>Communication. Figure 12 shows the parameter input. The error field
shows the deviation of the generated baud rate. It is very important to keep this
deviation within defined limits as otherwise communication errors may occur
Selection of baud rate and oscillator frequency
.
This is the screen where coding of the respective program is done
INTERFACING DIAGRAM
Source Code
$regfile = "8052.dat"
$crystal = 11059200
$baud = 9600
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = P2.4 , Db5 = P2.5 , Db6 = P2.6 , Db7 = P2.7 , E =
P0.1 , Rs = P0.0
P1 = 0
P2 = 0
P3 = 0
P3.2 = 1
P0 = 0
Dim A As Byte
Dim C As Byte
Dim D As Byte
A=0
C=0
D=0
Cursor On Blink
Cls
Aa:
Locate 1 , 5
Lcd "IoT based"
Locate 2 , 1
Lcd "Control System"
Wait 2
Cls
Locate 1 , 1
Lcd "Fan ON "
P1.3 = 1 'Fan on
Bitwait P3.2 , Reset
Wait 2
Locate 1 , 8
Lcd "Lght ON "
P1.2 = 1 'light on
Wait 5
Locate 1 , 1
Lcd "Fan OFF"
P1.3 = 0 'fan off
Wait 5
Locate 2 , 1
Lcd "Motor ON"
P1.1 = 1 'motor on
Wait 5
Locate 2 , 10
Lcd "G:ON "
P1.0 = 1 'geyser on
Wait 5
Locate 2 , 1
Lcd "Motor OF"
P1.1 = 0 'motor off
Wait 5
Locate 2 , 10
Lcd "G:OFF"
P1.0 = 0 'geyser off
Wait 10
Locate 1 , 8
Lcd "Lght OFF"
P1.2 = 0 'light off
End
STIMULATION