2014年2月5日 星期三

Lab 8 Amplitude Modulation

http://physics.usask.ca/~angie/ep311/lab8.htm
Lab 8 Amplitude Modulation 
Introduction

AM radio stations use a transmission system called Amplitude Modulation (AM).
 This consists of a high frequency "carrier" wave that is "modulated" by a low frequency
(audio range) wave that contains the actual signal to be transmitted.
The carrier frequency is used because it makes it possible to transmit over much larger
distances.
Modulation is achieved by multiplying the carrier and the modulator. This gives you a
frequency spectrum composed of the carrier frequency (fc) and two sidebands:
the carrier minus the modulator (fm), and the carrier plus the modulator.
Each sideband contains the information for both frequencies,
 so either one can be selected using a bandpass filter, and then "demodulated"
- the high frequency carrier is filtered out, leaving the modulator.
      Output of an AM Circuit:




When the carrier and the modulator are multiplied together, the output is is a waveform where the carrier wave is multiplied by the modulation index,m. The relative amplitudes of the modulating signal and the carrier signal determine what the modulation index will be.


You can view the output of an AM circuit on the oscilloscope (in "Stop" mode). It will look like the figure on the left. The modulation index is then defined as:
m = (message signal peak amplitude) / (unmodulated carrier peak amplitude)
m = (A - B) / (A + B)
The frequency components can also be displayed by using the FFT function on the oscilloscope. A typical plot is shown below.
This shows the frequencies of the signal components and their relative amplitudes in dB. The modulation index can be calculated from this plot, using the following equation:
m = 2 / 10 ^ (delta/20)
where delta is the difference between the carrier and the sideband power (dB).

      An AM Circuit:

A simple AM circuit is shown below. The AM signal is transmitted at the "antenna". The circuit uses a non-inverting amplifer in which the carrier wave is applied to the non-inverting input. The modulating signal is applied to the gate of a JFET (Junction Field Effect Transistor). The JFET acts like a voltage controlled resistor, so it can be used to vary the gain of the amplifier based on the applied modulating signal. This varying gain acts as the "multiplier" that creates the AM modulated output.
Breadboard and test the AM circuit shown above, using a carrier signal in the 70 - 90 kHz range (use the function generator on the IDL-800 breadboard).  Use the benchtop EZ function generator to supply a modulating signal of around 10 kHz. It will require an approximately -0.6V DC offset to provide a quiescent operating point in the linear range of the JFET. To set this offset, pull the DC Offset button the function generator and adjust it for the desired offset. The relative amplitude settings for the two waveforms are important. Set the modulating signal very close to the minimum amplitude possible on the function generator (make sure the "Attn+ button is pressed in for extra attenuation) and the carrier frequency just above the minimum value as well. Too high of an amplitude for either signal will cause distortion of the output.
Set the oscilloscope by using "Autoset", and adjust the trigger level, if necessary, to obtain a clear output. Then press "STOP" to see the modulated waveform. Sketch the waveforms, measure the amplitude of the signal and determine the modulation index, m.
Set the oscilloscope back on"RUN" and go to the MATH menu. Select the "Operation" (top right hand side of the display screen) to be "FFT". Now the frequency will be displayed on the x-axis and the amplitude(dB) of the signal on the y-axis. Use the "Zoom" option (bottom right hand side of the display screen) to zoom in on the area of interest, and the cursors to determine the difference in the frequencies and the amplitudes. Sketch the output, label the carrier frequency and the sidebands, and calculate the modulation index from this information.
You can also "capture" the screen output of the oscilloscope on your computer in Excel, then include it in your report. To do this, follow these instructions:
Launch Excel
On the Menu bar, go to: Tools, Add-Ins
Browse...
C:\VXIpnp\WINNT\TekVISA\ExcelToolbar\TekXLToolbar.xla
TekXL Toolbar now appears in Excel
Click the left button in Toolbar ("TekXL Connection")
Click ASRL2::INSTR, click OK
Click middle button in Toolbar (looks like a dual waveform)
Click Capture.
      An AM Receiver Circuit:
The AM signal can be received using the circuit shown below.
The tuned LC Circuit would filter out the specific sideband for the signal you want to receive (like selecting the station on an AM radio dial). The rest of the circuit retrieves the original modulating signal, which contains the information to be transmitted, by rectifying and filtering out the carrier frequency. A speaker can be used to listen to the final output.

2014年2月3日 星期一

MCU Atmega128 LED 閃爍

//***********************************************************************
//FUNCTION : LED FLASH
/* Test configuration:
MCU: ATmega128

Oscillator: External Clock 07.37280 MHz
Ext. Modules: -
SW: mikroC PRO for AVR
*/

//***********************************************************************
// Include Files
//***********************************************************************
#define uchar unsigned char
#define uint unsigned int

#define Data_IO PORTA //8-LED DATA
#define Data_DDR DDRA //8-LED DATA DIRECTION

//----------------------------------------------------------------------------------------
// Macros
//----------------------------------------------------------------------------------------
#define SETBIT(ADDRESS,BIT) (ADDRESS |= (1<<BIT))
#define CLRBIT(ADDRESS,BIT) (ADDRESS &= ~(1<<BIT))
#define CHKBIT(ADDRESS,BIT) (ADDRESS & (1<<BIT))

sbit D_LE at PORTD4_bit; // Output pin, PINx register is used
sbit W_LE at PORTD5_bit; // Output pin, PINx register is used
sbit D_LE_Pin_Direction at DDD4_bit;
sbit W_LE_Pin_Direction at DDD5_bit;

//***********************************************************************
// Common cathode DISPLAY CODE 0--F
// DP G F E D C B A
// 0 0 0 1 1 1 1 1 1 ==> 3FH
// 1 0 0 0 0 0 1 1 0 ==> 06H
// 2 0 1 0 1 1 0 1 1 ==> 5BH
//***********************************************************************

uchar table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};

