new microsoft office word document

54
Interactive Vending machine Prese Debahuti Bhattacharya (ec/11/2 Ahana das (ec/11/04 Ankita sen (Ec/11/1 pg. 1

Upload: debahuti-bhattacharya

Post on 15-Aug-2015

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: New Microsoft Office Word Document

Interactive Vending machine

Presented by:

Debahuti Bhattacharya (ec/11/27)

Ahana das (ec/11/04)

Ankita sen (Ec/11/12)

Animesh manna (ec/11/07)

pg. 1

Page 2: New Microsoft Office Word Document

CONTENTS:

1 INTRODUCTION (Pg. 3)

2 WORKING PRINCIPLE (Pg. 4 - 5)

3 COMPONENT LIST (Pg. 6)

4 DETAILS OF EACH AND EVERY PART WITH ITS EXPLANATION (Pg. 7 - 23)

5 SPECIAL MENTION OF FREEDUINO DATASHEET AND ALL ITS PARAMETERS (Pg. 23 - 25)

6 PIN CONFIGURATIONS (Pg. 26 - 27)

7 PIN DESCRIPTIONS (Pg. 28 - 30)

8 HARDWARE PROGRAMMING CODE (Pg. 31)

9 OVERVIEW (Pg. 32 - 39)

10 CONCLUSION (Pg. 39)

11 ACKNOWLEDGMENT (Pg. 40)

12 REFERENCES (Pg. 41)

pg. 2

Page 3: New Microsoft Office Word Document

INTRODUCTION:

The VENDING MACHINE, which disposes product like chocolate, soft drinks, chips etc, is not a new topic.

Assembling of all the parts to it is a complex process. Here we are trying to make the machine more user friendly. Such that, blind people or visually impaired persons will be able to operate the machine without others help as well as operating this machine would be easy for common people too.

So here comes the concept of INTERACTIVE VENDING MACHINE.

Where, every step of purchasing the product from vending machine will be easier, communicative and technically interesting.

It can be visualized as following:

Initially the machine is sleep mode, when a person stands in front of the machine the machine starts to function. It asks for the required product, then, it gets a user input. Machine functions as per the input then the operations of coin collector and dispenser starts. The functionality stops with the collecting the product by the customer. This part will be discussed in the working principle section.

In order to do so, we have prepared a proximity sensor.

For the both way communication the voice logger is to be used.

Other components such as, piezoelectric crystal, relay motor, load cell etc. are to be interfaced with a microcontroller

pg. 3

Page 4: New Microsoft Office Word Document

Freeduino or Arduino.

In our project, the full functionality of FREEDUINO has been checked and with the help of LED, and hardware program it has been used for detection of any object coming in the zone of periphery.

pg. 4

Page 5: New Microsoft Office Word Document

WORKING PRINCIPLE:

We wanted to design the Interactive Vending Machine in such a way, so that it will be convenient to each and every body. Apart from that, keeping the cost estimation in mind and other factors under consideration, here it is challenging to all of us.

Let us assume that the person has already reached the base area and he’s standing upon the position. The Piezzo Electric Crystals will then be relaxed. An automatic HIGH voltage will be given as an impulse. Now, the speaker will be ON. It will come up with all the details. The messages and responses will be taking place via speaker and microphone respectively. The conversation will be like this:

(MACHINE): Welcome! I have chocolates with price 5/- & 10/-.Coins are acceptable only.

You can get as many numbers of chocolates you want, by sending the same amt of coin for those many number of times.

“REPEATION OF THE SAME IN HINDI & BENGALI”

(MAN): Two 10/- ………..

~~~ COINS ARE TRANSACTED WITHIN A TIME INTIMATION OF 10 SECS OTHERWISE THE REQUEST WONT BE GRANTED ~~~

pg. 5

Page 6: New Microsoft Office Word Document

Coins will be taken through coin collector, a container provided with a nick/ groove. The box is attached with an electro mechanical drive. There is a program running behind. The software and hardware part is compounded.

The timing is also instanced through a series of flip flop (with clock) connected in series. When the timing pulse is generated HIGH, then the response will be activated through product dispenser. It is in the form of a tray, just similar to a drawer. When the motor rotates once then only one chocolate will be disposed. If it is rotated twice, then accordingly two and so on.

~~~ ALL THE ANSWERS WILL NOT ONLY BE SPEAKED RATHER BUZZER WILL ALSO BE SOUNDED IN ORDER TO ALLERT THE CUSTOMER ~~~

The Interactive vending machine is not only accessible to the normal persons but to the blind at the same time by providing the Braille Buttons, and to the physically challenged ones too. Since the chair is at the average person’s height along with the suitable wheel chair level. All these ideas were one step towards the innovation. But due to limited time and lack of application of all implemented technology into a common platform we are keeping those further technicalities for the next ones as future scope.

pg. 6

Page 7: New Microsoft Office Word Document

Now a brief description of each and every component is given below.

COMPONENT LIST:

PIC Microcontroller (PIC16f877A)

or

FREEDUINO or ARDUINO

Stepper Motor (5 volt)

Piezoelectric Cristal

Power supply (230 volt)

LED (Light Emitting Diode)

Microphone

Loud Speaker

Voice logger

Load Cell

Step Down Transformer (230-18 volt)

Motor Driver (L293D)

Proximity Sensor

LCD Screen (Liquid Crystal Display)

Relay Driver (ULN2803APG)

pg. 7

Page 8: New Microsoft Office Word Document

DESCRIPTION:All the components those are to be used are described here:

PIC MICROCONTROLLER:

PIC is a family of modified Harvard architecture microcontrollers made by Microchip Technology, derived from the PIC 1650 originally developed by General Instrument's Microelectronics Division. The name PIC initially referred to "Peripheral Interface Controller", but now it is "PIC" only. The first parts of the family were available in 1976; by 2013 the company had shipped more than twelve billion individual parts, used in a wide variety of embedded systems. Early models of PIC had read-only memory (ROM) or field-programmable EPROM for program storage, some with provision for erasing memory. Later models used flash memory for program storage, and some types have program-writeable non-volatile memory. Program memory and data memory are separated. Data memory is 8 or (later models) 16 bits wide, and most models can only access on-chip data memory. Program instructions vary in length by family of PIC, and may be 12, 14,16, or 24 bits long. The instruction set also varies by model, with more powerful chips adding instructions for digital signal processing functions. The hardware capabilities of the PIC range vary from 8-pin parts with only a few I/O pins and on-chip clock oscillators up to multiple pin surface mount packages with many discrete input/output bits, analog inputs and outputs, and communications ports. Low-power and high-speed variations exist for many types. The manufacturer supplies both assemblers and a C compiler for most models. Third party and some open-source tools are also made. Some parts have in-circuit programming

pg. 8

Page 9: New Microsoft Office Word Document

capability; low-cost development programmers are available as well has high-production programmers. PICs are popular with both industrial developers and hobbyists alike due to their low cost, wide availability, large user base, extensive collection of application notes, availability of low cost or free development tools, and serial programming (and re-programming with flash memory) capability.

The PIC architecture is characterized by its multiple attributes:

Separate code and data spaces (Harvard architecture).

A small number of fixed-length instructions

Most instructions are single-cycle (2 clock cycles, or 4 clock cycles in 8-bit models), with one delay cycle on branches and skips

One accumulator (W0), the use of which (as source operand) is implied (i.e. is not encoded in the op-code)

All RAM locations function as registers as both source and/or destination of math and other functions

A hardware stack for storing return addresses

A small amount of addressable data space (32, 128, or 256 bytes, depending on the family), extended through banking

Data-space mapped CPU, port, and peripheral registers

ALU status flags are mapped into the data space

The program counter is also mapped into the data space and writable (this is used to implement indirect jumps).

pg. 9

Page 10: New Microsoft Office Word Document

The popular 16F877A that we have used:

The 16F877A is one of the most popular PIC microcontrollers and it's easy to see why - it comes in a 40 pin DIP pin-out and it has many internal peripherals. The only disadvantage that you could level at it is that it does not have an internal clock source like most of the other more modern PIC's. There is an alternative part 16F887/A that has nearly the same functionality as the 16F887A but also includes an internal clock like the 16F88 and 18F4550 plus it has nano-watt technology.

STEPPER MOTOR: It is an electromechanical device which converts electrical pulses into discrete mechanical movements. The shaft or spindle of a stepper motor rotates in discrete step increments when electrical command pulses are applied to it in the proper sequence. The motors rotation has several direct relationships to these applied input pulses. The sequence of the applied pulses is directly related to the direction of motor shafts rotation. The speed of the motor shafts rotation is directly related to the frequency of the input pulses and the length of rotation is directly related to the number of input pulses applied. One of the most significant

pg. 10

Page 11: New Microsoft Office Word Document

advantages of a stepper motor is its ability to be accurately controlled in an open loop system. Open loop control means no feedback information about position is needed. This type of control eliminates the need for expensive sensing and feedback devices such as optical encoders. Your position is known simply by keeping track of the input step pulses.

Features: The rotation angle of the motor is proportional to the input

pulse.

The motor has full torque at standstill(if the windings are energized)

Precise positioning and repeatability of movement since good stepper motors have an accuracy of – 5% of a step and this error is non cumulative from one step to the next.

Excellent response to starting/stopping/reversing.

Very reliable since there are no contact brushes in the motor. Therefore the life of the motor is simply dependant on the life of the bearing.

The motors response to digital input pulses provides open-loop control, making the motor simpler and less costly to control.

It is possible to achieve very low speed synchronous rotation with a load that is directly coupled to the shaft.

A wide range of rotational speeds can be realized as the speed is proportional to the frequency of the input pulses.

Stepper motor Parameters:

Model : 28BYJ-48

Rated voltage : 5VDC

pg. 11

Page 12: New Microsoft Office Word Document

Number of Phase : 4

Speed Variation Ratio : 1/64

Stride Angle : 5.625° /64

Frequency : 100Hz

DC resistance : 50Ω±7%(25℃)

Idle In-traction Frequency : > 600Hz

Idle Out-traction Frequency : > 1000Hz

In-traction Torque >34.3mN.m(120Hz)

Self-positioning Torque >34.3mN.m

Friction torque : 600-1200 gf.cm

Pull in torque : 300 gf.cm

Insulated resistance >10MΩ(500V)

Insulated electricity power :600VAC/1mA/1s

Insulation grade :A

Rise in Temperature <40K(120Hz)

Noise <35dB(120Hz,No load,10cm)

The bipolar stepper motor usually has four wires coming out of it. Unlike uni polar steppers, bipolar steppers have no common center

pg. 12Stepper Motor

Page 13: New Microsoft Office Word Document

connection. They have two independent sets of coils instead. You can distinguish them from uni polar steppers by measuring the resistance between the wires.). The ULN2003A contains seven Darlington transistor drivers and is somewhat like having seven TIP120 transistors all in one package. The ULN2003A can pass up to 500 mA per channel and has an internal voltage drop of about 1V when on. It also contains internal clamp diodes to dissipate voltage spikes when driving inductive loads. To control the stepper, apply voltage to each of the coils in a specific sequence.

LED: 1. Record indication: D1 (RED) flashes 3 times within the 600ms, then off for400ms, and then flashes quickly for 4 times within 600ms. Now the recording indication is over.

2. Begin to speak: D1 (RED) is off for 400ms, and then is on. Voice during the time while D1 (RED) is on will be recorded by this module.

3. Recording a voice instruction successfully for the first time: D1 (RED) off, D2 (ORANGE) on for 300ms.

4. Recording a voice instruction successfully for the first time: D1 (RED) off, D2 (ORANGE) on for 700ms.

5. Recording failure: D2 (ORANGE) flashes 4 times within the 600ms. In cases that voice instructions detected twice don’t match, or the sound is too large, or there is no sound, recording will fail. You need to start over the recording process for that instruction.

pg. 13

Page 14: New Microsoft Office Word Document

Waiting mode:

In waiting mode, D2 (ORANGE) is off, and D1 (RED) is on for 80ms every other 200ms, fast flashing. In this mode, it doesn’t recognize voice command, only waiting for serial commands.

Recognition stage:

In identification stage, D2 (ORANGE) is off, and D1 (RED) is on for 100ms every other 1500ms, slow flashing. In this stage, this module is processing received voice signal, and if matching, it will send the result immediately via serial port.

Recording :

Before using it, we have train it by recording voice instructions. Each voice instruction has the maximum length of 1300ms, which ensures that most words can be recorded. Once you start recording, you can’t stop the recording process until you finish all the 5 voice instructions recording of one group. Also, once you start recording, the previous voice instructions in that group will be erased. In training state, this module doesn’t reply to any other serial commands. LED will flash to indicate state. Please refer to the LED part.

MICROPHONE:

A microphone, colloquially mice or mike (/ˈmark/), [1] is an acoustic-to-electric transducer or sensor that converts sound in air into an electrical signal. Microphones are used in many applications such as telephones, hearing aids, public address systems for concert halls and public events, motion picture production, live and recorded audio engineering, two-way radios, megaphones, radio and television

pg. 14

Page 15: New Microsoft Office Word Document

broadcasting, and in computers for recording voice, speech recognition, VoIP, and for non-acoustic purposes such as ultrasonic checking.

Most microphones today use electromagnetic induction (dynamic microphones), capacitance change (condenser microphones) or piezoelectricity (piezoelectric microphones) to produce an electrical signal from air pressure variations. Microphones typically need to be connected to a preamplifier before the signal can be amplified with an audio power amplifier or recorded.

1 FEATURES DESCRIPTION:

• 500-mA-Rated Collector Current The ULN2803A device is a high-voltage, high-current(Single Output) Darlington transistor array. The device consists ofeight npn Darlington pairs that feature high-voltage

• High-Voltage Outputs: 50 V outputs with common-cathode clamp diodes.

• Output Clamp Diodes switching inductive loads. • Inputs Compatible With Various of each Darlington pair is 500 mA.

Types of Logic pairs may be connected in parallel for higher current capability.

• Relay-Driver Applications• Compatible with ULN2800A Series Applications include relay drivers, hammer drivers, lamp drivers, display drivers (LED and gas discharge), line drivers, and logic buffers.

pg. 15

Page 16: New Microsoft Office Word Document

LOAD CELL:

A load cell is a transducer that is used to create an electrical signal whose magnitude is directly proportional to the force being

measured. The various types of load cells include hydraulic load cells, pneumatic load cells and strain gauge load cells.

Here we have used a Piezo-electric load cell:

Piezoelectric load cells work on the same principle of deformation as the strain gauge load cells, but a voltage output is generated by the basic piezoelectric material - proportional to the deformation of load cell. Useful for dynamic/frequent measurements of force. Most applications for piezo-based load cells are in the dynamic loading conditions, where strain gauge load cells can fail with high dynamic loading cycles.

The load or force cell takes many forms to accommodate the variety of uses throughout research and industrial applications. The majority of recent designs use strain gauges as the sensing element, whether foil or semiconductor. Foil gauges offer the largest choice of different types and in consequence tend to be the most used in load cell designs. Strain gauge patterns offer measurement of tension, compression and shear forces. Semiconductor strain gauges come in a smaller range of patterns but offer the advantages of being extremely small and have large gauge factors, resulting in much larger outputs for the same given stress.

Due to these properties, they tend to be used for the miniature load cell designs. Rings are used for load measurement, using a calibrated metal ring, the movement of

pg. 16

Page 17: New Microsoft Office Word Document

which is measured with a precision displacement transducer. A vast number of load cell types have developed over the years,the first designs simply using a strain gauge to measure the direct stress which is introduced into a metal element when it is subjected to a tensile or compressive force. A bending beam type design uses strain gauges to monitor the stress in the sensing element when subjected to a bending force.

STEP DOWN TRANSFORMER:

It 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 doesn’t have to conduct as much current, may be made of smaller-gauge wire.

THE TRANSFORMER THAT I USED IN THE PROJECT

Model: GPC-1005

230V primary to 110V secondary

Power Rating: 300VA

o It steps down from 230-18volt. The 18v is divided into 2 parts: 12v and 5v.

pg. 17

Page 18: New Microsoft Office Word Document

o 12v is given to the motor via the transistors. 5v supplied to MC.

MOTOR DRIVER: It is a device or group of devices that serves to govern in some predetermined manner the performance of an electric motor.

A motor controller might include a manual or automatic means for starting and stopping the motor, selecting forward or reverse rotation, selecting and regulating the speed, regulating or limiting the torque, and protecting against overloads and faults.

Stepper motor drivers: A stepper, or stepping, motor is a synchronous, brushless, high pole count, poly phase motor. Control is usually, but not exclusively, done open loop, i.e. the rotor position is assumed to follow a controlled rotating field. Because of this, precise positioning with steppers is simpler and cheaper than closed loop controls.

Modern stepper controllers drive the motor with much higher voltages than the motor nameplate rated voltage, and limit current through chopping. The usual setup is to have a positioning controller, known as an indexer , sending step and direction pulses to a separate higher voltage drive circuit which is responsible for commutation and current limiting.

Proximity Sensor:

pg. 18

Page 19: New Microsoft Office Word Document

A proximity sensor is a sensor able to detect the presence of nearby objects without any physical contact. A proximity sensor often emits an electromagnetic field or a beam of electromagnetic radiation (infrared, for instance), and looks for changes in the field or return signal. The object being sensed is often referred to as the proximity sensor's target. Different proximity sensor targets demand different sensors. For example, a capacitive or photoelectric sensor might be suitable for a plastic target; an inductive proximity sensor always requires a metal target. The maximum distance that this sensor can detect is defined "nominal range". Some sensors have adjustments of the nominal range or means to report a graduated detection distance. Proximity sensors can have a high reliability and long functional life because of the absence of mechanical parts and lack of physical contact between sensor and the sensed object. Proximity sensors are commonly used on smart phones to detect (and skip) accidental touch screen taps when held to the ear during a call.[1] They are also used in machine vibration monitoring to measure the variation in distance between a shaft and its support bearing. This is common in large steam turbines, compressors, and motors that use sleeve-type bearings. International Electro technical Commission (IEC) 60947-5-2 defines the technical details of proximity sensors.

LCD: A liquid-crystal display (LCD) is a flat panel display, electronic visual display, or video display that uses the light

pg. 19

Proximity Sensors.

Page 20: New Microsoft Office Word Document

modulating properties of liquid crystals. Liquid crystals do not emit light directly. LCDs are available to display arbitrary images (as in a general-purpose computer display) or fixed images which can be displayed or hidden, such as preset words, digits, and 7-segment displays as in a digital clock.

They use the same basic technology, except that arbitrary images are made up of a large number of small pixels, while other displays have larger elements.

LCDs are used in a wide range of applications including computer monitors, televisions, instrument panels, aircraft cockpit displays, and signage.

They are common in consumer devices such as DVD players, gaming devices, clocks, watches, calculators, and telephones, and have replaced cathode ray tube (CRT) displays in most applications. They are available in a wider range of screen sizes than CRT and plasma displays, and since they do not use phosphors, they do not suffer image burn-in. LCDs are, however, susceptible to image persistence.

The LCD screen is more energy efficient and can be disposed of more safely than a CRT. Its low electrical power consumption enables it to be used in battery-powered electronic equipment.

It is an electronically modulated optical device made up of any number of segments filled with liquid crystals and arrayed in front of a light source (backlight) or reflector to

pg. 20

Seven segment LCD:

LCD :

The pin diagram:

Visual:

Page 21: New Microsoft Office Word Document

produce images in color or monochrome.

Liquid crystals were first discovered in 1888.[2] By 2008, annual sales of televisions with LCD screens exceeded sales of CRT units worldwide, and the CRT became obsolete for most purposes.

RELAY DRIVER (ULN2803APG):

A relay is an electro-magnetic switch which is useful if you want to use a low voltage circuit to switch on and off a light bulb (or anything else) connected to the 220v main supply. The current needed to operate the relay coil is more than can be supplied by most chips (op. amps etc), so a transistor is usually needed. Relay Driver with Flip-Flop In many situations in which you use a relay, you will also need a bi-stable flip flop. One useful integrated circuit flip-flop is the 4013. (This IC actually contains two flip-flops.) With the connections as shown in the circuit below, when the voltage on pin 3 changes (rapidly) from 0v to the positive supply voltage, the flip-flop changes state (it “flips”). The next time the same thing happens, the flip-flop changes back to its original state again (it “flops”).

ULN2803APG:

The ULN2803APG series are high−voltage, high−current Darlington drivers comprised of eight NPN Darlington pairs. All units feature integral clamp diodes for switching inductive loads.

pg. 21

Page 22: New Microsoft Office Word Document

Applications include relay, hammer, lamp and display (LED) drivers.

Features:

Output current (single output) 500 mA (max)

• High sustaining voltage output 50 V (min)

• Output clamp diodes

• Inputs compatible with various types of logic.

• Package Type−APG : DIP−18pin.

Piezoelectric sensors:

A piezoelectric sensor is a device that uses the piezoelectric effect, to measure changes in pressure, acceleration, temperature, strain, or force by converting them to an electrical charge. The prefix  piezo - is Greek for 'press' or 'squeeze'.

Piezoelectric sensors are versatile tools for the measurement of various processes. They are used for quality assurance, process control, and for research and development in many industries. Pierre Curie discovered the piezoelectric effect in 1880, but only in the 1950s did manufacturers begin to use the piezoelectric effect in industrial sensing applications. Since then, this measuring principle has been increasingly used, and has become a mature technology with excellent inherent reliability.

It has been successfully used in various applications, such as in medical, aerospace, nuclear instrumentation, and as a tilt sensor in consumer electronics or a pressure sensor in the touch pads of mobile phones. In the automotive industry, piezoelectric

pg. 22

Page 23: New Microsoft Office Word Document

elements are used to monitor combustion when developing internal combustion engines.

The sensors are either directly mounted into additional holes into the cylinder head or the spark/glow plug is equipped with a built-in miniature piezoelectric sensor.

One disadvantage of piezoelectric sensors is that they cannot be used for truly static measurements.

Sensor Design:

Based on piezoelectric technology various physical quantities can be measured; the most common are pressure and acceleration. For pressure sensors, a thin membrane and a massive base is used, ensuring that an applied pressure specifically loads the elements in one direction. For accelerometers, a seismic mass is attached to the crystal elements. When the accelerometer experiences a motion, the invariant seismic mass loads the elements according to Newton's second law of motion F=m a.

The main difference in working principle between these two cases is the way they apply forces to the sensing elements. In a pressure sensor, a thin membrane transfers the force to the elements, while in accelerometers an attached seismic mass applies the forces.

Sensors often tend to be sensitive to more than one physical quantity. Pressure sensors show false signal when they are exposed to vibrations. Sophisticated pressure sensors

pg. 23

Page 24: New Microsoft Office Word Document

therefore use acceleration compensation elements in addition to the pressure sensing elements.

By carefully matching those elements, the acceleration signal (released from the compensation element) is subtracted from the combined signal of pressure and acceleration to derive the true pressure information.

Vibration sensors can also harvest otherwise wasted energy from mechanical vibrations. This is accomplished by using piezoelectric materials to convert mechanical strain into usable electrical energy.

Now, let us explain the freeduino data sheet.

FREEDUINO DATASHEET

ATMEGA 328P 8-BIT MICROCONTROLLER WITH 32-K

BYTES IN SYSTEM PROGRAMMABLE FLASH

pg. 24

Page 25: New Microsoft Office Word Document

DATASHEET

Features:

o High Performance, Microcontroller Familyo Advanced RISC Architectureo 131 Powerful Instructions – Most Single Clock Cycle Executiono 32 x 8 General Purpose Working Registerso Fully Static Operationo Up to 20 MIPS Throughput at 20MHzo On-chip 2-cycle Multipliero High Endurance Non-volatile Memory Segmentso 4/8/16/32KBytes of In-System Self-Programmable Flash

program memoryo 256/512/512/1KBytes EEPROMo 512/1K/1K/2KBytes Internal SRAMo Write/Erase Cycles: 10,000 Flash/100,000 EEPROMo Data retention: 20 years at 85C/100 years at 25Co Optional Boot Code Section with Independent Lock Bitso In-System Programming by On-chip Boot Programo True Read-While-Write Operationo Programming Lock for Software Securityo Capacitive touch buttons, sliders and wheelso QTouch and QMatrix® acquisitiono Up to 64 sense channelso Peripheral Featureso Two 8-bit Timer/Counters with Separate Prescaler and

Compare modeo One 16-bit Timer/Counter with Separate Prescaler, Compare

Mode, and

pg. 25

Page 26: New Microsoft Office Word Document

o Capture Modeo Real Time Counter with

Separate Oscillatoro Six PWM Channelso 8-channel 10-bit ADC in

TQFP and QFN/MLF packageo Temperature Measuremento 6-channel 10-bit ADC in PDIP

Packageo Temperature Measuremento Programmable Serial USARTo Master/Slave SPI Serial

Interfaceo Byte-oriented 2-wire Serial Interface (Philips I2C compatible)o Programmable Watchdog Timer with Separate On-chip

Oscillatoro On-chip Analog Comparatoro Interrupt and Wake-up on Pin Changeo Special Microcontroller Featureso Power-on Reset and Programmable Brown-out Detectiono Internal Calibrated Oscillatoro External and Internal Interrupt Sourceso Six Sleep Modes: Idle, ADC Noise Reduction, Power-save,

Power-down, Standby, and Extended Standbyo I/O and Packageso 23 Programmable I/O Lineso 28-pin PDIP, 32-lead TQFP, 28-pad QFN/MLF and 32-pad

QFN/MLFo Operating Voltage:o 1.8 - 5.5Vo Temperature Range:o -40C to 85Co Speed Grade:o 0 - [email protected] - 5.5V, 0 - [email protected] - 5.5.V, 0 - 20MHz @ 4.5 -

5.5Vo Power Consumption at 1MHz, 1.8V, 25Co Active Mode: 0.2mAo Power-down Mode: 0.1μA

pg. 26

Page 27: New Microsoft Office Word Document

Pin Configurations:

pg. 27

32 TQFP Top View:

(PCINT14/RESET) PC6(PCINT16/RXD) PD0(PCINT17/TXD) PD1(PCINT18/INT0) PD2(PCINT19/OC2B/INT1) PD3(PCINT20/XCK/T0) PD4VCCGND(PCINT6/XTAL1/TOSC1) PB6(PCINT7/XTAL2/TOSC2) PB7(PCINT21/OC0B/T1) PD5(PCINT22/OC0A/AIN0) PD6(PCINT23/AIN1) PD7(PCINT0/CLKO/ICP1) PB0PC5 (ADC5/SCL/PCINT13)PC4 (ADC4/SDA/PCINT12)PC3 (ADC3/PCINT11)PC2 (ADC2/PCINT10)PC1 (ADC1/PCINT9)PC0 (ADC0/PCINT8)GNDAREFAVCCPB5 (SCK/PCINT5)PB4 (MISO/PCINT4)PB3 (MOSI/OC2A/PCINT3)PB2 (SS/OC1B/PCINT2)PB1 (OC1A/PCINT1)

(PCINT19/OC2B/INT1) PD3(PCINT20/XCK/T0) PD4GNDVCCGNDVCC(PCINT6/XTAL1/TOSC1) PB6(PCINT7/XTAL2/TOSC2) PB7PC1 (ADC1/PCINT9)PC0 (ADC0/PCINT8)ADC7GNDAREFADC6AVCCPB5 (SCK/PCINT5) (PCINT21/OC0B/T1) PD5(PCINT22/OC0A/AIN0) PD6(PCINT23/AIN1) PD7(PCINT0/CLKO/ICP1) PB0(PCINT1/OC1A) PB1(PCINT2/SS/OC1B) PB2(PCINT3/OC2A/MOSI) PB3(PCINT4/MISO) PB4PD2 (INT0/PCINT18)PD1 (TXD/PCINT17)PD0 (RXD/PCINT16)PC6 (RESET/PCINT14)PC5 (ADC5/SCL/PCINT13)PC4 (ADC4/SDA/PCINT12)PC3 (ADC3/PCINT11)PC2 (ADC2/PCINT10)

Page 28: New Microsoft Office Word Document

pg. 28

28 MLF Top View

(PCINT19/OC2B/INT1) PD3(PCINT20/XCK/T0) PD4VCCGND(PCINT6/XTAL1/TOSC1) PB6(PCINT7/XTAL2/TOSC2) PB7(PCINT21/OC0B/T1) PD5(PCINT22/OC0A/AIN0) PD6(PCINT23/AIN1) PD7(PCINT0/CLKO/ICP1) PB0(PCINT1/OC1A) PB1(PCINT2/SS/OC1B) PB2(PCINT3/OC2A/MOSI) PB3(PCINT4/MISO) PB4PD2 (INT0/PCINT18)PD1 (TXD/PCINT17)PD0 (RXD/PCINT16)PC6 (RESET/PCINT14)PC5 (ADC5/SCL/PCINT13)PC4 (ADC4/SDA/PCINT12)PC3 (ADC3/PCINT11)PC2 (ADC2/PCINT10)PC1 (ADC1/PCINT9)PC0 (ADC0/PCINT8)GNDAREFAVCCPB5 (SCK/PCINT5)

28 PDIP32 MLF Top View

(PCINT19/OC2B/INT1) PD3(PCINT20/XCK/T0) PD4GNDVCCGNDVCC(PCINT6/XTAL1/TOSC1) PB6(PCINT7/XTAL2/TOSC2) PB7PC1 (ADC1/PCINT9)PC0 (ADC0/PCINT8)ADC7GNDAREFADC6AVCCPB5 (SCK/PCINT5)(PCINT21/OC0B/T1) PD5(PCINT22/OC0A/AIN0) PD6(PCINT23/AIN1) PD7(PCINT0/CLKO/ICP1) PB0(PCINT1/OC1A) PB1(PCINT2/SS/OC1B) PB2(PCINT3/OC2A/MOSI) PB3(PCINT4/MISO) PB4PD2 (INT0/PCINT18)PD1 (TXD/PCINT17)PD0 (RXD/PCINT16)PC6 (RESET/PCINT14)PC5 (ADC5/SCL/PCINT13)PC4 (ADC4/SDA/PCINT12)PC3 (ADC3/PCINT11)PC2 (ADC2/PCINT10)NOTE: Bottom pad should be soldered to ground.

Page 29: New Microsoft Office Word Document

Pin Descriptions:

VCC: Digital supply voltage

GND: Ground

Port B (PB7:0) XTAL1/XTAL2/TOSC1/TOSC2:

Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). 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 tristated 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. If the Internal Calibrated RC Oscillator is used as chip clock source, PB7...6 is used as TOSC2...1 input for theAsynchronous 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 ”SystemClock and Clock Options” on page 27.

Port C (PC5:0)

Port C is a 7-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). 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

