Automatic Floor Cleaner
Automatic Floor Cleaner
TOPICS
Certificates………………………………………………………………………
Acknowledgement………………………………………………………........
CHAPTER 1: INTRODUCTION
1.3 Thesis…………………………………………………………………………………………
3.2 Microcontroller……………………………………………………………………………………..
3.7 Servomotor………………………………………………………………………………………..
REFERENCES
2
CHAPTER 1: INTRODUCTION
1.1 Introduction:
Automatic floor cleaner is a compact robotics system which provides floor cleaning service in room
and big offices reducing human labor. Basically as a robot it eliminates human error and provide cleaning
activity with much more efficiency. If we clean the floor manually then there is a possibility that the operator
will leave some portion of the floor. Also due to manual labor involved this is time consuming and irritating to
clean the floor. Also in big offices floor area is very huge and the people involved there for cleaning purpose
cannot clean it much more efficiently. This is where the robot comes as an advantage. Also the robot is small
and compact in size. So we can carry it and place it wherever we can on the house. Also in industries the robot
is very cost effective as compared to manual labor involved. The flexibility, time saving and efficiency make
the robot a clean choice for cleaning the floor.
The project aims designing automatic floor cleaning robot using arduno . Arduino is an open source,
computer hardware and software company, project, and user community that designs and
manufactures microcontroller kits for building digital devices and interactive objects that can sense
and control objects in the physical world.
A dc motor uses electrical energy to produce mechanical energy, very typically through the
interaction of magnetic fields and current-carrying conductors. The reverse process, producing
electrical energy from mechanical energy, is accomplished by an alternator, generator or dynamo.
The controlling device of the robot system is Arduino Microcontroller. DC motors along with
driver, sro4 ultrasonic sensor is interfaced to Microcontroller. And user can place a bottle on the robot
with floor cleaning liquid. When the robot moves; automatically its pumps the liquid and cleans the
floor and avoiding the obstacles in its path. To perform this intelligent task, Arduino Microcontroller
is loaded with a program written in C language.
3
1.2 Project Overview:
1.3 Thesis:
Chapter 1 Presents introduction to the overall thesis and the overview of the project. In the project
overview a brief introduction of Arduino, sr04 ultrasonic sensor, DC motor and its applications are
discussed.
Chapter 2 Presents the topic embedded systems. It explains the about what is embedded systems,
need for embedded systems, explanation of it along with its applications.
Chapter 3 Presents the hardware description. It deals with the block diagram of the project and
explains the purpose of each block.
Chapter 5 Presents the project description along with each module interfacing to microcontroller.
Chapter 7 Presents the results, conclusion and future scope of the project.
4
CHAPTER 2: EMBEDDED SYSTEMS
Embedded systems are controlled by one or more main processing cores that are
typically either microcontrollers or digital signal processors (DSP). The key characteristic, however,
is being dedicated to handle a particular task, which may require very powerful processors. For
example, air traffic control systems may usefully be viewed as embedded, even though they involve
mainframe computers and dedicated regional and national networks between airports and radar sites.
(Each radar probably includes one or more embedded systems of its own.)
Since the embedded system is dedicated to specific tasks, design engineers can optimize
it to reduce the size and cost of the product and increase the reliability and performance. Some
embedded systems are mass-produced, benefiting from economies of scale.
Physically embedded systems range from portable devices such as digital watches and
MP3 players, to large stationary installations like traffic lights, factory controllers, or the systems
controlling nuclear power plants. Complexity varies from low, with a single microcontroller chip, to
very high with multiple units, peripherals and networks mounted inside a large chassis or enclosure.
In general, "embedded system" is not a strictly definable term, as most systems have
some element of extensibility or programmability. For example, handheld computers share some
elements with embedded systems such as the operating systems and microprocessors which power
them, but they allow different applications to be loaded and peripherals to be connected. Moreover,
even systems which don't expose programmability as a primary feature generally need to support
software updates. On a continuum from "general purpose" to "embedded", large application systems
5
will have subcomponents at most points even if the system as a whole is "designed to perform one or
a few dedicated functions", and is thus appropriate to call "embedded". A modern example of
embedded system is shown in fig: 2.1.
Labeled parts include microprocessor (4), RAM (6), flash memory (7).Embedded
systems programming is not like normal PC programming. In many ways, programming for an
embedded system is like programming PC 15 years ago. The hardware for the system is usually
chosen to make the device as cheap as possible. Spending an extra dollar a unit in order to make
things easier to program can cost millions. Hiring a programmer for an extra month is cheap in
comparison. This means the programmer must make do with slow processors and low memory, while
at the same time battling a need for efficiency not seen in most PC applications. Below is a list of
issues specific to the embedded field.
2.1.1 History:
6
One of the first recognizably modern embedded systems was the Apollo Guidance
Computer, developed by Charles Stark Draper at the MIT Instrumentation Laboratory. At the
project's inception, the Apollo guidance computer was considered the riskiest item in the Apollo
project as it employed the then newly developed monolithic integrated circuits to reduce the size
and weight. An early mass-produced embedded system was the Autonetics D-17 guidance computer
for the Minuteman missile, released in 1961. It was built from transistor logic and had a hard disk for
main memory. When the Minuteman II went into production in 1966, the D-17 was replaced with a
new computer that was the first high-volume use of integrated circuits.
2.1.2 Tools:
To save costs, embedded systems frequently have the cheapest processors that can do
the job. This means your programs need to be written as efficiently as possible. When dealing with
large data sets, issues like memory cache misses that never matter in PC programming can hurt you.
Luckily, this won't happen too often- use reasonably efficient algorithms to start, and optimize only
when necessary. Of course, normal profilers won't work well, due to the same reason debuggers don't
work well.
Memory is also an issue. For the same cost savings reasons, embedded systems usually
have the least memory they can get away with. That means their algorithms must be memory efficient
(unlike in PC programs, you will frequently sacrifice processor time for memory, rather than the
reverse). It also means you can't afford to leak memory. Embedded applications generally use
7
deterministic memory techniques and avoid the default "new" and "malloc" functions, so that leaks
can be found and eliminated more easily. Other resources programmers expect may not even exist.
For example, most embedded processors do not have hardware FPUs (Floating-Point Processing
Unit). These resources either need to be emulated in software, or avoided altogether.
Embedded systems frequently control hardware, and must be able to respond to them
in real time. Failure to do so could cause inaccuracy in measurements, or even damage hardware such
as motors. This is made even more difficult by the lack of resources available. Almost all embedded
systems need to be able to prioritize some tasks over others, and to be able to put off/skip low priority
tasks such as UI in favor of high priority tasks like hardware control.
The uses of embedded systems are virtually limitless, because every day new products
are introduced to the market that utilizes embedded computers in novel ways. In recent years,
hardware such as microprocessors, microcontrollers, and FPGA chips have become much cheaper. So
when implementing a new form of control, it's wiser to just buy the generic chip and write your own
custom software for it. Producing a custom-made chip to handle a particular task or set of tasks costs
far more time and money. Many embedded computers even come with extensive libraries, so that
"writing your own software" becomes a very trivial task indeed. From an implementation viewpoint,
there is a major difference between a computer and an embedded system. Embedded systems are often
required to provide Real-Time response. The main elements that make embedded systems unique are
its reliability and ease in debugging.
2.2.1 Debugging:
8
An in-circuit debugger (ICD), a hardware device that connects to the microprocessor via a
JTAG or Nexus interface. This allows the operation of the microprocessor to be controlled
externally, but is typically restricted to specific debugging capabilities in the processor.
An in-circuit emulator replaces the microprocessor with a simulated equivalent, providing full
control over all aspects of the microprocessor.
A complete emulator provides a simulation of all aspects of the hardware, allowing all of it to
be controlled and modified and allowing debugging on a normal PC.
Unless restricted to external debugging, the programmer can typically load and run software
through the tools, view the code running in the processor, and start or stop its operation. The
view of the code may be as assembly code or source-code.
Because an embedded system is often composed of a wide variety of elements, the
debugging strategy may vary. For instance, debugging a software(and microprocessor) centric
embedded system is different from debugging an embedded system where most of the processing is
performed by peripherals (DSP, FPGA, co-processor). An increasing number of embedded systems
today use more than one single processor core. A common problem with multi-core development is
the proper synchronization of software execution. In such a case, the embedded system design may
wish to check the data traffic on the busses between the processor cores, which requires very low-
level debugging, at signal/bus level, with a logic analyzer, for instance.
2.2.2 Reliability:
Embedded systems often reside in machines that are expected to run continuously for
years without errors and in some cases recover by themselves if an error occurs. Therefore the
software is usually developed and tested more carefully than that for personal computers, and
unreliable mechanical moving parts such as disk drives, switches or buttons are avoided.
Specific reliability issues may include:
The system cannot safely be shut down for repair, or it is too inaccessible to repair. Examples
include space systems, undersea cables, navigational beacons, bore-hole systems, and
automobiles.
The system must be kept running for safety reasons. "Limp modes" are less tolerable. Often
backups are selected by an operator. Examples include aircraft navigation, reactor control
systems, safety-critical chemical factory controls, train signals, engines on single-engine
aircraft.
9
The system will lose large amounts of money when shut down: Telephone switches, factory
controls, bridge and elevator controls, funds transfer and market making, automated sales and
service.
A variety of techniques are used, sometimes in combination, to recover from errors—
both software bugs such as memory leaks, and also soft errors in the hardware:
Watchdog timer that resets the computer unless the software periodically notifies the watchdog
Subsystems with redundant spares that can be switched over to
software "limp modes" that provide partial function
Designing with a Trusted Computing Base (TCB) architecture[6] ensures a highly secure &
reliable system environment
An Embedded Hypervisor is able to provide secure encapsulation for any subsystem
component, so that a compromised software component cannot interfere with other
subsystems, or privileged-level system software. This encapsulation keeps faults from
propagating from one subsystem to another, improving reliability. This may also allow a
subsystem to be automatically shut down and restarted on fault detection.
Immunity Aware Programming
2.3 Explanation of Embedded Systems:
In this design, the software simply has a loop. The loop calls subroutines, each of
which manages a part of the hardware or software.
Some embedded systems are predominantly interrupt controlled. This means that tasks
performed by the system are triggered by different kinds of events. An interrupt could be generated
for example by a timer in a predefined frequency, or by a serial port controller receiving a byte. These
kinds of systems are used if event handlers need low latency and the event handlers are short and
simple.
10
Usually these kinds of systems run a simple task in a main loop also, but this task is not
very sensitive to unexpected delays. Sometimes the interrupt handler will add longer tasks to a queue
structure. Later, after the interrupt handler has finished, these tasks are executed by the main loop.
This method brings the system close to a multitasking kernel with discrete processes.
Cooperative Multitasking:
Primitive Multitasking:
In this type of system, a low-level piece of code switches between tasks or threads
based on a timer (connected to an interrupt). This is the level at which the system is generally
considered to have an "operating system" kernel. Depending on how much functionality is required, it
introduces more or less of the complexities of managing multiple tasks running conceptually in
parallel.
As any code can potentially damage the data of another task (except in larger systems
using an MMU) programs must be carefully designed and tested, and access to shared data must be
controlled by some synchronization strategy, such as message queues, semaphores or a non-blocking
synchronization scheme.
11
A microkernel is a logical step up from a real-time OS. The usual arrangement is that
the operating system kernel allocates memory and switches the CPU to different threads of execution.
User mode processes implement major functions such as file systems, network interfaces, etc.
In general, microkernels succeed when the task switching and intertask communication
is fast, and fail when they are slow. Exokernels communicate efficiently by normal subroutine calls.
The hardware and all the software in the system are available to, and extensible by application
programmers. Based on performance, functionality, requirement the embedded systems are divided
into three categories:
These systems takes the input in the form of electrical signals from transducers or
commands from human beings such as pressing of a button etc.., process them and produces desired
output. This entire process of taking input, processing it and giving output is done in standalone mode.
Such embedded systems comes under stand alone embedded systems
Embedded systems which are used to perform a specific task or operation in a specific
time period those systems are called as real-time embedded systems. There are two types of real-time
embedded systems.
These embedded systems follow an absolute dead line time period i.e.., if the tasking is
not done in a particular time period then there is a cause of damage to the entire equipment.
Eg: consider a system in which we have to open a valve within 30 milliseconds. If this valve is
not opened in 30 ms this may cause damage to the entire equipment. So in such cases we use
embedded systems for doing automatic operations.
12
These embedded systems follow a relative dead line time period i.e.., if the task is not done in a
particular time that will not cause damage to the equipment.
Eg: Consider a TV remote control system ,if the remote control takes a few milliseconds delay it will
not cause damage either to the TV or to the remote control. These systems which will not cause damage when
they are not operated at considerable time period those systems comes under soft real-time embedded systems.
Eg:
Consider a web camera that is connected to the computer with internet can be used to
spread communication like sending pictures, images, videos etc.., to another computer
with internet connection throughout anywhere in the world.
Whenever a person comes near the door, it captures the image of a person and sends to
the desktop of your computer which is connected to internet. This gives an alerting message with
image on to the desktop of your computer, and then you can open the door lock just by clicking the
mouse. Fig: 2.2 shows the network communications in embedded systems.
13
The central processing unit (c.p.u) can be any one of the following microprocessor,
microcontroller, digital signal processing.
Among these Microcontroller is of low cost processor and one of the main advantage of
microcontrollers is, the components such as memory, serial communication interfaces, analog
to digital converters etc.., all these are built on a single chip. The numbers of external
components that are connected to it are very less according to the application.
Microprocessors are more powerful than microcontrollers. They are used in major applications
with a number of tasking requirements. But the microprocessor requires many external
components like memory, serial communication, hard disk, input output ports etc.., so the
power consumption is also very high when compared to microcontrollers.
Digital signal processing is used mainly for the applications that particularly involved with
processing of signals
1. Consumer applications:
2. Office automation:
14
Fig2.4: Fax machine Fig2.5: Printing machine
3. Industrial automation:
Today a lot of industries are using embedded systems for process control. In industries
we design the embedded systems to perform a specific operation like monitoring temperature,
pressure, humidity ,voltage, current etc.., and basing on these monitored levels we do control other
devices, we can send information to a centralized monitoring station.
Fig2.6: Robot
In critical industries where human presence is avoided there we can use robots which
are programmed to do a specific operation.
5. Computer networking:
15
Fig2.7: Computer networking
6. Tele communications:
16
CHAPTER 3: HARDWARE DESCRIPTION
3.1 Introduction:
In this chapter the block diagram of the project and design aspect of independent
modules are considered. Block diagram is shown in fig: 3.1:
17
The main blocks of this project are:
1. Arduino UNO.
2. DC motor with driver.
3. SR04.
4. SERVO MOTOR.
5. Rechargeable Battery.
6. LED indication.
3.2 ATMEGA328:
Features
(ATmega48PA/88PA/168PA/328P)
• Peripheral Features
– One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture
Mode
Temperature Measurement
Temperature Measurement
• Operating Voltage:
• Temperature Range:
– -40°C to 85°C
• Speed Grade:
20
1.1 Pin Descriptions
Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each it). The Port B output
buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port B pins
that are externally pulled low will source current if the pull-up resistors are activated. The Port B pins are tri-
stated when a reset condition becomes active, even if the clock is not running. Depending on the clock selection
fuse settings, PB6 can be used as input to the inverting Oscillator amplifier and input to the internal clock
operating circuit. Depending on the clock selection fuse settings, PB7 can be used as output from the inverting
Oscillator amplifier.
21
If the Internal Calibrated RC Oscillator is used as chip clock source, PB7..6 is used as TOSC2..1 input for the
Asynchronous Timer/Counter2 if the AS2 bit in ASSR is set. The various special features of Port B are
elaborated in ”Alternate Functions of Port B” on page 82 and ”System Clock and Clock Options” on page 26.
Port C is a 7-bit bi-directional I/O port with internal pull-up resistors (selected for each it). The PC5..0 output
buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port C pins
that are externally pulled low will source current if the pull-up resistors are activated. The Port C pins are tri-
stated when a reset condition becomes active, even if the clock is not running.
1.1.5 PC6/RESET
If the RSTDISBL Fuse is programmed, PC6 is used as an I/O pin. Note that the electrical characteristics of
PC6 differ from those of the other pins of Port C. If the RSTDISBL Fuse is un programmed, PC6 is used as a
Reset input. A low level on this pin for longer than the minimum pulse length will generate a Reset, even if the
clock is not running.
The minimum pulse length is given in Table 28-3 on page 318. Shorter pulses are not guaranteed to generate a
Reset. The various special features of Port C are elaborated in ”Alternate Functions of Port C” on page 85.
Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port D output
buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port D pins
that are externally pulled low will source current if the pull-up resistors are activated. The Port D pins are tri-
stated when a reset condition becomes active, even if the clock is not running. The various special features of
Port D are elaborated in ”Alternate Functions of Port D” on page
88.
1.1.7 AVCC
AVCC is the supply voltage pin for the A/D Converter, PC3:0, and ADC7:6. It should be externally connected
to VCC, even if the ADC is not used. If the ADC is used, it should be connected to VCC through a low-pass
filter. Note that PC6..4 use digital supply voltage, VCC.
1.1.8 AREF
22
In the TQFP and QFN/MLF package, ADC7:6 serve as analog inputs to the A/D converter. These pins are
powered from the analog supply and serve as 10-bit ADC channels.
Overview
23
The AVR core combines a rich instruction set with 32 general purpose working registers. All the 32 registers
are directly connected to the Arithmetic Logic Unit (ALU), allowing two independent registers to be accessed
in one single instruction executed in one clock cycle. The resulting architecture is more code efficient while
achieving throughputs up to ten times faster than conventional CISC microcontrollers.
24
Serial Interface, an SPI serial port, a 6-channel 10-bit ADC (8 channels in TQFP and QFN/MLF packages), a
programmable Watchdog Timer with internal Oscillator, and five software selectable power saving modes. The
Idle mode stops the CPU while allowing the SRAM, Timer/Counters, USART, 2-wire Serial Interface, SPI
port, and interrupt system to continue functioning. The Power-down mode saves the register contents but
freezes the Oscillator, disabling all other chip functions until the next interrupt or hardware reset.
In Power-save mode, the asynchronous timer continues to run, allowing the user to maintain a timer base while
the rest of the device is sleeping. The ADC Noise Reduction mode stops the CPU and all I/O modules except
asynchronous timer and ADC, to minimize switching noise during ADC conversions. In Standby mode, the
crystal/resonator Oscillator is running while the rest of the device is sleeping. This allows very fast start-up
combined with low power consumption.
The device is manufactured using Atmel’s high density non-volatile memory technology. The On-chip ISP
Flash allows the program memory to be reprogrammed In-System through an SPI serial interface, by a
conventional non-volatile memory programmer, or by an On-chip Boot program running on the AVR core. The
Boot program can use any interface to download the application program in the Application Flash memory.
Software in the Boot Flash section will continue to run while the Application Flash section is updated,
providing true Read-While-Write operation. By combining an 8-bit RISC CPU with In-System Self-
Programmable Flash on a monolithic chip, the Atmel ATmega48PA/88PA/168PA/328P is a powerful
microcontroller that provides a highly flexible and cost effective solution to many embedded control
applications.
The ATmega48PA/88PA/168PA/328P AVR is supported with a full suite of program and system development
tools including: C Compilers, Macro Assemblers, Program Debugger/Simulators, In-Circuit Emulators, and
Evaluation kits.
25
The ATmega48PA, ATmega88PA, ATmega168PA and ATmega328P differ only in memory sizes, boot loader
support, and interrupt vector sizes. Table 2-1 summarizes the different memory and interrupt vector sizes for
the three devices.
6.1 Overview
This section discusses the AVR core architecture in general. The main function of the CPU core is to ensure
correct program execution. The CPU must therefore be able to access memories, perform calculations, control
peripherals, and handle interrupts.
26
In order to maximize performance and parallelism, the AVR uses a Harvard architecture – with separate
memories and buses for program and data. Instructions in the program memory are executed with a single level
pipelining. While one instruction is being executed, the next instruction is pre-fetched from the program
memory. This concept enables instructions to be executed in every clock cycle. The program memory is In-
System Reprogrammable Flash memory.
The fast-access Register File contains 32 x 8-bit general purpose working registers with a single clock cycle
access time. This allows single-cycle Arithmetic Logic Unit (ALU) operation. In a typical ALU operation, two
operands are output from the Register File, the operation is executed, and the result is stored back in the
Register File – in one clock cycle. Six of the 32 registers can be used as three 16-bit indirect address register
pointers for Data Space addressing – enabling efficient address calculations. One of the these address pointers
can also be used as an address pointer for look up tables in Flash program memory. These added function
registers are the 16-bit X-, Y-, and Z-register, described later in this section.
27
The ALU supports arithmetic and logic operations between registers or between a constant and a register.
Single register operations can also be executed in the ALU. After an arithmetic operation, the Status Register is
updated to reflect information about the result of the operation.
Program flow is provided by conditional and unconditional jump and call instructions, able to directly address
the whole address space. Most AVR instructions have a single 16-bit word format. Every program memory
address contains a 16- or 32-bit instruction.
Program Flash memory space is divided in two sections, the Boot Program section and the Application
Program section. Both sections have dedicated Lock bits for write and read/write protection. The SPM
instruction that writes into the Application Flash memory section must reside in the Boot Program section.
During interrupts and subroutine calls, the return address Program Counter (PC) is stored on the Stack. The
Stack is effectively allocated in the general data SRAM, and consequently the Stack size is only limited by the
total SRAM size and the usage of the SRAM. All user programs must initialize the SP in the Reset routine
(before subroutines or interrupts are executed). The Stack Pointer (SP) is read/write accessible in the I/O space.
The data SRAM can easily be accessed through the five different addressing modes supported in the AVR
architecture.
The memory spaces in the AVR architecture are all linear and regular memory maps.
A flexible interrupt module has its control registers in the I/O space with an additional Global Interrupt Enable
bit in the Status Register. All interrupts have a separate Interrupt Vector in the Interrupt Vector table. The
interrupts have priority in accordance with their Interrupt Vector position.
The lower the Interrupt Vector address, the higher the priority.
The I/O memory space contains 64 addresses for CPU peripheral functions as Control Registers,
SPI, and other I/O functions. The I/O Memory can be accessed directly, or as the Data Space locations
following those of the Register File, 0x20 - 0x5F. In addition, the ATmega48PA/88PA/168PA/328P has
Extended I/O space from 0x60 - 0xFF in SRAM where only the ST/STS/STD and LD/LDS/LDD instructions
can be used.
The high-performance AVR ALU operates in direct connection with all the 32 general purpose working
registers. Within a single clock cycle, arithmetic operations between general purpose registers or between a
register and an immediate are executed. The ALU operations are divided into three main categories –
arithmetic, logical, and bit-functions. Some implementations of the architecture also provide a powerful
28
multiplier supporting both signed/unsigned multiplication and fractional format. See the “Instruction Set”
section for a detailed description.
The Status Register contains information about the result of the most recently executed arithmetic instruction.
This information can be used for altering program flow in order to perform conditional operations. Note that
the Status Register is updated after all ALU operations, as specified in the Instruction Set Reference. This will
in many cases remove the need for using the dedicated compare instructions, resulting in faster and more
compact code. The Status Register is not automatically stored when entering an interrupt routine and restored
when returning from an interrupt. This must be handled by software.
AVR Memories
7.1 Overview
This section describes the different memories in the ATmega48PA/88PA/168PA/328P. The AVR architecture
has two main memory spaces, the Data Memory and the Program Memory space. In addition, the
ATmega48PA/88PA/168PA/328P features an EEPROM Memory for data storage. All three memory spaces are
linear and regular.
The Flash memory has an endurance of at least 10,000 write/erase cycles. The
ATmega48PA/88PA/168PA/328P Program Counter (PC) is 11/12/13/14 bits wide, thus addressing the
2/4/8/16K program memory locations. The operation of Boot Program section and associated Boot Lock bits
for software protection are described in detail in ”Self-Programming the Flash, ATmega48PA” on page 269
and ”Boot Loader Support – Read-While-Write Self-Programming, ATmega88PA, ATmega168PA and
ATmega328P” on page 277. ”Memory Programming” on page 294 contains a detailed description on Flash
Programming in SPI- or Parallel Programming mode.
29
Constant tables can be allocated within the entire program memory address space (see the LPM – Load
Program Memory instruction description).
The ATmega48PA/88PA/168PA/328P is a complex microcontroller with more peripheral units than can be
supported within the 64 locations reserved in the Opcode for the IN and OUT instructions. For the Extended
I/O space from 0x60 - 0xFF in SRAM, only the ST/STS/STD and LD/LDS/LDD instructions can be used. The
lower 768/1280/1280/2303 data memory locations address both the Register File, the I/O memory, Extended
I/O memory, and the internal data SRAM. The first 32 locations address the Register File, the next 64 location
the standard I/O memory, then 160 locations of Extended I/O memory, and the next 512/1024/1024/2048
locations address the internal data SRAM.
The five different addressing modes for the data memory cover: Direct, Indirect with Displacement, Indirect,
Indirect with Pre-decrement, and Indirect with Post-increment. In the Register File, registers R26 to R31
feature the indirect addressing pointer registers.
The direct addressing reaches the entire data space. The Indirect with Displacement mode reaches 63 address
locations from the base address given by the Y- or Z-register.
When using register indirect addressing modes with automatic pre-decrement and post-increment, the address
registers X, Y, and Z are decremented or incremented. The 32 general purpose working registers, 64 I/O
Registers, 160 Extended I/O Registers, and the 512/1024/1024/2048 bytes of internal data SRAM in the
ATmega48PA/88PA/168PA/328P are all accessible through all these addressing modes.
30
lets the user software detect when the next byte can be written. If the user code contains instructions that write
the EEPROM, some precautions must be taken. In heavily filtered power supplies, VCC is likely to rise or fall
slowly on power-up/down. This causes the device for some period of time to run at a voltage lower than
specified as minimum for the clock frequency used. In order to prevent unintentional EEPROM writes, a
specific write procedure must be followed. Refer to the description of the EEPROM Control Register for
details on this. When the EEPROM is read, the CPU is halted for four clock cycles before the next instruction
is executed. When the EEPROM is written, the CPU is halted for two clock cycles before the next instruction is
executed.
Pins XTAL1 and XTAL2 are input and output, respectively, of an inverting amplifier which can be configured
for use as an On-chip Oscillator, Either a quartz crystal or a ceramic resonator may be used. This Crystal
Oscillator is a low power oscillator, with reduced voltage swing on the XTAL2 output.
It gives the lowest power consumption, but is not capable of driving other clock inputs, and may be more
susceptible to noise in noisy environments. C1 and C2 should always be equal for both crystals and resonators.
The optimal value of the capacitors depends on the crystal or resonator in use, the amount of stray capacitance,
and the electromagnetic noise of the environment. For ceramic resonators, the capacitor values given by the
manufacturer should be used.
Watchdog Timer
Features
– Interrupt
– System Reset
Overview
ATmega48PA/88PA/168PA/328P has an Enhanced Watchdog Timer (WDT). The WDT is a timer counting
cycles of a separate on-chip 128 kHz oscillator. The WDT gives an interrupt or a system reset when the counter
reaches a given time-out value. In normal operation mode, it is required that the system uses the WDR -
Watchdog Timer Reset - instruction to restart the counter before the time-out value is reached. If the system
doesn't restart the counter, an interrupt or system reset will be issued.
In Interrupt mode, the WDT gives an interrupt when the timer expires. This interrupt can be used to wake the
device from sleep-modes, and also as a general system timer. One example is to limit the maximum time
allowed for certain operations, giving an interrupt when the operation has run longer than expected. In System
Reset mode, the WDT gives a reset when the timer expires. This is typically used to prevent system hang-up in
case of runaway code. The third mode, Interrupt and System Reset mode, combines the other two modes by
first giving an interrupt and then switch to System Reset mode. This mode will for instance allow a safe
shutdown by saving critical parameters before a system reset.
The Watchdog always on (WDTON) fuse, if programmed, will force the Watchdog Timer to System Reset
mode. With the fuse programmed the System Reset mode bit (WDE) and Interrupt mode bit (WDIE) are locked
to 1 and 0 respectively. To further ensure program security, alterations to the Watchdog set-up must follow
timed sequences. The sequence for clearing WDE and changing time-out configuration is as follows:
1. In the same operation, write a logic one to the Watchdog change enable bit (WDCE) and WDE. A logic one
must be written to WDE regardless of the previous value of the WDE bit.
2. Within the next four clock cycles, write the WDE and Watchdog prescaler bits (WDP) as desired, but with
the WDCE bit cleared. This must be done in one operation.
The following code example shows one assembly and one C function for turning off the Watchdog Timer. The
example assumes that interrupts are controlled (e.g. by disabling interrupts globally) so that no interrupts will
occur during the execution of these functions.
32
8-bit Timer/Counter0 with PWM
Features
• Frequency Generator
Overview
Timer/Counter0 is a general purpose 8-bit Timer/Counter module, with two independent Output Compare
Units, and with PWM support. It allows accurate program execution timing (event management) and wave
generation.
CPU accessible I/O Registers, including I/O bits and I/O pins, are shown in bold.
3.3.1 Introduction:
Power supply is a supply of electrical power. A device or system that supplies electrical
or other types of energy to an output load or group of loads is called a power supply unit or PSU. The
term is most commonly applied to electrical energy supplies, less often to mechanical ones, and
rarely to others.
33
Conversion of one form of electrical power to another desired form and voltage, typically
involving converting AC line voltage to a well-regulated lower-voltage DC for electronic devices.
Low voltage, low power DC power supply units are commonly integrated with the devices they
supply, such as computers and household electronics.
Batteries.
Solar power.
Generators or alternators.
The basic circuit diagram of a regulated power supply (DC O/P) with led connected as
load is shown in fig: 3.3.3.
34
Fig 3.3.3 Circuit diagram of Regulated Power Supply with Led connection
230V AC MAINS
TRANSFORMER
BRIDGE RECTIFIER(DIODES)
CAPACITOR
VOLTAGE REGULATOR(IC 7805)
RESISTOR
LED(LIGHT EMITTING DIODE)
The detailed explanation of each and every component mentioned above is as follows:
Transformation: The process of transforming energy from one device to another is called
transformation. For transforming energy we use transformers.
Transformers:
A transformer is a device that transfers electrical energy from one circuit to another
through inductively coupled conductors without changing its frequency. A varying current in the first
or primary winding creates a varying magnetic flux in the transformer's core, and thus a
varying magnetic field through the secondary winding. This varying magnetic field induces a
35
varying electromotive force (EMF) or "voltage" in the secondary winding. This effect is called mutual
induction.
If a load is connected to the secondary, an electric current will flow in the secondary
winding and electrical energy will be transferred from the primary circuit through the transformer to
the load. This field is made up from lines of force and has the same shape as a bar magnet.
If the current is increased, the lines of force move outwards from the coil. If the
current is reduced, the lines of force move inwards.
If another coil is placed adjacent to the first coil then, as the field moves out or in, the
moving lines of force will "cut" the turns of the second coil. As it does this, a voltage is induced in the
second coil. With the 50 Hz AC mains supply, this will happen 50 times a second. This is called
MUTUAL INDUCTION and forms the basis of the transformer.
The input coil is called the PRIMARY WINDING; the output coil is the SECONDARY
WINDING. Fig: 3.3.4 shows step-down transformer.
For example, if the secondary has half the primary turns; the secondary will have half
the primary voltage.
36
Another example is if the primary has 5000 turns and the secondary has 500 turns,
then the turn’s ratio is 10:1.
If the primary voltage is 240 volts then the secondary voltage will be x 10 smaller = 24
volts. Assuming a perfect transformer, the power provided by the primary must equal the power
taken by a load on the secondary. If a 24-watt lamp is connected across a 24 volt secondary, then the
primary must supply 24 watts.
To aid magnetic coupling between primary and secondary, the coils are wound on a
metal CORE. Since the primary would induce power, called EDDY CURRENTS, into this core, the core
is LAMINATED. This means that it is made up from metal sheets insulated from each other.
Transformers to work at higher frequencies have an iron dust core or no core at all.
Note that the transformer only works on AC, which has a constantly changing current
and moving field. DC has a steady current and therefore a steady field and there would be no
induction.
Some transformers have an electrostatic screen between primary and secondary. This
is to prevent some types of interference being fed from the equipment down into the mains supply,
or in the other direction. Transformers are sometimes used for IMPEDANCE MATCHING.
Step Up transformer:
Because of having more turns secondary winding accepts more energy, and it releases
more voltage at the output side.
37
Incase of step down transformer, Primary winding induces more flux than the
secondary winding, and secondary winding is having less number of turns because of that it accepts
less number of flux, and releases less amount of voltage.
A battery is a type of linear power supply that offers benefits that traditional line-
operated power supplies lack: mobility, portability and reliability. A battery consists of multiple
electrochemical cells connected to provide the voltage desired. Fig: 3.3.5 shows Hi-Watt 9V battery
The most commonly used dry-cell battery is the carbon-zinc dry cell battery. Dry-cell
batteries are made by stacking a carbon plate, a layer of electrolyte paste, and a zinc plate
alternately until the desired total voltage is achieved. The most common dry-cell batteries have one
of the following voltages: 1.5, 3, 6, 9, 22.5, 45, and 90. During the discharge of a carbon-zinc battery,
the zinc metal is converted to a zinc salt in the electrolyte, and magnesium dioxide is reduced at the
carbon electrode. These actions establish a voltage of approximately 1.5 V.
The lead-acid storage battery may be used. This battery is rechargeable; it consists of
lead and lead/dioxide electrodes which are immersed in sulfuric acid. When fully charged, this type
of battery has a 2.06-2.14 V potential (A 12 volt car battery uses 6 cells in series). During discharge,
the lead is converted to lead sulfate and the sulfuric acid is converted to water. When the battery is
charging, the lead sulfate is converted back to lead and lead dioxide A nickel-cadmium battery has
become more popular in recent years. This battery cell is completely sealed and rechargeable. The
electrolyte is not involved in the electrode reaction, making the voltage constant over the span of
38
the batteries long service life. During the charging process, nickel oxide is oxidized to its higher
oxidation state and cadmium oxide is reduced. The nickel-cadmium batteries have many benefits.
They can be stored both charged and uncharged. They have a long service life, high current
availabilities, constant voltage, and the ability to be recharged. Fig: 3.3.6 shows pencil battery of
1.5V.
Rectification:
Rectifiers:
A device that it can perform the opposite function (converting DC to AC) is known as
an inverter.
When only one diode is used to rectify AC (by blocking the negative or positive
portion of the waveform), the difference between the term diode and the term rectifier is merely
one of usage, i.e., the term rectifier describes a diode that is being used to convert AC to DC. Almost
all rectifiers comprise a number of diodes in a specific arrangement for more efficiently converting
39
AC to DC than is possible with only one diode. Before the development of silicon semiconductor
rectifiers, vacuum tube diodes and copper (I) oxide or selenium rectifier stacks were used.
For the positive half cycle of the input ac voltage, diodes D1 and D3 conduct, whereas
diodes D2 and D4 remain in the OFF state. The conducting diodes will be in series with the load
resistance RL and hence the load current flows through RL.
For the negative half cycle of the input ac voltage, diodes D2 and D4 conduct
whereas, D1 and D3 remain OFF. The conducting diodes D2 and D4 will be in series with the load
resistance RL and hence the current flows through R L in the same direction as in the previous half
cycle. Thus a bi-directional wave is converted into a unidirectional wave.
Input Output
DB107:
40
Now -a -days Bridge rectifier is available in IC with a number of DB107. In our project
we are using an IC in place of bridge rectifier. The picture of DB 107 is shown in fig: 3.3.8.
Features:
Filtration:
The process of converting a pulsating direct current to a pure direct current using
filters is called as filtration.
Filters:
41
Electronic filters are electronic circuits, which perform signal-processing functions,
specifically to remove unwanted frequency components from the signal, to enhance wanted ones.
Introduction to Capacitors:
Units of Capacitance:
Operation of Capacitor:
First, let's consider the case of a "coupling capacitor" where the capacitor is used to
connect a signal from one part of a circuit to another but without allowing any direct current to
flow.
So a coupling capacitor allows "alternating current" to pass through because the ball
valve doesn't get a chance to close as the waves go up and down. However, a steady current quickly
fills the tank so that all flow stops.
A capacitor will pass alternating current but (apart from an initial surge) it will not
pass d.c.
43
Where a capacitor is used to decouple a circuit, the effect is to
"smooth out ripples". Any ripples, waves or pulses of current are
passed to ground while d.c. Flows smoothly.
Regulation:
Voltage Regulator:
A voltage regulator (also called a ‘regulator’) with only three terminals appears to be a
simple device, but it is in fact a very complex integrated circuit. It converts a varying input voltage
into a constant ‘regulated’ output voltage. Voltage Regulators are available in a variety of outputs
like 5V, 6V, 9V, 12V and 15V. The LM78XX series of voltage regulators are designed for positive
input. For applications requiring negative input, the LM79XX series is used. Using a pair of ‘voltage-
divider’ resistors can increase the output voltage of a regulator circuit.
It is not possible to obtain a voltage lower than the stated rating. You cannot use a
12V regulator to make a 5V power supply. Voltage regulators are very robust. These can withstand
over-current draw due to short circuits and also over-heating. In both cases, the regulator will cut off
before any damage occurs. The only way to destroy a regulator is to apply reverse voltage to its
input. Reverse polarity destroys the regulator almost instantly. Fig: 3.3.11 shows voltage regulator.
44
Fig 3.3.11: Voltage Regulator
Resistors:
A resistor is a two-terminal electronic component that produces a voltage across its terminals
that is proportional to the electric current passing through it in accordance with Ohm's law:
V = IR
Resistors are elements of electrical networks and electronic circuits and are ubiquitous in
most electronic equipment. Practical resistors can be made of various compounds and films, as well
as resistance wire (wire made of a high-resistivity alloy, such as nickel/chrome).
The primary characteristics of a resistor are the resistance, the tolerance, maximum working
voltage and the power rating. Other characteristics include temperature coefficient, noise, and
inductance. Less well-known is critical resistance, the value below which power dissipation limits the
maximum permitted current flow, and above which the limit is applied voltage. Critical resistance is
determined by the design, materials and dimensions of the resistor.
Resistors can be made to control the flow of current, to work as Voltage dividers, to
dissipate power and it can shape electrical waves when used in combination of other components.
Basic unit is ohms.
Theory of operation:
45
Ohm's law:
The behavior of an ideal resistor is dictated by the relationship specified in Ohm's law:
V = IR
Ohm's law states that the voltage (V) across a resistor is proportional to the current (I)
through it where the constant of proportionality is the resistance (R).
Power dissipation:
The power dissipated by a resistor (or the equivalent resistance of a resistor network) is
calculated using the following:
3.4. LED:
46
electronic component in 1962, early LED’s emitted low-intensity red light, but modern versions are
available across the visible, ultraviolet and infrared wavelengths, with very high brightness. The
internal structure and parts of a led are shown below.
Working:
The structure of the LED light is completely different than that of the light bulb.
Amazingly, the LED has a simple and strong structure. The light-emitting semiconductor material is
what determines the LED's color. The LED is based on the semiconductor diode.
When a diode is forward biased (switched on), electrons are able to recombine with
holes within the device, releasing energy in the form of photons. This effect is called
electroluminescence and the color of the light (corresponding to the energy of the photon) is
determined by the energy gap of the semiconductor. An LED is usually small in area (less than
1 mm2), and integrated optical components are used to shape its radiation pattern and assist in
reflection. LED’s present many advantages over incandescent light sources including lower energy
consumption, longer lifetime, improved robustness, smaller size, faster switching, and greater
durability and reliability. However, they are relatively expensive and require more precise current and
heat management than traditional light sources. Current LED products for general lighting are more
47
expensive to buy than fluorescent lamp sources of comparable output. They also enjoy use in
applications as diverse as replacements for traditional light sources in automotive lighting
(particularly indicators) and in traffic signals. The compact size of LED’s has allowed new text and
video displays and sensors to be developed, while their high switching rates are useful in advanced
communications technology. The electrical symbol and polarities of led are shown in fig: 3.4.3.
No UV Rays
48
Visual signal application where the light goes more or less directly from the LED to the
human eye, to convey a message or meaning.
Illumination where LED light is reflected from object to give visual response of these objects.
Generate light for measuring and interacting with processes that do not involve the human
visual system.
Ultrasonic principle:
Ultrasonic sensors emit short, high-frequency sound pulses at regular intervals. These propagate in
the air at the velocity of sound. If they strike an object, then they are re
flected back as echo signals to the sensor, which itself computes the distance to the target based on
the time-span between emitting the signal and receiving the echo.
As the distance to an object is determined by measuring the time of flight and not by the intensity of
the sound, ultrasonic sensors are excellent at suppressing background interference.
Virtually all materials which reflect sound can be detected, regardless of their color. Even
transparent materials or thin foils represent no problem for an ultrasonic sensor.
Micro sonic ultrasonic sensors are suitable for target distances from 30 mm to 10 m and as they
measure the time of flight they can ascertain a measurement with pinpoint accuracy. Some of our
sensors can even resolve the signal to an accuracy of less than 0.18 mm.
Ultrasonic sensors can see through dust-laden air and ink mists. Even thin deposits on the sensor
membrane do not impair its function.
Sensors with a blind zone of just 30 mm and an extremely narrow beam spread are finding totally
new applications these days: measuring levels in yoghurt pots and test tubes as well as scanning
49
small bottles in the packaging sector - no trouble for our sensors. Even thin wires are reliably
detected.
Specification:
The ultrasonic range sensor detects objects in it’s path and can be used to calculate the range to the
object. It is sensitive enough to detect a 3cm diameter broom handle at a distance of over 2m.
Voltage - 5v
Current - 30mA Typ. 50mA Max.
Frequency - 40 KHz
Max Range - 3 m
Min Range - 3 cm
Sensitivity - Detect 3cm diameter broom handle at > 2 m
Input Trigger - 10uS Min. TTL level pulse
Echo Pulse - Positive TTL level signal, width proportional to range.
Small Size - 43mm x 20mm x 17mm height
50
Fig.3.7.2 Ultrasonic sensor timing diagram
Electrical connection:
The SRF004 ultrasonic range finder has 5 connections pins. The power supply is connected to the 5V
and 0V ground connections on the SRF004. (Note that BOTH the ‘Mode’ (hole 4) and ‘0V Ground’
(hole 5) connections MUST be connected to 0V for correct operation with the PICAXE system).
Take care not to overheat, and therefore damage, the solder connection pads whilst making
connections.
The SRF004 Trigger Input is connected to a PICAXE output pin.
The SRF004 Echo Output is connected to a PICAXE input pin.
51
Fig.3.7.4.Pin configuration of ultrasonic sensor module
Connection:
The SRF004 must be mounted above the buggy (e.g. by using a small home-made aluminum bracket
(not supplied)). The SRF004 has five solder connections which must be connected via wires to the
solder joints on the bottom of the buggy PCB.
1. Hole 1 – 5v Supply – to PIC chip leg 14 (V+ Supply)
2. Hole 2 – Echo Output – to PIC chip leg 15 (input 6)
3. Hole 3 – Trigger Input – to PIC chip leg 9 (output 3)
4. Hole 4 *8//////8
– Mode – to PIC chip leg 5 (0V Ground)
5. Hole 5 – 0V Ground – to PIC chip leg 5 (0V Ground)
Note that both holes 4 and 5 must both be connected to 0V. It is recommended that the wire links
across the bottom of the
3.6 DC MOTOR:
52
A dc motor uses electrical energy to produce mechanical energy, very typically
through the interaction of magnetic fields and current-carrying conductors. The reverse process,
producing electrical energy from mechanical energy, is accomplished by
an alternator, generator or dynamo. Many types of electric motors can be run as generators, and
vice versa. The input of a DC motor is current/voltage and its output is torque (speed).
The DC motor has two basic parts: the rotating part that is called the armature and the stationary part
that includes coils of wire called the field coils. The stationary part is also called the stator. Figure
shows a picture of a typical DC motor, Figure shows a picture of a DC armature, and Fig shows a
picture of a typical stator. From the picture you can see the armature is made of coils of wire wrapped
around the core, and the core has an extended shaft that rotates on bearings. You should also notice
that the ends of each coil of wire on the armature are terminated at one end of the armature. The
termination points are called the commutator, and this is where the brushes make electrical contact to
bring electrical current from the stationary part to the rotating part of the machine.
Operation:
The DC motor you will find in modem industrial applications operates very similarly to the
simple DC motor described earlier in this chapter. Figure 12-9 shows an electrical diagram of a simple
DC motor. Notice that the DC voltage is applied directly to the field winding and the brushes. The
armature and the field are both shown as a coil of wire. In later diagrams, a field resistor will be added
in series with the field to control the motor speed. When voltage is applied to the motor, current
begins to flow through the field coil from the negative terminal to the positive terminal. This sets up a
strong magnetic field in the field winding. Current also begins to flow through the brushes into a
commutator segment and then through an armature coil. The current continues to flow through the
53
coil back to the brush that is attached to other end of the coil and returns to the DC power source. The
current flowing in the armature coil sets up a strong magnetic field in the armature.
The magnetic field in the armature and field coil causes the armature to begin to rotate.
This occurs by the unlike magnetic poles attracting each other and the like magnetic poles repelling
each other. As the armature begins to rotate, the commutator segments will also begin to move under
the brushes. As an individual commutator segment moves under the brush connected to positive
voltage, it will become positive, and when it moves under a brush connected to negative voltage it
will become negative. In this way, the commutator segments continually change polarity from
positive to negative. Since the commutator segments are connected to the ends of the wires that make
up the field winding in the armature, it causes the magnetic field in the armature to change polarity
continually from north pole to south pole. The commutator segments and brushes are aligned in such a
way that the switch in polarity of the armature coincides with the location of the armature's magnetic
field and the field winding's magnetic field. The switching action is timed so that the armature will not
lock up magnetically with the field. Instead the magnetic fields tend to build on each other and
provide additional torque to keep the motor shaft rotating.
54
When the voltage is de-energized to the motor, the magnetic fields in the armature and
the field winding will quickly diminish and the armature shaft's speed will begin to drop to zero. If
voltage is applied to the motor again, the magnetic fields will strengthen and the armature will begin
to rotate again.
DC Motor Driver:
The L293 and L293D are quadruple high-current half-H drivers. The L293 is designed to
provide bidirectional drive currents of up to 1 A at voltages from 4.5 V to 36 V. The L293D is
designed to provide bidirectional drive currents of up to 600-mA at voltages from 4.5 V to 36 V. Both
devices are designed to drive inductive loads such as relays, solenoids, dc and bipolar stepping
motors, as well as other high-current/high-voltage loads in positive-supply applications.
All inputs are TTL compatible. Each output is a complete totem-pole drive circuit, with a
Darlington transistor sink and a pseudo-Darlington source. Drivers are enabled in pairs, with drivers 1
and 2 enabled by 1,2EN and drivers 3 and 4 enabled by 3,4EN.When an enable input is high, the
associated drivers are enabled and their outputs are active and in phase with their inputs.
When the enable input is low, those drivers are disabled and their outputs are off and in the
high-impedance state. With the proper data inputs, each pair of drivers forms a full-H (or bridge)
reversible drive suitable for solenoid or motor applications. On the L293, external high-speed output
clamp diodes should be used for inductive transient suppression. A VCC1 terminal, separate from
VCC2, is provided for the logic inputs to minimize device power dissipation. The L293and L293D is
characterized for operation from 0°C to 70°C.
55
Pin Diagram of L293D motor driver:
56
Features of L293D:
Applications of DC Motors:
1. Electric Train: A kind of DC motor called the DC Series Motor is used in Electric Trains. The DC
Series Motors have the property to deliver more power when they are loaded more. So the more the
people get on a train, the more powerful the train becomes.
2. Elevators: The best bidirectional motors are DC motors. They are used in elevators. Compound DC
Motors are used for this application.
3. PC Fans, CD ROM Drives, and Hard Drives: All these things need motors, very miniature motors,
with great precision. AC motors can never imagine any application in these places.
4. Starter Motors in Automobiles: An automobile battery supplies DC, so a DC motor is best suited
here. Also, you cannot start an engine with a small sized AC motor,
Introduction to Servomotors
57
Hobby servomotors are a very elegant solution to the problem of adding a motor to your robot. They
are mainly used in hobby RC airplanes, so they are very compact, powerful, light and power conservative.
Since they have been in production for a long time they are also very cheap. You can buy a standard hobby
servomotor for under $13. In a very small package you get a DC motor, gearbox, and feedback control
system.
Servomotors are designed to operate control surfaces on hobby RC planes. So they do not rotate
continuously. Rather they are designed to rotate through 180 degrees with precise position control. If you
want to use them as the main drive motor for a mobile robot you need to modify them so that they will
rotate continuously. This is not a difficult thing to do. I will not cover it here but if you want to do it there are
many sites on the web that cover this. An excellent one is
They do not simply run on a DC voltage like a standard DC motor. They have 3 wires. Red is power
(generally 3V – 12V max), black is ground and then there is another wire, usually white or yellow that is the
“input signal wire”.
58
A servomotor is controlled by sending a pulse signal that is HIGH for a brief time, generally 1 – 2 ms.
If you just connect a battery to power and ground, nothing will happen. You must have a timer circuit that
generates this pulsed signal and by varying the pulse ON time (or the pulse width) the motor will move to a
certain position over its range of motion and then stop as long as the input pulse width is the same.
Depending on the pulse width, you’ll get a different position.
This diagram shows some control signal pulses for a typical servo and the position to which it
will rotate in response to the pulse width.
There is another element to the signal that also requires timing accuracy. The frequency of the signal
or its rate of refresh. Not only do you have to send the pulse, you have to keep sending them as long as you
want the motor to be in that position (or to keep rotating for modified servos). Generally a frequency of 50
Hz is good. This means that you send the Hi pulse 50 times every second.
59
I mentioned earlier that a servo will only rotate through 180 degrees unless you modify it for
continuous rotation (you can also buy them already modified through Acroname and other companies). One
interesting thing that comes out this modification is that you get a speed control function out of it, though
somewhat coarse.
When you make the modification you replace the circuitry in the motor that tells the motor what
position it is in. The mods you make tell the motor that it is always in the center position. So if you feed a
1.75 ms pulse, it rotates to the 180 degree position, checks the feedback which tells it that “hey, you haven’t
moved yet. You’re still in the center position, keep going” so it does, checks and sees that it hasn’t moved yet
and keeps doing it. Since it thinks that it is in center position and it has to move to its right most position it
will move at its fastest rate.
Now suppose you send it a signal that says to rotate to 95 degrees, 5 degrees right of center. The
internal control system knows that it is now to move a very short distance. It also knows that if it rotates at
its fastest speed that it may overshoot this and have to come back, and overshoot again in the other direction
and try again, and so forth. This is called oscillation and is not a good thing. The advantage that you get out
of this is that the motor will move slower when you feed a signal that is close to the center position. So you
feed it a “go to 95 degree” signal and it will rotate CW at a slow rate. Give it “go to 180 degrees” and it will
rotate CW at its fastest rate. And the same for CCW.
60
3.8 RECHARGEABLE BATTERY:
Rechargeable battery:
Rechargeable batteries have lower total cost of use and environmental impact than
disposable batteries. Some rechargeable battery types are available in the same sizes as disposable
types. Rechargeable batteries have higher initial cost but can be recharged very cheaply and used
many times.
During charging, the positive active material is oxidized, producing electrons, and the
negative material is reduced, consuming electrons. These electrons constitute the current flow in the
external circuit. The electrolyte may serve as a simple buffer for internal ion flow between the
61
electrodes, as in lithium-ion and nickel-cadmium cells, or it may be an active participant in the
electrochemical reaction, as in lead–acid cells.
The energy used to charge rechargeable batteries usually comes from a battery charger using
AC mains electricity, although some are equipped to use a vehicle's 12-volt DC power outlet.
Regardless, to store energy in a secondary cell, it has to be connected to a DC voltage source. The
negative terminal of the cell has to be connected to the negative terminal of the voltage source and
the positive terminal of the voltage source with the positive terminal of the battery. Further, the
voltage output of the source must be higher than that of the battery, but not much higher: the
greater the difference between the power source and the battery's voltage capacity, the faster the
charging process, but also the greater the risk of overcharging and damaging the battery.
Chargers take from a few minutes to several hours to charge a battery. Slow "dumb" chargers
without voltage- or temperature-sensing capabilities will charge at a low rate, typically taking 14
hours or more to reach a full charge. Rapid chargers can typically charge cells in two to five hours,
depending on the model, with the fastest taking as little as fifteen minutes. Fast chargers must have
multiple ways of detecting when a cell reaches full charge (change in terminal voltage, temperature,
etc.) to stop charging before harmful overcharging or overheating occurs. The fastest chargers often
incorporate cooling fans to keep the cells from overheating.
Battery charging and discharging rates are often discussed by referencing a "C" rate of
current. The C rate is that which would theoretically fully charge or discharge the battery in one
hour. For example, trickle charging might be performed at C/20 (or a "20 hour" rate), while typical
charging and discharging may occur at C/2 (two hours for full capacity). The available capacity of
electrochemical cells varies depending on the discharge rate. Some energy is lost in the internal
resistance of cell components (plates, electrolyte, interconnections), and the rate of discharge is
limited by the speed at which chemicals in the cell can move about. For lead-acid cells, the
relationship between time and discharge rate is described by Peukert's law; a lead-acid cell that can
no longer sustain a usable terminal voltage at a high current may still have usable capacity, if
discharged at a much lower rate. Data sheets for rechargeable cells often list the discharge capacity
on 8-hour or 20-hour or other stated time; cells for uninterruptible power supply systems may be
rated at 15 minute discharge.
62
Flow batteries, used for specialized applications, are recharged by replacing the electrolyte liquid.
Battery manufacturers' technical notes often refer to VPC; this is volts per cell, and refers to
the individual secondary cells that make up the battery. (This is typically in reference to 12-volt lead-
acid batteries.) For example, to charge a 12 V battery (containing 6 cells of 2 V each) at 2.3 VPC
requires a voltage of 13.8 V across the battery's terminals.
Non-rechargeable alkaline and zinc–carbon cells output 1.5V when new, but this voltage
drops with use. Most NiMH AA and AAA cells are rated at 1.2 V, but have a flatter discharge curve
than alkalines and can usually be used in equipment designed to use alkaline batteries.
Charging Circuit:
63
From the above circuit diagram, we can see that the 18v AC is being converted to 18V pulsating DC
which is in turn converted to smooth DC with the help of the Capacitor. This 18V Smooth DC is
converted to 12V DC by the Voltage Regulator 7812. At the output of the regulator, we get some
spikes which are not desirable. These spikes are removed with the help of another capacitor used. We
can get 12V Steady DC at the output terminal which can be indicated if the LED glows.
64
CHAPTER 4: SOFTWARE DESCRIPTION
Express PCB is a software tool to design PCBs specifically for manufacture by the
company Express PCB (no other PCB maker accepts Express PCB files). It is very easy to use, but it
does have several limitations.
Express PCB has been used to design many PCBs (some layered and with surface-mount
parts. Print out PCB patterns and use the toner transfer method with an Etch Resistant Pen to make
boards. However, Express PCB does not have a nice print layout. Here is the procedure to design in
Express PCB and clean up the patterns so they print nicely.
Express PCB comes with a less then exciting list of parts. So before any project is
started head over to Audio logical and grab the additional parts by morsel, ppl, and tangent, and
65
extract them into your Express PCB directory. At this point start the program and get ready to setup
the workspace to suit your style.
Click View -> Options. In this menu, setup the units for “mm” or “in” depending on
how you think, and click “see through the top copper layer” at the bottom. The standard color
scheme of red and green is generally used but it is not as pleasing as red and blue.
When a project is first started you will be greeted with a yellow outline. This yellow
outline is the dimension of the PCB. Typically after positioning of parts and traces, move them to
their final position and then crop the PCB to the correct size. However, in designing a board with a
certain size constraint, crop the PCB to the correct size before starting.
Fig: 4.1 show the toolbar in which the each button has the following functions:
The select tool: It is fairly obvious what this does. It allows you to move and manipulate
parts. When this tool is selected the top toolbar will show buttons to move traces to the top /
bottom copper layer, and rotate buttons.
The zoom to selection tool: does just that.
The place pad: button allows you to place small soldier pads which are useful for board
connections or if a part is not in the part library but the part dimensions are available. When
this tool is selected the top toolbar will give you a large selection of round holes, square holes
and surface mount pads.
The place component: tool allows you to select a component from the top toolbar and then
by clicking in the workspace places that component in the orientation chosen using the
66
buttons next to the component list. The components can always be rotated afterwards with
the select tool if the orientation is wrong.
The place trace: tool allows you to place a solid trace on the board of varying thicknesses.
The top toolbar allows you to select the top or bottom layer to place the trace on.
The Insert Corner in trace: button does exactly what it says. When this tool is selected,
clicking on a trace will insert a corner which can be moved to route around components and
other traces.
The remove a trace button is not very important since the delete key will achieve the same
result.
Before starting a project there are several ways to design a PCB and one must be
chosen to suit the project’s needs.
When making a PCB you have the option of making a single sided board, or a double
sided board. Single sided boards are cheaper to produce and easier to etch, but much harder to
design for large projects. If a lot of parts are being used in a small space it may be difficult to make
a single sided board without jumpering over traces with a cable. While there’s technically nothing
wrong with this, it should be avoided if the signal travelling over the traces is sensitive (e.g. audio
signals).
67
When using a double sided board you must consider which traces should be on what
side of the board. Generally, put power traces on the top of the board, jumping only to the bottom
if a part cannot be soldiered onto the top plane (like a relay), and vice- versa.
Some projects like power supplies or amps can benefit from having a solid plane to
use for ground. In power supplies this can reduce noise, and in amps it minimizes the distance
between parts and their ground connections, and keeps the ground signal as simple as possible.
However, care must be taken with stubborn chips such as the TPA6120 amplifier from TI. The
TPA6120 datasheet specifies not to run a ground plane under the pins or signal traces of this chip
Step 1: Parts
1 x Arduino on a Breadboard
1 x Arduino UNO
Connecting Wires
Arduino IDE installed on your PC
68
Step 2: The Approach
We use the Arduino UNO to bootload the ATmega328 that is sitting on the Arduino-on-a-
Breadboard. This is fairly straightforward having an ATmega328P-PU, but needs an extra step for an
ATmega328-PU.
69
We need to program the Arduino UNO to act as an ISP (In-System Programmer), so that it can burn the
bootloader onto the Breadboard chip.
Search for void heartbeat and change the line that reads:
delay(40);
to
delay(20);
Connect your UNO to the PC, making sure it’s not connected to the Arduino on a Breadboard.
Ensure your UNO is selected under the Boards menu option, and upload the sketch.
70
Now connect your ATmega to your UNO as follows:
71
I learnt the hard way that there is more than one type of ATmega328. The two variants that are of
interest to us are the ATmega328-PU and the ATmega328P-PU.
The -PU suffix means that the chips are in a PDIP package, the format we need for our breadboard.
The 328P is a picoPower processor, designed for low power consumption, and is used on the
Arduino boards. Given low power consumption this is first choice.
The 328 does not have picoPower technology, and is not used on the Arduino boards – and is not
explicitly supported by the Arduino IDE.
What this means is that we can easily bootload the ATmega328P, but not the ATmega328.
Unfortunately the websites that sell these chips don't always differentiate between them and
forums are filled with people struggling to use the ATmega328-PU.
Each microprocessor has a signature – a unique code that identifies its model. When you
bootload a chip (or even upload a sketch) the Arduino IDE checks that the chip selected
matches the type it’s connected to. Even though the ATmega328-PU in essence functions in
the same way as the ATmega328P-PU, it has a different signature, and one that isn’t
recognised by the Arduino IDE.
7. Continue with the rest of the steps in the instructable, and once bootloading is complete restore the
backup copy you made.
To burn the Bootloader, choose Burn Bootloader from the Tools menu
You should see a message “Burning bootloader to I/O Board (this may take a minute)"
73
Once the bootloader has been burned, a message of confirming the success gets displayed.
”Congratulations: You're now ready to load sketches onto your Arduino on a breadboard!”
74
Fig 5.1: schematic diagram of Automatic Floor Cleaner
75
Advantages:
Battery operated floor cleaning machine.
Convenient product that can be used to clean the room without much physical effort.
It is very first and efficient and the control system used in industries are 100 times efficient
than human work.
Disadvantages:
Applications:
76
CHAPTER 7: RESULTS
7.1 Result:
The project “Automatic floor cleaner” was designed a floor cleaning robot which is
connected to Arduino. And user can place a bottle on the robot with floor cleaning liquid. When the
robot moves; automatically its pumps the liquid and cleans the floor and avoiding the obstacles in its
path. To perform this intelligent task, Arduino Microcontroller is loaded with a program written in C
language.
7.2 Conclusion:
Integrating features of all the hardware components used have been developed in it.
Presence of every module has been reasoned out and placed carefully, thus contributing to the best
working of the unit. Secondly, using highly advanced IC’s with the help of growing technology, the
project has been successfully implemented. Thus the project has been successfully designed and
tested.
We can add IOT inthis project we can control the using wireless Wi-Fi technology.
We can add robotic arm to this project. This will help to pick up the objects. We can add Dust
cleaner blower model also for cleaning the dust at desks TV computers etc.
We can add library assistant service robot. This kind of robot gives an intelligent approach to place
the books in the preferred places.
77
In today’s era, 95 percent of the cost of cleaning a floor is labor. Naturally, the high cost of
this simple task has inspired alternative solutions and that is Automatic Floor Cleaner.
REFERENCES
1. www.wikipedia.com
2. www.allaboutcircuits.com
3. www.microchip.com
4. www.howstuffworks.com
Books referred:
REFERENCES :
[1] Jens-Steffen Gutmann , Kristen Culp , Mario E. Munich and Paolo Pirjanian. The Social Impact of
a Systematic Floor Cleaner . In IEEE international workshop on advance robotics an its social impacts
, Technische University munchen, Germany May 21-23,2012.
[3]J-S. Gutmann, E.Eade, P.Fong and M.E. Munich. Vector field SLAM. IN Int. conf. on Robotics
and automation (ICRA), 2010.
78
[4]J-Y. SUNG, R.E.Grinter, and H.I.Chrstensen, and L.Go.Housewives domestic robot technology
int. Journal of social robotics, 2(4):417-429,2010.
[5]Youngkak Ma, seungwoo Kim, Dongik Oh and Youngwan Cho.A study on development of home
mess- cleanup robot McBot.In IEEE/ASME international conference on advanced mechatronics July
2-5, 2008, Xian, China.
[6] Xueshan Gao, Kejie Li, Yan Wang, Guangliang Men, Dawei zhou and Koki Kikuchi. A floor
cleaner robot using Swedish wheels.In IEEE international conference on robotics and biomimetics
December 15-18, 2007, Sanya, China.
[7] G Tuangzhi Dai and Tiequn Chen.Design on measurement and control system of cleaning robot
based on sensor array detetion.In IEEE International conference on control automation Guangzhou,
CHINA-MAY 30 to June 1, 2007.
[8] J Frolizzi C.Disalvo. Service robots in the domestic environment: A study of Roomba vacuum in
the home”. In int. conference on human robot interaction HRI, PAGE 258-265 March 2006.
[9] H.Asada and J.-J E. Slotin, robot analysis and control, a wiley-interscience publication, 1986, pp.
29-49.
79