Вы находитесь на странице: 1из 14

REMOTE CONTROLLED DIGITAL AUDIO PROCESSOR By Parth Dave on Tuesday, March 16, 2010 8:25 PM , in REMOTE CONTROLLED DIGITAL

AUDIO PROCESSOR , 0 Comments 1 INTRODUCTION These days most audio systems come with remote controllers. However, no such fac ility is provided for normal audio amplifiers. Such audio controllers are not av ailable even in kit form. This article presents an infrared (IR) remote-controll ed digital audio processor. It is based on a microcontroller and can be used wit h any NEC-compatible fullfunction IR remote control. This audio processor has en hanced features and can be easily customised to meet individual requirements as it is programmable. Its main features are: 1. Full remote control using any NECcompatible IR remote control handset. 2. Provision for four stereo input channel s and one stereo output. 3. Individual gain control for each input channel to ha ndle different sources 4. Bass, midrange, treble, mute and attenuation control 5 . 80-step control for volume and 15-step control for bass, midrange and treble 6 . Settings displayed on two 7-segment light-emitting diode (LED) displays and ei ght individual LEDs 7. Stereo VU level indication on 10-LED bar display 8. Fullfunction keys on-board for audio amplifier control 9. All settings stored on the EEPROM 10. Standby mode for amplifier power control Circuit description BLODK DIAGRAM FOR REMOTE CONTROLLED DIGITAL AUDIO PROCESSOR CIRCUIT DIAGRAM FOR REMOTE CONTROLLED DIGITAL AUDIO PROCESSOR

CIRCUIT DESCRIPTION OF REMOTE-CONTROLLED DIGITAL AUDIO PROCESSOR Fig. 1 shows the block diagram of the remote-controlled digital audio processor. The system comprises Atmels AT89C51 microcontroller (IC1), TDA7439 audio processor from SGSThomson (IC4) and I2C bus compatible MC24C02 EEP ROM (IC5). The microcontroller chip is programmed to control all the digital pro cesses of the system. The audio processor controls all the audio amplifier functions and is co mpatible with I2C bus. All the commands from the remote control are received thr ough the IR sensor. The audio amplifier can also be controlled using the on-board keys. Microcontroller the function of the microcontroller is to receive commands (through port P3.2) f rom the remote handset, program audio controls as per the commands and update th e EEPROM. A delay in updating the EEPROM is de-liberately provided because norma lly the listener will change the value of a parameter continuously until he is satisfied. The 40-pin AT89C51 microcontroller has four 8-bit input/output (I/O) ports. Port 0 is used for indicating through L EDs the various functions selected via the remote/on-board keys. Port 1 drives t he 7-segment display using 7-segment latch/decoder/driver IC CD4543. Port 2 is p ulled up via resistor network RNW1 and used for manual key control. Pins P3.0 an d P3.1 of the microcontroller are used as serial data (SDA) and serial clock (SC L) lines for the I2C bus for communicating with the audio processor (TDA7439) an d EEPROM (MC24C02). These two lines are connected to pull-up resistors, which ar e required for I2C bus devices. P3.2 receives the remote commands through the IR receiver module. Pin P3.4 is used for flashing LED9 whenever a remote command i s received or any key is pressed. The microcontroller also checks the functionin g of the memory (MC24C02) and the audio processor (TDA7439). If it is not commun icating with these two ICs on the I2C bus, it flashes the volume level on the 7segment displays. Memory. IC MC24C02 is an I2C-bus compatible 2k-bit EEPROM orga nised as 2568-bit that can retain data for more than ten years. Various parameter s can be stored in it. To obviate the loss of latest settings in the case of pow er failure, the microcontroller stores all the audio settings of the user in the EEPROM. The memory ensures that the microcontroller will read the last saved se