pg. 29

Page 30: New Microsoft Office Word Document

low will source current if the pull-up resistors are activated. The Port C pins are tristatedwhen a reset condition becomes active, even if the clock is not running.

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 unprogrammed, 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 29-11 on page 305. 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 (PD7:0):

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 tristated 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.

pg. 30

Page 31: New Microsoft Office Word Document

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.

AREF: AREF is the analog reference pin for the A/D Converter.

ADC7:6 (TQFP and QFN/MLF Package Only):

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.

HARDWARE PROGRAMMING LIST:

pg. 31

Page 32: New Microsoft Office Word Document

void set up()

{

pinMode(A2,INPUT);

}

void loop()

{

if (digitalRead(A2)==HIGH)

digitalWrite(13,HIGH);

else

digitalWrite(13,LOW);

}

pg. 32

Page 33: New Microsoft Office Word Document

Overview:

The ATmega328/P is a low-power CMOS 8-bit microcontroller based on the AVR enhanced RISC architecture. By executing powerful instructions in a single clock cycle, the ATmega48A/PA/88A/PA/168A/PA/328/P achieves throughputs approaching 1 MIPS per MHz allowing the system designer to optimize power consumption versus processing speed. 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. The ATmega48A/PA/88A/PA/168A/PA/328/P provides the following features: 4K/8Kbytes of In-System Programmable Flash with Read-While-Write capabilities, 256/512/512/1Kbytes EEPROM, 512/1K/1K/2Kbytes SRAM, 23 general purpose I/O lines, 32 general purpose working registers, three flexible Timer/Counters withcompare modes, internal and external interrupts, a serial programmable USART, a byte-oriented 2-wire Serial Interface, an SPI serial port, a 6-channel 10-bit ADC (8 channels in TQFP and QFN/MLF packages), aprogrammable 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

