COS 109 Monday December 7 • Housekeeping – Lab 8 and Assignment 9 are posted – Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam – A review session will be held on January 14 (time and location TBA) – Reading assignment for next Monday (also posted on course home page) https://static.newamerica.org/attachments/3421-riding-thewave/Riding%20the%20Wave_Final_and_Teaching_Note.d71b398fa011446ca 2739f5b0737dcfb.pdf • Today’s class – Wireless from radio to wifi to cellphones – Data compression and error correction Sound waves and frequencies • Sound can be represented by a graph showing intensity plotted versus time • The graph is composed of components that appear regular (i.e. work at certain frequencies) • We can speak of the graph as being composed of its amplitudes (heights) at various frequencies. • We have Jean-Baptiste Joseph Fourier (1768— 1830) to thank for this Very simple view of what comes forward • A radio process consists of a transmitter and a receptor • Transmitter broadcasts signals at a certain frequency (or perhaps many frequencies) • Receptor is set to receive signals at a fixed frequency • Signals decay over distance (based on their frequency) • Underlying societal issue – Who owns a frequency in a (geographic) area? • Definition – Frequencies are measured in cycles per second (called Hertz (Hz)) e.g. tune your radio to 770 KHz (an AM station) or 101.5 MHZ (an FM station) or broadcast; Wifi may be at 5GHz; my cellphone uses 850MHz and 1900MHz How does a radio work? • Transmitter/receiver • Tuned on a frequency • Picks up that frequency and uses the amplitude to decode 1’s and 0’s from amplitude • How a radio works – How sound is made and transmitted (old time view) – How sound is transmitted • "modulate" the wave to impose information on it – amplitude (AM): change the power level – frequency (FM): change the frequency around nominal value – digital: on/off • received signal strength varies directly with power level • received signal strength dies off with square of distance • higher frequencies go shorter distances On to WiFi • A Wifi device involves two key components – Antennae to receive signals as radio waves – A port in the back to wire into the Internet (or LAN) The wireless part • Convert 0’s and 1’s into waves and transmit at frequency (2.4 or 5 GHz) • Work according to standards – Standards are defined by IEEE (Institute of Electrical and Electronic Engineers) • Transmit by various coding systems – orthogonal frequency-division multiplexing (OFDM) – complementary code keying (CCK) modulation • The 802.11 standards The 802.11 standards • • • • • 802.11a (1997) transmits at 5 GHz and can move up to 54 megabits of data per second. It uses OFDM to greatly reduce interference. 802.11b (1999) is the slowest and least expensive standard. For a while, its cost made it popular, but now it's becoming less common as faster standards become less expensive. 802.11b transmits in the 2.4 GHz frequency band of the radio spectrum. It can handle up to 11 megabits of data per second, and it uses CCK to improve speeds. 802.11g (2003) transmits at 2.4 GHz like 802.11b, but it's a lot faster -- it can handle up to 54 megabits of data per second. 802.11g is faster because it uses the same OFDM coding as 802.11a. 802.11n (2009) is the newest standard that is widely available. This standard significantly improves speed and range. For instance, although 802.11g theoretically moves 54 megabits of data per second, it only achieves real-world speeds of about 24 megabits of data per second because of network congestion. 802.11n, however, reportedly can achieve speeds as high as 140 megabits per second. 802.11ac came in 2013 to extend 802.11n. Channels are wider and will yield higher bandwidth. Vendors are now building devices in this range. Another view of wireless technology A simple view of cell phones • all phones are part of the public switched telephone network • a cell phone is connected by radio instead of wires • moves long distances, at high speed, appears out of nowhere • shares a very limited radio frequency spectrum with others • operates with low power because it uses batteries • this makes life complicated Public telephone network Switc h Switc h Base stations (== cellular towers) Cell phones Cells (a very idealized picture) • divide geographical area into cells (notionally hexagonal) • each cell has an antenna, handles all cell phones in its area • available radio spectrum is divided into channels – two channels for one conversation, one for each direction – competing carriers operate on different frequencies • each cell gets 1/7 of the channels – adjacent cells can't use the same channels because of interference – non-adjacent cells can re-use channels from www.howstuffworks.com Not in my back yard! Camouflage Camouflage Camouflage Meanwhile, in the southwest… Can you hear me? Sent on behalf of Jay Dominick, Vice President for Information Technology and Chief Information Officer Dear Colleague, OIT is currently working with Verizon to supplement the cellular wireless signal in and around the E-Quad. As part of that process, Verizon has established a Cellular transmitter on the roof of the J Wing of the E-Quad. The equipment being used will transmit in licensed frequency bands (746Mhz 787Mhz, 835Mhz - 894Mhz and 1710Mhz - 2120Mhz) at between 10 and 40 Watts. How it works • when a phone is turned on, it broadcasts its ID (“registration”) – nearest base station notices, validates with home system registration uses encryption for fraud prevention – phone keeps broadcasting enough to keep in touch • when the phone is called, the home system knows where it is – home system contacts base(s) where phone is – bases broadcast to where phone was last seen (“paging”) • phones talk to base with strongest signal – base and phone communicate over 2 agreed-upon channels (up, down) – phones continuously adjust power level to signal strength at base uses less battery, creates less interference for other phones • phones move from base to base and from system to system – base initiates handoff when signal gets weak – phone picked up by base with strongest signal – elaborate protocols at all levels How it works, continued • multiple frequency bands (different in different parts of the world) – divided into channels (frequency multiplexing) digital phones multiplex several calls on one channel (GSM) or spread calls out over the whole spectrum (CDMA) – phones usually support multiple bands • channels carry both voice and control information (including data) – digital speech is highly compressed (~1 bit/speech sample) – elaborate coding & error correction for speech & control information – power turned off when nothing is being sent • phones store user info on removable flash memory card – SIM (Subscriber Information Module) – may be able to replace card to use in a different environment • most of the world uses GSM – in USA, AT&T & T-Mobile use GSM; Verizon & Sprint use CDMA Radio waves – how are frequencies used • Might be different channels to offset frequencies • Device is set up to receive the frequency like a radio – – – – WCBS – 660KHz WPRB – 103.3MHz My home landline – 900MHz iPhone6 – 850,900,1800, 1900,2100 MHz for Cellular 802.11n (2.4GHz and 5 GHz for wifi) – WNBC-TV 67.25 MHz (video signal) 71.75 MHz (audio signal) • Frequency enables decoding Sample frequencies • • • • • • AM radio - 535 kilohertz to 1.7 megahertz Short wave radio - bands from 5.9 megahertz to 26.1 megahertz Citizens band (CB) radio - 26.96 megahertz to 27.41 megahertz Television stations - 54 to 88 megahertz for channels 2 through 6 FM radio - 88 megahertz to 108 megahertz Television stations - 174 to 220 megahertz for channels 7 through 13 • Wireless devices in the house – Garage door openers, alarm systems, etc. - Around 40 megahertz – Baby monitors: 49 megahertz – Radio controlled airplanes: Around 72 megahertz, which is different from... – Radio controlled cars: Around 75 megahertz – New cordless phones operate at DECT 6.0 (1.9 GHz) – Bluetooth: between 2.402 and 2.480 gigahertz – My slide advancing remote ~ 30 PHz (30 million GHz) (on infrared spectrum) • Other frequencies – Wildlife tracking collars: 215 to 220 megahertz – MIR space station: 145 megahertz and 437 megahertz – Air traffic control radar: 960 to 1,215 megahertz – Global Positioning System: 1,227 and 1,575 megahertz – Deep space radio communications: 2290 megahertz to 2300 megahertz – Ezpass – 915 megahertz The full spectrum From http://electronics.howstuffworks.com/radio-spectrum.htm RF spectrum Selling frequency • see an auction • Looking at a particular auction • Seeing the results Technology meets politics again • should texting while driving be illegal (and enforced)? – how about just talking on a phone while driving? • where determines where cell phone towers are permitted? – property rights versus eminent domain • should cell phone jammers be legalized? – in theatres, trains, etc. • location tracking and surveillance – – – – FCC mandates that cell phone can be locatable within 125 meter radius should real-time location info be available to law enforcement, etc.? how should this evolve as GPS becomes universally available? who can have access to what cell phone records under what circumstances? • if you use your cell phone to make a call or use wifi on your phone to Skype, what is the difference? GPS (Global Positioning System) • 31 satellites, each broadcasting time & its location – altitude ~ 20 km, frequency ~ 1575 MHz – at least 6 are visible at any time • receiver calculates its position using distances to 3 or more satellites – distances computed by careful measurement of time – accuracy typically within 15 m for civilian systems – additional inputs or use of encrypted info reduces this to < 1 m Web site of the day • The useless web Compression; Error detection & correction • compression: squeeze out redundancy – to use less memory or use less network bandwidth – encode the same information in fewer bits • some bits carry no information • some bits can be computed or inferred from others • some bits don't matter to the recipient and can be dropped entirely • error detection & correction: add redundancy – to detect and fix up loss or damage – add carefully defined, systematic redundancy – with enough of the right redundancy, can detect damaged bits can correct errors Compressing English text • letters do not occur equally often • encode frequent letters with fewer bits, less frequent things with more bits (trades complexity against space) – e.g., Morse code, Huffman code, ... • run-length encoding – encode runs of identical things with a count – e.g., World Wide Web Consortium => WWWC => W3C • words do not occur equally often • encode whole words, not just letters – e.g., abbreviations for frequent words Letter frequencies in King James bible (4.1M chars) 800000 SP 700000 600000 500000 E 400000 T H 300000 A O N I 200000 S R D L F 100000 U M W Y G C B P V K J Z X Q J Z X Q 0 SP E T H A O N I S R D L F U M W Y G C B P V K Word frequencies (790K words) 70000 the 60000 and 50000 40000 of 30000 20000 to that in he shall untofor i his a lordthey be is him notthem it w ith all thou thyw asgod w hichmy me saidbut ye theirhavew illtheefrom as 10000 as th ee ha ve ye sa id m y go d th y al l it no t is th ey a i un to he th at of th e 0 are Zipf's Law (adapted from Wikipedia) • frequency of any word is inversely proportional to its position in the frequency table 70000 60000 – empirically, the most frequent word will occur approximately twice as often as the second most frequent word, which occurs twice as the often as the fourth most frequent word, etc. and 50000 40000 of 30000 20000 to that in he shall untofor i his a lordthey be is him notthem it w ith all thou thyw asgodw hichmy me saidbut ye theirhavew illthee from as 10000 as th ee ha ve ye sa id m y go d th y al l it no t is th ey a i un to he th at of th e 0 are Lempel-Ziv coding; adaptive compression algorithms • build a dictionary of recently occurring data • replace subsequent occurrences by (shorter) reference to the dictionary entry • dictionary adapts as more input is seen – compression adapts to properties of particular input – algorithm is independent of nature of input • dictionary is included in the compressed data • Lempel-Ziv is the basis of PKZip, Winzip, gzip, GIF – compresses Bible from 4.1 MB to 1.2 MB (typical for text) • Lempel-Ziv is a lossless compression scheme – compression followed by decompression reproduces the input exactly • lossy compression: may do better if can discard some information – commonly used for pictures, sounds, movies JPEG (Joint Photographic Experts Group) picture compression • a lossy compression scheme, based on how our eyes work • digitize picture into pixels • discard some color information (use fewer distinct colors) – eye is less sensitive to color variation than brightness • discard some fine detail – decompressed image is not quite as sharp as original • discard some fine gradations of color and brightness • use Huffman code, run-length encoding, etc., to compress resulting stream of numeric values • compression is usually 10:1 to 20:1 for pictures • used in web pages, digital cameras, ... JPEG images • (16"x14") 1800 bytes: (87"x118") 360K Bytes: MPEG (Moving Picture Experts Group) movie compression • MPEG-2: lossy compression scheme, based on human perceptions • uses JPEG for individual frames (spatial redundancy) • adds compression of temporal redundancy – – – – – – look at image in blocks if a block hasn't changed, just transmit that fact, not the content if a block has moved, transmit amount of motion motion prediction (encode expected differences plus correction) separate moving parts from static background ... • used in DVD, high-definition TV, digital camcorders, video games • rate is 3-15 Mbps depending on size, frame rate – 15 Mbps ~ 2 MB/sec or 120 MB/min ~ 100x worse than MP3 – 3 Mbps ~ 25 MB/min; cf DVD 25 MB/min ~ 3000 MB for 2 hours – regular TV is ~ 15 Mbps, HDTV ~ 60-80 Mbps MP3 (MPEG Audio Layer-3) sound compression • movies have sound as well as motion; this is the audio part • 3 levels, with increasing compression, increasing complexity • based on "perceptual noise shaping": use characteristics of the human ear to compress better: • • • • – human ear can't hear some sounds (e.g., very high frequencies) – human ear hears some sounds better than others – louder sounds mask softer sounds break sound into different frequency bands encode each band separately encode 2 stereo channels as 1 plus difference gives about 10:1 compression over CD-quality audio – 1 MB/minute instead of 10 MB/minute – can trade quality against compression