ttings from the EEPROM when power resumes. Using SCL and SDA lines, the microcon troller can read and write data for all the parameters. For more details on I2C bus and memory interface, please refer to the MC24C02 datasheet. Audio parameter s can be set using the remote control handset or the on-board keys as per the de tails given under the remote control section. Audio processor. IC TDA7439 is a sin gle-chip I2C-bus compatible audio controller that is used to control all the fun ctions of the audio amplifier. The output from any (up to four) stereo preamplif ier is fed to the audio processor (TDA7439). The microcontroller can control vol ume, treble, bass, attenuation, gain and other functions of each channel separat ely. All these parameters are programmed by the microcontroller using SCL and SD A lines, which it shares with the memory IC and the audio processor. Data transm ission from the microcontroller to the audio processor (IC TDA7439) and the memo ry (MC24C02) and vice versa takes place through the two-wire I2C-bus interface c onsisting of SDA and SCL, which are connected to P3.0 (RXD) and P3.1 (TXD) of th e microcontroller, respectively. Here, the microcontroller unit acts as the mast er and the audio processor and the memory act as slave devices. Any of these thr ee devices can act as the transmitter or the receiver under the control of the m aster. Some of the conditions to communicate through the I2C bus are: 1. Data validity: The data on the SDA line must be stable during the high period of the clock. The high andlow states of the data line can change only when the clock signal on the SCL line is low. 2. Start and Stop: A start condition is a high-to-low transition of the SDA line while SCL is high. The stop condition is a low-to-high transition of the SDA li ne while SCL is high. 3. Byte format: Every byte transferred on the SDA line must contain eight bits. The most significant bit (MSB) is transferred first. 4. Acknowledge: Each byte must be followed by an acknowledgement bit. The acknow ledge clock pulse is generated by the master. The transmitter releases the SDA l ine (high) during the acknowledge clock pulse. The receiver must pull down the S DA line during the acknowledge clock pulse so that it remains low during the hig h period of this clock pulse. To program any of the parameters, the following in terface protocol is used for sending the data from the microcontroller to TDA743 9. The interface protocol comprises: 1. A start condition (S) 2. A chip address byte containing the TDA7439 address (88H) followed by an ackno wledgement bit (ACK) 3. A sub-address byte followed by an ACK. The first four bits (LSB) of this byte indicate the function selected (e.g., input select, bass, treble and volume). T he fifth bit indicates incremental/ non-incremental bus (1/0) and the sixth, sev enth and eighth bits are dont care bits. 4. A sequence of data followed by an ACK. The data pertains to the value for the selected function. 5. A stop condition (P) In the case of non-incremental bus, the data bytes corre spond only to the function selected. If the fifth bit is high, the sub-address i s automatically incremented with each data byte. This mode is useful for initial ising the device. For actual values of data bytes for each function, refer to th e datasheet of TDA7439. Similar protocol is followed for sending data to/from th e microcontroller to MC24C02 EEPROM by using its chip address as A0H. Power supply . Fig. 3 shows the power supply circuit for the remotecontrolled digital audio p rocessor. The AC mains is stepped down by transformer X1 to deliver a secondary outputof 9V AC at 1A. The transformer output is rectified by full-wave bridge re ctifier BR1 and filtered by capacitor C42. Regulators IC8 and IC9 provide regula ted 5V and 9V power supplies, respectively. IC10 acts as the variable power supp lyregulator. It is set to provide 3V regulated supply by adjusting preset VR1. C apacitors C39, C40 and C41 bypass any ripple in the regula ted outputs.This supp ly is not used in the circuit. However, the readers can use the same for powerin g devices like a Walkman. As capacitors above 10 F are connected to the outputs o f regulator ICs, diodes D3 through D5 provide protection to the regulator ICs, r espectively, in case their inputs short to ground. Relay RL1 is normally energis ed to provide mains to the power amplifier. In standby mode, it is de-energised.

Switch S2 is the on/off switch. Software The software was assembled using Metalinks ASM51 assembler, which is freely avail able for download. The source code has been extensively commented for easier und erstanding. It can be divided into the following segments in the order of listin g: 1. Variable and constant definitions 2. Delay routines 3. IR decoding routines 4. Keyboard routines 5. TDA7439 communication 6. MC24C02 communication 7. I2C bus routines 8. Display routines 9. IR and key command processing 10. Timer 1 interrupt handler 11. Main program On reset, the microcontroller executes the main program as foll ows: 1. Initialise the microcontrollers registers and random-access memory (RAM) locat ions. 2. Read Standby and Mute status from the EEPROM and initialise TDA7439 according ly. 3. Read various audio parameters from the EEPROM and initialise the audio proces sor. 4. Initialise the display and LED port. 5. Loop infinitely as follows, waiting for events: Enable the interrupts. Check the monitor input for AC power-off. If the power goes off, jump to the pow er-off sequence routine. Else, if a new key is pressed, call the DO_KEY routine to process the key. For t his, check whether the NEW_KEY bit is set. This bit is cleared after the command is processed. Else, if a new IR command is received, call the DO_COM routine to process the re mote command. For this, check whether the NEW_COM (new IR command available) bit is set. This bit is cleared after the command is processed. Jump to the beginning of the loop.6. Power-off sequence. Save all the settings t o the EEPROM, and turn off the display and standby relay. Since the output of th e IR sensor is connected to pin 12 (INT0) of the microcontroller, an external in terrupt occurs whenever a code is received. The algorithm for decoding the IR st ream is completely implemented in the external interrupt 0 handler routine. This r outine sets NEW_COM (02H in bit memory) if a new command is available. The decod ed command byte is stored in Command (location 021H in the internal RAM). The main routine checks for NEW_COM bit continuously in a loop. Timer 0 is exclusively u sed by this routine to determine the pulse timings. Decoding the IR stream invol ves the following steps: 1. Since every code is transmitted twice, reject the first by introducing a dela y of 85 milliseconds (ms) and start timer 0. The second transmission is detected by checking for no-overflow timer 0. In all other cases, timer 0 will overflow. 2. For second transmission, check the timer 0 count to determine the length of t he leader pulse (9 ms). If the pulse length is between 8.1 ms and 9.7 ms, it wil l be recognised as valid. Skip the following 4.5ms silence. 3. To detect the incoming bits, timer 0 is configured to use the strobe signal s uch that the counter runs between the interval periods of bits. The value of the counter is then used to determine whether the incoming bit is 0, 1 or Stop. This is i mplemented in the RECEIVE_BIT routine. 4. If the first bit received is Stop, repeat the last command by setting the NEW_C OM bit. 5. Else, receive the rest seven bits.Compare the received byte with the custom c ode (C_Code). If these dont match, return error. 6. Receive the next byte and compare with the custom code. If these dont match, r