pg. 33

Page 34: New Microsoft Office Word Document

crystal/resonator Oscillator is running while the rest of the device is sleeping. This allows very fast start-up combined with low power consumption. Atmel® offers the QTouch® library for embedding capacitive touch buttons, sliders and wheels functionality into AVR® microcontrollers. The patented charge-transfer signal acquisition offers robust sensing and includes fully denounced reporting of touch keys and includes Adjacent Key Suppression® (AKS™) technology for unambiguous detection of key events. The easy-to-use QTouch Suite toolchain allows you to explore, develop and debug your own touch applications.

The device is manufactured using Atmel’s high density non-volatile memory technology. The On-chip ISP Flashallows 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 theBoot 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 ATmega48A/PA/88A/PA/168A/PA/328/P is a powerful microcontroller that provides a highly flexible and cost effective solution to many embedded control applications.

The ATmega48A/PA/88A/PA/168A/PA/328/P AVR is supported with a full suite of program and system development tools including: C Compilers, Macro Assemblers, Program ebugger/Simulators, In-Circuit Emulators, and Evaluation kits.

ATmega48A/PA/88A/PA/168A/PA/328/P support a real Read-While-Write Self-Programming mechanism.

pg. 34

Page 35: New Microsoft Office Word Document

There is a separate Boot Loader Section, and the SPM instruction can only execute from there. In ATmega 48A/48PA there is no Read-While-Write support and no separate Boot Loader Section. The SPM instruction can execute from the entire Flash.

