AM Modulation and Demodulation AN62582 Author: Pavankumar Vibhute and Praveen Sekar Associated Project: Yes Associated Part Family: CY8C38xx/CY8C55xx Software Version: PSoC® Creator™ Associated Application Notes: None Application Note Abstract The application note describes how to implement amplitude modulation (AM) and demodulation using PSoC® 3 and PSoC 5. Amplitude modulation is achieved by using an up-mixer to multiply the carrier and message. Demodulation is achieved by down mixing the signal with the same carrier frequency. This application note demonstrates examples of modulation and demodulation. Introduction Amplitude Modulation is defined as modifying the amplitude of the carrier wave according to the message or information signal. The AM generation involves mixing of carrier and information signal. There are two methods to generate AM: low level modulation and high level modulation. In low level modulation, the message signal and carrier signal are modulated at low power levels and then amplified. The advantage of this technique is that a small audio amplifier is sufficient to amplify the message signal. The disadvantage is that the linear amplifiers should be used to amplify the modulated signal to transmitter levels. The nonlinear amplifiers cause distortion of the modulated wave. In this application note, the modulation is inside PSoC 3 and PSoC 5 at low power levels (not at the transmitting power levels); this is low level modulation technique. In high level modulation, the carrier and message signals are sufficiently amplified to the transmitting levels and modulation is done at high power levels.The advantage of this technique is that nonlinear high efficient amplifiers can be used to amplify the signals. The disadvantage is that large audio amplifier needs to be used to amplify the message signal.. The modulation in PSoC 3 and PSoC 5 is achieved by using the up-mixer component. A square with carrier frequency is multiplied with the message signal. The output of the mixer is filtered using a band pass filter to remove harmonics. The modulation index of AM is the extent of amplitude variation about an unmodulated carrier amplitude level. Higher the message signal amplitude, larger the variation on the amplitude of the AM wave. In the section, Examples – Modulation on on page 4, examples 1, 2, and 3 show the AM for different modulation indices. The message signal power is increased keeping the carrier level constant to get different modulation indices. Example 4 shows the AM waves with different carrier power levels. July 2, 2010 In some applications, power is saved by suppressing the carrier from the AM wave. Example 5 shows the Double Side Band Suppressed Carrier (DSBSC) AM wave. Coherent detection is used for demodulation. The coherent demodulation involves multiplication of the AM wave by a carrier wave. In this implementation, the square wave with the same frequency as carrier wave is generated by passing the input AM wave through Zero Crossing Detector (ZCD). This square wave and the AM are given to the down-mixer component. The output of the mixer is filtered by a low pass filter to get the message signal. AM Generation Figure 1. AM Generation K(offset) +m(t) ( K+m(t) ) * c(t) AM c(t) Mixer c(t)= Carrier Signal m(t)= Message Signal Document No. 001-62582 Rev. ** 1 [+] Feedback AN62582 m(t) is message signal, m(t) = Am cos (2 Π fmt) Figure 2. Suppressed Carrier AM Generation Equation 1 m(t) c(t) is a carrier signal, c(t) = cos (2 Π fct) Equation 2 m(t)* c(t) AM c(t) Offset of ‘K’ is added to the message signal: AM = (K + m(t) ) × c(t) = K cos (2 Π fct) + Am cos (2 Π fmt) × cos (2 Π fct) Equation 3 If the message signal is given with zero offset, you get a suppressed carrier AM, Mixer c(t)= Carrier Signal m(t)= Message Signal AM = m(t) × c(t) = Am cos (2 Π fmt) × cos (2 Π fct) Equation 4 PSoC 3 / PSoC 5 Implementation Figure 3. Amplitude Modulation The VDAC provides offset to the message signal m(t). The message signal and carrier signal are multiplied by mixer; therefore, the carrier component strength in the resulting AM wave is determined by this offset voltage (see Figure 1 on page 1). By varying this offset voltage, the carrier level in July 2, 2010 AM can be controlled. The message signal should be biased on top of this DC offset voltage and fed to mixer. The reference Vdda/2 with buffer provides the AGND for all signals and to the mixer. The offset of the message signal Document No. 001-62582 Rev. ** 2 [+] Feedback AN62582 should be above AGND. Thus, VDAC voltage value should be VDAC = AGND + offset (K). gives a gain of 1 for the up converted frequency; the down mixer gives a lesser gain. The square wave of 100 kHz is used as a carrier signal. The square wave has odd harmonics such as 300 kHz and 500 kHz in it. When it is multiplied with the message signal with frequency, fM, it produces double sided AM with components ‘fC + fM’ and ‘fC – fM’. However, there are also harmonics ‘3fC + fM’, ‘3fC – fM’, and so on. To remove these higher harmonics the band pass filter with bandwidth 10 kHz, and center frequency 100 kHz is put at the mixer output. The band pass filter with cutoff frequency 100 kHz and bandwidth of 10 kHz is built as follows. This is a simple band pass filter with low Q factor. Lowest frequency of pass band fL= 90 kHz Highest frequency of pass band fH= 110 kHz fL= 1/2 Π R1C1, fH = 1/2 Π R2C2. The mixer component type is set to ‘Up-Mixer’ (or ‘Multiply Mixer’). The up-mixer is used for modulation because it Figure 4. Frequency Spectrum for AM Amplitude 500 Hz Signal -500 Hz f 500 Hz 100 kHz carrier -300 kHz Amplitude modulated wave -300 kHz July 2, 2010 -100 kHz 100 kHz BPF BPF -100 kHz 100 kHz Document No. 001-62582 Rev. ** 300 kHz f 300 kHz f 3 [+] Feedback AN62582 Examples - Modulation In the following figures, the waveform in cyan color is message signal and waveform in yellow is the AM. Example with Modulation Index (u) = 50 % Figure 5. AM with 50% Modulation Vdda = 5 V AGND = Vdda/2 = 2.5 V VDAC = AGND + 1 V (K) = 3.5 V Message amplitude = Am = 0.5 V Carrier amplitude = K = 1 V u = (Max – Min)/(Max + Min); Max and Min are shown in Figure 5. u = (3 – 1) / (3 + 1) = 0.5 Example with Modulation Index (u) = 25 % Figure 6. AM with 25% Modulation Message signal strength is reduced keeping the carrier strength same. Message amplitude= Am = 0.25 V. Vdda = 5 V AGND = Vdda/2 = 2.5 V VDAC = AGND + 1 V (K) = 3.5 V Carrier amplitude = K = 1 V u = (Max – Min) / (Max + Min); Max and Min are shown in Figure 6. u = (2.5 – 1.5) / (2.5 + 1.5) = 0.25 Example with Modulation Index (u) = 100 % Figure 7. AM with 100% Modulation Message signal strength is amplified, keeping the carrier strength same. Message amplitude= Am = 1 V. Vdda = 5 V AGND = Vdda/2 = 2.5 V VDAC = AGND + 1 V (K) = 3.5 V Carrier amplitude = K = 1 V u = (Max –- Min) / (Max + Min); Max and Min are shown in Figure 7. u = (4 - 0) / (4 + 0) = 1 July 2, 2010 Document No. 001-62582 Rev. ** 4 [+] Feedback AN62582 Example Showing Different Carrier Level for 50% Modulation Carrier amplitude = K= 0.5 V Carrier amplitude = K = 1 V Message amplitude = Am = 0.25 V Message amplitude= Am = 0.5V Vdda = 5 V Vdda = 5 V AGND = Vdda/2=2.5 V AGND = Vdda/2 = 2.5 V VDAC= AGND + 0.5V (K) = 3 V VDAC = AGND + 1 V (K) = 3.5 V u = (Max – Min) / (Max + Min), u = (Max – Min) / (Max + Min), u = (1.5 – 0.5) / (1.5 + 0.5) = 0.5 u = (3 – 1) / (3 + 1) = 0.5 Figure 8. AM with Different Carrier Levels Example with Carrier Suppressed Figure 9. AM with suppressed carrier Carrier amplitude = K = 0 V Message amplitude = Am = 0.5 V Vdda = 5 V AGND = Vdda/2 = 2.5 V VDAC = AGND + 0 (K) = AGND July 2, 2010 Document No. 001-62582 Rev. ** 5 [+] Feedback AN62582 Figure 10. AM Demodulation Demodulation This section explains the coherent detection of AM signal. In this method, the incoming AM signal is multiplied with the local oscillator signal of same frequency as carrier frequency. The local oscillator signal is generated from the AM by passing the AM signal through the zero crossing detector. The envelope detector method can also be implemented for demodulation using opamp, but it requires external components. AM Zero Cross Detector Local Oscillator Low Pass Filter Demodulated signal Mixer PSoC 3 / PSoC 5 Implementation Figure 11. TopDesign for AM Demodulation Page1 - AM_Demodulator July 2, 2010 Document No. 001-62582 Rev. ** 6 [+] Feedback AN62582 Figure 12. Top Design for AM Demodulation Page2 - Filter The Vdda/2 reference voltage is buffered and used as an analog ground (AGND) for the circuit. The incoming AM signal should be biased at this DC voltage. The AM signal is given to comparator whose reference is AGND. The output of the comparator is used as a local oscillator signal for the mixer. The mixer type is set to Down Mixer (or Sample Mixer).The down mixer gives a gain close to ‘1’ (when the signal is sampled at peaks) for the down converted signal. The low pass filter is used to filter the demodulated output to remove the sample and hold effect on the output of mixer. The sample and hold gives maximum output when the signal is sampled at peaks. The comparator output delay plays a very important role in the demodulation. The ideal delay that gives maximum output is quarter period (90°) of the carrier. See Figure 13. When the delay is 90°, the mixer samples the AM wave at the peaks. A delay lesser than 90° still gives a demodulated output; however, the amplitude level is reduced. The comparator typical delay is 90 ns. This delay makes the mixer sample the AM wave within 45° to 135° from the zero crossing for the frequency range 1.25 MHz to 4 MHz. If the signal frequency is out of this range then, either external delay circuit should be added on the signal before giving it to zero crossing July 2, 2010 detector or the signal should be brought within the range before demodulating it. Figure 13. Comparator Delay of 90° Making Sampling at Peak 900 The low pass filter is needed to remove the high frequency components of the mixer output. The Sallen-Key low pass filter with 1 kHz cutoff is built using opamp as follows. For Sallen-Key low pass filter, Cutoff frequency, fC= 1/2Π(R1 R2 C1 C2)1/2 fC= 1/ 2Π(146.5k × 78.67k × 1n × 2.2 n)0.5 = 1 kHz. Document No. 001-62582 Rev. ** 7 [+] Feedback AN62582 Figure 14. Frequency Spectrum for AM and Demodulated Signal Amplitude AM Signal –1.2 MHz 1.2 MHz f Demodulated Output LPF 1.2 MHz Example - Demodulation AM wave amplitude = 1 V Carrier frequency = 1.2 MHz Message frequency = 500 Hz. Figure 15. Example of AM Demodulation July 2, 2010 1.2 MHz 0 Hz f Summary Implementing the AM modulation and demodulation is straight forward using the mixer component in PSoC 3 and PSoC 5. The AM modulation with different modulation indices, carrier levels, and suppressed carrier is discussed in this application note. AM demodulation using the coherent detection method is also demonstrated. Document No. 001-62582 Rev. ** 8 [+] Feedback AN62582 Document History Document Title: AM Modulation and Demodulation Document Number: 001-62582 Revision ** ECN 2968090 Orig. of Change PVKV Submission Date 07/02/10 Description of Change New application note PSoC is a registered trademark of Cypress Semiconductor Corp. PSoC Creator is a trademark of Cypress Semiconductor Corp. All other trademarks or registered trademarks referenced herein are the property of their respective owners. Cypress Semiconductor 198 Champion Court San Jose, CA 95134-1709 Phone: 408-943-2600 Fax: 408-943-4730 http://www.cypress.com/ © Cypress Semiconductor Corporation, 2010. The information contained herein is subject to change without notice. Cypress Semiconductor Corporation assumes no responsibility for the use of any circuitry other than circuitry embodied in a Cypress product. Nor does it convey or imply any license under patent or other rights. Cypress products are not warranted nor intended to be used for medical, life support, life saving, critical control or safety applications, unless pursuant to an express written agreement with Cypress. Furthermore, Cypress does not authorize its products for use as critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. The inclusion of Cypress products in life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies Cypress against all charges. This Source Code (software and/or firmware) is owned by Cypress Semiconductor Corporation (Cypress) and is protected by and subject to worldwide patent protection (United States and foreign), United States copyright laws and international treaty provisions. Cypress hereby grants to licensee a personal, non-exclusive, non-transferable license to copy, use, modify, create derivative works of, and compile the Cypress Source Code and derivative works for the sole purpose of creating custom software and or firmware in support of licensee product to be used only in conjunction with a Cypress integrated circuit as specified in the applicable agreement. Any reproduction, modification, translation, compilation, or representation of this Source Code except as specified above is prohibited without the express written permission of Cypress. Disclaimer: CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress reserves the right to make changes without further notice to the materials described herein. Cypress does not assume any liability arising out of the application or use of any product or circuit described herein. Cypress does not authorize its products for use as critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. The inclusion of Cypress’ product in a life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies Cypress against all charges. Use may be limited by and subject to the applicable Cypress software license agreement. July 2, 2010 Document No. 001-62582 Rev. ** 9 [+] Feedback