eturn error. 7. Receive the next byte and store in Command. 8. Receive the next byte and check whether it is complement value of Command. Else , return error. 9. Receive Stop bit. 10. Set NEW_COM and return from interrupt. Other parts of the source code are relatively straightforward and self-explanato ry. Remote control. The micro-controller can accept commands from any IR remote that uses NEC transmission format. These remote controllers are readily availabl e in the market and use PD6121, PT2221 or a compatible IC. Here, weve used Creativ es remote handset. All the functions of the system can be controlled fully using the remote or the on-board keys. By default, the display shows the volume settin g and LEDs indicate the channel selected. LED9 glows momentarily whenever a comm and from the remote is received or any key is pressed. Function adjustments are detailed below: 1. Volume: Use Vol+/Vol- key to increase/decrease the volume. The volume setting s are shown on the twodigit, 7-segment display. Steps can be varied between 1 and 8 0. 2. Mute and Standby: Using Mute and Standby buttons, you can toggle the mute and sta ndby status, respectively. If Mute is pressed, the display will show 00. In Standby mo de, the relay de-energises to switch off the main amplifier. All the LEDs and di splays, except LED9, turn off to indicate the standby status. 3. Input Select: To select the audio input source, press Channel key until the des ired channel is selected. The LED corresponding to the selected channel turns on and the input gain setting for that channel is displayed for five seconds. Ther eafter, the volume level is displayed on the 7-segment display. 4. Input Gain set: Press Gain key. The LED corresponding to the channel will start blinking and the gain value is displayed. Use Vol+/Vol- key to increase/ decrea se the gain for that channel. Note that the gain can be varied from 1 to 15. If you press Gain key once more, and no key is pressed for five seconds, it will exit the gain setting mode and the volume level is displayed. 5. Audio: Press Audio Set (Menu) key to adjust bass, middle, treble and attenuatio n one by one. Each time Audio Set key is pressed, the LED corresponding to the sel ected function turns on and the function value is displayed. Once the required f unction is selected, use Vol+ and Vol- to adjust the setting. Bass, middle and t reble can be varied from 07 to 7. Values 0 through 7 indicate Boost and 00 throug Cut. Attenuation can be varied from 0 to 40. COMPONENTS REQUIRED FOR REMOTE CONTROLLED DIGITAL AUDIO PROCESSOR Semiconductors: IC1 - AT89C51 microcontroller IC2, IC3 - CD4543 7-segment decoder/ driver IC4 - TDA7439 audio processor IC5 - MC24C02 I2C EEPROM IC6 - KA2281 2-channel level meter driver IC7 - TSOP1238 IR receiver module IC8 - 7809 9V regulator IC9 - 7805 5V regulator IC10 - LM317 variable regulator T1 - BC558 pnp transistor T2, T3, T5 - BC547 npn transistor T4 - BD139 pnp transistor BR1 - W04M bridge rectifier D1-D6 - 1N4004 rectifier diode DIS1, DIS2 - LTS543 7-segment display DIS3 - 10-LED bargraph display

LED1-LED8 - Red LED LED9 - Green LED Resistors (all -watt, 5% carbon): R1 - 8.2-kilo-ohm R2-R24, R40-R49 - 1-kilo-ohm R25, R28, R50, R53 - 10-kilo-ohm R26, R29, R30, R34 - 2.7-kilo-ohm R27 - 100-ohm R31, R35 - 5.6-kilo-ohm R32, R33 - 4.7-kilo-ohm R36-R39 - 22-kilo-ohm R51 - 220-kilo-ohm R52 - 2.2-kilo-ohm Capacitors: C1, C2 - 33pF ceramic disk C3, C10 - 10F, 16V electrolytic C4-C6, C39-C41 - 100nF ceramic disk C7 - 4.7F, 16V electrolytic C8, C9 - 2.2F, 16V electrolytic C11, C20 - 5.6nF polyester C12, C19 - 18nF polyester C13, C18 - 22nF polyester C14, C17 - 100nF polyester C21-C28 - 0.47F polyester C29-C32 - 4.7F, 25V electrolytic C33, C34 - 10F, 25V electrolytic C35 - 1000F, 25V electrolytic C36 - 4700F, 25V electrolytic C37, C38 - 0.33F ceramic disk C42 - 470F, 25V electrolytic Miscellaneous: X1 - 230V AC primary to 12V, 1A secondary transformer RL1 - 9V, 160, 2 C/O relay XTAL - 12MHz crystal S1- S7 - Push-to-on switch S8 - On/Off switch Remote - Creatives remote (NECcompatible format) PCB LAYOUT FOR REMOTE CONTROLLED DIGITAL AUDIO PROCESSOR

COMPONENT LAYOUT FOR REMOTE CONTROLLED DIGITAL AUDIO PROCESSOR

