110 likes | 214 Views
Electronics and Physical Interfaces. Speaker Interface Electronics Review 8051 I/O. Speaker Interface. Add waveforms to get multiple tones ( think current through speaker , not voltage). Note that lower frequency is smoother for a given sample rate. Ideal Solution.
E N D
Electronics and Physical Interfaces • Speaker Interface • Electronics Review • 8051 I/O CSE 370 - Fall 1999 - Introduction - 1
Speaker Interface • Add waveforms to get multiple tones (think current through speaker, not voltage) Note that lower frequency is smoother for a given sample rate CSE 370 - Fall 1999 - Introduction - 2
Ideal Solution • Digital to Analog Converter We can probably find a chip for this 8051 8 DAC AMP (V to I) Voltage signal Speaker cares about current, not voltage What is algorithm to superimpose 1KHz tone with 500Hz tone With a sampling rate of 10KHz CSE 370 - Fall 1999 - Introduction - 3
Synthesizer Algorithm • Let sin[] be a look up table with 256 entries (1 complete cycle) • Every .1ms (10KHz) • P2 = sin[t1] + sin[t2] + sin[t3] … • For 1KHz, t1 += 256/10 is this hard? how do we implement this? • For 500Hz, t2 += 256/20 • At 8-bit resolution we can vary output from 0 to 255. Hi frequencies are smoother • Can Compute arbitrary waveforms (not just tone summations) • This is probably quite doable with our 8051, but we will take a simpler approach (maybe some of you may take the last week to improve the acoustics) 255 128 0 Computer each sample through CSE 370 - Fall 1999 - Introduction - 4
Using single bit tones • Two tones generated by single bit outputs. • Use current summation externally. • Note: high frequencies look more sinusoidal CSE 370 - Fall 1999 - Introduction - 5
Our Version • Objective convert number of bits to current 5V 8051 tone1 AMP (B to I) tone2 tone3 CSE 370 - Fall 1999 - Introduction - 6
One Idea 5V 8051 R=? tone1 8ohms tone2 Vs tone3 Constraints 5/(8+R)<10mA 5/(8+R/3) < 26mA • Does this sum? (I = Bx) • What must R be to protect the processor? • What is the worst case (1, 2, or 3 bits)? • How much power are we putting • through the speaker in the worst case? No quite. Vs decreases with increasing B. So each Ir decreases with increasing B 3 bits is worse (Higher R constraint) (26mA)^2 * 8 = 5.4mA CSE 370 - Fall 1999 - Introduction - 7
Another Idea • Use a current amplifier (PNP Transistor) • Ice=Ib (assume =10) • Assume Vbe = 0 (can be up to .7V) • Assume tone1 = 0V • Determine: Ib, Ice • Determine Power dissipated by speaker 5V 8ohms Ib 8051 e Ib = 11*Is Is = 5/8 Is = 625mA Ib = 57mA Ic = 568mA Violates speaker, 8051, Transistor constraints Ps = (.625^2) * 8 = ~3W (overpowers .2W speaker) tone1 b Ib c CSE 370 - Fall 1999 - Introduction - 8
How do we fix this problem • How much current can we safely put through a .2W speaker? • Imax = (.2/8)^.5 = ~158mA • From data sheet for transistor, notice that Ice = 50mA if Ib = 5mA, and it gives us values for Vce and Vbe for that case. Is this a good “on” operating point for us? (Other operating points can be found on graphs, experimentation) • Its perfect if we use one for each tone for a total of about 50mA • If we limit Ib then we limit Ice too. What size resistor should we put between 8051 port and the BASE to “bias” the transistor properly. Heavy use of KCL and Ohm’s law. See next page CSE 370 - Fall 1999 - Introduction - 9
Final Circuit Design Size R to match your speaker and to Stay within the current limitations of the Processor. From DataSheet (On Sat.) 5V Ib = 5mA Ic = 50mA Vbe = .65V (min) Vr = (5 – (50mA*8) - .65) R = Vr/5mA ~ 790ohms 8ohms 8051 R=? tone1 tone2 tone3 CSE 370 - Fall 1999 - Introduction - 10
Resistor • Review of basic Electronics • Capacitors • Inductors • Bipolar Transistors • MOS transistors • Review of 8051 I/O configuration CSE 370 - Fall 1999 - Introduction - 11