Disease Diagnoser and Pill Dispenser Using Embedded Network Essay
In spite of seeking medical assistance, with the knowledge of the symptoms of the diseases what he is suffering from, he can diagnose the disease of him via internet through many medical websites. Some websites provide symptoms of nearly 1200 diseases. With the help of those websites we can determine our disease up to certain extend.
Some website provides many combinations of diseases which are more useful for the viewer to select the apt symptom from which he is suffering from. Some other websites on receiving the data’s from the user, based on the data’s it displays the disease names and also the type of doctor they need to meet with.They also provide information about the current status of the patient on his disease.
But this case is only when the person is connected to the internet 1. 2 Drawbacks The person who needs the medical assistance is to be connected to the internet. This cannot be implemented everywhere. People in rural areas cannot afford this due to insufficient facilities with them. There is no hardware assemble for this idea, which serves as the major drawback of the project. If a hardware form is available it can be very useful for all the people to use the facility, in the absence of internet facility in rural areas.
. 3 Proposed System A small ATM like setup is installed in all the rural villages. The person who has medical problem is checked for temperature and heartbeat and automatically made a voice counseling for example a series of questions is asked in Tamil for which he has to answer via a key press.
The questionnaire is asked for a series of rounds and the computer sends all the input data such as heart beat, temperature, the answers for the questions asked by the machine and the picture of the patient is sent to the doctor sitting at the server side.The doctor on seeing the patient data’s diagnoses the disease and sends a list of medicines to the patient in return, if the disease is curable without any active consultation via a doctor or asks the patients to consult the hospital. On getting a valid response the machine either dispenses medicines to the patient along with the Prescription or informs the patient to visit the hospital.
2. BLOCK DIAGRAM 2. 1 Transmitter PIC MICROCONTROLLER 16F877A ZIGBEE RELAY VOICE PROCESSOR HEART BEAT SENSOR TEMPERATURE SENSOR EJECTOR LCD DISPLAY S1 S2 MIC SPEAKER RF RECEIVER 2. 2 ReceiverPIC MICROCONTROLLER 16F877A ZIGBEE LCD DISPLAY S1 S2 S3 S4 RF TRANSMTER 2. 3 Block diagram explanation The main component of this project is PIC 16F877A controller. It is a dual in line package with 40 pins.
The two vital inputs necessary for our project is heartbeat and temperature. These two inputs are derived from heartbeat sensor and temperature sensor. The inputs of these two sensors are fed to the microcontroller.
The microcontroller consists of inbuilt Analog to Digital converter, which converts the fetched analog inputs (such as pulse and temperature) to digital values.A LCD display in the patient side, displays the values, which are fed to the microcontroller. The voice processor is recorded with questions to ask the patients, which is pre recorded with a mike. Once if the two sensor inputs are given to the microcontroller it starts to ask the question the patient. All the inputs are given to the microcontroller.
The values of heart beat sensor, temperature sensor, and all the inputs given to the ZigBee and it transmits to the doctor side. A 3G mobile camera captures the picture of the patient and transmits the picture to the doctor.The doctor receives all the input through ZigBee at the receiver side. The ZigBee is connected to the LCD display that displays the heartbeat, temperature and all the answers of the patient. The picture of the patient is in another 3G mobile the doctor’s side. The doctor analyzes the patient’s condition with all the received values and decides the pills to give to the patient. The switches corresponding to the tablets in the doctor’s side are connected with Infrared transmitter. Whenever the doctor presses the switch a signal gets transmitted to the patient side and received in the receiver side.
That is connected with a relay and an ejector which ejects out the tablet to the patient. The ejector ejects the tablet corresponding to the medicine of the switch; the doctor presses (the medicine, which the doctor prescribes) in the receiver side. The LCD display in the patient side displays the prescription to the patient indicating the time of intake of the tablets. This information is also sent from the doctor side from the doctor to the patient via ZigBee.
3. CIRCUIT DIAGRAM EXPLANATION The step down transformer with a rating of 15-0-15 serves as the power supply to the circuit.The power supply gives two types of output as 5V and 12V. The 5V power is given to the microcontroller. The 12V power supply is given to the LCD. Another 12 V power supply is given to the relay. The output of heart beat sensor is given to RB0 of the microcontroller as it is Digital value and temperature sensor is given to RA1 of the microcontroller as it the analog port.
The monochrome LCD display is connected to port D of the microcontroller. There are fourteen data lines in it, with eight data lines, two for power supply, two for ground one for Read/ Write, one for Register select.The IR receiver is connected to the LCD display and the relay connections.
The relay connection consists of a series of four relays connected with an ejector along with it. The ZigBee is connected to the microcontroller to receive the inputs from the microcontroller and transmit to the doctor side. The voice processor used is APR 9600. The voice processor set is connected with the microcontroller, to feed the inputs to the microcontroller. It consists of a mike to record the questions which is to be asked to the patients and a speaker to output the questions to the patient.Once if the values or data’s are f3ed to the microcontroller, it starts transmitting to the doctor side.
The picture of the patient is captured with a 3G mobile and transmitted. The data’s like heart beat, temperature, patient’s picture, and all the inputs given by the patient for the questions by the voice processor. The same connections are there in the doctor’s side, with slight changes. The setup consists of a step down transformer giving supply to microcontroller, LCD and switch. The microcontroller is connected to the LCD display, and the ZigBee receiver.ZigBee receiver receives all the data’s from the patient’s side. The 3G mobile in the doctor’s side shows the picture of the patient. The inputs from the patient side are displayed in the LCD display.
The doctor analyzes the patient and decides the tablets to be given to the patient. The series of switches are connected to the IR transmitter corresponding to the tablets in the patient’s side. When the doctor presses a switch in the doctor side, the signal gets transmitted via IR transmitter and received in the IR receiver in the patient side. There the IR receiver is connected to the relay in the patient side.
The relay unit is connected to a series of ejector’s corresponding to the tablets for the switches in the doctor side. The relay which is corresponding to the switch pressed in the doctor side for the tablet alone gets energized and it ejects the medicine via the ejector. The prescription will be displayed in the LCD display which is connected to the IR receiver in the patient’s side. 4.
FLOWCHART- 4. 1 Flow chart transmitter NO Start If Key pressed YES Get Data from heart Beat sensor Get Data from Temperature sensor Send data to PC Is dispensing data received? If Key pressed NO Send data to PC If PC stop scan receivedNO YES YES A A YES NO Move Dc Motor Forward Move Dc motor reverse B B 4. 2 Flow chart receiver NO Start If Serial Data Received YES Ask the Sequence of questions Display Data in Screen Send data to server If Server has replied NO Send data to MC If MC stop command received NO YES YES A A 5. HARDWARE DESCRIPTION 5. 1 Power supply 5. 1. 1 Introduction A power supply is a device that supplies electrical energy to one or more electric loads.
The term is most commonly applied to devices that convert one form of electrical energy to another, thoug h it may also refer to devices that convert another form of energy (e. . , mechanical, chemical, solar) to electrical energy.
A regulated power supply is one that controls the output voltage or current to a specific value; the controlled value is held nearly constant despite variations in either load current or the voltage supplied by the power supply’s energy source. Fig. 5. 1 Power supply Every power supply must obtain the energy it supplies to its load, as well as any energy it consumes while performing that task, from an energy source. Depending on its design, a power supply may obtain energy from: * Electrical energy transmission systems.
Common examples of this include power supplies that convert AC line voltage to DC voltage. * Energy storage devices such as batteries and fuel cells. * Electromechanical systems such as generators and alternators.
* Solar power. A power supply may be implemented as a discrete, stand-alone device or as an integral device that is hardwired to its load. Examples of the latter case include the low voltage DC power supplies that are part of desktop computers and consumer electronics devices. Commonly specified power supply attributes include, * The amount of voltage and current it can supply to its load. How stable its output voltage or current is under varying line and load conditions. * How long it can supply energy without refueling or recharging (applies to power supplies that employ portable energy sources).
Power supplies for electronic devices can be broadly divided into line-frequency (or “conventional”) and switching power supplies. The line-frequency supply is usually a relatively simple design, but it becomes increasingly bulky and heavy for high-current equipment due to the need for large mains-frequency transformers and heat-sinked electronic regulation circuitry.Conventional line-frequency power supplies are sometimes called “linear,” but that is a misnomer because the conversion from AC voltage to DC is inherently non-linear when the rectifiers feed into capacitive reservoirs. Linear voltage regulators produce regulated output voltage by means of an active voltage divider that consumes energy, thus making efficiency low. A switched-mode supply of the same rating as a line-frequency supply will be smaller, is usually more efficient, but will be more complex. 5. 1.
2 Power supply types 5. 1. 2. 1 DC power supply An AC powered unregulated power supply usually uses a transformer to convert the voltage from the wall outlet (mains) to a different, nowadays usually lower, voltage. If it is used to produce DC, a rectifier is used to convert alternating voltage to a pulsating direct voltage, followed by a filter, comprising one or more capacitors, resistors, and sometimes inductors, to filter out (smooth) most of the pulsation.
A small remaining unwanted alternating voltage component at mains or twice mains power frequency(depending upon whether half- or full-wave rectification is used)—ripple—is unavoidably superimposed on the direct output voltage.Fig 5. 2 DC power supply * For purposes such as charging batteries the ripple is not a problem, and the simplest unregulated mains-powered DC power supply circuit consists of a transformer driving a single diode in series with a resistor. * Before the introduction of solid-state electronics, equipment used valves (vacuum tubes) which required high voltages; power supplies used step-up transformers, rectifiers, and filters to generate one or more direct voltages of some hundreds of volts, and a low alternating voltage for filaments.Only the most advanced equipment used expensive and bulky regulated power supplies. 5. 1. 2.
2 AC power supply * An AC power supply typically takes the voltage from a wall outlet (mains supply) and lowers it to the desired voltage (e. g. 9 VAC), some filtering may take place as well. 5. 1. 2. 3 Linear regulated power supply There are many types of power supply.
Most are designed to convert high voltage AC mains electricity to a suitable low voltage supply for electronic circuits and other devices. A power supply can by broken down into a series of blocks, each of which performs a particular function.Fig 5. 3 5V regulated supply * Transformer – steps down high voltage AC mains to low voltage AC. * Rectifier – converts AC to DC, but the DC output is varying. * Smoothing – smooth the DC from varying greatly to a small ripple. * Regulator – eliminates ripple by setting DC output to a fixed voltage.
* The voltage produced by an unregulated power supply will vary depending on the load and on variations in the AC supply voltage. For critical electronics applications a linear regulator may be used to set the voltage to a precise value, stabilized against fluctuations in input voltage and load.The regulator also greatly reduces the ripple and noise in the output direct current. Linear regulators often provide current limiting, protecting the power supply and attached circuit from overcurrent. * Adjustable linear power supplies are common laboratory and service shop test equipment, allowing the output voltage to be adjusted over a range.
For example, a bench power supply used by circuit designers may be adjustable up to 30 volts and up to 5 amperes output. Some can be driven by an external signal, for example, for applications requiring a pulsed output. . 1.
3 Power Supply applications 5. 1. 3. 1 AC adapter A power supply that is built into an AC mains power plug is known as a “plug pack” or “plug-in adapter”, or by slang terms such as “wall wart”.
They are even more diverse than their names; often with either the same kind of DC plug offering different voltage or polarity, or a different plug offering the same voltage. “Universal” adapters attempt to replace missing or damaged ones, using multiple plugs and selectors for different voltages and polarities.Replacement power supplies must match the voltage of, and supply at least as much current as, the original power supply.
The least expensive AC units consist only of a small transformer, while DC adapters include a few additional diodes. Whether or not a load is connected to the power adapter, the transformer has a magnetic field continuously present and normally cannot be completely turned off unless unplugged. Fig 5. 4. AC adapter Because they consume standby power, they are sometimes known as “electricity vampires” and may be plugged into a power strip to allow turning them off.Expensive switched-mode power supplies can cut off leaky electrolyte-capacitors, use powerless MOSFETs, and reduce their working frequency to get a gulp of energy once in a while to power, for example, a clock, which would otherwise need a battery. 5. 1.
3. 2 Over load Protection Power supplies often include some type of overload protection that protects the power supply from load faults (e. g. , short circuits) that might otherwise cause damage by overheating components or, in the worst case, electrical fire. Fuses and circuit breakers are two commonly used mechanisms for overload protection.
A fuse contains a short piece of wire which melts if too much current flows. This effectively disconnects the power supply from its load, and the equipment stops working until the problem that caused the overload is identified and the fuse is replaced. Some power supplies use a very thin wire link soldered in place as a fuse. Fuses in power supply units may be replaceable by the end user, but fuses in consumer equipment may require tools to access and change. One benefit of using a circuit breaker as opposed to a fuse is that it can simply be reset instead of having to replace the blown fuse.
A circuit breaker contains an element that heats, bends and triggers a spring which shuts the circuit down. Once the element cools, and the problem is identified the breaker can be reset and the power restored. 5. 1.
4 Current limiting Some supplies use current limiting instead of cutting off power if overloaded. The two types of current limiting used are electronic limiting and impedance limiting. The former is common on lab bench PSUs, the latter is common on supplies of less than 3 watts output. A foldback current limiter reduces the output current to much less than the maximum non-fault current. 5. 1.
5 Power conversionThe term “power supply” is sometimes restricted to those devices that convert some other form of energy into electricity (such as solar power and fuel cells and generators). A more accurate term for devices that con vert one form of electric power into another form (such as transformers and linear regulators) is power converter. The most common conversion is from AC to DC. 5. 1. 6 Mechanical Power Supplies * Flywheels coupled to electrical generators or alternators * Compulsators * Explosively pumped flux compression generators 5.
1. 7 Terminology * SCP – Short circuit protection * OPP – Overpower (overload) protection OCP – Overcurrent protection * OTP – Overtemperature protection * OVP – Overvoltage protection * UVP – Undervoltage protection * UPS – Uninterruptable Power Supply * PSU – Power Supply Unit * SMPSU – Switch-Mode Power Supply Unit 5. 2 PIC 5.
2 PIC MICROCONROLLER 5. 2. 1 PIC16F877A architecture Fig 5. 5 PIC16F877A architecture 5. 2. 2 Peripheral Features • Timer0: 8-bit timer/counter with 8-bit prescaler.
• Timer1: 16-bit timer/counter with prescaler, can be incremented during sleep via external crystal/clock. • Timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler. Two Capture, Compare, PWM modules – Capture is 16-bit, max. resolution is 12. 5 ns.
– Compare is 16-bit, max. resolution is 200 ns. – PWM max. resolution is 10-bit. • 10-bit multi-channel Analog-to-Digital converter. • Synchronous Serial Port (SSP) with SPI?? (Master Mode) and I2C?? (Master/Slave). • Universal Synchronous Asynchronous Receiver Transmitter (USART/SCI) with 9-bit address detection.
• Parallel Slave Port (PSP) 8-bits wide, with external RD, WR and CS controls (40/44-pin only). • Brown-out detection circuitry for Brown-out Reset (BOR). 5. 2.
3 Microcontroller Core Features • High-performance RISC CPU. Only 35 single word instructions to learn. • All single cycle instructions except for program branches which are two cycle. • Operating speed: DC – 20 MHz clock input DC – 200 ns instruction cycle. • Pin out compatible to the PIC16C73B/74B/76/77.
• Interrupt capability (up to 14 sources). • Eight level deep hardware stack. • Direct, indirect and relative addressing modes. • Power-on Reset (POR).
• Power-up Timer (PWRT) and Oscillator Start-up Timer (OST). • Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable operation. • Programmable code-protection. • Power saving SLEEP mode.
• Selectable oscillator options. Low-power, high-speed CMOS FLASH/EEPROM technology. • Fully static design.
• In-Circuit Serial Programming?? (ICSP)? via two pins. • Single 5V In-Circuit Serial Programming capability. • Processor read/write access to program memory. • Low-power consumption. 5. 2. 4 Pin diagram PIC16F877A Fig 5. 6 Pin diagram -PIC16F877A Key Features PIC micro Mid-Range ReferenceManual (DS33023)| PIC16F877| Operating Frequency| DC – 20 MHz| Resets (and Delays)| POR, BOR(PWRT, OST)| FLASH Program Memory(14-bit words)| 8K| Data Memory (bytes)| 368| EEPROM Data Memory| 256| Interrupts| 14| I/O Ports| PORT A,B,C,D,E| Timers| 3|Capture/Compare/PWM modules| 2| Serial Communications| MSSP, USART| Parallel Communications| PSP| 10-bit Analog-to-Digital Module| 8 input channels| Instruction Set| Instruction Set| TABLE 1-2: PIC 16F877 PINOUT DESCRIPTION Pin Name| DIPPin#| PLCCPin#| QFPPin#| I/O/PType| BufferType| Description| OSC1/CLKIN| 13| 14| 30| 1| ST/CMOS(4)| Oscillator crystal input/external clock source input.
| OSC2/CLKOUT| 14| 15| 31| 0| —-| Oscillator crystal output. connects to crystal or resonator in crystal oscillator mode. In RC mode, the OSC2 pin outputs CLKOUT which has ? the frequency of OSC1, and denotes the instruction cycle rate. MCLR/ Vpp/THV| 1| 2| 18| I/O| ST| Master clear (reset) input or programming voltage test mode control. This pin is an active low reset to the device.
| RA0/AN0RA1/AN1RA2/AN2/VREF-RA3/AN3/VREF+RA4/T0CKIRA5/SS/AN4| 2 3 4567| 3 3 4678| 19 20 21222324| I/O I/O I/OI/OI/OI/O| TTL TTL TTLTTLST TTL| PORTA is a bi-directional I/O port. RA0 can also analog input0 RA1 can also be analog input1 RA2 can also be analog input2 or negative analog reference voltage RA3 can also be analog input3 or positive analog reference voltage RA4 can also be the clock input to the Timer0 module.Output is open drain type. RA5 can also be analog input4 or the slave select for the synchronous serial port.
| RBO/INTRB1RB2RB3/PGMRB4RB5RB6/PGCRB7/PGD| 33 34353637383940| 36 373839414243 44| 8 9101114151617| I/O I/OI/OI/OI/OI/OI/OI/O| TTL/ST(1) TTLTTLTTLTTLTTLTTL/ST(2)TTL/ST(2)| PORTB is a bi-directional I/O port. PORTB can be software programmed for internal weak pull-up on all inputs. RB0 can also be the external interrupt pin. RB3 can also be the voltage programming input Interrupt on change pin. Interrupt on change pin. Interrupt on change pin or in-circuit Debugger pin. Serial programming data.Interrupt on change pin or in-circuit Debugger pin.
Serial programming data. | RC0/T1OSO/T1CLK1RC1/T1OSI/CCP2RC2/CCP1RC3/SCK/SCLRC4/SDI/SDARC5/SD0RC6/TX/CKRC7/RX/DT| 15 16171823 242526| 1618192025262729| 323536374243441| I/OI/OI/0I/OI/OI/OI/OI/O| STSTSTSTST STSTST| PORTC is a bi-directional I/O port. RC0 can also be the Timer1oscillator output or Timer1 clock input. RC1can also be the Timer1 oscillator input or capture2 input/compare 2 output/pwm2 output. RC2 can also the capture 1 input /compare 1output /PWM 1 output. RC3 can also be the synchronous serial clock input/output for both SPI and I2c modes.RC4 Can also be the SPI Data in (SPI mode) or data I/O (I2c mode).
RC5 can also be the SPI Data out(SPI mode). RC6 can also be the USART Asynchronous Transmit or synchronous clock. RC7 can also be the USART Asynchronous Receive or Synchronous Data. | RDO/PSP0RD1/PSP1RD2/PSP2RD3/PSP3RD4/PSP4RD5/PSP5RD6/PSP6RDR7/PSP7| 1920212227282930| 2122232430313233| 383940412345| I/OI/OI/OI/OI/OI/OI/OI/O| ST/TTL(3)ST/TTL(3)ST/TTL(3)ST/TTL(3)ST/TTL(3)ST/TTL(3)ST/TTL(3)ST/TTL(3)| PORTD is a bi-directional I/O port or parallel slave port when interfacing to a microprocessor bus. RE0/RD/ANSRE1/WR/AN6RE2/CS/AN7| 8910| 91011| 252627| I/OI/OI/O| ST/TTL(3)ST/TTL(3)ST/TTL(3)| PORTE is a bi-directional I/Oport. RE0 can also be read control for the parallel port, or analog input5.
RE1 can also be write control for the parallel slave port, or analog input6. RE2 can also be select control for the parallel slave port, or analog input7| VSS| 8,19| 8,19| | p| —| Ground reference for logic and I/O pins. | VDD| 20| 20| | P| —| Positive supply for logic and I/O pins. | NC| —| 1,17,28,40| 12,13,33,34| | —| These pins are not internally connected these pins should be left unconnected. Legend: I = input O = output I/O = input/output P = power — = Not used TTL = TTL input ST = Schmitt Trigger input Note 1: This buffer is a Schmitt Trigger input when configured as the external interrupt. 2: This buffer is a Schmitt Trigger input when used in serial programming mode.
3: This buffer is a Schmitt Trigger input when configured in RC oscillator mode and a CMOS input otherwise. 5. 2. 5 ANALOG-TO-DIGITAL CONVERTER (A/D) MODULE * The Analog-to-Digital (A/D) Converter module has five inputs for the 28-pin devices and eight for the other devices. The analog input charges a sample and hold capacitor. * The output of the sample and hold capacitor is the input into the converter. The converter then generates a digital result of this analog level via successive approximation.
The A/D conversion of the analog input signal results in a corresponding 10-bit digital number. * The A/D module has high and low voltage reference input that is software selectable to some combination of VDD, VSS, RA2 or RA3. * The A/D converter has a unique feature of being able to operate while the device is in SLEEP mode.
To operate in sleep, the A/D clock must be derived from the A/D’s * Internal RC oscillator. * The A/D module has four registers. These registers are: * A/D Result High Register (ADRESH) * A/D Result Low Register (ADRESL) * A/D Control Register0 (ADCON0) * A/D Control Register1 (ADCON1) * The ADCON0 register, shown in Register 11-1, controls the operation of the A/D module. The ADCON1 register, shown in Register 11-2, configures the functions * of the port pins.
The port pins can be configured as analog inputs (RA3 can also be the voltage reference) or as digital I/O. REGISTER 11-1: ADCON0 REGISTER (ADDRESS: 1Fh)R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 U-0 R/W-0 ADCS1| ADCS0| CHS2| CHS0| GO/DONE| -| ADON| Bit7bit0 R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’ – n = Value at POR reset bit 7-6: ADCS1:ADCS0: A/D Conversion Clock Select bits 00 = FOSC/2 01 = FOSC/8 10 = FOSC/32 11 = FRC (clock derived from an RC oscillation) bit 5-3: CHS2:CHS0: Analog Channel Select bits 000 = channel 0, (RA0/AN0) 001 = channel 1, (RA1/AN1) 010 = channel 2, (RA2/AN2) 011 = channel 3, (RA3/AN3) 100 = channel 4, (RA5/AN4) 101 = channel 5, (RE0/AN5)(1) 110 = channel 6, (RE1/AN6)(1) 11 = channel 7, (RE2/AN7)(1) bit 2: GO/DONE: A/D Conversion Status bit If ADON = 1 1 = A/D conversion in progress (setting this bit starts the A/D conversion) 0 = A/D conversion not in progress (This bit is automatically cleared by hardware when the A/D conversion is complete) bit 1: Unimplemented: Read as ‘0’ bit 0: ADON: A/D On bit 1 = A/D converter module is operating 0 = A/D converter module is shutoff and consumes no operating current 5. 2. 3 MEMORY ORGANIZATION There are three memory blocks in each of these PICmicro MCUs.
The Program Memory and Data Memory have separate buses so that concurrent access can occur and is detailed in this section. The EEPROM data memory block is detailed in Additional information on device memory may be found in the PICmicroa Mid-Range Reference Manual,(DS33023). 5. 2. 3. 1 Program Memory Organization The PIC16F87X devices have a 13-bit program counter capable of addressing an 8K x 14 program memory space. The PIC16F877/876 devices have 8K x 14 words of FLASH program memory and the PIC16F873/ 874 devices have 4K x 14. Accessing a location above the physically implemented address will cause a wraparound.
The reset vector is at 0000h and the interrupt vector is at 0004h. Fig 5. 7 PIC16F877A memory organisation 5. 2. 3. 2 Data Memory Organization The data memory is partitioned into multiple banks which contain the General Purpose Registers and the Special Function Registers.
Bits RP1(STATUS;lt;6;gt;) and RP0 (STATUS;lt;5;gt;) are the bank select bits. Each bank extends up to 7Fh (128 bytes). The lower locations of each bank are reserved for the Special Function Registers. Above the Special Function Registers are General Purpose Registers, implemented as static RAM. All implemented banks contain Special Function Registers.Some “high use” Special Function Registers from one bank may be mirrored in another bank for code reduction and quicker access. REGISTER 2-3: INTCON REGISTER (ADDRESS 0Bh, 8Bh, 10Bh, 18Bh) The INTCON Register is a readable and writable register, which contains various enable and flag bits for the TMR0 register overflow, RB Port change and External RB0/INT pin interrupts.
5. 2. 4 I/O PORTS Some pins for these I/O ports are multiplexed with an alternate function for the peripheral features on the device. In general, when a peripheral is enabled, that pin may not be used as a general purpose I/O pin.Additional information on I/O ports may be found in the PICmicro™ Mid-Range Reference Manual, (DS33023).
5. 2. 4. 1 PORTA and the TRISA Register PORTA is a 6-bit wide bi-directional port. The corresponding data direction register is TRISA.
Setting a TRISA bit (=1) will make the corresponding PORTA pin an input (i. e. , put the corresponding output driver in a hi-impedance mode).
Clearing a TRISA bit (=0) will make the corresponding PORTA pin an output (i. e. , put the contents of the output latch on the selected pin). Reading the PORTA register reads the status of the pins, whereas writing to it will write to the port latch.All write operations are read-modify-write operations. Therefore, a write to a port implies that the port pins are read, the value is modified and then written to the port data latch. Pin RA4 is multiplexed with the Timer0 module clock input to become the RA4/T0CKI pin.
The RA4/T0CKIN pin is a Schmitt Trigger input and an open drain output. All other PORTA pins have TTL input levels and full CMOS output drivers. Other PORTA pins are multiplexed with analog inputs and analog VREF input. The operation of each pin is selected by clearing/setting the control bits in the ADCON1 register (A/D Control Register1).REGISTER 3-1: TRISE REGISTER (ADDRESS 89h) R-0 R-0 R/W-0 R/W-0 U-0 R/W-1 R/W-1 R/W-1 IBF| OBF| IBOV| PSPMODE| —| Bit2| Bit1| Bit0| bit7 bit0 Parallel Slave Port Status/Control Bits IBF: Input Buffer Full Status bit 1 = A word has been received and is waiting to be read by the CPU 0 = No word has been received OBF: Output Buffer Full Status bit 1 = The output buffer still holds a previously written word = The output buffer has been read IBOV: Input Buffer Overflow Detect bit (in microprocessor mode) 1 = A write occurred when a previously input word has not been read (must be cleared in software) 0 = No overflow occurred PSPMODE: Parallel Slave Port Mode Select bit 1 = Parallel slave port mode 0 = General purpose I/O mode Unimplemented: Read as ’0’ PORTE Data Direction Bits Bit2: Direction Control bit for pin RE2/CS/AN7 1 = Input 0 = Output Bit1: Direction Control bit for pin RE1/WR/AN6 1 = Input 0 = Output Bit0: Direction Control bit for pin RE0/RD/AN5 1 = Input 0 = OutputR = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’ – n= Value at POR reset Fig 5. 8 Block diagram of the timer0/WDT prescalar Using Timer0 with an External Clock When no prescaler is used, the external clock input is the same as the prescaler output.
The synchronization of T0CKI with the internal phase clocks is accomplished by sampling the prescaler output on the Q2 and Q4 cycles of the internal phase clocks. Therefore, it is necessary for T0CKI to be high for at least 2Tosc (and a small RC delay of 20 ns) and low for at least 2Tosc (and a small RC delay of 20 ns).Refer to the electrical specification of the desired device. 5. 2. 4. 2 PORTB and the TRISB Register PORTB is an 8-bit wide, bi-directional port. The corresponding data direction register is TRISB.
Setting a TRISB bit (=1) will make the corresponding PORTB pin an input (i. e. , put the corresponding output driver in a hi-impedance mode). Clearing a TRISB bit (=0) will make the corresponding PORTB pin an output (i. e. , put the contents of the output latch on the selected pin). Three pins of PORTB are multiplexed with the Low Voltage Programming function; RB3/PGM, RB6/PGC and RB7/PGD.The alternate functions of these pins are described in the Special Features Section.
Each of the PORTB pins has a weak internal pull-up. A single control bit can turn on all the pull-ups. This is performed by clearing bit RBPU (OPTION_REG;lt;7;gt;).
The weak pull-up is automatically turned off when the port pin is configured as an output. The pull-ups are disabled on a Power-on Reset. FIGURE 3-3: BLOCK DIAGRAM OF RB3:RB0 PINS Four of PORTB’s pins, RB7:RB4, have an interrupt on change feature. Only pins configured as inputs can cause this interrupt to occur (i. e.
ny RB7:RB4 pin configured as an output is excluded from the interrupt on change comparison). The input pins (of RB7:RB4) are compared with the old value latched on the last read of PORTB. The “mismatch” outputs of RB7:RB4 are OR’ed together to generate the RB Port Change Interrupt with flag bit RBIF (INTCON;lt;0;gt;). This interrupt can wake the device from SLEEP.
The user, in the interrupt service routine, can clear the interrupt in the following manner: a) Any read or write of PORTB. This will end the mismatch condition. b) Clear flag bit RBIF. A mismatch condition will continue to set flag bit RBIF.Reading PORTB will end the mismatch condition and allow flag bit RBIF to be cleared. The interrupt on change feature is recommended for wake-up on key depression operation and operations where PORTB is only used for the interrupt on change feature. Polling of PORTB is not recommended while using the interrupt on change feature.
This interrupt on mismatch feature, together with software configurable pull-ups on these four pins, allow easy interface to a keypad and make it possible for wake-up on key-depression. Refer to the Embedded Control Handbook, “Implementing Wake-Up on Key Stroke” (AN552).RB0/INT is an external interrupt input pin and is configured using the INTEDG bit (OPTION_REG;lt;6;gt;). 5. 2. 4.
3 PORTC and the TRISC Register PORTC is an 8-bit wide, bi-directional port. The corresponding data direction register is TRISC. Setting a TRISC bit (=1) will make the corresponding PORTC pin an input (i. e. , put the corresponding output driver in hi-impedance mode). Clearing a TRISC bit (=0) will make the corresponding PORTC pin an output (i. e.
, put the contents of the output latch on the selected pin). PORTC is multiplexed with several peripheral functions (Table 3-5).PORTC pins have Schmitt Trigger input buffers. When the I2C module is enabled, the PORTC (3:4) pins can be configured with normal I2C levels or with SMBUS levels by using the CKE bit (SSPSTAT ;lt;6;gt;).
When enabling peripheral functions, care should be taken in defining TRIS bits for each PORTC pin. Some peripherals override the TRIS bit to make a pin an output, while other peripherals override the TRIS bit to make a pin an input. Since the TRIS bit override is in effect while the peripheral is enabled, read-modify write instructions (BSF, BCF, XORWF) with TRISC as destination should be avoided.The user should refer to the corresponding peripheral section for the correct TRIS bit settings. 5. 2. 4. 4 PORTD and TRISD Registers PORTD is an 8-bit port with Schmitt Trigger input buffers.
Each pin is individually configurable as an input or output. PORTD can be configured as an 8-bit wide microprocessor port (parallel slave port) by setting control bit PSPMODE (TRISE;lt;4;gt;). In this mode, the input buffers are TTL. 5. 2. 4.
5 PORTE and TRISE Register This section is not applicable to the PIC16F873 or PIC16F876. PORTE has three pins, RE0/RD/AN5, RE1/WR/AN6 and RE2/CS/AN7, which are individually configurable as inputs or outputs.These pins have Schmitt Trigger input buffers.
I/O PORTE becomes control inputs for the microprocessor port when bit PSPMODE (TRISE;lt;4;gt;) is set. In this mode, the user must make sure that the TRISE;lt;2:0;gt; bits are set (pins are configured as digital inputs). Ensure ADCON1 is configured for digital I/O. In this mode, the input buffers are TTL. Register 3-1 shows the TRISE register, which also controls the parallel slave port operation. PORTE pins are multiplexed with analog inputs. When selected as an analog input, these pins will read as ’0’s.
TRISE controls the direction of the RE pins, even when they are being used as analog inputs. The user must make sure to keep the pins configured as inputs when using them as analog inputs. 5. 2. 5 Prescaler There is only one prescaler available, which is mutually exclusively shared between the Timer0 module and the watchdog timer. A prescaler assignment for the Timer0 module means that there is no prescaler for the watchdog timer, and vice-versa.
This prescaler is not readable or writable (see Figure 5-1). The PSA and PS2:PS0 bits (OPTION_REG;lt;3:0;gt;) determine the prescaler assignment and prescale ratio.When assigned to the Timer0 module, all instructions writing to the TMR0 register (e.
g. CLRF 1, MOVWF 1, BSF 1,x…. etc.
) will clear the prescaler. When assigned to WDT, a CLRWDT instruction will clear the prescaler along with the Watchdog Timer. The prescaler is not readable or writable. 5. 3 HEART BEAT SENSOR Heart beat sensor is designed to give digital output of heat beat when a finger is placed on it. When the heart beat detector is working, the beat LED flashes in unison with each heart beat. This digital output can be connected to microcontroller directly to measure the Beats Per Minute (BPM) rate.It works on the principle of light modulation by blood flow through finger at each pulse.
5. 3. 1 Feature * Heat beat indication by LED * Instant output digital signal for directly connecting to microcontroller * Compact Size * Working Voltage +5V DC 5. 3. 2 Applications * Digital Heart Rate monitor * Patient Monitoring System * Bio-Feedback control of robotics and applications 5. 3.
3 Using the Sensor * Connect regulated DC power supply of 5 Volts. Black wire is Ground, Next middle wire is Brown which is output and Red wire is positive supply. These wires are also marked on PCB. To test sensor you only need power the sensor by connect two wires +5V and GND. You can leave the output wire as it is. When Beat LED is off the output is at 0V. * Put finger on the marked position, and you can view the beat LED blinking on each heart beat. * The output is active high for each beat and can be given directly to microcontroller for interfacing applications.
5. 3. 4 Internal block diagram for heart beat sensor Fig 5. 9 Internal block diagram for heart beat sensor 5. 3. 5 Working Heart beat is sensed by using a high intensity type LED and LDR.The finger is placed between the LED and LDR.
The LED needs to be super bright as the maximum light must pass spread in finger and detected by detector. As Sensor a photo diode or a photo transistor can be used. The skin may be illuminated with visible (red) using transmitted or reflected light for detection. The very small changes in reflectivity or in transmittance caused by the varying blood content of human tissue are almost invisible. Various noise sources may produce disturbance signals with amplitudes equal or even higher than the amplitude of the pulse signal.Valid pulse measurement therefore requires extensive preprocessing of the raw signal. Fig 5.
10 Heart beat sensor Now, when the heart pumps a pulse of blood through the blood vessels, the finger becomes slightly more opaque and so less light reached the detector. With each heart pulse the detector signal varies. This variation is converted to electrical pulse. This signal is amplified and triggered through an amplifier which outputs +5V logic level signal.
The output signal is also indicated by a LED which blinks on each heart beat. 5. 4 Temperature sensor LM35 Fig 5. 11 Temperature sensor LM35 5. 4. 1 DescriptionThe LM35 series are precision integrated-circuit temperature sensors, whose output voltage is linearly proportional to the Celsius (Centigrade) temperature.
The LM35 thus has an advantage over linear temperature sensors calibrated in ° Kelvin, as the user is not required to subtract a large constant voltage from its output to obtain convenient Centigrade scaling. The LM35 does not require any external calibration or trimming to provide typical accuracies of ±? °C at room temperature and ±? °C over a full -55 to +150°C temperature range. Low cost is assured by trimming and calibration at the wafer level.The LM35’s low output impedance, linear output, and precise inherent calibration make interfacing to readout or control circuitry especially easy. It can be used with single power supplies, or with plus and minus supplies. As it draws only 60 µA from its supply, it has very low self-heating, less than 0.
1°C in still air. The LM35 is rated to operate over a -55° to +150°C temperature range, while the LM35C is rated for a -40° to +110°C range (-10° with improved accuracy). The LM35 series is available packaged in hermetic TO-46 transistor packages, while the LM35C, LM35CA, and LM35D are also available in the plastic TO-92 transistor package.The LM35D is also available in an 8-lead surface mount small outline package and a plastic TO-220 package. 5.
4. 2 Internal block diagram for Temperature sensor LM35 Fig 5. 12 Internal block diagram for Temperature sensor LM35 5. 4.
3 Features * Operates from 4 to 30 volts * Calibrated directly in ° Celsius (Centigrade) * Less than 60 µA current drain * Linear + 10. 0 mV/°C scale factor * 5°C accuracy guarantee able (at +25°C ) * Rated for full -55°C to +150°C range * Suitable for remote applications * Low cost due to wafer-level trimming * Low self heating, 0. 08°C in still air * Non linearity only ±? C typical * Low impedance output, 0. 1 Ohm for 1 mA load The LM35 | 5. 4. 4 Applications The LM35 can be applied easily in the same way as other integrated-circuit temperature sensors. It can be glued or cemented to a surface and its temperature will be within about 0.
01°C of the surface temperature. This presumes that the ambient air temperature is almost the same as the surface temperature; if the air temperature were much higher or lower than the surface temperature, the actual temperature of the LM35 die would be at an intermediate temperature between the surface temperature and the air temperature.This is expecially true for the TO-92 plastic package, where the copper leads are the principal thermal path to carry heat into the device, so its temperature might be closer to the air temperature than to the surface temperature. To minimize this problem, be sure that the wiring to theLM35, as it leaves the device, is held at the same temperature as the surface of interest. The easiest way to do this is to cover up these wires with a bead of epoxy which will insure that the leads and wires are all at the same temperature as the surface, and that the LM35 die’s temperature will not be affected by the air temperature.The TO-46 metal package can also be soldered to a metal surface or pipe without damage. Of course, in that case the V? terminal of the circuit will be grounded to that metal.
Alternatively, the LM35 can be mounted inside a sealed-end metal tube, and can then be dipped into a bath or screwed into a threaded hole in a tank. As with any IC, the LM35 and accompanying wiring and circuits must be kept insulated and dry, to avoid leakage and corrosion. This is especially true if the circuit may operate at cold temperatures where condensation can occur.
Printed-circuit coatings and varnishes such as Humiseal and epoxy paints or dips are often used to insure that moisture cannot corrode the LM35 or its connections. These devices are sometimes soldered to a small light-weight heat fin, to decrease the thermal time constant and speed up the response in slowly-moving air. On the other hand, a small thermal mass may be added to the sensor, to give the steadiest reading despite small deviations in the air temperature. Fig 5.
13 Basic connection for temperature sensorFor calculation, the following equation has been used to get the number either in degree farenheit or celcius. AD value is 10 bit ADC result 5. 5 LCD A liquid crystal display (LCD) is a flat panel display, electronic visual display, or video display that uses the light modulating properties of liquid crystals (LCs). LCs do not emit light directly. LCDs are used in a wide range of applications, including computer monitors, television, instrument panels, aircraft cockpit displays,signage, etc.They are common in consumer devices such as video players, gaming devices, clocks, watches, calculators, andtelephones.
LCDs 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 cannot suffer image burn-in. LCDs are, however, susceptible to image persistence. Fig 5. 14 2 X 16 LCD LCDs are more energy efficient and offer safer disposal than CRTs. 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 produce images in color or monochrome. The most flexible ones use an array of small pixels. Each pixel of an LCD typically consists of a layer of molecules aligned between two transparent electrodes, and two polarizing filters, the axes of transmission of which are perpendicular to each other. With no actual liquid crystal between the polarizing filters, light passing through the first filter would be blocked by the second polarizer.The surfaces of the electrodes that are in contact with the liquid crystal material are treated so as to align the liquid crystal molecules in a particular direction.
This treatment typically consists of a thin polymer layer that is unidirectional rubbed using, for example, a cloth. The direction of the liquid crystal alignment is then defined by the direction of rubbing. Electrodes are made of a transparent conductor called Indium Tin Oxide (ITO). The Liquid Crystal Display is intrinsically a “passive” device; it is a simple light valve.The managing and control of the data to be displayed is performed by one or more circuits commonly denoted as LCD drivers.
Before applying an electric field, the orientation of the liquid crystal molecules is determined by the alignment at the surfaces of electrodes. In a twisted pneumatic, the surface alignment directions at the two electrodes are perpendicular to each other, and so the molecules arrange themselves in a helical structure, or twist. This induces the rotation of the polarization of the incident light, and the device appears grey.If the applied voltage is large enough, the liquid crystal molecules in the center of the layer are almost completely untwisted and the polarization of the incident light is not rotated as it passes through the liquid crystal layer. This light will then be mainly polarized perpendicular to the second filter, and thus be blocked and the pixel will appear black. By controlling the voltage applied across the liquid crystal layer in each pixel, light can be allowed to pass through in varying amounts thus constituting different levels of gray.Color performance: There are many terms to describe color performance of an LCD. They include color gamut which is the range of colors that can be displayed and color depth which is the color resolution or the resolution or fineness with which the color range is divided.
Although color gamut can be expressed as three pairs of numbers, the XY coordinates within color space of the reddest red, greenest green, and bluest blue, it is usually expressed as a ratio of the total area within color space that a display can show relative to some standard such as saying that a display was “120% of NTSC”.NTSC is the National Television Standards Committee, the old standard definition TV specification. Color gamut is a relatively straight forward feature. However with clever optical techniques that are based on the way humans see color, termed color stretch, colors can be shown that are outside of the nominal range of the display. In any case, color range is rarely discussed as a feature of the display as LCDs are designed to match the color ranges of the content that they are intended to show.Having a color range that exceeds the content is a useless feature. Color depth or color support is sometimes expressed in bits, either as the number of bits per sub-pixel or the number of bits per pixel. This can be ambiguous as an 8-bit color LCD can be 8 total bits spread between red, green, and blue or 8 bits each for each color in a different display. Further, LCDs sometimes use a technique called dithering which is time averaging colors to get intermediate colors such as alternating between two different colors to get a color in between.This doubles the number of colors that can be displayed; however this is done at the expense of the temporal performance of the display. Dithering is commonly used on computer displays where the images are mostly static and the temporal performance is unimportant. When color depth is reported as color support, it is usually stated in terms of number of colors the LCD can show. The number of colors is the translation from the base 2-bit numbers into common base-10. For example, 8-bit, in common terms means 2 to the 8th power or 256 colors. 8-bits per color or 24-bits would be 56 x 256 x 256 or over 16 Million colors. The color resolution of the human eye depends on both the range of colors being sliced and the number of slices; but for most common displays the limit is about 28-bit color. LCD TVs commonly display more than that as the digital processing can introduce color distortions and the additional levels of color are needed to ensure true colors The LCD we use for our project is 2*16 display. 5. 5. 1 LCD-MODULE 2×16 5. 5. 1. 1 Overview LCD 2×16 A Module provides versatile display functions.Through its simple connections, it can be controlled by Innovati’s BASIC Commander for a wide range of LCD applications. In this module, two display lines, each with 16 characters on each line can be displayed. By using the cursor control command, the position of the character to be displayed on the screen can be arbitrarily changed. In this module, the backlight function can be used to change the backlight to allow the message to be read easily. In addition, it can be con? gured to display user de? ned characters to display any specially required characters.Please use “LCD2x16A” as the module object name in program. 5. 5. 1. 2 Features * High contrast LCD supertwist display. * EA dip162-dnled: yellow/green with led backlight. * EA dip162-dn3lw and dip162j-dn3lw with white led b/l. , low power. * Incl. HD 44780 or compatible controller. * Interface for 4- and 8-bit data bus. * Power supply +5v or ±2. 7v or ±3. 3v. * Operating temperature 0~+50°c (-dn3lw, -dhnled: -20~+70°c). * Led backlight y/g max. [email protected]+25°c. * Led backlight white max. [email protected]+25°c. * Some more modules with same mechanic and same pinout: Dot-matrix 1×8, 4×20 – Graphic 122×32 * No screws required: solder on in PCB only. * Detachable via 9-pin socket ea b200-9 (2 pcs. required). 5. 5. 2 Application • Together with an RTC Module, it can be used to display a real time clock or a simple electronic clock. • It can be used to display the operating status at any time for various applications. • It can display status or error messages directly on the screen without using the PC. • With the user- de? ned characters, special patterns can be created to produce creative messages. 5. RF TRANSMITTER AND RECEIVER 5. 6. 1 RF Transmitter The RF module, as the name suggests, operates at Radio Frequency. The corresponding frequency range varies between 30 kHz & 300 GHz. In this RF system, the digital data is represented as variations in the amplitude of carrier wave. This kind of modulation is known as Amplitude Shift Keying (ASK). Transmission through RF is better than IR (infrared) because of many reasons. Firstly, signals through RF can travel through larger distances making it suitable for long range applications.Also, while IR mostly operates in line-of-sight mode, RF signals can travel even when there is an obstruction between transmitter & receiver. Next, RF transmission is more strong and reliable than IR transmission. RF communication uses a specific frequency unlike IR signals which are affected by other IR emitting sources. This RF module comprises of an RF Transmitter and an RF Receiver. The transmitter/receiver (Tx/Rx) pair operates at a frequency of 434 MHz. An RF transmitter receives serial data and transmits it wirelessly through RF through its antenna connected at pin4.The transmission occurs at the rate of 1Kbps – 10Kbps. The transmitted data is received by an RF receiver operating at the same frequency as that of the transmitter. The RF module is often used alongwith a pair of encoder/decoder. The encoder is used for encoding parallel data for transmission feed while reception is decoded by a decoder. HT12E-HT12D, HT640-HT648, etc. are some commonly used encoder/decoder pair ICs. 5. 6. 1. 1 Pin Diagram Fig 5. 15 Pin Diagram of RF Transmitter 5. 6. 1. 2 Pin Description of RF Transmitter Pin No| Function| Name| 1| Ground (0V)| Ground| 2| Serial data input pin| Data| | Supply voltage; 5V| Vcc| 4| Antenna output pin| ANT| 5. 6. 2 RF Receiver Radio receiver design includes the electronic design of different components of a radio receiver which processes the radio frequency signal from an antenna in order to produce usable information such as audio. This article only concentrates on the historical configurations leading up to and including the modern superheterodyne receiver design. The complexity of a modern receiver and the possible range of circuitry and methods employed are more generally covered in electronics and communications engineering.The term radio receiver is understood in this article to mean any device which is intended to receive a radio signal in order to generate useful information from the signal, most notably a recreation of the so-called baseband signal (such as audio) which modulated the radio signal at the time of transmission in a communications or broadcast system. 5. 6. 2. 1 Pin diagram Fig 5. 16 Pin diagram of RF Receiver 5. 6. 2. 2 RF Receiver – Pin description Pin No| Function| Name| 1| Ground (0V)| Ground| 2| Serial data output pin| Data| 3| Linear output pin; not connected| NC| | Supply voltage; 5V| Vcc| 5| Supply voltage; 5V| Vcc| 6| Ground (0V)| Ground| 7| Ground (0V)| Ground| 8| Antenna input pin| ANT| 5. 6. 3 RF transmitters and receivers working An RF transmitter generates radio frequency waves in its circuits, and to this ‘carrier signal’, it adds the information part by modulating the carrier signal. This composite signal (carrier plus information) is then fed to an antenna (aerial). The aerial induces a corresponding signal into the atmosphere, by altering the Electric and Magnetic fields at (obviously) the same frequency.The impedance of ‘free space’ is few tens of Ohms to a few hundreds of Ohms. [Impedance may be considered analogous to resistance, but with reactive properties as well. ] The power emitted by the transmitter can vary from a megawatt or so (for VLF signals) to a few watts for handheld devices. An RF receiver receives the signal from the atmosphere, from its own aerial. The receiver aerial is often quite simple, and the signal level is typically of a few micro volts. This it tunes in (gets rid of unwanted signals and amplifies only the wanted ones).The receiver circuits then strip the information part of the signal from the carrier part, and amplify this to a useful level for audio or video. The actual signal into the loudspeaker will be a few tens of volts. In spite of the inefficiency of loudspeakers, (often only a few %) the signal eventually appears at a level that may be heard. A background radio will be a few milliwatts of power. Even a very loud sound is only a few watts of radiated (sound) energy!! Radio transmitter design is a complex topic which can be broken down into a series of smaller topics.A radio communication system requires two tuned circuits each at the transmitter and receiver, all four tuned to the same frequency. The transmitter is an electronic device which, usually with the aid of an antenna, propagates an electromagnetic signal such as radio, television, or other telecommunications. * The transmitting system consists of two tuned circuits such that the one containing the spark-gap is a persistent oscillator; the other, containing the aerial structure, is a free radiator maintained in oscillation by being coupled to the first (Nikola Tesla and Guglielmo Marconi). * The oscillating system, including the erial structure with its associated inductance-coils and condensers, is designed to be both a sufficiently persistent oscillator and a sufficiently active radiator (Oliver Lodge). * The transmitting system consists of two electrically coupled circuits, one of which, containing the air-gap, is a powerful but not persistent oscillator, being provided with a device for quenching the spark so soon as it has imparted sufficient energy to the other circuit containing the aerial structure, this second circuit then independently radiating the train of slightly damped waves at its own period (Oliver Joseph Lodge and Wilhelm Wien). The transmitting system, by means either of an oscillating arc (Valdemar Poulsen) or a high-frequency alternator (Rudolf Goldschmidt), emits a persistent train of undammed waves interrupted only by being broken up into long and short groups by the operator’s key. 5. 6. 4 Frequency synthesis 5. 6. 4. 1 Fixed frequency systems For a fixed frequency transmitter one commonly used method is to use a resonant quartz crystal in a Crystal oscillator to fix the frequency. Where the frequency has to be variable, several options can be used. 5. 6. 4. 2 Variable frequency systems An array of crystals – used to enable a transmitter to be used on several different frequencies; rather than being a truly variable frequency system, it is a system which is fixed to several different frequencies (a subset of the above). * Variable-frequency oscillator (VFO) * Phase-locked loop frequency synthesizer 5. 6. 5 Frequency multiplication 5. 6. 5. 1 Frequency doubler Fig 5. 17 Frequency doubler 5. 6. 5. 2 Frequency tripler Fig 5. 18 Frequency tripler 5. 6. 6 Direct digital synthesis For VHF transmitters, it is often not possible to operate the oscillator at the final output frequency.In such cases, for reasons including frequency stability, it is better to multiply the frequency of the free running oscillator up to the final, required frequency. If the output of an amplifier stage is tuned to a multiple of the frequency with which the stage is driven, the stage will give a larger harmonic output than a linear amplifier. In a push-push stage, the output will only contain even harmonics. This is because the currents which would generate the fundamental and the odd harmonics in this circuit (if one valve was removed) are canceled by the second valve.In the diagrams, bias supplies and neutralization measure have been omitted for clarity. In a real system, it is likely that tetrodes would be used, as plate-to-grid capacitance in a tetrode is lower, thereby reducing stage instability. In a push-pull stage, the output will contain only odd harmonics because of the canceling effect. 5. 6. 7 Frequency mixing and modulation The task of many transmitters is to transmit some form of information using a radio signal (carrier wave) which has been modulated to carry the intelligence.A few rare types of transmitter do not carry information: the RF generator in amicrowave oven, electrosurgery, and induction heating. RF transmitters that do not carry information are required by law to operate in an ISM band. 5. 6. 8 AM modes In many cases the carrier wave is mixed with another electrical signal to impose informa tion upon it. This occurs in Amplitude modulation (AM). Amplitude Modulation: In Amplitude modulation the instantaneous change in the amplitude of the carrier Frequency with respect to the amplitude of the modulating or Base band signal. . 6. 8. 1 Low level Here a small audio stage is used to modulate a low power stage, the output of this stage is then amplified using a linear RF amplifier 5. 6. 8. 2 Advantages The advantage of using a linear RF amplifier is that the smaller early stages can be modulated, which only requires a small audio amplifier to drive the modulator. 5. 6. 8. 3 Disadvantages The great disadvantage of this system is that the amplifier chain is less efficient, because it has to be linear to preserve the modulation. Hence class C amplifiers cannot be employed.An approach which marries the advantages of low-level modulation with the efficiency of a Class C power amplifier chain is to arrange a feedback system to compensate for the substantial distortion of the AM envelope. A simple detector at the transmitter output (which can be little more than a loosely coupled diode) recovers the audio signal, and this is used as negative feedback to the audio modulator stage. The overall chain then acts as a linear amplifier as far as the actual modulation is concerned, though the RF amplifier itself still retains the Class C efficiency.This approach is widely used in practical medium power transmitters, such as AM radiotelephones. 5. 6. 8. 4 High level 5. 6. 8. 5 Advantages One advantage of using class C amplifiers in a broadcast AM transmitter is that only the final stage needs to be modulated, and that all the earlier stages can be driven at a constant level. These class C stages will be able to generate the drive for the final stage for a smaller DC power input. However, in many designs in order to obtain better quality AM the penultimate RF stages will need to be subject to modulation as well as the final stage. 5. . 8. 6 Disadvantages A large audio amplifier will be needed for the modulation stage, at least equal to the power of the transmitter output itself. Traditionally the modulation is applied using an audio transformer, and this can be bulky. Direct coupling from the audio amplifier is also possible (known as a cascode arrangement), though this usually requires quite a high DC supply voltage (say 30 V or more), which is not suitable for mobile units. 5. 6. 9 FM modes Angle modulation is the proper term for modulation by changing the instantaneous frequency or phase of the carrier signal.True FM and phase modulation are the most commonly employed forms of analogue angle modulation. 5. 6. 9. 1 Direct FM Direct FM (true Frequency modulation) is where the frequency of an oscillator is altered to impose the modulation upon the carrier wave. This can be done by using a voltage-controlled capacitor (Varicap diode) in a crystal-controlled oscillator or frequency synthesiser. The frequency of the oscillator is then multiplied up using a frequency multiplier stage, or is translated upwards using a mixing stage, to the output frequency of the transmitter. . 6. 9. 2 Indirect FM Indirect FM employs a varicap diode to impose a phase shift (which is voltage-controlled) in a tuned circuit that is fed with a plain carrier. This is termed phase modulation. The modulated signal from a phase-modulated stage can be understood with an FM receiver, but for good audio quality, the audio is applied to the phase modulation stage. The amount of modulation is referred to as the deviation, being the amount that the frequency of the carrier instantaneously deviates from the centre carrier frequency.In some indirect FM solid state circuits, an RF drive is applied to the base of a transistor. The tank circuit (LC), connected to the collector via a capacitor, contains a pair of varicap diodes. As the voltage applied to the varicaps is changed, the phase shift of the output will change. Phase modulation is mathematically equivalent to direct Frequency modulation with a 6dB/octave high-pass filter applied to the modulating signal. This high-pass effect can be exploited or compensated for using suitable frequency-shaping circuitry in the audio stages ahead of the modulator.Fig 5. 19 Indirect FM solid state circuit For example, many FM systems will employ pre-emphasis and de-emphasis for noise reduction, in which case the high-pass equivalency of phase modulation automatically provides for the pre-emphasis. Phase modulators are typically only capable of relatively small amounts of deviation while remaining linear, but any frequency multiplier stages also multiply the deviation in proportion. 5. 6. 10 Linking the transmitter to aerialThe majority of modern transmitting equipment is designed to operate with a resistive load fed via coaxial cable of a particular characteristic impedance, often 50 ohms. To connect the aerial to this coaxial cable transmission line a matching network and/or a balun may be required. Commonly an SWR meter and/or an antenna analyzer are used to check the extent of the match between the aerial system and the transmitter via the transmission line (feeder). An SWR meter indicates forward power, reflected power, and the ratio between them. 5. 6. 11 RF leakage (defective RF shielding)All equipment using RF electronics should be inside a screened metal box, all connections in or out of the metal box should be filtered to avoid the ingress or egress of radio signals. A common and effective method of doing so for wires carrying DC supplies, 50/60 Hz AC connections, audio and control signals is to use a feedthrough capacitor. This is a capacitor which is mounted in a hole in the shield, one terminal of the capacitor is its metal body which touches the shielding of the box while the other two terminal of the capacitor are the on either side of the shield.The feed through capacitor can be thought of as a metal rod which has a dielectric sheath which in turn has a metal coating. In addition to the feed through capacitor, either a resistor or RF choke can be used to increase the filtering on the lead. In transmitters it is vital to prevent RF from entering the transmitter through any lead such as an electric power, microphone or control connection. If RF does enter a transmitter in this way then an instability known as Motorboating (electronics) can occur. Motorboating is an example of a self inflicted EMC problem.If a transmitter is suspected of being responsible for a television interference problem, then it should be run into a dummy load; this is a resistor in a screened box or can which will allow the transmitter to generate radio signals without sending them to the antenna. If the transmitter does not cause interference during this test, then it is safe to assume that a signal has to be radiated from the antennato cause a problem. If the transmitter does cause interference during this test then a path exists by which RF power is leaking out of the equipment, this can be due to bad shielding.This is a rare but insidious problem and it is vital that it be tested for. Such leakage is most likely to occur on homemade equipment or equipment that has been modified. RF leakage from microwave ovens may also sometimes be observed, especially when the oven’s RF seal has been compromised. 5. 6. 12 Spurious emissions * Early in the development of radio technology it was recognised that the signals emitted by transmitters had to be ‘pure’. For instance Spark-gap transmitters were quickly outlawed as they give an output which is so wide in terms of frequency.In modern equipment there are three main types of spurious emissions. * The term spurious emissions refers to any signal which comes out of a transmitter other than the wanted signal. The spurious emissions include harmonics, out of band mixer products which are not fully suppressed and leakage from the local oscillator and other systems within the transmitter. 5. 6. 13 Harmonics These are multiples of the operation frequency of the transmitter, they can be generated in a stage of the transmitter even if it is driven with a perfect sine wave because no real life amplifier is perfectly linear. . 6. 13. 1 Avoiding Harmonics It is best if these harmonics are designed out at an early stage. For instance a push-pull amplifier consisting of twotetrode valves attached to an anode tank resonant LC circuit which has a coil which is connected to the high voltage DC supply at the centre (Which is also RF ground) will only give a signal for the fundamental and the odd harmonics. 5. 7 ZIGBEE 5. 7. 1 Forming a ZigBee Network The Co-ordinator is responsible for starting a ZigBee network. Network initialization involves the following steps: 5. 7. 1. 1 Search for a Radio ChannelThe Co-ordinator first searches for a suitable radio channel (usually the one which has least activity). This search can be limited to those channels that are known to be usable – for example, by avoiding frequencies in which it is known that a wireless LAN is operating. 5. 7. 1. 2 Assign PAN ID The Co-ordinator starts the network, assigning a PAN ID (Personal Area Network identifier) to the network. The PAN ID can be pre-determined, or can be obtained dynamically by detecting other networks operating in the same frequency channel and choosing a PAN ID that does not conflict with theirs.At this stage, the Co-ordinator also assigns a network (short) address to itself. Usually, this is the address 0x0000. 5. 7. 1. 3 Start the Network The Co-ordinator then finishes configuring itself and starts itself in Co-ordinator mode. It is then ready to respond to queries from other devices that wish to join the network. 5. 7. 2 Joining a ZigBee Network Once the network has been created by the Co-ordinator, other devices (Routers and End Devices) can join the network. Both Routers and the Co-ordinator have the capability to allow other nodes to join the network. The join process is as follows: 5. . 2. 1 Search for Network The new node first scans the available channels to find operating networks and identifies which one it should join. Multiple networks may operate in the same channel and are differentiated by their PAN IDs. 5. 7. 2. 2 Select Parent The node may be able to ‘see’ multiple Routers and a Co-ordinator from the same network, in which case it selects which one it should connect to. Usually, this is the one with the best signal. 5. 7. 2. 3 Send Join Request The node then sends a message to the relevant Router or Co-ordinator asking to join the network. 5. 7. 2. Accept of Reject Join Request The Router or Co-ordinator decides whether the node is a permitted device, whether the Router/Co-ordinator is currently allowing devices to join and whether it has address space available. If all these criteria are satisfied, the Router/Co-ordinator will then allow the device to join and allocate it an address. 5. 7. 3 Message Propagation The way that a message propagates through a ZigBee network depends on the network topology. However, in all topologies, the message usually needs to pass through one or more intermediate nodes before reaching its final destination.The message therefore contains two destination addresses: * Address of the final destination * Address of the node which is the next “hop” The way these addresses are used in message propagation depends on the network topology, as follows: 5. 7. 3. 1 Star Topology All messages are routed via the Co-ordinator. Both addresses are needed and the “next hop” address is that of the Co-ordinator. 5. 7. 3. 2 Tree Topology A message is routed up the tree until it reaches a node that can route it back down the tree to the destination node. Both addresses are needed and the initial “next hop” address is that of the parent of the sending node.The parent node then resends the message to the next relevant node – if this is the target node itself, the “final destination” address is used. The last step is then repeated and message propagation continues in this way until the target node is reached. 5. 7. 3. 3 Mesh Topology In this case, the propagation path depends on whether the target node is in range, * If the target node is in range, only the “final destination” address is used. * If the target node is not in range, the initial “next hop” address is that of the first node in the route to the final destination.The message propagation continues in this way until the target node is reached. 5. 7. 4 Route Discovery The ZigBee stack network layer supports a “route discovery” facility in which a mesh network can be requested to find the best available route to the destination, when sending a message. Route discovery is initiated when requested by a data transmission request. 5. 7. 4. 1 Route Discovery Options There are three options related to route discovery for a mesh network (the required option being indicated in the message): 5. 7. 4. 1. 1 SUPPRESS route discovery The message is routed along the tree. 5. 7. 4. 1. 2 ENABLE route discoveryThe message is routed along an already discovered mesh route, if one exists; otherwise the Router initiates a route discovery. Once this is complete, the message will be sent along the calculated route. If the Router does not have the capacity to store the new route, it will direct the message along the tree. 5. 7. 4. 1. 3 FORCE route discovery If the Router has the route capacity, it will initiate a route discovery, even if a known route already exists. Once this is complete, the message will be sent along the calculated route. If the Router does not have the route capacity, it will route the message along the tree.Use of this option should be restricted, as it generates a lot of network traffic. 5. 7. 4. 2 Route Discovery Mechanism The mechanism for route discovery between two End Devices involves the following steps: * A route discovery broadcast is sent by the parent Router of the source End Device. This broadcast contains the network address of the destination End Device. * All Routers eventually receive the broadcast, one of which is the parent of the destination End Device. * The parent Router of the destination node sends back a reply addressed to the parent Router of the source. As the reply travels back through the network, the hop count and a signal quality measure for each hop are recorded. Each Router in the path can build a routing table entry containing the best path to the destination End Device. * Eventually, each Router in the path will have a routing table entry and the route from source to destination End Device is established. Note that the corresponding route from destination to source is not known – the route discovered is unidirectional. * The MAC (IEEE) address of the node with a given network address * The network address of the node with a given MAC address 5. . 5 Device and Service Discovery The ZigBee specification provides the facility for devices to find out information about other nodes in a network, such as their addresses, which types of applications are running on them, their power source and sleep behavior. This information is stored in descriptors on each node, and is used by the enquiring node to tailor its behavior to the requirements of the network. Discovery is typically used when a node is being introduced into a user-configured network, such as a domestic security or lighting control system.Once the device has joined the network, its integration into the network may require the user to start the integration process by pressing a button or similar. The first task is to find out if there are any other devices that it can talk to. For example, a device implementing the switch conforming to the HCL profile tries to find devices containing HCL load controllers to which it could potentially send its switch state information (the process of associating the switch with a particular load controller is handled by the binding process, presented earlier in this course).There are two types of discovery, Device and Service Discovery 5. 7. 5. 1 Device Discovery Device Discovery involves interrogating a remote node for address information. The retrieved information can be either: * The MAC (IEEE) address of the node with a given network address * The network address of the node with a given MAC address. If the node being interrogated is a Router or Co-ordinator, it may optionally supply the addresses of all the devices that are associated with it, as well as its own address.In this way, it is possible to discover all the devices in a network by requesting this information from the Co-ordinator and then using the list of addresses corresponding to the children of the Co-ordinator to launch queries about their child nodes. 5. 7. 5. 2 Service Discovery Service discovery involves interrogating a remote node for information about its capabilities. This information is stored in a number of descriptors on the remote node, and includes: The device type and capabilities of the node (Node Descriptor) * The power characteristics of the node (Node Power Descriptor) * Information about each application running on the node (Simple Descriptor) Requests for these descriptors are made by a device during its configuration and integration into a ZigBee network. 5. 8 SWITCH In electronics, a switch is an electrical component that can break an electrical circuit, interrupting the current or diverting it from one conductor to another. Fig 5. 20 Electronic switchThe most familiar form of switch is a manually operated electromechanical device with one or more sets of electrical contacts, which are connected to external circuits. Each set of contacts can be in one of two states: either “closed” meaning the contacts are touching and electricity can flow between them, or “open”, meaning the contacts are separated and the switch is nonconducting. The mechanism actuating the transition between these two states (open or closed) can be either a “toggle” (flip switch for continuous “on” or “off”) or “momentary” (push-for “on” or push-for “off”) type.A switch may be directly manipulated by a human as a control signal to a system, such as a computer keyboard button, or to control power flow in a circuit, such as a light switch. Automatically operated switches can be used to control the motions of machines, for example, to indicate that a garage door has reached its full open position or that a machine tool is in a position to accept another workpiece. Switches may be operated by process variables such as pressure, temperature, flow, current, voltage, and force, acting as sensors in a process and used to automatically control a system.For example, a thermostat is a temperature-operated switch used to control a heating process. A switch that is operated by another electrical circuit is called a relay. Large switches may be remotely operated by a motor drive mechanism. Some switches are used to isolate electric power from a system, providing a visible point of isolation that can be pad-locked if necessary to prevent accidental operation of a machine during maintenance, or to prevent electric shock. In electronics engineering, an ideal switch describes a switch that: * has no current limit during its ON state has infinite resistance during its OFF state * has no voltage drop across the switch during its ON state * has no voltage limit during its OFF state * has zero rise time and fall time during state changes * switches without “bouncing” between on and off positions Practical switches fall short of this ideal, and have resistance, limits on the current and voltage they can handle, finite switching time, etc. The ideal switch is often used in circuit analysis as it greatly simplifies the system of equations to be solved, however this can lead to a less accurate solution.Electronics specification and abbreviation| Expansion of abbreviation| British mains wiring name| American electrical wiring name| Description| Symbol| SPST| Single pole, single throw| One-way| Two-way| A simple on-off switch: The two terminals are either connected together or disconnected from each other. Example: light switch. | | SPDT| Single pole, double throw| Two-way| Three-way| A simple changeover switch: C (COM, Common) is connected to L1 or to L2. | | SPCO SPTT, c. o. | Single pole changeover or Single pole, centre off orSingle Pole, Triple Throw| | | Similar to SPDT. Some suppliers use SPCO/SPTT for switches with a stable off position in the centre and SPDT | | DPST| Double pole, single throw| Double pole| Double pole| Equivalent to two SPST switches controlled by a single mechanism| | DPDT| Double pole, double throw| | | Equivalent to two SPDT switches controlled by a single mechanism. | | DPCO| Double pole changeover or Double pole, centre off| | | Equivalent to DPDT. Some suppliers use DPCO for switches with a stable off position in the centre and DPDT for those without. | | | Intermediate switch| Four-way switch| DPDT switch internally wired for polarity-reversal applications: only four rather than six wires are brought outside the switch housing. | | Switches with larger numbers of poles or throws can be described by replacing the “S” or “D” with a number (e. g. 3PST, 4PST, etc. ) or in some cases the letter “T” (for “triple”). In the rest of this article the terms SPST, SPDT and intermediate will be used to avoid the ambiguity. 5. 8. 1 Light switches In building wiring, light switches are installed at convenient locations to control lighting and occasionally other circuits.By use of multiple-pole switches, control of a lamp can be obtained from two or more places, such as the ends of a corridor or stairwell. 5. 8. 2 Tactile switch A tact switch is type of switch that is only on when the button is pressed. As soon as you release the button, the circuit is broken. Think of the keys on a keyboard. Electronics parts can be a pain to choose. It’s often hard to tell from manufacturers’ datasheets if a part will fit your design. We auditioned six different tactile switches to find a cheap button to use in upcoming projects.A tactile switch, also called a momentary button or push-to-make switch, is commonly used for input and microcontroller resets. This type of button creates a temporary electrical connection when pressed. 5. 9 VOICE PROCESSOR(APR 9600)| | | The APR9600 device offers true single-chip voice recording, non-volatile storage, and playback capability for 40 to 60 seconds. The device supports both random and sequential access of multiple messages. Sample rates are user-selectable, allowing designers to customize their design for unique quality and storage time needs.Integrated output amplifier,microphone amplifier, and AGC circuits greatly simplify system design. the device is ideal for use in portable voice recorders, toys, and many other consumer and industrial applications. | Fig 5. 21 Voice processor APR 9600 APR9600 is a low-cost high performance sound record/replay IC incorporating flash analogue storage technique. Recorded sound is retained even after power supply is removed from the module. The replayed sound exhibits high quality with a low noise level. Sampling rate for a 60 second recording period is 4. kHz that gives a sound record/replay bandwidth of 20Hz to 2. 1 kHz. However, by changing an oscillation resistor, a sampling rate as high as 8. 0 kHz can be achieved. This shortens the total length of sound recording to 32 seconds. Total sound recording time can be varied from 32 seconds to 60 seconds by changing the value of a single resistor. The IC can operate in one of two modes: serial mode and parallel mode. In serial access mode, sound can be recorded in 256 sections. In parallel access mode, sound can be recorded in 2, 4 or 8 sections. The IC can be controlled simply using push button keys.It is also possible to control the IC using external digital circuitry such as micro-controllers and computers. The APR9600 has a 28 pin DIP package. Supply voltage is between 4. 5V to 6. 5V. During recording and replaying, current consumption is 25 mA. In idle mode, the current drops to 1 A. The APR9600 experimental board is an assembled PCB board consisting of an APR9600 IC, an electrets microphone, support components and necessary switches to allow users to explore all functions of the APR9600 chip. The oscillation resistor is chosen so that the total recording period is 60 seconds with a sampling rate of 4. kHz. The board measures 80mm by 55mm. 5. 9. 1 Features • Single-chip, high-quality voice recording & playback solution – No external ICs required – Minimum external components • Non-volatile Flash memory technology – No battery backup required • User-Selectable messaging options – Random access of multiple fixed-duration messages – Sequential access of multiple variable-duration messages • User-friendly, easy-to-use operation – Programming & development systems not required – Level-activated recording & edge-activated play back switches • Low