CONSTRUCTION The circuit can be easily assembled on any PCB with IC base. Before you install the microcontroller, memory and audio processor in their sockets and solder the IR receiver module, make sure that the supply voltage is correct. All parts, exc ept the audio processor (TDA7439), require 5V DC supply. The audio processor is powered by 9V DC. Remotely Programmable RTC-Interfaced Microcontroller for Multiple Device Control

By Parth Dave on Monday, March 15, 2010 3:23 PM , in Remotely Programmable RTC-I nterfaced Microcontroller for Multiple Device Control , 0 Comments 1

INTRODUCTION This project based on Atmel AT89C52 and Dallas real-timeclock (RTC) chip DS12887 can be used to control and remotely program the switching operation of 24 elect rically operated devices. The devices can be switched on/off at precise times re peatedly every day, every month. The microcontroller can be programmed for devic e control using a normal Philips TV remote control. RC5 CODING Since the circuit makes use of Philips TV remote for device-switching time param eters, you need to know the fundamentals of the coding format used in these IR remotes. The Philips IR format makes use of RC5 code, which is also known as bi-phase codi ng. In RC5-coded signals (Fig. 2), each bit has a uniform duration. A transition in the middle of the time interval assigned to each bit encodes its logical value (0 or 1). A high-to-low transition assigns the bit a logic value of 0, and a low-to-high transition assigns the bit a logic value of 1. We nee d additional transitions at the beginning of each bit if a stream of equal bits is sent. However, there is no need of additional transitions if the next bit has a different logic value.Table II shows how all the commands of an R C5 remote control are encoded. The first two bits are start bits, which are used to adjust and synchronise the re ceiver. These bits are used to calculate and analyse the bit length of the other bits. The third bit is a toggle bit, which is toggled every time a button ispressed at t he remote control. This bit is used to identify whether the button is really pre ssed or whether an obstacle came in between the IR path of the remote and the IR receiver. The five bits (A4 through A0) immediately following the toggle bit are used to i dentify the device (see Table III). So, a maximum of 32 devices can be identifie d to and respond individually to the same type of coding without any disturbance , i.e., one among the 64 devices can be identified uniquely. Addresses of some o f the remotes are shown in Table III. The six bits (C5 through C0) immediately following the five address bits are the control/command bits. Therefore a maximum of 64 commands can be equipped in an RC5-type remote. Some of the command codes (decimal equivalents), as used in thi s project, are shown in Table IV. When any of the command/control buttons on the remote is pressed, the coded signal is received by the IR receiver-demodulator TSOP1738. The output of the IR demodulator circuit is normally high, but when any of the b uttons in the remote is pressed, a stream of low-going demodulated pulses will a ppear at its output. These pulses are fed to the external active-low interrupt i nput pin (INT/0) of 89C52. On receipt of the first low-going pulse, the monitor program of 89C52 will get interrupted and jump to the location 0003H, where the ex ecution is redirected to receive sub-routine of the program. The outputs from the subroutineare: 1. Toggle bit, which toggles (either 0 or 1) each time the button in a remote is pre ssed. 2. Address byte, whose value is zero for a normal Philips-type TV remote control (see Table III). 3. Control byte, which has a unique value for each button in the remote control (see Table IV). CIRCUIT DIAGRAM

THE HARDWARE