//***********************************************************************
// IO PORT Initialization
//***********************************************************************

void System_Init()
{
Data_IO=0xFF; //7-SEGMENT DATA PORT IS OUT <1=OUT , 0=IN>
Data_DDR=0xFF;

D_LE_Pin_Direction = 1; // Set pin as output ;
W_LE_Pin_Direction = 1; // Set pin as output ;
//IC74HC573 CONTROL PORT IS OUT.
//IC1 74LS573 LE=PD4 ,IC2 74LS573 LE=PD5
}

//*************************************************************************
// 74HC573 CONTROL 7-SEGMENT SCAN FUNCTION
// 74LS573 LE=1 ACTIVE , LE=0 DISABLE
//*************************************************************************

void Display_char(uchar num)
{
D_LE=1;
W_LE=1; //控制數碼管位的74HC573的LE管腳置高
Data_IO=0x7f; //設置要顯示的位,也就是哪一個數碼管亮,這裡是八個一起顯示
// Display @ digit 0 , all segment 8 digits , 7-6-5-4-3-2-1-0
Delay_us(5);
W_LE=0; //鎖存位數據,下面送上段數據以後,就顯示出來了
Data_IO=table[num]; //SEND DATA TO 7-SEG, EXAMPLE 0 IS SEND 0x3f
D_LE=0; //鎖存段數據,數碼管亮一個時間片刻
Delay_us(10); //DELAY, affect the brightness and flashing of 7-SEG
}

//*************************************************************************
// MAIN PROCEDURE
//*************************************************************************

void main(){
char num;
System_Init();
while(1) {
for (num=0;num<=15;num++)
{
Display_char(num);
Delay_ms(250);
}
} ;
} // END MAIN

MCU Atmega128 LED 依照設計圖形閃爍

//************************************************************
//FUNCTION : LED 8 FLASH BY PATTERN
/* Test configuration:
MCU: ATmega128
Oscillator: External Clock 07.37280 MHz
Ext. Modules: -
SW: mikroC PRO for AVR
*/
//************************************************************
// Include Files
//************************************************************
#define uchar unsigned char
#define uint unsigned int
#define Data_IO PORTA //8-LED DATA
#define Data_DDR DDRA //8-LED DATA DIRECTION
//----------------------------------------------------------------------------------------
// Macros
//----------------------------------------------------------------------------------------
#define SETBIT(ADDRESS,BIT) (ADDRESS |= (1<<BIT))
#define CLRBIT(ADDRESS,BIT) (ADDRESS &= ~(1<<BIT))
#define CHKBIT(ADDRESS,BIT) (ADDRESS & (1<<BIT))
uchar LED_PTN[17] = {0B11111111,
0B11100111,
0B11000011,
0B10000001,
0B00000000,
0B10000001,
0B11000011,
0B11100111,
0B11111111,
0B10101010,
0B01010101,
0B10101010,
0B01010101,
0B10101010,
0B01010101,
0B10101010,
0B01010101
};
char i;
void main() {
Data_IO=0xFF; //8-LED DATA PORT IS OUT <1=OUT , 0=IN>
Data_DDR=0xFF;
while(1)
{
for (i=0 ; i<=17 ;i++)
{
Delay_ms(125);
Data_IO = LED_PTN[i];
}
Data_IO=0x00;
Delay_ms(2000);
}
}