Resources

A comprehensive set of development tools, application notes and datasheets are available for download onhttp://www.atmel.com/avr. 1.

Data Retention

Reliability Qualification results show that the projected data retention failure rate is much less than 1 PPM over20 years at 85°C or 100 years at 25°C.

About Code Examples

This documentation contains simple code examples that briefly show how to use various parts of the device.These code examples assume that the part specific header file is included before compilation. Be aware that notall C compiler vendors include bit definitions in the header files and interrupt handling in C is compilerdependent. Please confirm with the C compiler documentation for more details.For I/O Registers located in extended I/O map, “IN”, “OUT”, “SBIS”, “SBIC”, “CBI”, and “SBI” instructions mustbe replaced with instructions that allow access to extended I/O. Typically “LDS” and “STS” combined with“SBRS”, “SBRC”, “SBR”, and “CBR”.

pg. 35

Page 36: New Microsoft Office Word Document

Capacitive Touch Sensing:

The Atmel® QTouch® Library provides a simple to use solution to realize touch sensitive interfaces on mostAtmel AVR® microcontrollers. The QTouch Library includes support for the Atmel QTouch and Atmel QMatrix®acquisition methods.Touch sensing can be added to any application by linking the appropriate Atmel QTouch Library for the AVRMicrocontroller. This is done by using a simple set of APIs to define the touch channels and sensors, and thencalling the touch sensing APIs to retrieve the channel information and determine the touch sensor states.The QTouch Library is FREE and downloadable from the Atmel website at the following location:www.atmel.com/qtouchlibrary. For implementation details and other information, refer to the Atmel QTouch