Microcontroller AT89C52 is interfaced to DS12887 (RTC), a 16x2 LCD mod-ule and a n 8255 programmable peripheral interface (PPI). The address-decoding circuitry c omprises NAND gates 74LS00 and 3-to-8 line decoder 74LS138 as shown in Fig. 1. T he interfacing circuitry for the external electrical appliances comprises Darlin gton array IC ULN2803. The addressing range of various peripheral devices is sho wn in Table I. In 89C52 (IC1), port P0 is used for outputing multiplexed address (lower8-bit) and data. The address is latched into 74LS573 (IC2) octal latch an d RTC DS12887 (IC3) with the help of ALE (address latch-enable) output from pin 30 of IC1. Only two address lines from IC2 (A0 and A1) have been used for addres sing the four registers of 8255 PPI (IC6) in conjunction with the chipselect sig nal at pin 6 (from IC4) and read/write signals from IC1. Higher-address bits fro m port P2 of IC1 (A8, A9 and A10 from output pins P2.0, P2.1 and P2.2) are used for generating the chipselect signals from 74LS138 (IC4) cover INg address range s 000H-0FFH, 100H-1FF and 200- 2FF for RTC, LCD module and PPI chip, respectivel y. Quad NAND gate 7400 (IC5) in conjunction with read and write signals from IC1 and chip-select signal from pin 14 of IC4 is used for selecting the LCD module both during read and write cycles of IC1. PPI chip 8255 is configured with port A, port B and port C as output ports for controlling up to 24 electrical applian ces via relays RL1 through RL24. Relays are energised through high-current octal Darlington arraysconjunction with the chipselect signal at pin 6 (from IC4) and read/write signals from IC1. Higher-address bits from port P2 of IC1 (A8, A9 an d A10 from output pins P2.0, P2.1 and P2.2) are used for generating the chipsele ct signals from 74LS138 (IC4) covering address ranges 000H-0FFH, 100H-1FF and 20 0- 2FF for RTC, LCD module and PPI chip, respectively. Quad NAND gate 7400 (IC5) in conjunction with read and write signals from IC1 and chip-select signal from pin 14 of IC4 is used for selecting the LCD odule both during read and write cy cles of IC1. PPI chip 8255 is configured with Port A, port B and port C as outpu t ports for controlling up to 24 electrical appliances via relays RL1 through RL 24. Relays are energised through high-current octal Darlington arrays inside ULN 2803 (IC7 through IC9) in accordance with programmed data stored in the non-vola tile RAM (NV RAM) of RTC chip DS12887. There is no need of connecting external f reewheeling diodes across relays as inbuilt diodes are provided in ULN2803 ICs. All the 24 devices/electrical appliances are considered as 24 bits (threebytes a t locations 200H, 201H and 202H) of the three ports (ports A, B and C) of 8255. The LCD is used for displaying real time (year, month, date, day and time in 24hour mode) obtained from RTC DS12887 as also some other information during time setting, device programming, searching (device- switching programmed data), pass word entry, etc, as described later. RTC DS12887 is clock-cum-calendar chip with 128 NV RAM (14 bytes used fo its control registers and 114 bytes as general-pur pose RAM). It has an inbuilt lithium battery and can retain stored data for over ten years in the absence of external power. Memory map of DS12887 is shown in T able V. Data stored in location 07FH (decimal 127) indicates the address of the last RAM location used.The relay-switching data that is output from ports A, B a nd C of the PPI is stored as consecutive bits at 00EH, 00FH and 010H locations o f the RAM. The relay/device programming timing data is stored at five consecutiv e locations for each device. This data includes month, date, hour and minute in first four bytes, while the fifth byte contains 5-bit address of the device with MSB indicating on/off status of the device. Bits 6 and 7 of this byte are dont care b ts. Address locations 123 through 126 are used for storing the 4-byte long passw ord. Thus only 106 locations are available for storing the 5-byte long device da ta and as such the program for a maximum of only 21 devices out of 24 devices ca n be stored. The remaining three devices can be switched on/off through remote k ey operation as explained below. Bit P1.1 output of IC1 is fed to transistor BC5 47 (T1) through R5. Transistor T1 acts like a switch for LCD backlight. So you c an switch the backlight of LCD on/off just by setting/resetting the P1.1 bit of 89C5 2. Power supply (Fig. 3). While most of the circuit requires regulated 5V for it s operation, the relays and Darlington drivers IC7 through IC9 (ULN2803) are ope r-ated with unregulated 12V DC supply. A step-down transformer rated at 15V AC s