MCU Atmega128 8個LED 閃爍燈

//************************************************************
//FUNCTION : 8 LED PORTA.0 -PORTA.7 FLASH
/* Test configuration:
MCU: ATmega128
Oscillator: External Clock 07.37280 MHz
Ext. Modules: -
SW: mikroC PRO for AVR
*/
//************************************************************
// Include Files
//************************************************************#define uchar unsigned char
#define uint unsigned int
#define Data_IO PORTA //8-LED DATA
#define Data_DDR DDRA //8-LED DATA DIRECTION
//----------------------------------------------------------------------------------------
// Macros
//----------------------------------------------------------------------------------------
#define SETBIT(ADDRESS,BIT) (ADDRESS |= (1<<BIT))
#define CLRBIT(ADDRESS,BIT) (ADDRESS &= ~(1<<BIT))
#define CHKBIT(ADDRESS,BIT) (ADDRESS & (1<<BIT))
char i;
void main() {
Data_IO=0xFF; //8-LED DATA PORT IS OUT <1=OUT , 0=IN>
Data_DDR=0xFF;
while(1)
{
Data_IO=0x01;
for (i=0 ; i<=7 ;i++)
{
Delay_ms(125);
Data_IO = Data_IO <<1;
}
Data_IO=0x80;
for (i=0 ; i<=7 ;i++)
{
Delay_ms(125);
Data_IO = Data_IO >>1;
}
}
}

MCU Atmega128 LED閃爍燈

//FUNCTION : LED PORTA.0 FLASH
/* Test configuration:
MCU: ATmega128
Oscillator: External Clock 07.37280 MHz
Ext. Modules: -
SW: mikroC PRO for AVR
*/
//***********************************************************************
// Include Files
//***********************************************************************
#define uchar unsigned char
#define uint unsigned int
#define Data_IO PORTA //8-LED DATA
#define Data_DDR DDRA //8-LED DATA DIRECTION
//----------------------------------------------------------------------------------------
// Macros
//----------------------------------------------------------------------------------------
#define SETBIT(ADDRESS,BIT) (ADDRESS |= (1<<BIT))
#define CLRBIT(ADDRESS,BIT) (ADDRESS &= ~(1<<BIT))
#define CHKBIT(ADDRESS,BIT) (ADDRESS & (1<<BIT))
void main() {
Data_IO=0xFF; //8-LED DATA PORT IS OUT <1=OUT , 0=IN>
Data_DDR=0xFF;
Data_IO=0x00;
while(1)
{
SETBIT(PORTA,0);
Delay_ms(500);
CLRBIT(PORTA,0) ;
Delay_ms(500);
}
}

2014年1月29日 星期三

The Ultimate AM Radio Antenna

The Ultimate AM Radio Antenna
as realized by Ted Tenny
When I searched on “AM radio antenna design”, the best result I found was How to Make the Ultimate AM Antenna by R. Wagoner. The design looked right, but only by making one could I find out how good it was. The result is audibly better AM reception at my home in Mesa, Arizona.
The original wooden frame was problematic to build (and alas, not very substantial) so I tried substituting plastic pipe for the wood, with the antenna wires on the inside. This proved to be durable and easy to construct.
Here are the parts ...
AM_parts
  1. 6' of telephone cable. Round telephone cable with four solid #22 wires works best. Cable with twisted pairs of wires interferes with AM reception, and therefore must be avoided.
    Thanks to Gary Camp for advising me about this.
  2. three 11" sections of 1/2" plastic pipe.
  3. three 5" sections of 1/2" plastic pipe.
  4. four slip elbows for 1/2" plastic pipe.
  5. one slip “T” for 1/2" plastic pipe.
  6. wire cutting and stripping tool
  7. radio and TV solder
  8. electrical tape
Here’s how to assemble the antenna:
1.Thread the telephone cable through the plastic pipes and fittings, like stringing beads. The ends of the cable coming out the bottom should be of approximately equal length. It’s easier to get them even if you start by threading the 11" plastic pipe on top.IMG_3371_530
2.Press the plastic pipes and fittings together, with the telephone cable inside. You can glue the plastic parts with PVC cement, but you don’t have to. They fit snugly.IMG_3372_530
3.Strip the outer insulation from both ends of the telephone cable.

