Remote Weather Station using Ethernet
Interim Report ‘05
1. INTRODUCTION There is a general consensus that in years to come more and more Ethernet devices will be embedded and pc oriented. just one prediction is that by 2010 95% of internet connected devices will not be computers. so if they are not computers what will they be? Embedded Ethernet devices. Internet-enabled hardware products are slowly becoming commonplace. a real web server can be implemented in a device in your own home connected to your pc via a local area network. This will allow you to do things like display temperature, control heater and switch light remotely from any web browser in the house When connected, another pc connected to the device can see and access data in the device as though it were another pc-remote weather station used for ending weather data from a remote weather monitoring station to a control station The device consist pf a small dedicated microcontroller connected to a custom Ethernet interface chip, which is in turn connected to the local area network via suitable electrical transformers. the Ethernet inter phase chi act like sophisticated serial to parallel converter its job is to read serial packet of data from the wire ,check their header bits with an internal address perform checksum calculation and push the block into a user accusable fist In first out data buffer during transmission opposite takes effect the microprocessor places data block in a buffer, the Ethernet chip then adds any required headers and checksum perform the parallel to serial conversion and then push the serial stream in to the wire by the same time checking for possible collision The embedded system includes the interfacing of the sensors like temp sensors light, humidity and pressure sensors … to the micro control the remote weather station also as got a LCD interface which can enabled if required if it is enable the system itself will display the weather data in the LCD.
Dept. of ECE
1
MESCE Kuttippuram
Remote Weather Station using Ethernet
Interim Report ‘05
The sensors give analog output s and they have to be converted to digital values for processing external ADC or more preferably an internal ADC(in micro controller) the microcontroller which is the controlling device regularly reads sensor out put a proper communication protocol has to be established for communication between the control room remote system The remote weather station is a low cost devices which can be used for remote weather forecasting unlike existing device it can connect and send the data to the remote control station and send a variety of data from deferent sensors
SYSTEM INTERFACE The data from the weather station is send through Ethernet to the computer system the computer system displays the weather parameter using a GUI software the software can be developed using visual basics and can be installed in the main computer system
Dept. of ECE
2
MESCE Kuttippuram
Remote Weather Station using Ethernet
Interim Report ‘05
2. BASIC BLOCK DIAGRAM
Dept. of ECE
3
MESCE Kuttippuram
Remote Weather Station using Ethernet
Interim Report ‘05
3. ETHERNET TECHNOLOGY Ethernet is the name given to a popular packet switched LAN technology invented at Xerox PARC in the early 1970s.ethernrt has become a popular LAN technology most medium or large corporations use Ethernet.
Each Ethernet cable is about ½ inch in diameter and up to 500 ms long. A resistor is added between the center wire and the shield at each end to prevent reflection of electrical signals. The original Ethernet design used a coaxial cable as in figure called the ether. The connection between a computer and a coaxial Ethernet cable requires a hardware device called a transceiver. Physically the connection between a transceiver and the Ethernet requires a small hole in the outer layers of the cable. Technicians usually use the term tap to describe the connection between an Ethernet transceiver and the cable. Each connection to an Ethernet has two major electrical components. a transcei1ver connects to the center wire and drained shield on the cable sensing and sending signals on ethereal host interface or host adaptor plugs into the computers bus and connects to the transceiver. A transceiver is a small piece of hardware usually found physically adjacent to the ether. In addition to the analog hardware that sense and controls electrical signals on the ether, a transceiver contains digital circuitry that allows it to communicate with the digital computer. The transceiver can send when the ether is in use and can translate Dept. of ECE
4
MESCE Kuttippuram
Remote Weather Station using Ethernet
Interim Report ‘05
analog electrical signals on the ether to digital form. a cable called attachment unit interface[AUI].cable connects the transceiver to an adapter board to a computer. Informally called a transceiver cable, the AUI cable contains many wires. The wires carry the electrical power needed to operate the transceiver, signals that control the transceiver operation and the contents of the packet being send or received. Below figure shows how the componenents form a connection between a bus in a computer system and an Ethernet cable. Fig
3.1 THIN WIRE ETHERNET To reduce cost of environment like offices that do not contain much electrical interference engineers developed an alternative Ethernet wiring scheme called thin wire Ethernet thin net the alternative coaxial cable is thinner less expensive and moiré flexible how thin wire ether net has some disadvantage because it does not provide as much protection from electrical interference thin wire Ethernet cannot be placed adjacent o powerful electrical equipment like that found in factory further more thin wire ether net covers some what shorter distance s and supports fewer computer connection per network than thick Ethernet To further reduce cost with thin wire Ethernet, engneers replaced the costly transceiver with specially high speed digital circuit and provided direct connection from a computer to ether thus in a thin wire scheme a computer contain both the host inter phase and the circuitry that connect to the cable.beacuse a thin wire ether net connects directly from one computer to another, the wiring scheme works well when many computer occupy an single room. Thin wire cable runs directly from one computer to the next to add a new computer only need kink it in to the chain
Dept. of ECE
5
MESCE Kuttippuram
Remote Weather Station using Ethernet
Interim Report ‘05
3.2TWISTED PAIR ETHERNET
Advances in technology has made it possible to build Ethernet that do not need the electrical shielding of a coaxial cable .called twisted pair Ethernet the technology allows the computer excess an Ethernet using a pair of conventional unshielded copper wire similar to the wires used to connect telephone. The advantage of using twister pairing it further reduces cost and protect other computer on the net work from a user who disconnect a single computer a twisted pair technology for an organization to use ether net over exciting telephone wiring with out adding new cable
. The hub is an electronic device that stimulate the signals on Ethernet cable physically hub consist of a small box that usually resides in a wiring closet a connection between a hub and a computer must be less than 100ms log it have required power can allow other used personal to monitor and control for the over the net work
Dept. of ECE
6
MESCE Kuttippuram
Remote Weather Station using Ethernet
Interim Report ‘05
3.3 ADAPTER AND MULTIPLE WIREING SCHEMES A connection to thick Ethernet required a AUI connecter a connection to thin wire Ethernet a BNC connecter and a connection to 10baset RJ45 connecter that reusable the modular connector used with connecter
3.4 PROPERTIES OF AN ETHERNET The ether net is a 10Mbps broadcast technology with bust effort delivery and semantics and distributed accessory control it is a bus because all station share a single communication channel it is broadcast because all transceiver every transmission. a transceiver passes all packet from the cable to the host inter phase which choices packet the computer should receive and filters out all others. Ethernet is called a best effort delivery mechanism because the hard ware provide no information to the center about weather the packet was delivered Ethernet access scheme is called carriers send multiple access with collision detect(CSMA/CD)it CSMA because multiple machine can access the Ethernet simultaneously and each machine determines weather the ether is idle by sensing weather a carrier wave is present
Dept. of ECE
7
MESCE Kuttippuram
Remote Weather Station using Ethernet
Interim Report ‘05
3.5 COLLISION DETECTION AN RECOVERY When a transceiver begins transmission, the signal does not reach all parts of the network simultaneously. Instead it travels along the cable approximately 80% of the speed of light. Thus it is possible two transceiver to both sense that the net work is idle and begin transmission simultaneously. When the two electrical signal cross they become scrambled, such that neither is meaningful. such incident is called collision. The Ethernet handle collision in a ingenious fashion. each transceiver monitors cable while it is transmitting to see if a foreign signal interfere with its transmission.Technicaly the monitoring is called collision detect(CD),making the Ethernet a CSMA/CD network. When a collision detect, the host interface abort transmission, wait for activity to subside, and tries again. to help such situation ,Ethernet users a binary exponential back off policy where a sender delays a random time after the first collision ,twice as long if second attempt to transmit also produce a collision ,four time as long if a third attempt results in collision and so on. the motivation for exponential back off is that in the unlikely event many station attempt to transmit simultaneously ,a severs traffic jam will occure.in such jam there is high probability two station will choose random bakeoffs that close together. thus the probability of another collision is high .by doubling the random delay, the exponential back off strategy quickly spread the station attempts to retransmit over a reasonably long periodic time, making the probability of further collisions extremely small.
3.6 ETHERNET CAPACITY The standard Ethernet is rated at 10Mbps, which means that data can be transmitted on to the cable at 10 million bit per second. although a computer can generate data at a Ethernet speed ,raw network should be thought of as the rate at which two computer can exchange data. instead network speed should be thought of as measure of network total traffic capacity.
Dept. of ECE
8
MESCE Kuttippuram
Remote Weather Station using Ethernet
Interim Report ‘05
3.7 ETHERNET HARDWARE ADRESSES Ethernet defines as 48-bit addressing scheme. each computer attached to an Ethernet net work assigned a unique 48-bit number know as its Ethernet address. to assign an address Ethernet hardware manufactures purchase block of Ethernet address and assign them in sequence as they manufacture Ethernet interface harware.thus no two hardware interface have the same address Usually the Ethernet address is fixed in machine readable form on the host interface hardware .because Ethernet addresses belong to hardware devices they are some time called hardware address or physical address. note the following important property of Ethernet physical address [Physical addresses are associated with the Ethernet interface hardware; moving the hardware interface to a new machine or replacing a hardware interface that has failed changes the machine’s physical address] The host interface hardware examine s packet and determine the packet that should be send to the host. Recall that each interface receives a copy every packet even those addressed to other machine. the host inter face uses the destination address field in a packet as filter. The interface ignores those packets that are addressed to it. the addressing machine and hardware filter are needed to prevent a computer from being overwhelmed with incoming data
3.8 TWO APPROACHES TO NETWORK COMMUNICATIONS Whether they provide connections between one computer and another or between terminals and computers networks can be divided into two basic types: circuit switched(sometimes called connection oriented) and packet switched (sometimes called connectionless).circuit switched networks operate by forming a dedicated connection between two points the advantage of circuit switching lies in its guaranteed capacity: once a circuit is established no other network activity will decrease the capacity o the circuit. One disadvantage of circuit switching is cost circuit costs are fixed independent of traffic. Dept. of ECE
9
MESCE Kuttippuram
Remote Weather Station using Ethernet
Interim Report ‘05
In a packet switched network data to be transferred across a network is divided into small piece called packets that are multiplexed onto high capacity intermeshing connections. a packet which usually contains only a few hundred bytes of data carries identification that enables the network hardware to know how to send it to a specified destination. the chief advantage of packet switching is that multiple communication among computers can proceed concurrently with intermeshing connections shared by all pairs of machines that are communicating. the disadvantage of course is that as activity increases a given pair of communicating computers receives less of network capacity that is whenever a packet switched network become overloaded computers using the network must wait before that can send additional packets.
Dept. of ECE
10
MESCE Kuttippuram
Remote Weather Station using Ethernet
Interim Report ‘05
4. CIRCUIT DIAGRAM
Dept. of ECE
11
MESCE Kuttippuram
Remote Weather Station using Ethernet
Interim Report ‘05
5. IMPORTANT PINS • Pin 1 is ACTIVE LOW RESET. • Pin 2 to 5 ARE CONNECTED TO SENSORS. • Pin 12 is connected to GROUND and Pin 11 to 5V. • Pin 13 and 14 takes in the clock (20 MHz) signal. • Port C and D to LCD DISPLAY. • Pins 25 and 26 to USART Module.
5.1 PERIPHERAL FEATURES. T has the following peripheral features which suits best for the project: Timer0:8-bit timer/counter with 8 bit prescalar. 10 bit multi channel Analog to digital converter having 8 input channels. Universal Synchronous Asynchronous Receiver Transmitter (USART) with 9b bit address detection. .
5.2 MPLAB FOR PIC PROGRAMING We had an overview of PIC programming which includes all modules mentioned above. As communication with the computer using USART is comparatively difficult, we opt for parallel port communication with PIC. Our project requires the analog signal received from the finger probe sensor digital signal compatible for the parallel port of the computer. Thus, we use the 10 bit ADC module of the PIC 16f877.
Dept. of ECE
12
MESCE Kuttippuram
Remote Weather Station using Ethernet
Interim Report ‘05
5.6 DIGITAL TO ANALOG (A/D) CONVERTER MODULE It has 8 inputs It generates a Digital signal for analog levels via successive approximation .The A/D module has 4 registers .These registers are : 1. A/D Result High Register (ADESH). 2. A/D Result Low Register (ADRESL). 3. A/D Control Register0 (ADCON) 4. A/D Control Register1 (ADCON!) ADCON register controls the operation of the A/D module.ADCON1 register configures the functions of the port pins. The port pins are configured as analog inputs.
Dept. of ECE
13
MESCE Kuttippuram
Remote Weather Station using Ethernet
Interim Report ‘05
6. SENSOR SPECIFICATION
Dept. of ECE
14
MESCE Kuttippuram
Remote Weather Station using Ethernet
Dept. of ECE
Interim Report ‘05
15
MESCE Kuttippuram
Remote Weather Station using Ethernet
Interim Report ‘05
7. FLOW CHART
Dept. of ECE
16
MESCE Kuttippuram
Remote Weather Station using Ethernet
Dept. of ECE
Interim Report ‘05
17
MESCE Kuttippuram
Remote Weather Station using Ethernet
Interim Report ‘05
8. SOFTWARE PROGRAM include"P16877.INC" LIGHTH EQU 20H LIGHTL EQU 21H TEMPH EQU 22H TEMPL EQU 23H HUMH EQU 24H HUML EQU 25H PRESH EQU 26H PRESL EQU 27H TRANS EQU 28H org 0000h CLRF PCLATH
;FOR LOADING
goto start org 0020h start CALL UARTINIT BSF STATUS,RP0
;ADCON1 IS IN BANK1
MOVLW B'10000000'
;RIGHT JUSTIFIED,ALL ANALOG MODE
MOVWF ADCON1
;CONTROL REGISTER1 FOR ADC INITIALISED
BCF STATUS,RP0
;BANK 0
READING LIGHT SENSOR VALUES(LDR)--STORING IN(LIGHTH) AND (LIGHTL) CLOOP MOVLW H'81' MOVWF ADCOND
;FOSC/32,CHANELN 0(RAD),AD on & Go/done==0 ;VALUE PASSED TO CONTROLE REGISTER0
CALL DELAY BSF ADCON,2
;SET GO /DONE BIT--AD CONVERSION STARTS
CONVCHK BTFSC ADCON0,2 GOTO CONVCHK MOVF ADRESH0 ANDLW H'03'
;CHECK WETHER CONVERSION OVER ;NOT OVER GO BACK ;VALUE OF ADRESH INWR ;AND WR WITH 0F
MOVWF LIGHTH
Dept. of ECE
18
MESCE Kuttippuram
Remote Weather Station using Ethernet
Interim Report ‘05
BSF STATUS,RP0
;ADRESL IS IN BANK1
BSF STATUS,RP0
;BANK0
MOVWF LIGHTL CALL DELAY2
;DELAY WIYH TIMER1 IS CALLED
;READING TEMPERATURE
SENSOR VALUE ---STORIN IN(TEMPH)AND
(TEMPL) MOVLW H'89' MOVWF ADCON0
;FOSC/32,chanel1 (ra1),ADon & go/done==0 ;VALUE PASSED TO CONTROLE REGISTER 0
CALL DELAY BSF ADCON0,2
;SET GO/DONE BIT----AD CONVERSION START
CONVCHK1 BTFSC ADCON0,2
;CHECK WETHER CONVERSION OVER
GOTO CONVCHK1
;NOT OVER,GO BACK
MOVF ADRESH,0
;VALUE OF ADRESH IN WR
ANDLW H'03'
;AND WF WITH 0F
MOVWF TEMPH BSF STATUS,RP0 MOVF ADRESL,O
;ADRESL IS BANK1 ;VALUE OF ADRESH IN WR
BCF STATUS,RP0,BANK0 MOVWF TEMPL CALL DELAY2
;DELAY WITH TIMER1IS CALLED
;READING HUMIDITY SENSOR VALUES MOVLW H'91' MOVWF ADCON0
;FOSC,CHANEL2 0(RA2),AD ON *GODONE==0 ;VALUE PASSED TO CONTROLE REGISTER0
CALL DELAY BSF ADCON0,2
;SET GO/DONE BIT
CONVCHK2 BTFSC ADCON0,2 GOTO CONVCHK2 MOVF ADRESH,0
Dept. of ECE
;CHEK WETHER CONVERSION OVER ;NOT OVER GO BACK ;VALUE OF ADRESH IN WR
19
MESCE Kuttippuram
Remote Weather Station using Ethernet ANDLW H'03'
Interim Report ‘05
;AND WR WITH 0F
MOVWF HUMH BSF STATUS,RP0 MOVF ADRESL,0 BSF STATUS,RP0
;ADRESL IS IN BANK1 ;VALUE OF ADRESH IN WR ;BANK0
MOVWF HUML CALL DELAY2
; DELAY WITH TIMER1 IS CALLED(100 MILLI)
;READING PRESSURE SENSOR VALUES__STORING IN (PRESH) AND (PRESHL) MOVWH'99'
;FOSC/32,CHANNEL 3(RA3),ADON&GO/DONE=0
MOVWF ADCOND CALL DELAY BSF ADCOND,2
;VALUE PASSED TO CONTROL REGISTER0 ;DELAY CALLED ;SET GO/DONE BIT--AD CONVERSION STARTS
CONVCHK3 BTFSC ADCON0,2
;CHECK WHETHER CONVERSION OVER
GOTO CONVCHK3 MOVF ADRESH,0 ANDLW H'03'
;NOTOVER GOBACK ;VALUE OF ADRESH IN WR ;ANDWR WITH OF
MOVWF FRESH BSF STATUS,RP0
;ADRESL IS IN BANK1
MOVF ADRESL,0
;VALUE OF ADRESH IN WR
BCF STATUS,RP0
;BANK0
MOVWF PRESL CALL DELAY2
;DELAY WITH TIMER1 IS CALLED
;TRANSMIT VALUE THROUGHUSART-BAUDRATE-9600 MOVF LIGHTL,0 MOVWF TRANS CALL UART TRANSMIT
;TRANSMIT LIGHT VALUE
CALL UART TRANSMIT MOVF TEMPL,0 MOVWF TRANS CALL UART TRANSMIT
;TRANSMIT TEMP VALUE
MOV HUML,0
Dept. of ECE
20
MESCE Kuttippuram
Remote Weather Station using Ethernet
Interim Report ‘05
MOVWF TRANS CALL UART TRANSMIT
;TRANSMIT HUMIDITY VALUE
MOVF PRESSL,0 MOVWF TRANSF CALL UARTTRANSMIT GOTO CLOOP
;TRANMIT PRESSURE VALUE
;INFINITE LOOP TO START
DELAY BCF STATUS RP1 BSF STATUS,RP0
;BANK1
BCF OPTION_REG,PSA
;PRESCALLER ASSIGNED TO TIMER0
BCF OPTION_REG,PS1
;PROGRAM USES PRESSCALLER RATE 1:4
BCF OPTION_REG,PS2
;PS2:PS0=001
BCF OPTION_REG,T0CS
;TIMER ACTIVATED
DLYCHK BTFSS INTCON,T0IF GOTO DLYCHK
;OVERFLOW FLAG IS CHECKED IF SET ;NO OVERFLOW,GO BACK
BSF OPTION_REG,T0CS
;TIMER DE ACTIVATED
BCF INTCON,T0IF
;OVERFLOW FLAG CLEARED
BCF STATUS,RP0
;BANK0
RETURN DELAY2 BSF T1CON,T1CKPS0
;TIMER1 PRESCALLER SET
BSFT1CON,T1CKPS1
;VALUE 1:8==11
BCF T1CON,TMR1CS
;INTERNAL CLOCK STARTS RUNNING
BSFT1CON,TMR1ON
;TIMER IS ENABLED
DLYCHK2 BTFSS PIR1,TMR11F
;OVERFLOW FLAG IS CHECKED IF SET
GOTO DLYCHK2 BCF T1CON,TMR1ON
;TIMER IS OFF
BCF PIR1,TMR11F RETURN UART TRANSMIT MOVF TRANS,0
;DATA TO BE TRANSMITTED
MOVWF TXREG
;DATA MOVED TO TXREG
LOOP BTFSS PIR1,TXIF
Dept. of ECE
;TESTING WHETHER TRANSMIT IS OVER
21
MESCE Kuttippuram
Remote Weather Station using Ethernet GOTO LOOP
Interim Report ‘05
;TRANSMIT NOT OVER,WAIT
RETURN UARTINIT CLRF RCSTA BSF STATUS,RP0
;TXSTA IS IN BANK 1
CLRF TXSTA BSF TXSTA,BRGH
;HIGH BAUD RATE IS USED
BCF TXSTA,SYNC MOVLWD'129' MOVWF SPBRG
;SINCE V USE 9600 BAUD RATE(BITS/SEC)
BCF STATUS,RP0
;RCSTA IS IN BANK0
BSF RCSTA,SPEN
;SERIAL PORT ENABLED
BSF STATUS,RP0
;BANK1
BSF TXSTA,TXEN BCF STATUS,RP0
;TRANSMIT ENABLED ;TXREG IS IN BANK0
RETURN END
Dept. of ECE
22
MESCE Kuttippuram
Remote Weather Station using Ethernet
Interim Report ‘05
USART MODULE.(MAX 232) It is ued to provide a serial communication to the computer to DB9 via RS 232.
Dept. of ECE
23
MESCE Kuttippuram
Remote Weather Station using Ethernet
Interim Report ‘05
9. WORKDONE SO FAR September
Develop an understanding about the project objectives
2005
Collected data sheet and circuit diagram. References Learn about PIC16f877
October
Studied about designing PIC circuit. Done some
2005 November
small programs. Designed circuit . Written program for A/D
2005
conversion and LCD Display.
Dept. of ECE
24
MESCE Kuttippuram
Remote Weather Station using Ethernet
Interim Report ‘05
10. CONCLUSION The requirements of this project were analyzed. The block diagram was developed .Studied about the PIC microcontroller programming. Hardware components collected.
10.1 GOALS The project is aimed for easy access of various parameters like temperature,humidity,pressure and light through Ethernet. This also aims at helping fast access of these parameters from the control tower Project will be finished within two or three months.
Dept. of ECE
25
MESCE Kuttippuram
Remote Weather Station using Ethernet
Interim Report ‘05
11. BIBILOGRAPHY 1. www.microchip.com
2. INTERNETWORKING WITH TCP/IP BY DOUGLAS E.COMER
Dept. of ECE
26
MESCE Kuttippuram
Remote Weather Station using Ethernet
Interim Report ‘05
APPENDIX
Dept. of ECE
27
MESCE Kuttippuram
Remote Weather Station using Ethernet
Interim Report ‘05
ABSTRACT
Ethernet is the most popular local area network or land technology. An Ethernet LAN typically use twisted pair wires or fiber optics cable transmit at 10 Mbps.Ethernet are in expensive and provide a relatively high through put and low delay that can support many applications. most importantly Ethernet provides inexpensive, relatively high speed network access to individual users. This project is an attempt to connect an embedded device to an Ethernet. The embedded device is a REMOTE WEATHER STATION. With help of this remote weather monitoring station, the master control station located at another geographical area can receive the weather data. The remote weather system monitors temperature, humidity, atmospheric pressure, light intensity etc.. And send the data to the master control station at regular intervals when required. The weather station communicates through Ethernet for sensing the temperature; humidity respective sensors are used data from the sensors are analyzed by the microcontroller and processed
Dept. of ECE
28
MESCE Kuttippuram
Remote Weather Station using Ethernet
Interim Report ‘05
CONTENTS
1. INTRODUCTION
1
2. BASIC BLOCK DIAGRAM
3
3. ETHERNET TECHNOLOGY
4
4. CIRCUIT DIAGRAM
11
5. IMPORTANT PINS
12
6. SENSOR SPECIFICATION
14
7. FLOW CHART
16
8. SOFTWARE PROGRAM
18
9. WORKDONE SO FAR
24
10. CONCLUSION
25
11. BIBILOGRAPHY
26
Dept. of ECE
29
MESCE Kuttippuram