Home
RCT-433-AS / ASB - Faculty Home
Contents
1. E PORTA DRIVERS BUFFERS PORTC DRIVERS BUFFERS GND PORTA DIGITAL INTERFACE PORTC DIGITAL INTERFACE 1 1 avec dl oo 24 MUX 8 2 4 Tw ADC INTERFACE i PROGRAM L STACK M CONTES 4 0 OSCILLATOR COUNTER POINTER 4 2 PROGRAM gt INTERNAL FLASH ex OSCILLATOR Henna banana MM o xT Y INSTRUCTION GENERAL WATCHDOG REGISTER PURPOSE 6 TIMER OSCILLATOR REGISTERS 4 A x i 4 XTAL2 INSTRUCTION MCU CTRL 4 0 DECODER i amne RESET 2 INTERNAL CONTROL INTERRUPT H Wu CALIBRATED LINES ALU UNIT OSCILLATOR AVR CPU Wi wu EEPROM 1 SPI M lt gt USART LOGIC i INTERFACE PORTB DIGITAL INTERFACE DRIVERS BUFFERS AR 8 PBO PB7 2502FS AVR 06 04 PORTD DIGITAL INTERFACE PORTD DRIVERS BUFFERS PDO PD7 APPENDIX RESULT FROM GRAPHICAL USER INTERFACE 71 Result from Graphical User Interface When the sensor did not sense any water it considers as low water level Therefore the first level is assigned with blue color The message also wills popup in the water lev
2. Transmitter Node Makefil MCU name MCU atmega8535 Output format can be srec ihex binary FORMAT ihex Target file nam without extension ARGET wlevel Optimization level can be 0 1 2 3 s 0 turns off optimization Note 3 is not always the best optimization level S avr libc FAQ OPT 5 List source files here dependencies are automatically generated If there is more than one source file append them above or modify and uncomment the following SRC foo c bar c You can also wrap lines by appending a backslash to the end of the line SRC baz c XYZZY C List Assembler source files here Make them always end in a capital S Files ending in a lowercase 5 will not be considered source files but generated files assembler output from the compiler and will be deleted upon make clean Even though the DOS Win filesystem matches both s and S the same it will preserve the spelling of the filenames and gcc itself does care about how the name is spelled on its command line ASRC List any extra directories to look for include files here Each directory must be seperated by a space EXTRAINCDIRS Optional compiler flags generate debugging information for GDB or for COFF conver
3. PORTA Oxf0 Z7 while 1 YR if TIFR amp 0 1 0 1 226 PORTC endif void USART_INIT unsigned int UBRR Set baud rate UCSRA amp Oxfd UBRRH unsigned char UBRR gt gt 8 UBRRL unsigned char UBRR Enable receiver and transmitter UCSRB 1 lt lt RXEN 1 lt lt TXEN UCSRC 1 lt lt URSEL 1 lt lt UCSZ1 1 lt lt 0 520 void USART_TX unsigned char data Wait for empty transmit buffer while UCSRA amp 1 lt lt UDRE Start transmission UDR data send least significant byte unsigned char USART_RX void Wait for data to be received while UCSRA amp 1 lt lt RXC Get and return received data from buffer return UDR void delay 1m unsigned char i int js while i 57 Set frame format 8data no parity 1 stop bit 1 11415 8Mhz Exteranl Crystal CKS while 3 void ADC_INIT void Activate ADC with Prescaler 2 ADCSRA 00610000000 ADMUX 0b00100100 unsigned char ADC_READ void ADCSRA 0 01000000 while ADCSRA amp _BV ADSC return ADCH Es void TMRO_INIT void TCCRO 0x05 TCCRIA 0 TCCRIB 0x4 58 59
4. 55 4 MOSI MISO 6 Figure 3 5 Atmega8535 pin configuration As illustrated in figure 3 5 to enable the Microcontroller it is essential to provide it with the suitable voltage Referred to the datasheet operating voltage for Atmega8535 is between ranges 4 5 V until 5 5 V At this level this microcontroller unit will function effectively To obtain the optimum value of power source a 5 Volt voltage regulator circuit was applied on the Microcontroller board This circuit ensures that the Microcontroller received less than 5 5 Volt of supply during its operation If more than 5 5 Volt of voltage is supplied directly to the board the regulator decreased the value to avoid any damage to the microcontroller unit Figure 3 6 shows the voltage regulator schematic diagram Figure 3 6 Voltage regulator schematic diagrams 23 ATmega8535 microcontroller uses 8 MHz crystal oscillator to generate external clocking Radio frequency transmitter was connected to pin 15 which are the USART pin PORT B is applied for an ISP cable which is use to program the microcontroller directly on the circuit board and PORT A was assigned as input port to read data from sensor Output gained from sensor was connected to PINA 1 PINA 2 PINA 3 and PINA 4 Each pin indicated different level of water which is represent lowest water level while PINA 4 represent the highest or critical level
5. 0011 0010 in binary number The start bit for the transmission is 0 while the stop bit is 1 Sv H Data 32 0011 0010 MA Al Figure 4 9Sensor data transmission oscilloscope 4 5 Data Transmission between Sensor Nodes Data transmission between sensor nodes explains the result obtained during wired and wireless transmission 4 5 1 Wired transmission Figure 4 10 and 4 11 explain the observed data during wired transmission Figure 4 10 shows the data captured at the virtual terminal The data sent through the network including 2 bytes header 2 bytes address 1 byte data and 1 byte checksum as discussed in chapter 2 The red circle show the data frame received the receiver node while the green circle explains the extracted data from the receiver node that will be sent to computer for GUI display 45 Communication Terminal HE Settings Communication Com Port COMI EN Bad i20 421 Append O Send as typing Stop Bits One Stop Bi CI O Send as number History Party Format Check Panty C HEX DEC s n sl Da Da E 2 esser 04 010 0134 0 01 0 15 One Commgnds pCeed 0848 RIS Received 0844 0910 0x34 0 01 015 545 Received 048 Received 0544 0510 0x34 0401 015 0545 Received 0 48 Received 0x44 0510 0x34 0401 0515 045 Received 048 Received 044 0410 0x34 0401 0415045 Log Bead trom Wite
6. E ee 96 E9 OF F1 1D 32 97 80 81 28 Hp 3RB f 83 representation 11 F4 12 2F 95 30 19 AS ANG 6 CF 89 81 9A 81 89 OF OF 88 OF ar A9 F4 0D CO 13 38 11 FA A 05 CO 1F 30 11 F4 a 4 EF A2 DF 90 3W h Y60 24 27 08 95 81 50 8F 3F 876 Microcontroller memory 3F FF FF FF FF FF FF FF FF FF FF FF FF 9 FF FF FF FF FF FF FF FF FF FF FF 9 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF UUUUUUUUUUUU FF FF FF FF FF FF FF FF FF FF FF 99 FF FF FF FF FF FF FF FF FF FF FF y FF FF FF FF FF FF FF FF FF FF FF 99 FF FF FF FF FF FF FF FF FF FF FF fu Free Buffer FF FF FF FF FF FF FF FF FF FF FF FF PonyProg2000 Size 8704 Bytes CRC 15B0h Figure 3 15 PonyProg window 37 The figure 3 15 shows the hex file generated after compiling the source code in WinAVR The Ponyprog window contains the Hex code compiled from the original program written in C language the source code ASCII s representation microcontroller memory and the unused microcontroller buffer The essential steps require before using this software was first setup the interface whether to use serial or parallel connector Secondly calibrate the bus timing define the device going to be used and setup the configuration and security bits One completing the calibration and setting the selected hex fil
7. warning RECEIVER unsigned char rx_data ctr sensor_d endif unsigned char hdr 2 hf unsigned char add 2 12 unsigned char chksum Initialize PORTC DDRC Oxff PORTC 0 e INS Fesch Figure 3 14 WinAVR notepad and makefile window 1 1 191 Make file 36 3 3 1 2 PonyProg The next step after generating the Hex file is uploading the generated Hex into the microcontroller To uploading the Hex file the other software was used which called PonyProg PonyProg is serial device programmer software with a user friendly GUI framework available for Windows95 98 2000 amp NT and Intel Linux Its purpose is reading and writing every serial device PonyProg works with other simple hardware interfaces like AVR ISP STK200 300 JDM Ludipipo EasyI2C and DT 006 AVR by Dontronics 3 The PonyProg window shown in figure 3 15 w File Edit Device Command Script Utility Setup 2 Window Epp e AVR micro 51 ATmeas8535 red wart Gal e eue mi 2B co 23 22 1B 1 BF 19 AB 92 86 36 1 87 92 86 36 B1 07 3 BD 08 95 9 01 4 E1 8A B9 86 ES eF Source Code 00 89 83 9A 83 ere eae 83 DC DF 8F E9 B ASCII s BB 5F 9B FE CF 1D 81 81 OA
8. lot of rework needs to be done when the result didn t achieve the initial target In general there are three major tasks need to be performed by sensor node which is read data from sensor process the data to include data header address sensor data and frame check sequence and finally send the data to the receiver As illustrated in figure 3 10 the work flow began by building the application flowchart This flowchart was a necessary guideline to be follow during accomplishing the system Next step is writing a program according to the application The program was written in C programming After that a make file was set up Make file was essential because it can determines the types of linker loader and the object files to be produced After completing the program it needs to be compiled The written program was compiled using WinAVR WinAVR ensure that the codes generated from the program are compatible with Atmega8535 This point demands a lot of rework if any errors are detected during compiling The system need to be altered and reprogram to resolve the error Once the programs are free from error WinAVR compiler will generate a Hex file This is a very useful file that required to be uploaded into the microcontroller unit After the Hex file were uploaded into the microcontroller unit the whole circuit can be tested either it compatible or function accordingly to the application Rework also necessitate if the expected result coul
9. To ensure that PORTA can read the data captures by the sensor the sensor itself must generate output voltage at 4 5 V 5 5 V range Besides the register the other pin that needed the special attention is pin 30 which is the AVCC AVCC is the supply voltage pin for Port A and the A D Converter It should be externally connected to VCC even if the ADC is not used If the ADC is used it should be connected to VCC through a low pass filter 5 To ensure the stability of the voltage supply a 100 nF capacitor was connected to the VCC input These capacitors should be placed as close to the power pins as possible 24 Input From Sensor Mis DU 8330 AAA I Ai 57 4 Alle LA Kai Figure 3 7 Microcontroller Board Schematic Diagram Atmega8535 was manufactured using Atmel s high density non volatile memory technology It allows the chip to be reprogrammed directly on the assembled microprocessor board using ISP cable By combining an 8 bit RISC CPU with in system self programmable flash on a monolithic chip the Atmel Atmega8535 is a powerful microcontroller that provides highly flexible and cost effective solution to many embedded control applications Furthermore Atmega8535 AVR is supported with a full suite of program and system development tools including C programming macro assemblers program debugger simulators in circuit emulators and evalua
10. Unit Electrically Eraseable Programmable Read Only Memory File Transfer Protocol In Circuit Serial Programmable Kilo Byte Least Significant Bit Megahertz Most Significant Bit Operating System Point to Point Protocol Random Access Memory Radio Frequency Receiver Serial Line Interface Protocol Transmission Control Protocol Internet Protocol Transmitter User Datagram Protocol Universal Synchronous Asynchronous Receiver Transmitter APPENDIX PAGE A LIST OF APPENDICES TITLE Transmitter node source code Transmitter node makefile RF Module Data Sheet Atmel Atmega8535 block diagram Graphical User Interface Result Ponyprog Manual xiv 54 59 66 70 71 73 1 INTRODUCTION 1 1 Overview Sensor network composes of large number of sensor nodes which communicate with each other Sensor network deployments were envisioned to be done in large scales where each network consists of hundreds or even thousands of sensor nodes These sensor nodes work by gathering their sensing information and sent the data trough the network using specific address The main characteristic of sensor node is said to be physically small and inexpensive Basically a sensor node consists of one or more sensor a short range radio transmitter or transceiver a small microcontroller and a power supply in form of battery This project implements a water level sensor as a sensor node The sensor node will communicate be
11. and sensors Generally the design processes are divided into three phases They are the initial electronic design or the hardware development sensor node programming or the software development and the final phase the overall system testing development In order to achieve the objectives of this project it is important to figure out what is the finest technique and proper step in designing the sensor node The microcontroller circuit should suit best the sensor implementation to achieve the greatest performance during transmission 3 2 Hardware Development Figure 3 1 gives an idea about the steps followed in order to finish this project The initial state is about getting the brief idea about what is wireless sensor network what components each node in the network consist and finally distribute these nodes into transmitter and receiver part The project is then divided into 2 parts which is the transmitter and the receiver part In the transmitter part it is essential to 15 choose the appropriate sensor to be developed in the project The sensor application must be suitable with the microprocessor so that the program written for the sensor can be fit into the microprocessor memory Other than that the output voltage from the sensor also must be within the microprocessor range which is 4 5 5 5 volt It is important to keep the voltage level within the range because at this range the microprocessor will work efficiently If the sensor volt
12. as a central processing unit CPU 8 The microcontroller unit is generally referred as MCU An 8 bit AVR RISC microcontroller is selected as the brain of water sensor system The processor is selected based on its memory utilization This processor has provides interesting features such as 8K bytes of in system programmable flash with read while write capabilities 512 bytes EEPROM 512 bytes SRAM 32 general purpose working registers three flexible timer counter with compare modes internal and external interrupt a serial programmable USART a byte oriented two wire serial interface an 8 channel 10 bit ADC a programmable watchdog timer with internal oscillator an SPI serial port and six software selectable power saving modes 5 Figure 3 5 illustrate the Atmel Atmega8535 pin configuration It shows all connection of I O port oscillator connection pin USART transmit and receive pin and ADC port This configuration must correctly follow the Atmel AVR datasheet to ensure the processor operate properly This system utilizes almost the entire Atmega8535 pin out 22 XCK TO PBO PAO ADCO PA1 ADC1 PA2 ADC2 PA3 ADC3 4 ADC4 ADC5 PA6 ADC6 SCK PB7 ADCT RESET AREF VCC GND GND AVCC XTAL2 PC7 TOSC2 XTAL1 PC6 TOSC1 RXD PDO PC5 TXD PD1 4 INTO PD2 PC3 INT1 PD3 PC2 OC1B PD4 PC1 SDA OC1A PCO SCL ICP1 PD6 PD7 OCH 11 1 INT2 AINO 2 OCO AIN1
13. ec finished ec end ec ec ASRC S 1st Creating Cleaning project 5 ASRC S 0 ting to AVR COFF Converting to AVR Creating load file for Flash ting load file for E Extended COFF EPROM Extended Listing Creating Symbol Table S SRC c 1st all necessary flags and optional flags E 1 ASFLAGS NO NO NO mmcu MCU I Add target processor to flags S CFLAGS mmcu MCU Default target begin gccversion sizebefore S TARGET elf 5 TARGET eep S TARGI BEGIN 2 a Q ERRORS NON 5 MSG END Display size of file assembler with cpp ASFLAGS 155 S TARGET sym sizeafter finished end Studio 3 x does not check make s exit code but relies on following magic strings to be generated by the compile job sizebefore if f S TARGET elf then echo S ELFSIZE echo fi sizeafter if f S TARGET elf then echo S ELFSIZE echo fi Display compiler version information gccversion 85 CC version Conver AVR Studio or VMLAB COFFCONVERT OBJCOPY debugging change section address data 0x800 change section address bss 0x8000 change section address noinit 0x8 change secti
14. network it requires the developer to use a transceiver instead of using a stand alone radio frequency transmitter or receiver Transceiver will possible any two way communications and protocol to be embed in the sensor network PPP protocol can possibly be employed into the network so that the security and reliability of data are certainly sure Other than that transceiver enables both nodes to communicate each other sending acknowledgement to ensure data transmission and if necessary the node can resent any damage data Finally a research on traffic delay routing protocol and energy saving also should be done to establish the development of wireless sensor network The research will enhance the wireless sensor network performance in term of traffic delay longer operation time for each and effective bandwidth Other than that the optimal number of nodes and path can be obtaining to ensure the entire network work efficiently 52 REFERENCES 1 Warsuzarina Binti Mat Jubadi Embedded TCP IP In Sensor Nodes SENSORNETS Universiti Teknologi Malaysia November 2005 2 Forouzan Behrouz A 2001 Data Communications and Networking 2nd Edition McGraw Hill Higher Education 3 William Stalling Data and Computer Communication edition Prentice Hall 4 PonyProg website URL http www lancos com e2p ponyprog2000 html 5 ATMEL corporation Website URL http www Atmel com 6 Radiotronix datasheet Website URL www radiot
15. often use serial communication such as RS 232 to return information directly to the controller or computer through a serial port 19 Parts List Generally the sensor circuit consist the following components IC2 14 pin D4011BC 2 input NAND get R2 R3 R6 R7 470 ohm resistor R4 R5 R8 180K ohm resistor D1 02 D3 DA 4148 diode Probe any object that can conduct current D4011BC 1 180k Figure 3 4 Water Level Sensor Schematic Diagram In this system water level sensor is designed with a simple but reliable circuit to detect the existence of water at 4 present limits Figure 3 4 shows the sensor setup The component used during the sensor development are 14 pin 2 input NAND gate 04011 4 units 470 Ohm resistor 4 units 180K Ohm resistor 4148 Diode and 5 probes 4 probes are mounted on the circuit corresponding to water levels 1 2 3 and 20 4 Any object that is able to conduct current can be used as probe The probe will work together with VCC probe The VCC probe must be deployed deeply into the water LED is used as the indicator that represents the water level LED 1 represents level 1 and so on Diode that is attached at the output of the IC used to block any feedback current It can prevent any overload current from damaging the IC This sensor will operate at 9 V operating voltage Water level sensor starts functioning when the water level reached probe 1
16. similar voltage value The transmitter module can operate with the same level with the receiver module which is 5 volt So no signal distortions occur during the transmission It can be proves at channel 1 and channel 2 voltage reading at the bottom of oscilloscope display Channel 3 represents the signal sent from receiver node s USART transmitter This signal didn t experience any critical issue since the data from this pin was transmitted to computer using wired transmission 47 Transmitter 1 Ze Sent to Unido computer Autoset 4 ee Stop Bit Figure 4 12 Observed data during wireless transmission As the illustrated the result both transmitter ad receiver nodes had been determined Data may only capture by receiver node when the connection has been establish Same socket address must be used to obtain the result otherwise data transmitted from the transmitter node cannot be received at the receiver side 48 4 6 Graphical User Interface Graphical user interface was developed as the additional indicator of the water sensor system The GUI displays the current water level sense by the sensor node and transmitted to the receiver node As shown in figure 4 13 the GUI display shows that on Wednesday November 1 2006 at 1 09 02 PM the water indicate that the water level was at the range of 2 meter The level described as average and indicat
17. the ISP ISP header must supply power to the Dongle 2 MOSI Master Out Data being transmitted to the part being Slave In programmed is sent on this Pin 3 RESET Target Connect to target AVR Target AVR is Reset programmed while in Reset State 4 SCK Shift Clock Serial Clock generated by the Programmer 5 MISO Master In Slave Data received from part being Out programmed is sent on this pin 6 GND Ground Common Ground 741 5245 was an octal tristate buffer It used as the main component to the development of ISP cable It was used to provide the float state after the hex code has been written into the AVR chip The two loop back connections pin 2 to 12 and 3 and 11 is used to identify the ISP cable or so called as dongle With both links in place the dongle is identified as a Value Added Pack Dongle With only pins 2 and 12 links it is reported as STK300 or AVR ISP Dongle With only 3 and 11 the dongle is reported as an STK200 or old Kanda ISP Dongle 1 The LED implemented in this circuit was used as an indicator to detect the programmer It is very useful during uploading the program into the microcontroller The LED indicator will turn on when PC start up and it will blink when the code in written into the microcontroller Otherwise there might be an error arise during the programming 29 3 3 Software development Software development was the crucial part while developing this system A
18. to Data frame received Extracted data sent for at receiver node GUI display Figure 4 10 Communication terminals for wired data Figure 4 11 shows the wave generated during data transmission This data were collected at transmitter node s USART transmit pin receiver node s USART receive pin and receiver node s USART transmit pin The result consists of a start bit a stop bit and the original data as defined in the frame format The bits were defined out serially starting with the start bit of 0 followed by the MSB and end with stop bit of 1 The bits shifting operation was analyzed according to Big Endian Byte order As shows in the figure the same bit sequence that being transmitted from the transmitter was observed at the receiver node Apart of that there are some delays when sending the data from receiver node to the computer This scenario happen because data from transmitter must be extracted by the receiver before sending it back to the computer So the process only possible after the whole frame was received 46 Data transmitted at transmitter node M OSE ejssssususi nuassemususus ed data at Data receive at receiver and sent receiver node to PC Figure 4 11 Observed data during wired transmission 4 5 2 Wireless transmission Figure 4 12 shows data transmitted using wireless communication As shown in the figure at the bottom of the oscilloscope shows that all channels have the
19. K The numerous modulation techniques have their description On off key it can be described as a binary form of amplitude modulation Other than that amplitude modulation explains as a technique used in electronic communication usually for transmitting information using a carrier wave wirelessly Amplitude modulation works by varying the strength of the transmitted signal in relation to the information being sent 9 Next is the frequency modulation technique FM is a form of modulation which represents information as variations in the instantaneous frequency of a carrier wave In analog applications the carrier frequency is varied in direct proportion to changes in the amplitude of an input signal Digital data can be represented by shifting the carrier frequency among a set of discrete values a technique known as frequency shift keying 7 Besides FM the other modulation technique is frequency shift keying Frequency shift keying is a digital modulation scheme that conveys data by changing or modulating the frequency of a reference signal the carrier wave 10 Meanwhile Amplitude shift keying ASK is a form of modulation which represents digital data as variations in the amplitude of a carrier wave And finally Phase shift keying PSK is a digital modulation scheme that conveys data by changing or modulating the phase of a reference signal 2 3 Sensor network communication architecture Sensor network may operat
20. LAGS v v Define directories if needed DIRAVR c winavr DIRAVRBIN S DIRAVR bin DIRAVRUTILS DIRAVR utils bin DIRINC DIRLIB DIRAVR avr lib Define programs and commands SHELL sh CC OBJCOPY avr objcopy OBJDUMP avr objdump SIZE avr size Programming support using avrdude AVRDUDE avrdude HEXSIZE FSIZI J SIZI 5121 F Er p F Defin English MSG_ MSG_BEGIN GI Mes RRORS_NONE sages ll mrrors 62 target FORMAT A S TARGET elf none 5 TARGET hex begin MSG_END nd MSG_SIZE EFORE Size befor MSG SIZE B AFT ER Size after MSG COFF Conver MSG EX END MSG FLASH MSG M COFE Crea MSG EXTEN DED LISTING MSG SYMBOL MSG LINKI MSG COMPI MSG ASS MSG CLEAN Defin NG LIN ING 11 OBJ 5 5 Defin RC all TABLE G EMBLING Linking Compiling Assembling object files Eise listing files LST Combine 11 5 AVR th begin ec
21. NKING 58 5 S ALL CFLAGS 5 OBJ ED LISTING SQ ELF output file 50 Link create ELF output file from object files ECONDARY S TARGET elf output 50 LDFLAGS Compile create object files from C source files 10 3 0 echo echo 5 MSG COMPILING lt CC c CFLAGS lt o 508 Compile create assembler files from source files Ges t Bae CC S CFLAGS lt o Assemble create object files from assembler source files 5 0 SD echo echo S MSG ASSEMBLING lt CC c ASFLAGS lt o 560 Target clean project clean begin clean_list finished end clean_list echo echo 5 MSG CLEANING S REMOVE TARGET hex 5 REMOVE S TARGET eep REMOVE TARGET obj 5 REMOVE S TARGET cof S REMOVE S TARGET elf 5 REMOVE S TARGET map REMOVE TARGET obj 5 REMOVE TARGET a90 REMOVE TARGET sym 65 REMOVE 5 10 REMOVE TARGET lss REMOVE OBJ REMOVE LST REMOVE SRC c s REMOVE SRC c d Automatically generate C source code dependencies Code originally taken from the GNU make user manual and modified S README txt Credits Note that this w
22. PSM 1 hereby declared that I have read the content of this thesis and in my opinion it is suitable in terms of scope and quality for the purpose of awarding a Bachelor Degree in Electrical Engineering Telecommunication Signature Name PROF DR NORSHEILA BINTI FISAL Date 30 WATER SENSOR SYSTEM TRANSMITTER ZATULFARHA BT MD YAMAN Project Report Submitted as Partial Fulfilment Of the Requirement for the Degree in Bachelor of Electrical Engineering Telecommunication FACULTY OF ELECTRICAL ENGINEERING UNIVERSITI TEKNOLOGI MALAYSIA NOVEMBER 2006 I hereby declared that this thesis entitied Water Sensor System Transmitter is a result of my own research and idea except for works that have been cited clearly in the references Signature Name ZATULFARHA BT MD YAMAN Date 30 2006 Specially Dedicated to My beloved Mother Father Sisters Brother and Grandma Thank you for the never ending support encouragement and inspiration iii iv ACKNOWLEDGEMENT Alhamdulillah thank you to Allah for His blessing and finally ve completed final project successfully Peace upon our Prophet Muhammad S A W who has given light to mankind First of all I would like to express my gratitude to my father Mr Md Yaman B Jais my mother Mrs Salmah Bt Hj Hamid sisters Zatulhanne and Zatulnadia and finally my brother Mohd Farhan for their encouragement and support over 3 y
23. PSZ 19 16 Pind 1 97 PENGESAHAN STATUS TESIS JUDUL WATER SENSOR SYSTEM TRANSMITTER SESI PENGAJIAN 2006 2007 Saya ZATULFARHA BT MD YAMAN UF BESAR mengaku membenarkan tesis PSM Serjana Boktor Falsafah ini disimpan di perpustakaan Universiti Teknologi Malaysia dengan syarat syarat kegunaan seperti berikut Tesis adalah hakmilik Universiti Teknologi Malaysia Perpustakaan Universiti Teknologi Malaysia dibenarkan membuat salinan untuk tujuan pengajian sahaja Perpustakaan dibenarkan membuat salinan tesis ini sebagai bahan pertukaran antara institusi pengajian tinggi Sila tandakan 47 SULIT Mengandungi maklumat yang berdarjah keselamatan atau kepentingan Malaysia seperti yang termaktub di dalam AKTA RAHSIA RASMI 1972 Mengandungi maklumat TERHAD yang telah ditentukan oleh organisasi badan di mana penyelidikan dijalankan GAN PENULIS TANDATANGAN PENYELIA Alamat Tetap NO 33 JALAN BENTENG PROF DR NORSHEILA BINTI FISAL BARU Nama Penyelia Potong yang tidak berkenaan Jika tesis ini SULIT atau TERHAD sila lampirkan surat daripada pihak berkuasa organisasi berkenaan dengan menyatakan sekali sebab dan tempah tesis ini perlu dikelaskan sebagai SULIT atau TERHAD Tesis dimaksudkan sebagai tesis bagi Ijazah Doktor Falsafah dan Sarjana secara penyelidikan atau disertai bagi pengajian secara kerja kursus dan penyelidikan atau Laporan Projek Sarjana Muda
24. age is the similar output voltage from voltage regulator circuit The oscilloscope was set to 2V div therefore from the reading the signal vary into 2 ke box which is 2 5x2 5 volt 43 d D EI Mg Dg Tg Tag e s a eee amp Ground level Figure 4 7 Measured input voltage for processor board 4 4 Sensor data transmission Figure 4 8 show the changes of sensor data It shows that the water level changes from level 0 until level 2 The result was captured using hyperterminal during the transmission of sensor data using wireless module The data captured using ASCII format because the transmitter node was programmed to send the ASCII value as the level indicator uno Parity None _ Check Parity 1 2501 Level 0 Data bits Eight Recent Commands iveN RIS rDTR Off Ze Level 1 Connect Status Send Receive CTS DSR Log Files S eet 1 Bead from Write to gt 5 Create file App end to file v automatically Figure 4 8 Sensor data transmission hyperteminal 44 Figure 4 9 show the sensor reading during level 2nd level of water was detected The reading captured at the Usart Transmitter pin and read on the ISIS Proteus software The oscilloscope reading shows the wave generated in this transmission ASCII 2 represents Hex value 32 which is equal to
25. age level is out of range microprocessor may not detect the signal sent by the sensor In figure 3 1 the next step after selecting the appropriate sensor is sketching the system block diagram System block diagram illustrates each part on the system development It gives the brief idea on the water sensor system development Next is the water sensor and microcontroller circuit design using multisim software Then the circuit is simulated using the same software to ensure that the circuit is free from error After completing with the circuit design the project continus by assembling the circuit on the test board Then the circuit is tested using multimeter and oscilloscope Sensor circuit is tested to obtain the suitable voltage level according to the microprocessor s operating voltage range Other than that the microprocessor board must be tested to ensure that it receive the stable input voltage Stable input voltage refers to the steady voltage value supplied to VCC pin It is essential to obtain this level to make sure the microprocessor performs efficiently and to avoid any error from occurring during data transmission Hardware designing is the critical phase in this project Any failure on the hardware part will affect the overall system A troubleshoot and redo work must be done if any error is detected during the hardware development process The final step after hardware development is software development This phase involve a fe
26. and suggests the possible enhancement that can be done to improve the wireless sensor network performance 2 Literature Review 2 1 Wireless Sensor Network Overview Wireless sensor network describes accumulate numbers of nodes within an area It consists of distributed sensors to monitor physical or environmental conditions such as water level temperature sound vibration pressure motion or pollution taken at different locations Wireless sensor network development is originally inspired by military application such as battlefield surveillance The sensor nodes represent significant improvement compare to ad hoc sensor The major difference is in sensor networks the sensor can be placed directly to the phenomena Sensor network also allows the deployment in inaccessible terrain 2 1 1 Basic concept of wireless sensor network Most sensor node application aims at monitoring or detection of a phenomenon Sensor nodes are densely deployed either inside the phenomena or very close to it It can be an advantage to get the actual precise data compared to the conventional sensor Examples of sensor node application includes weather forecasting humidity detector wind speed detector earthquake detector by reading the vibration of earth surface water level sensor for flood prevention forest fire detection and wild life habitat monitoring Another unique feature for sensor node is its mobility and it can be remotely monito
27. cription 50 ohm antenna output The antenna port impedance affects output 1 ANT power and harmonic emissions An L C low pass filter may be needed to sufficiently filter harmonic emissions 2 GND Transmitter ground Connect to ground plane Digital data input This input is CMOS compatible and should be 9 driven with CMOS level inputs Pin 4 provides operating voltage for the transmitter VCC should be bypassed with a 01uF ceramic capacitor and filtered with a 4 7uF 4 VCC tantalum capacitor Noise on the power supply will degrade transmitter noise performance Mechanical Drawing ad 0 40 1 yA K 0 10 0 06 7 06 0 30 0 04 Figure 1 Mechanical Drawing of 433 5 Figure 2 Suggested Pad Layout 0 41 PIN 1 pA 0 10 2 06 097 8 0 32 Qoia 004 Figure 3 Mechanical Drawing of RCT 433 ASB Figure 4 Suggested Pad Layout 2 6 7 2005 RN ATmega8535 L Overview The ATmega8535 is a low power CMOS 8 bit microcontroller based on the AVR enhanced RISC architecture By executing instructions in a single clock cycle the ATmega8535 achieves throughputs approaching 1 MIPS per MHz allowing the system designer to optimize power consumption versus processing speed Block Diagram Figure 2 Block Diagram PAO PCO PC7
28. dn t be obtained 30 Y Applic Program s V Setup mak ompile pro 1 Figure 3 10 Software development flow chart Figure 3 11 shows the flowchart that describes the program written to read the sensor input The program began by port configuration PORT A at the microcontroller unit was assign as input port Nest step was reading the input port and then the data was compared to obtain the actual level of water Finally the data was store and used for the whole program 31 Gu Configure Port Port A as Input 1 Read Input Pin Port A 0F Data Level4 lex Data Level 3 Port A 03 No Data Level 1 Sensor Data Data Data Level 2 Figure 3 11 Sensor flowchart Based on figure 3 13 the program start by initialized the microcontroller Port In this system Port A from the microcontroller was used as the input port The steps followed by initialized the USART function Those USART initializing codes can be referring in the ATmega8535 Datasheet Water sensor system employs a serial communication to transfer between two microcontrollers The next step was read the sensor data Data read from sensor the stored as sensor data Next was inserted header which use as frame synchronization followed by addre
29. e OdBm output power and 4800 baud operation The RCT 433 AS module is ideal for remote application where low cost and longer range are required The 1 5 to 12 Volt operation voltages make it ideal for battery power applications The transmitter utilizes a Surface Acoustic Wave SAW stabilized oscillator to ensure precise frequency control for best range performance RCT 433 AS Figure 3 8 RF module 26 Figure 3 8 shows the RCT 433 AS transmitter module The transmitter module pin description is described in table 3 1 Table 3 1 RCT 433 AS pin descriptions Pin Pin Description No Name 1 ANT 50 ohm antenna output The antenna port impedance affects output power and harmonic emissions An L C low pass filter may be needed to sufficiently filter harmonic emissions 2 GND Transmitter ground Connect to ground plane 3 DATA Digital data input This input is CMOS compatible and should be driven with CMOS level inputs 4 VCC Pin 4 provides operating voltage for the transmitter VCC should be bypassed with a OluF ceramic capacitor and filtered with 4 7uF tantalum capacitor Noise on the power supply will degrade transmitter noise performance 3 2 4 ISP Cable One unique features offer by Atmega8535 is this chip can be program directly on the circuit board Atmel offer a package call The Atmel AVR ISP which is In System Programmer for Atmel s AVR Flash Microcontrollers The AVR ISP gives th
30. e transmitter module Figure 4 2 shows the sensor built up to measure the water level Next figure 4 3 shows the RF transmitter module used to convey data wirelessly from the transmitter node to the receiver node Processor board Sensor Board RF Transmitter modules Figure 4 4 shows a complete system developed for water sensor system on the transmitter node The prototype includes the processor board sensor board transmitter module and a water level modeler The sensor and processor board was powered by 9 Volt Lithium batteries At the processor board 9 volt lithium batteries connected to the voltage regulator to keep the supply lower than 5 Volt according to the microcontroller operating voltage The RF module use the same supply on the processor board since its operating voltage may vary from 1 5 V to 12 V 40 Figure 4 5 show the ISP cable which is In System Programmer for Atmel s AVR Flash Microcontrollers ISP simplified the code uploading process By using this cable developer may program the generated code directly on the circuit board Unlike the ordinary boot loader by using ISP cable developer doesn t have to plug out the microcontroller unit in order to load the hex file Water level Sensor Processor modeler board board Transmitter module Figure 4 4 Water Sensor System Prototypes 41 Figure 4 5 ISP Cable 4 2 Software Development The next phase of water sensor system development was buil
31. e OSI environment for user and also provide distributed information services Presentation Provides independence to the application process from difference in data representation syntax Session Provides the control structure for communication between applications establish manage terminate the connection between cooperating systems Transport Provides reliable transparent transfer of data between end points provides end to end error recovery and flow control Network Provides upper layers with independence from the data transmission and switching technologies used to connect system responsible for establishing maintaining and terminating connections Data Link Provides the reliable transfer of information across the physical link sends blocks frame with necessary synchronization error control and flow control Physical Concerns with transmission of unstructured bit stream over physical medium deals with mechanical electrical functional and procedural characteristics to access the physical medium This system deploys the first 2 bottom layer of OSI model which consist of Data link and Physical layer Non standard protocol is implemented for the system for communication Physical layer provides the electrical and mechanical interface to the network medium which is represented by the wireless link By providing the interface it offers data link layer the ability to transport a stream of serial data bits betw
32. e block diagram which include a sensor radio frequency transmitter and a Microcontroller is shown in figure 3 3 Water level sensor was linked to Port A Radio frequency module connected to Port D and ISP cable as the code downloader was connected to Port B 18 ISP Connector Water Level Sensor TX Module 433 MHz Figure 3 3 Transmitter Node Block Diagram Transmitter node design consists of water level sensor schematic circuit and microcontroller schematic circuit Both sensor and microcontroller schematic circuits are showed in figure 3 4 and figure 3 7 Data from sensor is linked to the microcontroller board by a direct wire The microcontroller then processes the data captured by water level sensor and as a final step the data is sent over the network using radio frequency transmitter that operates in 433MHz 3 2 1 Sensor Sensor can be described as any device that receives a signal or stimulus and react to it in a distinctive manner or in other words sensor is an electronic device used to measure a physical quantity such as temperature pressure or loudness and convert it into an electronic signal of some kind e g a voltage Sensors are normally components of some larger electronic system such as a computer control or measurement system Analog sensors most often produce a voltage proportional to the measured quantity The signal must be converted to digital form with an ADC before the CPU can process it Digital sensors most
33. e can be downloaded into the microcontroller unit It is essential to ensure that right memory location has been chosen for the programming either in flash or EEPROM memory The full Ponyprog setup enclosed in appendix D 4 RESULTS AND ANALYSIS Overall this chapter discussed the result attained from the system development and analysis for each result The result was obtained from both wired and wireless communication Result obtained from these system output measured using oscilloscope and the data transmitted can be read using USART terminal Some of the result was captured using ISIS Proteus software Wave captured from this software was similar with the data captured by the oscilloscope To obtain the result this software read the data from RS232 connector that connected from the microcontroller board to the computer The results have been analyzed to guarantee data collected at the receiver node is similar as transmitted at the transmitting node 4 1 Hardware Development As mentioned in chapter 3 water sensor system design process divided onto three phases which are the electronic design or the hardware development sensor node programming or the software development and final phase the overall system testing development This system successfully completed the first phase of the system development which is the development of electronics components 39 Figure 4 1 shows the completed processor board connected with th
34. e developer a compact and reliable programming tool to program all In System Programmable AVR microcontrollers through a 6 or 10 pin ISP connector The AVR ISP uses AVR Studio Atmel s Integrated Development Environment IDE for code writing and debugging The programming software is user friendly and can be controlled from both a Windows environment and a DOS command line interface 27 Instead of using AVR ISP offer by the Atmel developer also can build its own ISP cable This ISP cable has the similar function with AVR ISP offered by Atmel The ISP cable schematic diagram was illustrated in figure 3 9 This cable was cheap and effortless to build up It can be the ideal starting for the developer ISP Conn D Connector Figure 3 9 ISP cable Schematic Diagram Components required in order to develop ISP cable are a DB25 connector 741 5245 chip 6 pin header a 470 ohm resistor a LED as a power indicator and jumper cables There are 6 signals to be implemented in developing an ISP cable It consist Master Out Slave MOSI pin Master in Slave out MISO pin Shift Clock SCK pin and RESET pin Another 2 pin are for VCC and ground The function of ISP Connector pin is explained in table 3 2 The pin sequence followed the ISP conn pin header in the schematic 28 Table 3 2 ISP connector pin descriptions Pin Name Function Description No 1 VCC ISP Power Power supply for
35. e in different geographic areas and in any unsecured environment therefore security should be built into the design Network techniques are needed to provide low latency survivable and secure networks Low probability of detection communication is needed for networks because sensors are being envisioned for use behind enemy lines For the same reason the network should be protected against intrusion and spoofing 12 The approach to design protocols for sensor networks is driven by the requirements of the physical layer The protocols should be developed according to the choice of physical layer components such as the type of micro processors and the type of RF modules 11 The approach of the wireless sensor node also highlights the importance of the application layer network layer MAC layer and physical layer to be integrated with sensor nodes hardware Sensor network protocol has to be aware of the hardware and able to use special features of the microcontroller and transmitter to minimize the sensor node s power consumption Those approaches to design the protocol describe how data communications should take place In OSI model each layer performs the function required to communicate with another system Every layer provides service for its higher layer Table 2 1 validates the function of every layer in OSI Model 11 Table 2 1 The OSI function Layers Function Application Provides access to th
36. ears of my education period in UTM Skudai Allow me to convey my appreciation to my honorable supervisor Prof Dr Norsheila Bt Fisal for inspired and assist me to complete this project Thank you to her for sharing the fascinating knowledge and her patient to instruct me in order to complete this task This appreciation also dedicated to my friends Diyana Dedeq Karl Mazru Tla Mala Nusi Areff Ajis Jenny and Iema for lending their help and support in order to complete this project Thank you for all the contribution towards the successful of my project Finally I would also like to express heartfelt appreciation to all individuals who have directly or indirectly offered help support and suggestions contributing towards the successful completion of this project Thank You 5 The development of sensor networks requires technologies from three different areas which is sensing processing and communication including hardware software and algorithms A sensor node basically is equipped by one or more sensor small microcontroller radio transmitter and receiver and finally an energy source Overall this project explains the development of water level sensor in a wireless sensor network Three different phases involved while developing this project which are sensor node hardware design sensor node programming and as a final point the overall system development The project began with the development of water l
37. een two nodes in the system The physical layer is also responsible for making sure that the bits are safely sent from one place to another by considering other factors such as modulation technique and deals with the electrical characteristics of the wireless link 12 2 4 Water Level Sensor For the environment application variety choices of water level sensors have been manufactured and produced These water level sensors mostly employ a high technology system to measure a very accurate level for examples ultrasonic water level sensor produced by Global Water Instrument INC The system uses the latest ultrasonic distance measuring technology for accurate non contact water level monitoring The fully encapsulated sensor transmitter is temperature compensated and provides an industry standard 4 20 MA output There are three ranges available including 1 3 6 and 35 to meet a wide variety of applications The unique 1 range ultrasonic water level sensor is ideal for measuring flow in small flumes and weirs The 3 and 6 ultrasonic water level sensor ranges are best for measuring river lake and tank levels and for measuring open channel flow in larger flumes 10 Figure 2 2 shows the non contact water level measurement by Global Water Instrument Figure 2 2 Non Contact Water Level Measurement 13 Besides ultrasonic technology water level alarm sensor by Global Water is also a unique choice It is a sol
38. el section Then when the sensor sense the first level of the water the second level in GUI will assign green color This process will continue until the water reached the highest level where the message 4 meter critical will appear on screen The following figures have summarized the operation of GUI for this system amp Water Sensor System Dis Wednesday 11 1 2606 1 07 12 Water Level Level Water is Low a amp Water Sensor System ol x Wednesday 11 1 2006 1 08 16 PM Water Level Level 1 Meter b 12 amp Water Sensor System x Wednesday 11 1 2006 1 09 02 PM Water Level Level 2 Meter c amp Water Sensor System s SE Wednesday 11 1 2006 1 09 50 Water Level Level 3 Meter d Water Sensor System of x Wednesday 11 1 2006 1 11 39 PM Water Level Level 4 Meter Critical 1 e GUI result a No level b Level 1 c level 2 d level 3 and e level4 APPENDIX D PONYPROG MANUAL 74 How to use PonyProg2000 for the Microrobot AVR Products Rev 0 3 Contents What is PonyProg2000 How to install Preparation How to download a program using PonyProg2000 What is PonyProg2000 PonyProg is a serial device programmer software with a user friendly GUI framework available for Windows95 98 2000 amp NT and Intel Linux Its purpose is reading and writing every serial device At the moment it s
39. ency RCT 433 AS RCT 433 ASB control for best range performance Output power and harmonic emissions are easy to control making FCC and ETSI compliance easy The manufacturing friendly SMT style package and low cost make the RCT 433 AS suitable for high volume applications The RCT 433 ASB is suitable for IR reflow ovens and hot air soldering Ordering Information Frequency Part Number 433 92 2 RCT 433 AS 433 92 2 RCT 433 ASB Domestic and international orders Mouser Electronics 1 800 346 6873 http www mouser com Future Electronics http www futureelectronics com For a Radiotronix Representative in your area please visit www radiotronix com and visit our corporate information page Document Control Created By Steve Montgomery 05 21 02 Engineering Review Tom Marks 8 21 03 Marketing Review Bryan Montgomery 8 21 03 Approved Engineering Tom Marks 8 21 03 Approved Marketing Bryan Montgomery 8 21 03 Revision History Revision Author Date Description 1 1 0 SJM 05 21 02 Document Created 1 2 0 BFA 07 30 03 Revision 1 3 0 SJM 8 21 03 Revision Added troubleshooting and design tips 1 4 0 GWH 6 7 05 Added RCT 433 ASB specification to datasheet li RCT 433 AS Low Cost SAW stabilized surface mount OOK RF transmitter 2001 2002 2003 All Rights Reserved Pin Out Diagram Pin Description Pin No Pin Name Des
40. ensor network is linked by a form of radio frequency module infrared or optical media Various transmission medium enable global operation of these networks worldwide For example the radio frequency module and a variety of modulation technique can be used to be implemented in the wireless sensor network The selection of the modulation technique also is depends on other factors discussed previously Various frequency bands are available for sensor nodes applications The last factor that influences the design of wireless sensor network is power consumption The wireless sensor node can only be equipped with a limited power source One of the examples is the 3 9 V battery sources In some application scenarios replacement of power resources might be impossible The sensor node lifetime strongly depend on battery source 2 2 Radio frequency modules Radio Frequency modules are partially complete circuits that can be incorporated into larger designs RF modules include receivers transmitters and transceivers RF modules employ numerous dissimilar modulation technique and radio system An examples of modulation technique used in RF module is Phase shift keying PSK which is a digital modulation scheme that conveys data by changing or modulating the phase of a reference signal the carrier wave Other examples are amplitude modulation AM Frequency modulation FM Amplitude shift key ASK Frequency shift key FSK and Phase shift key PS
41. es by the yellow label This colour indicator will change accordingly to the increments of the water level The changes of water level indicator were enclosed in appendix C amp Water Sensor System o x Wednesday 11 1 2006 1 09 02 PM Water Level Level 2 Meter Figure 4 13 GUI water level indicators 5 CONCLUSION AND SUGGESTION 5 1 Conclusion By the end of the day this water sensor system has successfully achieved its main objective The system was successfully created with the ability to do sensing processing and communicate between the nodes This system completes the main task which is to sense the existence of water and measure several point of water before it burst the maximum level and transmit the collected data to the receiver node for further action Furthermore this water sensor system is able to perform its operation in a real time operation with a tiny delay In some way by implement this water sensor system might be helping resident within the flood area to get prepare before the flood happen By implementing this system it can as well as reducing the resident loss due to flood The best way to implement this system is putting the sensor at the police station or neighborhoods center The person who is on duty that day will inform if any danger encounters the resident area and ask them to prepare pack their goods and move to safety places Besides contribute as the flood alarm thi
42. evel sensor which is to sense 4 different level of water and send the data to the microprocessor The microprocessor then processes the data and sends the data to the receiver Meanwhile at the receiver part the data will be extracted and filtered Finally the sensing data will be detected and processed to be display into the computer Result and data are capture and analyze throughout the project to ensure the system function properly At the end of the day the entire project functions effectively The transmitter node able to sense 4 deterrents water level and transmit the sensor data encapsulated with header address and checksum to the receiver via wireless medium While at the receiver node the sensor data was successfully extracted from the header address and checksum Then the sensor data was transmitted to computer to display the current water condition 5 Pembangunan rangkaian penderia mengadaptasikan teknologi daripada 3 bidang yang berbeza iaitu penderia pemproses and rangkaian perhubungan termasuk perkakasan perisian dan algoritma Pada amnya nod penderia dilengkapi dengan satu atau lebih penderia mikro pengawal penghantar dan penerima radio serta bekalan tenaga Secara keseluruhan projek ini menerangkan tentang proses pembangunan penderia paras air yang beroperasi dalam rangkaian penderia tanpa wayar tiga fasa yang berbeza terlibat dalam proses pembangunan projek ini iaitu pembangunan perkakasan nod pe
43. f 3 ee warning RECEIVER 3 within comment 25 warning sensors data might be used uninitialized in this functior 20 warming chksum might be used uninitialized in this function pum UIPslip elf gcc 8535 g 0s funsigned char funsigned bitfields Creating ols file ie Flash avr objcopy 0 ihex eeprom UIPslip elf UIPslip hex Creating load file for EEPROM avr objcopy x E iore idee ap tH poe gee eeprome al Lech A change sect eeprom 0 UiPslip elf 010613 Int main void FCT X 0 warning TRANSMITTER unsigned char sen_data telse warning RECEIVER unsigned char rx data ctr sensc andit unsigned char hdr 2 hf unsigned char add 12 unsigned char chksum CENE Extended Listing 019511 avr objdump h S UIPslip elf gt 155 Creating Symbol Table UIPsli1p sym avr nm n UIPslip elf gt UIPslip sym Initialize portc Oxf Ff PORTS 0 section size adde set Ip Figure 4 6 C Language program in WinAVR Programmer Notepad 4 3 Measured Voltage Figure 4 7 shows the voltage supply connected to microcontroller VCC input pin The purpose of measuring the supply voltage is to ensure that the microcontroller was supplied with a stable voltage This volt
44. he 35 program didn t recognize the registers use in the program Afterwards the makefile was saved in the same folder for source code file In order to clean any existing file except for the code and makefile make clean command was choose in the tools panel Finally choose make all command in the tools panel to make all file for the program such as filename lst filename obj and filename hex Those three file is the code used and will be uploaded into the microcontroller Figure 3 14 show the programmer notepad of WinAVR window environment The main program is shown at the back window and the upper windows illustrate the makefile setup for the system main program amp Programmers Notepad 2 main c 8 Ele Edit Tools avr gcc 3 4 3 Copyrigh 2004 Free Software Foundation Inc This is free software see the source for copying conditions There is NO not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE define baudrate FOSC 16 BAUD 1 include avr io h include lt stdio h gt Size before Hipp elt define TX 1 void usaRT INIT unsigned int UBRR void USART TX unsigned char data unsigned char USART RX void void delay 1m unsigned char i void ADC INIT void unsigned char ADC READ void void TMRO INIT void int main void if Tx 0 warning TRANSMITTER unsigned char sen_data else
45. he data to other node so the network wont break or fall apart This will be a challenge in deployment a large scale wireless sensor network This project may be enhancing by implementing a smaller size sensor compare to the one that have been develop in this project A smaller sensor will suit the criteria of a wireless sensor network which is developing a tiny node that equivalent to the coin size Other than that a study about power consumption should be perform so that the nodes might work in a longer time and an effective data may be delivered thus distortion can be avoided 51 Furthermore sensor node should apply more than one sensor so that the real sensor network can be performing with a complete protocol Beside that the development of multi hop wireless sensor network also recommended for future work so that the many sensor node can interact each other Moreover a complete protocol should be implementing in the wireless sensor network to ensure the reliability and security of data The data sent over the network shouldn t be lost or damage If this happen if may effect the entire network and the actually sensing data is not possible to obtain Moreover a central node should be developing to gather all data from its network This central may collect the data from its network and store the data into a database to keep record for further reference if anything happen in the environment In order to develop the entire sensor
46. id state water sensor for detecting the presence of conductive solutions such as water spills water tank levels and drainage ponds The water alarm sensor features two stainless steel electrodes that are positioned at a desired point for liquid detection When fluid is detected a relay closes in the water level alarm and the signal can be used to sound an audible alarm or close a switch inside a piece of remote monitoring equipment The relay output is fully isolated and can handle 2 amps of current If the water level alarm sensor sense in a dry conditions the detection sensor will automatically reset without requiring additional service The water level alarm is rugged and durable and requires minimal maintenance The water level alarm has many uses including surface water monitoring precision level detection water level control high water indication and submersible marine low level indication 10 Figure 2 3 shows the high water indicator and low level water controller that can be implemented as the alternative sensor for this system Figure 2 3 High water indicator and low level water controller 3 METHODOLOGY 3 1 Introduction This chapter describes the method used in order to complete water sensor system It consists of the design process of water sensor system The development of water level sensor has been made possible by a number of technological developments including the miniaturization of electronics
47. ill work with sh bash and sed that is shipped with WinAVR 5 the SHELL variable defined above This may not work with other shells or other seds set e sed s CC MM 11 CFLAGS lt ND NG OL SIP NI 20 s 58 rm SG Remove the if you want to 8 the dependency files generated include SRC c d Listing of phony targets all begin finish end sizebefore sizeafter gccversion coff extcoff clean clean_list program APPENDIX MODULE SHEET ATMEL 8535 BLOCK DIAGRAM RCT 433 AS ASB 9 8 adiot Low Cost SAW stabilized surface mount Embedding the wireless future OOK RF transmitter Typical Applications Features e 315 418 433 92 MHz versions Low Cost e 1 5 12V operation 5mA current consumption at 3V Smallsize e Remote Keyless Entry e Remote Lighting Controls e On Site Paging e Asset Tracking e Wireless Alarm and Security Systems e Long Range RFID e OdBm output power at 3V e Automated Resource Management e 4800 baud operation Description The RCT 433 AS is ideal for remote control applications where low cost and longer range are required The transmitter operates from a 1 5 12V supply making it ideal for battery powered applications The transmitter employs a SAW stabilized oscillator ensuring accurate frequ
48. nclude tracking the movements of birds small animals and insects monitoring environmental conditions that effects may harm the surroundings such as forest fire detection flood detection and precision agriculture Wireless Sensor network application Figure 2 1 Wireless sensor network applications Other than environmental applications employing the wireless sensor network for health application can be very useful Some health application based on wireless sensor network provide interfaces for the disabled integrated patient monitoring wireless diagnostics remote drug administration in hospitals monitoring the movements and internal processes of insects or other small animals telemonitoring of human physiological data and tracking and monitoring doctors and patients inside a hospital With the rapid growth in technology applying wireless sensor network for home appliance is one of the best ideas A smart home technology demands a tiny node to be implemented directly to home appliance and help the owner manage their home devices remotely The other implementations for wireless sensor network are the commercial applications such as monitoring material fatigue building virtual keyboards managing inventory monitoring product s quality constructing smart office spaces and environmental control in office buildings 2 1 3 Factors influencing sensor network design The factors that drive the design of sensor networks and sens
49. nderia pembangunan aturcara dan akhir sekali pembangunan keseluruhan system Pembangunan sistem ini bermula dengan merekabentuk penderia paras air Penderia ini mempunya keupayaan untuk mengesan 4 paras air dan seterusnya menhantar data yang telah diperolehi terus kepada mikropengawal Manakala pada nod penerima pula data yang dihantar akan diasingkan dan ditapis Seterusnya data yang dikesan pada penderia di nod pemancar akan dikesan dan diproses untuk tujuan paparan pada komputer Di sepanjang pembangunan sistem ini setiap data dan keputusan akan dianalisis untuk memastikan keseluruhan projek berfungsi dengan baik Secara keseluruhannnya projek ini berfungsi dengan baik Nod ini berjaya mengesan 4 paras air dan menghantar data yang telah ditambah dengan kepala dan alamat data ke nod penerima menggunakan medium tanpa wayar Manakala pada nod penerima data ini akan diekstrak dan hanya data dari penderia akan dihantar ke komputer untuk memaparkan keadaan air dari masa ke semasa 1 TABLE OF CONTENTS TITLE TITLE DECLARATION DEDICATION ACKNOWLEDGEMENTS ABSTRAK ABSTRACT LIST OF TABLES LIST OF FIGURES LIST OF ABBREVIATIONS LIST OF APPENDICES INTRODUCTION 1 1 Overview 1 2 Problem Statement 1 3 Objectives 14 Scope of work 1 5 Thesis outline vii PAGE ii jii iv vi xi xiii xiv 2 3 4 LITERATURE REVIEW 2 Wi
50. ng processing and communicating between nodes The sensor involved in this project is water level sensor Most wireless sensor network developments are implemented close to the actual phenomena The water level system is linked to a water level sensor so it can measure 4 levels of water before it reaches the maximum level In order to apply this sensor it must be placed near the riverbank This sensor needs to be controlled by a microcontroller and the data might be sent via the wireless network By completing this sensor node perhaps it can perform accordingly to the design and present its task successfully 1 4 Scope of work In general this project was divided into 2 parts the transmitter and the receiver Each part was developed separately and combined at the end of this project The development of transmitter node consists of 3 main stages which are the hardware development software development and finally a complete system development First and foremost this project focuses on the development of a sensor node that can communicate wirelessly in wireless sensor network Figure 1 2 shows the block diagram of the system development First it is necessary to get the overview and learn deeply this system functions Next is the hardware development in wireless sensor network Commonly a sensor node consists of a microprocessor a sensor a radio frequency transmitter and power supply Complete systems block diagram need to be designed and
51. ntf lprintf min Floating point printf version requires lm below DELAGS Wl u vfprintf lprintf flt im math library LDFLAGS lm Programming support using avrdude Settings and variables Programming hardware alf avr910 avrisp bascom bsd dt006 pavr picoweb pony stk200 5 12 stk200 stk500 61 Type avrdude c to get a full listing AVRDUDE_PROGRAMMER stk500 AVRDUDE PORT coml programmer connected to serial device AVRDUDE PORT 1 1 programmer connected to parallel port AVRDUDE WRITE FLASH U flash w TARGET hex AVRDUDE WRITE U eeprom w TARGET AVRDUDE FLAGS p P S AVRDUDE PORT c 5 AVRDUDE PROGRAMMER Uncomment the following if you want avrdude s erase cycle counter Note that this counter needs to initialized first using s avrdude manual AVRDUDE ERASE y Uncomment the following if you do not wish a verification to be performed after programming the device AVRDUDE FLAGS 4 V Increase verbosity level Please use this when submitting bug reports about avrdude See http savannah nongnu org projects avrdude to submit bug reports AVRDUDE F
52. ome devices require Flash Fuse Bits Setting for the desired clock source setting For example CKSEL3 0 bits of the ATmega8535 and Atmega8515 devices need to be set 1 to JT select the External Crystal clock source mode Refer to Clock Options of the device sheet for the detailed bit setting If you need to set the bits select Command gt Security and Configuration Bits Click on Read button uncheck the CKSEL3 0 bits and then click on Write button Fig 1 6 shows a Security and Configuration Bits dialog box as an example Configuration and Security bits Bootlocc12 Boatlockil 2 BootlockOl Lock2 Locki Ir 885350 EESAYE Iv BOOTSZ1 Rv 80015201 BOOTRST 1 1 1 1 Uncheck 1 Refer to device datasheet pleas Carcel Cea All wike Read Note If the board has an AT90S type CPU instead of ATmega type the setting is not reguired Select File gt Open Program File and load the rom or hex file Select Command gt Program or press Ctrl to start the downloading If no Program Failed message appears the downloading has been completed successfully www microrobot com
53. on address prom 0x8 63 echo MSG SIZE echo MSG_SIZE_AFTE ELF to COFF for use in debugging simulating in 000 00 00000 10000 coff 5 TARGET elf echo echo 5 MSG COFF TARGET cof coff avr lt S TARGET cof extcoff TARGET elt echo echo S MSG EXTENDED COFF TARGET cof coff ext avr lt TARGET cof Program the device program TARGET hex TARGET eep 5 AVRDUDE AVRDUDE FLAGS 5 AVRDUDE WRITE FLASH 5 AVRDUDE WRITE Create final output files hex p from ELF output file S elf echo echo MSG_FLASH 5 S FORMAT R eeprom lt 58 S elf echo echo MSG_EEPROM S OBJCOPY j prom set section flags eeprom alloc load change section lma prom 0 S FORMAT lt 508 5 188 elf 64 Creat xtended listing file from ELF output file echo echo MSG EXTEND S OBJDUMP h S lt gt 50 Create a symbol table sym elf echo from echo MSG SYMBOL TABLE avr nm n SQ PRECIOUS 5 080 elf OBJ echo echo S MSG LI
54. or nodes also cannot be neglected These factors are important because they serve as a guideline to design a protocol for sensor networks In addition these influencing factors can be used to compare different schemes 11 Sensor network design can be influence by numerous factors includes fault tolerance Fault tolerance is the ability of wireless sensor network to sustain network functionality without any interruption due to sensor node failure 11 Low fault tolerance is required for low interference environment and vice versa The other factor is production costs Cost of each sensor nodes has to be kept low The cost should not be above than Bluetooth and satellite technology Besides cost a hardware constraint is also the main factor that influences sensor network design Sensor node is made up of four basic components including sensor microprocessor radio frequency module and power unit The implementation processor board is depends on the application or sensor used by the sensor node Environment also can be the main factors that influence the sensor node design The sensor nodes can directly deploy to the actual phenomena It also may work in remote geographic areas The sensor node can also work under high pressure in the bottom water in harsh environment and also under extreme heat and cold So the correct component must be selected to ensure the performance of the sensor node The next factor is the transmission media Wireless s
55. pleting this system are WinAVR and PonyProg 3 3 1 1 WinAVR The initial step was writing the source code in C programming language For this purpose the code can be written in Visual C notepad or WinAVR programmer notepad On the other hand for compiling purpose a WinAVR code compiler was used to compile the written program and generated the Hex file This software was choose since it offer a complete development tools including the programmer notepad compiler Assembler linker AVR library file converter debugger and so on WinAVR compiler was complete software while developing this project It is flexible and can be hosted on many platforms Furthermore WinAVR can target many different processor and extremely compatible for most Atmel s ICs There are a few steps to be followed while writing a program using this software First step was writing the source codes and save it in a specified folder Then save the file created according to the source codes language For example asm c etc In this case the file must be saved as filename c After that the next step was edited the makefile according to the target device Makefile is a text file that that lists and controls the program and the microcontroller unit Three changes need to be done First change the PRG and OBJ to the name of the source code and lastly edit MCU_TARGET depends on what type of microcontroller used If these steps were missing an error may occur because t
56. red To achieve this remote access monitoring sensor node can be connected to an existing network infrastructure such as the global internet local area network or private intranet Since the sensor node is equipped by on board processor instead of sending the raw data to the node responsible for the fusion sensor node uses its processing ability to locally carry out simple computation and transmit only the required and partially processed data 2 1 2 Application of wireless sensor network The range of wireless sensor network usage can vary from ecological to social applications in everyday world Figure 2 1 shows some examples of sensor network applications which can generally be categorize as military applications environmental applications Health applications home applications and other commercial applications In the military application the implementation of wireless sensor network is the best idea since sensor networks are based on the dense deployment of disposable and low cost sensor nodes Destruction of some nodes by hostile actions does not affect a military operation as much as the destruction of a traditional sensor which makes sensor networks concept a better approach for battlefields 11 Similar with the implementation of wireless sensor network in the battle field implementing the wireless sensor network for environmental application might be very helpful Some examples of environmental applications of sensor networks i
57. reless Sensor Network Overview 2 1 1 Basic concept of wireless sensor Network 2 2 Application of wireless sensor Network 2 1 3 Factors influencing sensor Network design 2 2 Radio frequency modules 2 3 Sensor network communication Architecture 24 Water Level Sensor METHODOLOGY 3 1 Introduction 3 2 Hardware Development 3 2 1 Sensor 3 2 2 Processor 3 2 3 RF Module 3 2 4 ISP Cable 3 3 Software development 3 3 1 Code development 3 3 1 1 WinAVR 3 3 1 2 PonyProg RESULT AND ANALYSIS 4 1 Hardware Development 4 20 Software Development 4 3 Measured Voltage 10 12 14 14 18 21 25 26 29 34 34 36 38 41 42 5 4 4 Sensor data transmission 4 5 Data Transmission between Sensors Nodes 4 5 1 Wired transmission 4 5 2 Wireless transmission 4 6 Graphical User Interface CONCLUSION AND SUGGESTION 5 1 Conclusion 5 2 Discussion and Future Work REFERENCES APPENDIX A D ix 43 44 44 46 48 49 50 52 54 77 TABLE 2 1 3 1 222 LIST TABLES TITLE The OSI function RCT 433 AS pin descriptions ISP connector pin descriptions PAGE 11 26 28 FIGURE 1 1 1 2 2 1 2 2 2 3 3 1 3 2 3 3 3 4 3 5 3 6 3 7 3 8 3 9 3 10 3 11 3 12 3 13 3 14 3 15 4 1 4 2 4 3 4 4 4 5 4 6 LIST OF FIGURES TITLE Flash flood incident in Johor Bharu System development processes Wireless sensor network applications Non Contact Water Level Measu
58. rement High water indicator and low level water controller Hardware development Flow chart Wireless sensor network block diagram Transmitter Node Block Diagram Water Level Sensor Schematic Diagram Atmega8535 pin configuration Voltage regulator schematic diagrams Microcontroller Board Schematic Diagram RCT 433 AS transmitter module ISP cable Schematic Diagram Software development flow chart Sensor reading flowchart Transmitted data frame format Data Transmission flow chart WinA VR notepad and makefile window PonyProg window Processor board Water level sensor RF Transmitter modules Water Sensor System Prototypes ISP Cable C Language program in WinAVR Programmer Notepad 12 13 16 17 18 19 05 22 24 25 27 30 31 32 33 35 36 39 39 39 40 4l 42 4 7 4 8 4 9 4 10 4 11 4 12 4 13 Measured input voltage for processor board Sensor data transmission hyperteminal Sensor data transmission oscilloscope Communication terminals for wired data Observed data during wired transmission Observed data during wireless transmission GUI water level indicators xii 43 43 44 45 46 47 48 ADC AVRGCC AVR RISC COMI CPU EEPROM FTP ISP KB LSB MHz MSB OS PPP RAM RF Rx SLIP TCP IP UDP USART xiii LIST OF ABBREVIATIONS Analog to Digital Conversion AVR GNU Compiler Collection AVR Reduced Instruction Set Computer Serial communication port 1 Central Processor
59. ronix com datasheets RCT 433 AS pdf 7 Wikipedia Website URL http en wikipedia org wiki mainpage 8 Ismahayati Binti Adam Development Of Embedded Uip Sensor Node For Sensing Light Transmitter Universiti Teknologi Malaysia May 2006 9 answer com URL www answer com 10 Water Level Sensor website URL http www globalw com 53 11 LF Akyildiz W Su Y Sankarasubramaniam E Cayirci Wireless sensor networks a survey Broadband and Wireless Networking Laboratory School of Electrical and Computer Engineering Georgia Institute of Technology Atlanta GA 30332 USA 12 Yee and S P Kumar August 2003 Sensor Networks Evolution Opportunities and Challenges IEEE Proceedings Vol 91 No 8 1247 1256 APPENDIX A TRANSMITTER NODE SOURCE CODES TRANSMITTER NODE MAKE FILE define FOSC 8000000 Clock Speed define BAUD 1200 define baudrate FOSC 16 BAUD 1 include lt avr io h gt include lt stdio h gt define TX 1 void USART_INIT unsigned int UBRR void USART_TX unsigned char data unsigned char USART RX void void delay lm unsigned char 1 void ADC INIT void u v nsigned char ADC_READ void oid TMRO_INIT void H nt main void if TX 0 warning TRANSMITTER unsigned char sen_data else warning RECEIVER unsigned char rx_data ctr sensor_data chksum_ endif
60. s system also offers the other benefit where it can be use to measure water level in the dam It might help certain area that facing the water supply problem 50 5 2 Discussion and Future Work Implementation of TCP IP protocol in a wireless sensor network was said to be a hard task due to limitation of memory in the microcontroller In a very limited memory sizes wireless sensor network developer should employ the gathered sensor data as well as the protocol data into the microcontroller and finally sending the processed data to the receiver The processed data that sent through the network including data header IP address sensor data and checksum Different from computer communications sensor network didn t have specific server to allocate and generate its own IP address In wireless sensor network the developer should assign its own IP address for each sensor or nodes depending on the network size The wireless sensor networks form a temporary network without any deployed infrastructure or centralized organization Each node that communicates each other has an independent algorithm The deployment of wireless sensor network also said to be critically in term of power efficiency A node in wireless sensor network is not only performing as a host but in order to communicate each other in the network a node also performs as a router Due to these reason the node has conflicting of saving energy for its own transmission and relaying t
61. sion QN optimization level E 2 tuning see gcc manual and avr libc documentation Wall warning level Was tell GCC to pass this to the assembler ahlms create assembler listing 60 CFLAGS g 05 funsigned char funsigned bitfields fpack struct fshort enums Wall Wstrict prototypes Wa adhlns c lst S patsubst I EXTRAINCDIRS Set a language standard compiler flag Unremark just one line below to set the language standard to use gnu99 C99 GNU extensions See manual for more information CFLAGS std c89 CFLAGS std gnu89 CFLAGS std c99 CFLAGS std gnu99 Optional assembler flags Way e tell GCC to pass this to the assembler ahlms create listing gstabs have the assembler create line number information note that for use in COFF files additional information about filenames and function names needs to be present in the assembler source files 5 avr libc docs FIXME not yet described there ASFLAGS Wa adhlns S 1st gstabs Optional linker flags Wlgg pati tell GCC to pass this to linker Map create map file cref add cross reference to map file LDFLAGS W1 Map TARGET map cref Additional libraries Minimalistic printf version DELAGS Wl u vfpri
62. ss as the indicator receiver port name into the frame Then sensor data was inserted into the 92 frame followed by checksum Checksum is error detecting code based a summation operation performed on the bits to be check The formula to generate Checksum Code is Checksum Header Header Addressl Address Data The sensor data then send through the network in a form of frame as shown in figure 3 12 Header Address Sensor Data Checksum 2 Bytes 2 Bytes 1 Bytes 1 Bytes 3 12 Sensor data frame format 33 Start 24 Initialize port Initialize USART Read Sensor Data Sensor Data Data Insert header i Insert Address i Insert Sensor Data i Calculate Checksum Checksum Header 1 Header 2 Address 1 Address 2 Data Insert Checksum Transmit data Figure 3 13 Data Transmission flow chart 34 3 3 1 Code development Several software was involved to accomplish this project The source code was written in C language The code written need to be complied to generated the Hex file and finally the Hex file was uploaded into the microcontroller unit The choice of software used are depends on the most convenient way to implement the code generated into the microcontroller unit Two major software that mostly used during com
63. t up the software and writes a program in C language in the WinAVR programmer notepad Afterward the source codes will be compiled using WinAVR compiler Figure 4 6 proved this phase was completed The back windows shows the C programming language for the system and the front window shows the output from the compiler The compiler will create certain files such as lt filename gt eep lt filename gt o lt filename gt obj filename Ist and filename Apart of that if any error generated the execution will stop and it error message will display in the output window 42 aalus oax Ee neu main c define FOSC B000000 Clock Speed edefine Baud 1200 define baudrate FOSC l6 BAUD 1 include avr io h include lt stdio h gt 35 I g 0s fi d char funsigned bit quoi dogs iie tme mand define Tx 1 gcc teeny 4 3 bpyright C 3531 Free Software Foundation Inc T ms 15 free software see the source for copying conditions There is NO anty not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE void USART_INITCunsigned int UBRR void usart Tx unsigned char data unsigned char USART RX void void delay 1m unsigned char 1 void ap INIT void unsigned char READ void void TMRO INIT void 1 ling msin c 1 lt I 9 0s funsigned char funsigned bitfselds
64. the step of work need to be planed so that the system will be implemented according to the schedule After that the sensor node requires the software development The microprocessor needs to be programmed to ensure its function It must be programmed according to the application Schedule plan of work Whole system overview Software development Figure 1 2 system development processes Hardware development 1 5 Thesis outline This thesis consists of five chapters Chapter 1 briefly explains the development of water sensor system It describes the reason of developing this system the objective of developing water sensor system and as well as the scope of work involved while the system was developed Chapter 2 clarifies on the idea about the development of water sensor system It includes the overview of wireless sensor network the fundamental knowledge in TCP IP protocol design architecture and the alternative sensor to be chosen for the water sensor development Then Chapter 3 elaborates the process of completing the project It explains the step by step work to complete the water sensor system which includes the development of hardware and software Chapter 4 discusses results and analysis of water sensor system In this chapter the results taken from the sensor node is analyzed Data is captured using oscilloscope during data transmission Finally chapter 5 concludes the overall performance of the system
65. tion kits This microcontroller can be program using C programming MikroBasic and its own assembly language This program is then compiled to generate the Hex file Finally this Hex file will be uploaded into the MCU 25 3 2 3 Module Radio Frequency modules are partially complete circuits that incorporated into larger designs RF modules include receivers transmitters and transceivers RF modules employ numerous dissimilar modulation technique and radio system The examples of modulation techniques use in RF module are on off key OOK Amplitude modulation AM Frequency modulation FM Amplitude shift key ASK Frequency shift key FSK and Phase shift key PSK Performance criteria for RF modules consist of sensitivity output power communication interface operating frequency and maximum transmission distance Sensitivity described as a minimum input signal necessary to construct a specified output signal Output power is the maximum signal power that RF modules can transmit Operating frequency is the range of transmitted and received signals Last but not least maximum transmission distance is the maximum range that a transmitter and receiver can be separated A low cost stabilized surface mount RF transmitter RCT 433 AS from Radiotronix was chosen to be implemented in this system This RF module includes 433 92 MHz amplitude modulation version 1 5 12V voltage operation 5mA current consumption small siz
66. tween the transmitter and receiver node using wireless transmission The embed sensor will measure 4 different water levels and sends the data from the transmitter directly to the desired receiver A wireless communication will be used throughout the project This system consists of a microcontroller RF transmitter water level sensor and power supply 1 2 Problem Statement Water level sensor system was built appropriate with flood issue that hit our country every year This issue forms many problems and trouble to the resident within the hit area Most of them are left with nothing neither shelter nor property Other than that the wireless sensor network was chosen based on its performance This system can be placed directly to the phenomena Thus the precise data will be achieved Figure 1 1 shows the latest flash flood incident that hit Johor Bharu reported in Berita Harian on November 1 2006 The aerial view of the phenomena showed the vehicles trapped in the flood at Johor Bharu 71 Figure 1 1 Flash flood incident in Johor Bharu Moreover the wireless sensor network operates in real time operation Therefore this system is very convenient since data is transmitted and received at a specific time Other than that the rapid growth of wireless sensor network technology is also one of the reasons why this project was developed 1 3 Objectives The objective of the project is to create a sensor node that is able to do sensi
67. unsigned char hdr 2 hf unsigned char add 2 12 unsigned char chksum Initialize PORTC DDRC Oxff PORTC 0 Set ID Initialize 0 amp USART TMRO_INIT USART INIT baudrate if TX 0 Initialize ADC DDRA OxF0 while 1 sen_data PINA chksum sen data hdr 0 hdr 1 add 0 add 1 chksum chksum USART TX hdr 0 USART TX hdr 1 USART TX add 01 USART TX 1 USART TX sen data USART TX chksum else 0 56 DDRA Oxff PORTA 0 while 1 if UCSRA 1 lt lt RXC rx_data UDR if ctr lt 2 if rx data hdr ctr ctrt t else ctr 0 else if ctr gt 1 66 ctr lt 4 if rx data add ctr 2 4 etri else ctr 0 else if ctr 4 4 sensor_data rx_data ctr d else if ctr 5 chksum rx data GUE H else chksum hdr 0 hdr 1 add 0 add 1 sensor data chksum if chksum_ Oxff USART TX sensor data if sensor data 0 1 4 0x3j else if sensor_data 0x3 PORTA 0 7 else if sensor data 0x7 PORTA Oxf else if sensor data Oxf PORTA Oxlfj else PORTA 0 1 else USART_TX Oxf f ctr 0 if TIFR amp 0x2 TIFR 0x2 y 1 34328
68. upports 2 Bus Microwire SPI EEPROM the Atmel AVR and Microchip PIC micro For more details visit http www lancos com e2p ponyprog2000 html How to install Run the setup exe file Preparation 1 Supply proper power to the CPU board 2 Connect the downloading adapter to the PC printer port Then connect the downloading adapter and the board with the flat cable 3 Turn on the power switch on the board Power LED turns on when applicable Compile the source file you want to download How to download a program using PonyProg2000 Run the PonyPorg2000 program 75 Bodo GO Click on OK The following window appears Click on OK Select Setup gt Calibration Click on Yes button The following window appears Click on OK Select Setup gt interface Setup and set up as shown below Parallel Avr ISP I O LPT1 and click on Probe Test Ok message appears Click on OK Click on OK 76 Interface board Setup Parallel Avr ISP 1 0 D En com4 1 2 Select Polarity of the Control lines Invert Reset Invert D IN Invert SCKL Invert D OUT OK Notice Select the device you want Device gt AVR micro gt XXX XXX is the device you want Select Command gt Program Options and check as shown below Reload Files Erase Write Program memory Click on OK Program Options S
69. w software which will be discussed in detail in the next topic in this chapter 16 Overview about Wireless Sensor Network WSN Divide WSN into 2 nodes Transmitter and Receiver Assigned to transmitter end Select appropriate sensor to be implemented in WSN Design system block diagram Design sensor and microcontroller circuit Simulate circuit using multisim Redesign and retest circuit Purchase component and assemble circuit on test board Run test on circuit using multimeter and oscilloscope Troubleshoot and repair Software development Figure 3 1 Hardware development Flow chart 17 Transmitter Node Receiver Node Figure 3 2 Wireless sensor network block diagram The network block diagram is showed in figure 3 2 As shown in figure 3 2 a set of wireless sensor network consist of 1 unit of microcontroller at each part radio transmitter and receiver one or more sensor depending on the application and as well as energy source Microcontroller is the main component for each node in sensor network Microcontroller is used to process data sense from the sensor send the data through the network and to extract data that have been received As mention before in the transmitter part it is essential to select the suitable sensor to be implemented in and communicate in the network Water level sensor was selected due to the current issue regarding flood and the profit loss by the flood victim Transmitter nod
70. which is the first level and it will short circuit pin 1 The output from this IC which is pin 4 will turn on the first LED If water didn t reach the first probe the sensor will remain idle and microprocessor will read the sensor data as 0 or very stable condition The measuring process will continue and function appropriately according to the increment of the water The LED will remain on as the water level increase to the next level which is level 2 3 and 4 The critical situation will occur when all LEDs are turned on It indicates that the water has reached the maximum level Output from this sensor is connected directly to the microprocessor Voltage measured at pin 4 and 10 of each IC are around 4 8 V and can effectively work with the microprocessor It is essential to take every precaution to avoid short circuit since water is also an electric conductor This sensor must be placed far from the water source to avoid any short circuits 21 3 2 2 Processor The processing unit which is commonly connected with a small storage unit handles the procedures that make the sensor node work together with the other nodes to carry out the assigned sensing tasks Processor can be defined as a single ship device that contains memory for programmed information and data It has logic programmed control reading inputs manipulating data and sending outputs In other words it has a built in interface for input output I O as well
Download Pdf Manuals
Related Search
Related Contents
Untitled - Clarion Diapositive 1 PB-PWD9600 Installation Manual Wiley 3D for Graphic Designers Bertazzoni PM60 3 0 X hob Polypower - Prescott SM Design of Velocity-Measuring System with Doppler Radar Concept Visualizza il Manuale d`uso PS PROGRAMMER User Guide: HTS Customer Care Kits Copyright © All rights reserved.
Failed to retrieve file