If you don’t already have a wire cutting and stripping tool it’s well worth buying one. Mine is from JerryCo, part no. 40587.
IMG_3375_530
4.Cut all but the white wire on the left, and all but the black wire on the right, leaving just enough to connect the wires that remain. Save the pieces of wire you cut off.IMG_3380_530
5.Strip and connect each short wire on the left to a short wire on the right. Make sure each connection is from a left wire to a right wire. Remember that left and right wires of the same color are opposite ends of the same wire. An effective connection pattern is
left —right
white —red
red —green
green —black

You are transforming the 4-conductor telephone cable into a loop with 4 turns of wire.
IMG_3386_530
6.Test the loop for circuit continuity at the ends of the two long wires you didn’t cut.

My home-made circuit continuity tester has both a beeper and a light that come on when the circuit is closed.
IMG_3389_530
7.Twist the two long wires together so that they have approximately 2 turns per inch.

If the wires aren’t too long you can hold the loose ends up with one hand while turning the antenna assembly below them. Watch out for kinking.
IMG_3394_530
8.If the resulting antenna leads aren’t long enough, extend them using the pieces of wire you cut off in step 4, all twisted so they have approximately 2 turns per inch.IMG_3395_530
9.Build a base for your antenna out of wood, plastic pipe, or other insulating material. Or, depending on the location, you could hang the antenna from a ceiling.

Here’s where I used that third 5" plastic pipe. Drill a hole in one side to let the wires through.
IMG_3399_530

IMG_3403_530
You can turn the antenna in any direction to get the best AM radio reception.



Ted,
This was fascinating and I have a few observations to share.
The verbal description was excellent, yet when I referred to the photographs there seemed to be disconnect when you said “Cut all but one of the wires on the left, and all but one of the wires on the right,” since when I referred to the photo I saw only one long wire. Turns out that the background color, the wire color, and my “first look” observation skills did not allow me to see the black wire. Fortunately I continued to follow the instructions to the end, then went back and read it again with the knowledge that there had to be two long wires, and walla there they were. Once the black wire is seen it is obvious in subsequent looks. Working in medical imaging, I am always fascinated by the way the human visual system filters image information, causing some things to be invisible until they are pointed out.
I am curious whether the shape and size of the loop is critical to the efficiency of the AM reception and how you determined the optimum design.
For those that don’t have any engineering or science background, it would help to show how the antenna is connected to the radio, perhaps even several different radios to demonstrate different means/locations of the connection.
You might also want to check out the broadcast Digital TV Antenna described in the attached document. You might also want to check out the broadcast Digital TV Antenna described in Makezine.
Loved your post. Thank you for sharing.
Phil Rauch



Phil,
Thanks! It’s great to hear from you.
The green carpet in my living room might not have been the best background. I’d thought about using a table, or the concrete floor on the patio, but wound up on my living room carpet.
The shape and size of the AM antenna are optimal, according to Wagoner. I don’t know enough about antenna design to say much more, so I adopted Carver’s design as given.
IMG_0580_530
On the back of my stereo receiver (and apparently most) there are antenna jacks marked for AM and FM. For best reception you should use both an AM antenna and an FM antenna, just by inserting the wires in their corresponding jacks.
The Digital TV Coat Hanger Antenna looks interesting. We didn’t throw away all of our metal coat hangers when my family switched to plastic.
Ted

  updated October 14, 2013Mile 204Ted Tenny  

FM, AM/MW and SW Antenna Amplifier

FM, AM/MW and SW Antenna Amplifier
Here is a schematic of FM, AM/MW and SW antenna amplifier circuit or we can also say it antenna preamplifier circuit which can be used to increase the faint signals of FM, AM/MW & SW bands. The circuit is very simple and easy to build using only one transistor MPF 102 and few other components

But if you didn't found MPF 102 transistor then you can use NTE 451 or 2N4406 as substitutes. For L1 use 470uH coil for AM and for shortwave use 20uH coil. This circuit can be powered with a 9V alkaline battery or if  you are using power supply then bypass power supply with a 0.04 uF capacitor to decrease noise. Antenna can be a 18 inch telescope or 18 inch thick piece of copper wire. 

  清除項目編譯快取 執行 flutter clean 重新取得套件依賴 執行 flutter pub get 完整重新編譯並執行 flutter run 1. 新增專案套件 (pubspec.yaml) 在 Flutter 專案根目錄下的 pubspec.yaml 中,新增 ...