econdary voltage at 500 mA is used to supply 12V unregulated and 5V regulated po wer to the circuit. The secondary output is rectified by 1A rated bridge rectifi er BR1 and smoothed by 1000F, 35V capacitor C10. The output from the capacitor is directly fed to all the relays and ULN2803 ICs. The same output is used for regu lation by 7805 (IC10). The ripple in the regulator output is filtered by capacit or C11. An actual-size, single-side PCB for the re otely-programmable RTC-interf aced microcontroller for multiple device control and power supply circuits (Figs 1 and 3) is shown in Fig. 4 and its component layout in Fig. 5. The connections for relays are to be extended from the 16-pin FRC connectors on the PCB. Each c onnector is meant for extending connections to eight relays. The authors prototyp e is shown in Fig. 6. Remote key operations Refer Table IV for details of remote buttons/keys. The functions of these keys f ollow: Keys 0 through 9, -- and sfx. Used to switch on/off the 24 devices manually. E time you press any of these buttons, the status of the corresponding device wil l toggle, i.e., its output will be the complement of the previous state. Button - is used as 10+ button. When it is pressed, the system waits for around three seco nds before the next button (which should be between 0 and 9 to determine the device between 10 and 19) is pressed. Similarly, sfx is used as 20+ key. The button followin he sfx button should be between 0 and 3 (as the project supports only 24 electrical ap pliances numbering 0 through 23).RCL. Turns the LCD backlight on/off. PWR. Used to ch e the 4-digit password (initial value 0000). When you press this button, the syste m will ask for the existing password. If the correct password is entered, it wil l ask for the new password. If a wrong password is entered, invalid message will f lash on the LCD. Note that the password can be any 4-digit value, which need not be the numbers from 0000 to 9999. Other buttons representing various codes are also accepted. Timer. Used to change the real time. As the circuit operations depend on the real (set) time, changing the same is password-protected. A valid 4-digi t password will let you change/set the time. When you press timer button, the top row on the LCD defines the format Hr:Mn:ScWkDyMnYr. You need to enter the valid da ta as follows: Hr: 00 to 23 (24-hour mode) Mn: 00 to 59 minutes Sc: 00 to 59 sec onds Wk: 01 to 07 (01 is Sunday) Dy: 01 to 31 dates Mn: 01 to 12 (01 is January) Yr: 00 to 99 (year) Any value out of the range will not be accepted and message invalid value will be displayed on the LCD. Store. Enables/disables the child loc k function. You can lock the remote keypad by enabling the child lock. When you press this button, the system will prompt the message Lock? or UnLock? depending on the present status of the child lock. If 1 is pressed, the child lock feature is e nabled/disabled. Any button other than 1 will be treated as zero. PP. Takes you to programming of a task. If the NV RAM is full in DS12887, the message prog memory full will flash on the LCD. If the memory is not full, a new device program is a ccepted by displaying a message in the first line of the LCD as Mn Dt Hr:Mn Dv S a nd a blinking cursor will appear on the second line to take the data. Mn indicates month (01 to 12), Dt indicates date (01 to 31), Hr indicates hours (00 t 9), Dv indicates device number (00 to 23) and S stands for programmed status (1 Enter the desired data in this format, which will get stored in the NV RAM of t he RTC. If month (Mn) is entered as 00, the same task will repeat every month on t he same date and time. If date (Dt) is entered as 00, the same task will repeat ev ery day on the same time. Search. Shows the existing device programs that are st ored in the memory starting from location 011H onwards one by one. Each time, yo u need to press CH+/CH- button to move forward/ backward. In this mode, you may delete the displayed device program data entry simply by pressing Mute button. The n the program that is residing next to this task moves to the location of the de leted task and the whole memory is refreshed. See the example shown above for cl arity. The pointer value in memory location 007FH of DS12887 changes accordingly . AC. Deletes the entire programmed data in one stroke. So use this key very cau tiously. PCB LAYOUT FOR MULTIDEVICE CONTROL Cellphone Operated Land Rover

By Parth Dave 2:48 PM , in CELLPHONE OPERATED LANDROVER , 0 Comments 1 INTRODUCTION Conventionally, wireless-controlled robots use RF circuits,which have the drawba cks of limited working range, limited frequency range and limited control. Use o f a mobile phone for robotic control can overcome these limitations. It provides the advantages of robust control, working range as large as the coverage area o f the service provider,no interference with other controllers and up to twelve c ontrols.Although the appearance and capabilities of robots vary vastly, all robo ts share the features of a mechanical, movable structure under some form of cont rol. The control of robot involves three distinct phases: reception, processing and action. Generally, the preceptors are sensors mounted on the robot, processi ng is done by the on-board microcontroller or processor, and the task (action) i s performed using motors or with some other actuators. PROJECT OVERVIEW In this project, the robot is controlled by a mobile phone that makes a call to the mobile phone attached to the robot. In the course of a call, if any button i s pressed,a tone corresponding to the button pressed is heard at the other end o f the call. This tone is called dual-tone multiple-frequency (DTMF) tone. The robo t perceives this DTMF tone with the help of the phone stacked in the robot. The received tone is processed by the ATmega16 microcontroller with the help of DTMF decoder MT8870. The decoder decodes the DTMF tone into its equivalent binary di git and this binary number is sent to the microcontroller.The microcontroller is preprogrammed to take a decision for any given input and outputs its decision t o motor drivers in order to drive the motors for forward or backward motion or a turn. The mobile that makes a call to the mobile phone stacked in the robot act s as a remote. So this simple robotic project does not require the construction of receiver and transmitter units. DTMF signaling is used fr telephone signaling over the line in the voice-frequency band to the call switching centre. The ver sion of DTMF used for telephone tone dialing is known as Touch-Tone.DTMF assigns a specific frequency (consisting of two separatetones) to each key so that it can easily be identified by the electronic circuit. The signal generated by the DTM F encoder is a direct algebraic summation, in real time, of the amplitudes of tw o sine (cosine)waves of different frequencies, i.e., pressing 5 will send a tone m ade by adding 1336 Hz and 770 Hz to the other end of the line. The tones and ass ignments in a DTMF system are shown in Table I. SCEMATIC OF CELLPHONE OPERATED LANDROVER CIRCUIT DESCRIPTION Fig. 1 shows the block diagram of the microcontroller-based mobile phoneoperated land rover. The important components of this rover are a DTMF decoder, microcon troller and motor driver. An MT8870 series DTMF decoder is used here. All types of the MT8870 series use digital counting techniques to detect and decode all th e 16 DTMF tone pairs into a 4-bit code output. The built-in dial tone rejection circuit eliminates the need for pre-filtering. When the input signal given at pi n 2 (IN-) in single-ended input configuration is recognised to be effective, the correct 4-bit decode signal of the DTMF tone is transferred to Q1 (pin 11) thro ugh Q4 (pin 14) outputs. Table II shows the DTMF data output table of MT8870. Q1 through Q4 outputs of the DTMF decoder (IC1) are connected to port pins PA0 thr ough PA3 of ATmega16 microcontroller (IC2) after inversion by N1 through N4,resp ectively. The ATmega16 is a low-power, 8-bit, CMOS microcontroller based on the AVR enhanced RISC architecture. It provides the following features: 16 kB of insystem programmable Flash program memory with read-while-write capabilities, 512 bytes of EEPROM, 1kB SRAM, 32 general-purpose input/output (I/O) lines and 32 g

eneral-purpose working registers. All the 32 registers re directly connected to the arithmetic logic unit, allowing two independent registers to be accessed in one single instruction executed in one clock cycle. The resulting architecture i s more code-efficient. Outputs from port pins PD0 through PD3 and PD7 of the mic rocontroller are fed to inputs IN1 through IN4 and enable pins (EN1 and EN2) of motor driver L293D, espectively, to drive two geared DC motors. Switch S1 is use d for manual reset. The microcontroller output is not sufficient to drive the DC motors, so current drivers are required for motor rotation. The L293D is a quad , high-current, half-H driver designed to provide bidirectional drive currents o f up to 600 mA at voltages from 4.5V to 36V. It makes it easier to drive the DC motors. The L293D consists of four drivers. Pin IN1 through IN4 and OUT1 through OUT4 are input and output pins, respectively, of driver 1 through driver 4. Dri vers 1 and 2, and drivers 3 and 4 are enabled by enable pin 1 (EN1) and pin 9 (E N2), respectively. When enable input EN1 (pin 1) is high, drivers 1 and 2 are en abled and the outputs corresponding to their inputs are active. Similarly, enabl e input EN2 (pin 9) enables drivers 3 and 4. An actual-size, single-side PCB for cellphone-operated land rover is shown in Fig. 4 and its component layout in Fi g. 5. PCB LAYOUT FOR CELLPHONE OPERATED LANDROVER

SOFTWARE DESCRIPTION The software is written in C language and compiled using CodeVision AVR C compiler. The source program is ed into hex code by the compiler. Burn this hex code into ATmega16 AVR microcontroller.The source program is well commented and easy to un derstand. First include the register name defined specifically for ATmega16 and also declare the variable. Set port A as the input and port D as the output. The program will run forever by using while loop. Under while loop, read port A and test the rec eived input using switch statement. The corresponding data will output at port D a fter testing of the received data. WORKING In order to control the robot, you need to make a call to the cell phone attache d to the robot (through head phone) from any phone, which sends DTMF tunes on pr essing the numeric buttons. The cell phone in the robot is kept in auto answer mod e. (If the mobile does not have the auto answering facility, receive the call by OK key on the rover-connected mobile and then made it in hands-free mode.) So aft er a ring, the cellphone accepts the call. Now you may press any button on your mobile to perform actions as listed in Table III. The DTMF tones thus produced a re received by the cellphone in the robot. These tones are fed to the circuit by the headset of the cellphone. The MT8870 decodes the received tone and sends the equivalent binary number to the microcontroller. According to the program in the microcontroller, the robot starts moving.When you press key 2 (binary equivalent 00000010) on your mobile phone, the microcontroller outputs 10001001 binary equivalent. Port pins PD 0, PD3 and PD7 are high. The high output at PD7 of the microcontroller drives th e motor driver (L293D). Port pins PD0 and PD3 drive motors M1 and M2 in forward direction (as per Table III). Similarly, motors M1 and M2 move for left turn, ri ght turn, backward motion and stop condition as per Table III. CONSTRUCTION When constructing any robot, one major mechanical constraint is the number there a two-wheel drive or a four-wheel ive. Though four-wheel drive is more complex than two-wheel drive, it provides more torque and good control. Two-wheel drive, on the other hand, is very easy to construct. Top view of a four-wheel-driven l and rover is shown in Fig. 3. The chassis used in this model is a 1018cm2 sheet m ade up of parax. Motors are fixed to the bottom of this sheet and the circuit is affixed firmly on top of the sheet. A cellphone is also mounted on the sheet as

shown in the picture. In the four-wheel drive system, the two motors on a side are controlled in parallel. So a single L293D driver IC can drive the rover. For this robot, beads affixed with glue act as support wheels. PROGRAM FOR CELLPHONE OPERATED LANDROVER Source program: Robit.c #include void main(void) { unsigned int k, h; DDRA=0x00; DDRD=0XFF; while (1) { k =~PINA; h=k & 0x0F; switch (h) { case 0x02: //if I/P is 0x02 { PORTD=0x89;//O/P 0x89 ie Forward break; } case 0x08: //if I/P is 0x08 { PORTD=0x86; //O/P 0x86 ie Backward break; } case 0x04: { PORTD=0x85; // Left turn break; case 0x06: { PORTD=0x8A; // Right turn break; } case 0x05: { PORTD=0x00; // Stop break; } } } } HOME AUTOMATION CONTROL SYSTEM USING DTMF TELEPHONE LINE By Parth Dave on Saturday, March 6, 2010 3:54 PM , 3 Comments 4

INTRODUCTION INTRODUCTION OF THE PROJECT How this project is different from other home automation control system?

Controlling device using switches are common. From a few decades controlling dev ices using remote control switches like infrared remote control switch, wireless remote control switches, light activated switches are becoming popular. But the se technologies have their own limitations. Laser beams are harmful to mankind. Some technologies like IR remote control are used for short distance application s. In such case if we have system which does not require any radiations or which is not harmful, long remote control switch!! Yes here is the solution. Here I a m introducing such a system which does not require any radiations, any laser bea m which has no limitation of range, I mean it can be used from any distance from meters to thousands kilometers using a simple telephone line or mobile phone. Here I am using a telephone as a media, which serves main part of this system, b y using home phone as a local phone and another phone, either landline or mobile phone as a remote phone. The Home Automation Control System Using DTMF Telephone Line project is a secure D TMF control system for intelligent houses. With this implemented system, it is possible to safely control electricity opera ted domestic devices. FEATURES 1. We can control up to 8 devices. It may be any electric or electronic applianc es or devices with simple to heavy appliance. Each device is given a unique code . 2. It makes accurate switching, any false switching of device are not done so th ere is no risk for false switching. 3. Our local phone can be used for normal use by using a DPDT switch. So we need not use a separate telephone line for this device controlling. 4. To perform any operations through remote phone line, the user needs to dial t o the local telephone then the respective code of the device is dialed. 5. This circuit not require any complex IC, so any one with little knowledge of electronics can construct this circuit, because it does not need any programmabl e ICs or programming. 6. This system detects the ringing signal from your exchange with the help of ri ng detector and automatically switches ON. 7. This device saves our money. This circuit switches OFF after a time of 60 sec onds. 8. Before changing the state of the device we can confirm the present status of the device. 9. This circuit gives an acknowledgement tone after switching ON the devices to confirm the status of the device. 10. We can control devices from any local telephone. It can also be controlled b y PCO. TAKING A TOUR OF PROJECT This system uses Dual Tone Multi Frequency (DTMF) technology of our telephone se t. Every telephone set will have this facility. We have two type of dialing faci lities in our telephone system (1)pulse dialing mode (2) tone dialing mode. Here this system works on tone dialing mode. The DTMF mode is shortly called as tone dialing mode. This system is divided into two sections. 1: Remote section 2: Local control section. What is DTMF?

When you press a button in the telephone set keypad, a connection is made that g enerates a resultant signal of two tones at the same time. This two tones are taken from a row frequency and a column frequency. The result ant frequency signal is called a Dual Tone Multiple Frequency . These tones are identical and unique. A DTMF signal is the algebraic sum of two different audio frequencies, and can b e expressed as follows: f(t) = A0sin(2*?*fa*t)+B0sin(2*?*fb*t)+--- > (1) Where fa and fb are two different audio frequencies with A and B as their peak a mplitude and f as the resultant DTMF signal. fa belongs to the low frequency group and fb belongs to the high frequency group . Each of the low and high frequency groups comprise four frequencies from the var ious keys present on the telephone keypad; two different frequencies, one from t he high frequency group and another from the low frequency group are used to pro duce a DTMF signal to represent the pressed key. The amplitudes of the two sine waves should be such that (0.7<(A\B)<0.9)v> (2) The frequencies are chooses such that they are not the harmonics of each other. The frequencies associated with various keys on the keypad are shown in figure(A ). When you send this DTMF signals to the telephone exchange through cables, the se rvers in the telephone exchange identifies these signals and makes the connectio n to the person you are calling. CIRCUIT DIAGRAM RELAY DRIVER CIRCUIT

DESCRIPTION The brain of the switcher is the Atmel AT89xxx micro controller U3. Incoming rin g is detected via C10, D9, R16 and the opto- coupler U6 and connected to pin 12 of the micro controller. The incoming call is answered by connecting the circuit based around Q1 and R4 ( an electronic holding coil) to the line. One output from micro controller (pin 1 3) is used to output a 325Hz software generated tone into the telephone line via the Q2, This tone is used to signal the user when commands have been completed or of any command errors. The micro controller examines incoming signals on port 1 (P1.0 - P1.4) and contr ols the outputs over port 0 (P0.0 - P0.7). Connection to the telephone network is via RJ11 connector K2. Socket K3 is conne cted in parallel with socket K2 and allows a telephone to be connected at the sa me time as the circuit. A voltage-dependent resistor (visitor) is connected acro ss these two sockets, which provides protection against voltages in excess of 13 0 V. The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer with 4K by tes of Flash programmable and erasable read only memory (PEROM). The device is manufactured using Atmels high-density nonvolatile memory technolog y and is compatible with the industry- standard MCS-51 instruction set and pin o ut. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT 89C51 is a powerful microcomputer which provides a highly-flexible and cost-effe ctive solution to many embedded control applications. DTMF DECODER INTERFACE

DTMF detection and decoding is provided by U5. This chip, an 8870, is a complete DTMF receiver, which is able to detect and decode all 16 DTMF tone pairs into a 4-bit code. When a valid DTMF digit is detected the 4-bit code is placed on pin s 11-14 and a data available output, pin 15, is set to logic high. It is conne cted to the telephone line via C2 and R9 and R14 a hexadecimal value correspondi ng to the two tones at its outputs Q1 to Q4. These outputs are latched and so are only valid when the control output STD is h igh. For its operation the integrated circuit requires a base of times, generate d in this case by the quartz crystal of 3.579545MHz. This crystal is very common in the market since he is the employee for the systems of color of the TV equip ment

Вам также может понравиться