Library User Guide - also available for download from Atmel website.In order to maximize performance and parallelism, the AVR uses a Harvard architecture – with separatememories and buses for program and data. Instructions in the program memory are executed with a single levelpipelining. 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 cycleaccess time. This allows single-cycle Arithmetic Logic Unit (ALU) operation. In a typical ALU operation there are --------

pg. 36

Page 37: New Microsoft Office Word Document

Program Memory

Instruction

Register

Decoder

Program Counter

Control Lines

(32 x 8) General Purpose Registers

ALU

Status and Control

I/O Lines

EEPROM

Data Bus 8-bit

Data SRAM

Direct Addressing

Indirect Addressing

Interrupt

Unit SPI

Unit Watchdog

pg. 37

Page 38: New Microsoft Office Word Document

Timer Analog

Comparator I/O Module 2I/O Module1 I/O Module n:

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 Zregister,described later in this section.

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. 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

pg. 38

Page 39: New Microsoft Office Word Document

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 AVRarchitecture.

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 bitin 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, thehigher 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 ATmega48A/PA/88A/PA/168A/PA/328/P has Extended I/O spacefrom 0x60 - 0xFF in SRAM where only the ST/STS/STD and LD/LDS/LDD instructions can be used.

ALU – Arithmetic Logic Unit:

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 multiplier supporting both signed/unsigned multiplication and

pg. 39

Page 40: New Microsoft Office Word Document

fractional format. See the “Instruction Set” section for a detailed description.

Status Register:

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.

CONCLUSION:

Due to less time we have shorten the project. Design of the detection of any object by FREEDUINO has been done, by perceiving the electromagnetic radiations (IR RADIATIONS) and keeping the LED ON.

Other parts, such as, voice logger and the casing, is kept for the future group who will work on our project. The interfacing would be easier as we have used FREEDUINO as the

pg. 40

Page 41: New Microsoft Office Word Document

microcontroller. We wish the best to the future groups to complete the project.

ACKNOWLEDGMENT

The entire project is done under the guidance of our most respected Director Sir, Dr. Dipankar Sarkar and Miss. Sukanya Roy.We are also thankful to our E.C.E. faculty members, particularly Mr. Abhishek Saha, Mr.Rajarshi Mukhopadhyay & Mrs. Sayani De Sarkar.

pg. 41

Page 42: New Microsoft Office Word Document

References:

http://www.freeduino.org/freeduino_open_designs.html

http://embeddeddesignfreaks.in/difference-between-an-arduino-and-freeduino/

http://www.nanomotion.com/piezo-ceramic-motor-technology/piezoelectric-effect/

http://piceramic.com/piezo-technology/fundamentals.html

http://playwithrobots.com/

http://www.instructables.com/

http://www.webopedia.com/TERM/L/LCD.html

http://artsites.ucsc.edu/ems/music/tech_background/te-20/teces_20.html

http://www.electroschematics.com/4355/step-down-transformer/

http://www.ledinside.com/

http://electronics.howstuffworks.com

http://www.entrepreneur.com/bizopportunities/categories/vend.html

http://www.bplans.com/vending_services_business_plan/executive_summary_fc.php

pg. 42

Page 43: New Microsoft Office Word Document

pg. 43