AFeL (Audio FM Link) Service Manual Senior Design Fall Semester 2001 Team Number: 16, FM Link - Blue Project Sponsor: Dr. Matthew Valenti Manual Author: Elizabeth S. Cullinan Date: 12 December 2001 1 Table of Contents Contents Page Introduction-------------------------------------------------------------------------3 Circuit Description-----------------------------------------------------------------4 Separate Parts List-----------------------------------------------------------------6 System Layout---------------------------------------------------------------------9 FM-25A Layout Schematics------------------------------------------------------------------------10 USB – PIC Schematic FM Receiver Schematic Transmitter Schematic Software List---------------------------------------------------------------------13 Software Code-------------------------------------------------------------------14 First Code User Software PIC Code Troubleshooting----------------------------------------------------------------28 FCC Rules & Regulations----------------------------------------------------29 References for Specifications-----------------------------------------------30 2 Introduction Welcome to the AFeL Service Manual. In here you will find all the information you will need to completely understand the AFeL’s components and how they work together. You will also be able to use this to troubleshoot any problems you may encounter with the AFeL. As discussed in the User’s Manual, the AFeL is a personal unlicensed, lowpowered FM Broadcasting system controlled by your PC. The AFeL is made of two main components: it’s hardware and it’s software. The AFeL’s hardware consists of the unlicensed, low-powered FM Transmitter, a FM Receiver, USB cable and a microcontroller. The AFeL’s Software consists of a user interface run on the PC and embedded software found in the microcontroller. The AFeL does transmit on an unlicensed FM broadcasting station in which the United States embarks the FCC Rules & Regulations. It is vital that you understand these rules. Please refer to the FCC Rules & Regulations chapter of this manual for further information. 3 Circuit Description Power Supply The AFeL DC power supply is originally provided as a part of the Ramsey™ FM-25A kit. 1While a DC power source is provided with the FM-25A, the DC isn’t proper enough to provide us with the low-noise, stable supply that we would like for a good audio quality. The Voltage Regulator VR3 provides us with the means to take the raw DC output from the wall transformer and smooth it out, keeping it at a constant 12 volts. USB The USB provides the communication between the PC User interface (software) and the PIC microcontroller (hardware). The USB tells the PIC which hardware component to turn on/off and what frequency to use. The USB returns a ‘go’ or ‘no-go’ information form the PIC to the PC. The USB has four Pins: Power, ground, D1 & D2 used to pass and receive data. Microchip™ PIC16745 The Microchip™ PIC16745 microcontroller is the brains of the transmitter and receiver. The PIC tells the transmitter and receiver when to turn on or off and what station to transmit or receive. Without the PIC, the transmitter and receiver would do nothing. The PIC, upon power-up, sets the PLL of the transmitter then configures and initiates the USB. The frequency is set to the Transmitter and transmission will begin. Please refer to the PIC schematic for input/output specific pins. Receiver The Receiver is used to scan the licensed FM band (88-108 MHz) in order to detect an open, or unused frequency. The components in the diagram consist of the front-end chip, receiver chip and the PLL chip. 1 Note: Technical/Use information concerning FM25A kit taken directly from Ramsey™ User Manua 4 1 Transmitter Once transmitter receives the information from the PIC, the PLL U1 takes the 6MHz crystal frequency and divides it by 60 to obtain a stable frequency of 100KHz. Your desired frequency is sent to the PLL in a string of binary bits. The PLL is used to constantly check the output frequency so that it matches the desired frequency. The PLL also takes the output frequency from U3 and divides it by a number N. N is your desired frequency in megahertz times 10. The frequency from U3 is divided by N and compared to 100 KHz. If N is less than 100KHz, the PLL will increase the output voltage (pin 13). This will increase the voltage across the varactor diode D21 that will in turn cause a decrease in the capacitance. The final result is an increase in U3’s RF oscillator, and keeping the output frequency on track to match your desired frequency. The opposite occurs when N is more than 100 KHz. Adjustable Components There are five potentiometers found in the hardware; three located in the transmitter circuit and two located in the receiver circuit. 2The transmitter potentiometers R11 and R16 allows for the adjustment of the audio levels. The transmitter potentiometer R6 permits adjustment of stereo balance. The receiver potentiometer RP1 is used in place of 22ohm resister and should never be adjusted. The receiver potentiometer RP2 allow for adjustment of the FM tuning level. 1 Information concerning the FM25A is taken directly from FM25A user manual. l. 5 The FM Link Parts List 1 1 1 1 6 foot USB Cable Cord Radio Shack Black Project Box 7x5x3 Shielded stereo audio cable Micro-Controller Circuit 1 Microchip PIC 16C745 1 220 μF, ceramic capacitor 1 100μF, ceramic capacitor 1 1.5K ohms (brown – green – red) resistor 1 Receiver Circuit Capacitors 5 .01μF disc capacitors 1 .017μF disc capacitor 2 .022μF disc capacitor 2 .03μF disc capacitor 2 .033μF disc capacitor 1 100 pF disc capacitor 1 680 pF disc capacitor 1 .22μF electrolytic capacitor 2 1μF electrolytic capacitor 1 10μF electrolytic capacitor 2 100μF electrolytic capacitor Resistors 1 1K ohm (brown-black-red) 1 1.2K ohm (brown-red-red) 1 10K ohm (brown-red-orange) 1 20K ohm (red-yellow-orange) 1 10K ohm potentiometer 1 100K ohm potentiometer Hardware, Misc. 2 4-turn inductor coils 1 2.7MHz ceramic filter 1 10.7MHz discriminator 1 Rohm™ BA1448S 1 Rohm™ B2611A 1 Rohm™ BA4424N 6 1 2 2 Ramsey Electronics, Inc. FM25A Transmitter Kit Capacitors 8 .001μF disc capacitors [C10,C12,C13,C26,C27,C28,C29,C31] 7 .01 μF disc capacitors [C7,C8,C15,C23,C24,C42,C43] 2 .1μF disc capacitors [C9,C16] 2 .022 μF ceramic capacitors [C14,C22] 2 5 pF disc capacitors [C18,C20] 2 10 pF disc capacitors [C30,C32] 2 27 pF disc capacitors [C1,C2] 2 47 pF disc capacitors [C35,C37] 1 75 pF disc capacitors [C36] 1 220 pF disc capacitors [C33] 8 10 μF electrolytic capacitors [C3,C6,C11,C17,C19,C21,C25,C34] 1 100 μF electrolytic capacitors [C4] 1 1000 μF electrolytic capacitors [C5] Resistors 1 100 ohms (brown-black-brown) [R12] 2 220 ohms (red-red-brown) [R14,17] 1 270 ohms (red-violet-brown) [R13] 2 470 ohms (yellow-violet-brown) [R2,R10] 1 1K ohms (brown-black-red) [R31] 1 2.2K ohms (red-red-red) [R19,] 2 3.3K ohms (orange-orange-red) [R9,R15] 2 4.7K ohms (yellow-violet-red) [R21,R28,R30] 5 10K ohms (brown-black-orange) [R1,R4,R5,R18,R20] 3 47K ohm (yellow-violet-orange) [R8,R27,R29] 1 100K ohms (brown-black-yellow) [R7] 1 150K ohms (brown-green-yellow) [R22] 1 10M ohms (brown-black-blue) [R3] 2 1K ohms potentiometer [R11,R16] 1 100K ohm potentiometer [R6] Note: Items included in the Ramsey™ FM25A Kit that are not listed where not used in AFeL 7 (FM25A Kit continued) Semiconductors 1 2N3904 NPN transistor [Q1] 2 2SC2498 or 2570 NPN transistor [Q2,Q3] 1 Varactor diode, marked MV2105 [D21] 1 LED [D1] 1 Shielded can inductor [L1] 1 Pre-wound spring style inductors [L2,L3] Hardware, Misc. 1 6MHz crystal, marked 6.00 [Y1] 1 38 KHz crystal [Y2] 1 78L05 +5 volt voltage regulator [VR1] 1 78L02 +2.6 volt voltage regulator [VR2] 1 7812 +12 volt voltage regulator [VR3] 1 18-pin socket for U3 1 145170 Serial PLL IC [U1] 1 BA1404 Stereo modulator IC [U3] 1 FM-25A printed circuit board 1 RCA-style jacks [J2,J3,J4] 1 DC power jack [J1] 1 Horizontal push-button switch [S1] 1 Whip antenna [ANT1] 1 12 volt DC power transformer 1 Two pin jumper and jumper block [JMP1] 8 FM25-A Layout NOTE: Items Blocked in RED are not part of AFeL, but are part of Ramsey ™ FM25-A Kit. 9 USB – PIC Schematic 10 FM Receiver Schematic 11 Transmitter Schematic 12 Software List Visual Basic (User Interface) First: Main: main.vbp PIC 16C745 Main: pic.c Packages: usb_main.c ushb_ch9.as stub.as hidclass.as descript.as usb_defs.as 13 Visual Basic ‘First’Code Const Const Const Const Const SCAN = 1 TXON = 2 TXOFF = 3 GOOD = 11 BAD = 13 Private Sub cmdAuto_Click() frmMain.Show frmFirst.Hide intMode = SCAN sngTestFreq = 92.3 ReDim Buffer(2) Do sngTestFreq = Round(sngTestFreq + 0.2, 1) 'Sends three bytes to the device and reads two bytes back. Buffer(0) = Int((sngTestFreq * 10) / 256) Buffer(1) = Int(sngTestFreq * 10) Mod 256 HIDComm1.WriteTo Buffer, 3 Buffer = HIDComm1.ReadFrom(2) intModeRtn = Buffer(0) intCommResult = Buffer(1) If intModeRtn <> intMode Then MsgBox "error", vbOKOnly End If If (intCommResult = BAD And sngTestFreq >= 107.9) Then sngTestFreq = 92.1 End If frmMain.txtFreq.Text = Round(sngTestFreq, 1) Loop Until (intCommResult = GOOD) MsgBox "The AFeL is ready to begin broadcasting", vbOKOnly, "Success" frmMain.cmdBroadcast.Enabled = True End Sub Private Sub cmdOnce_Click() sngTestFreq = InputBox("What frequency do you want to scan?", _ "Manual Scan", 92.3) If ((sngTestFreq * 10) Mod 2) <> 1 Then sngTestFreq = Round(sngTestFreq + 0.1, 1) End If If ((sngTestFreq * 100) Mod 10) <> 0 Then sngTestFreq = Round(sngTestFreq, 1) End If If sngTestFreq > 107.9 Or sngTestFreq < 92.3 Then sngTestFreq = 92.3 14 End If frmMain.Show frmFirst.Hide intMode = SCAN 'Sends three bytes to the device and reads two bytes back. ReDim Buffer(2) Buffer(0) = Int(Int(sngTestFreq * 10) / 256) Buffer(1) = Int(sngTestFreq * 10) Mod 256 HIDComm1.WriteTo Buffer, 2 Buffer = HIDComm1.ReadFrom(2) intModeRtn = Buffer(0) intCommResult = Buffer(1) If intModeRtn = intMode Then If intCommResult = GOOD Then frmMain.txtFreq.Text = sngTestFreq frmMain.cmdBroadcast.Enabled = True MsgBox "The AFeL is ready to begin broadcasting", vbOKOnly, "Success" Else If intCommResult = BAD Then MsgBox "Please choose a different frequency", vbOKOnly, "Unclear Frequency" Else MsgBox "error", vbOKOnly End If End If Else MsgBox "error", vbOKOnly End If End Sub 15 Visual Basic ‘Main’Code Option Explicit Dim Result As Long Dim intMode As Byte Dim intModeRtn As Byte Dim sngBCFreq As Single Dim Buffer() As Byte Dim Buffersize As Long Dim sngTestFreq As Single Dim intCommResult As Byte 'Set these to match the values in the device's firmware and INF file. Const MyVendorID = &H4D8 Const MyProductID = &H1234 Const Const Const Const Const SCAN = 1 TXON = 2 TXOFF = 3 GOOD = 11 BAD = 13 Private Sub cmdAutoScan_Click() intMode = SCAN sngTestFreq = sngBCFreq ReDim Buffer(3) Do sngTestFreq = Round(sngTestFreq + 0.2, 1) 'Sends three bytes to the device and reads two bytes back. Buffer(0) = intMode Buffer(1) = Int(sngTestFreq * 10) / 256 Buffer(2) = Int(sngTestFreq * 10) Mod 256 HIDComm1.WriteTo Buffer, Buffersize Buffer = HIDComm1.ReadFrom(Buffersize) intModeRtn = Buffer(0) intCommResult = Buffer(1) If intModeRtn <> intMode Then MsgBox "error", vbOKOnly End If If (intCommResult = BAD And sngTestFreq >= 107.9) Then sngTestFreq = 92.1 End If frmMain.txtFreq.Text = Round(sngTestFreq, 1) Loop Until (intCommResult = GOOD) 16 MsgBox "The AFeL is ready to begin broadcasting", vbOKOnly, "Success" frmMain.cmdBroadcast.Enabled = True End Sub Private Sub cmdBroadcast_Click() If cmdBroadcast.Caption = "Start Broadcasting" Then intMode = TXON sngBCFreq = sngTestFreq 'Sends three bytes to the device and reads two bytes back. Buffer(0) = intMode Buffer(1) = Int(sngTestFreq * 10) / 256 Buffer(2) = Int(sngTestFreq * 10) Mod 256 HIDComm1.WriteTo Buffer, 3 Buffer = HIDComm1.ReadFrom(2) intModeRtn = Buffer(0) intCommResult = Buffer(1) If intModeRtn = intMode Then If intCommResult = GOOD Then cmdBroadcast.Caption = "Cancel Broadcasting" cmdChkFreq.Enabled = False cmdAutoScan.Enabled = False Else If intCommResult = BAD Then MsgBox "error", vbOKOnly Else MsgBox "error", vbOKOnly End If End If Else MsgBox "error", vbOKOnly End If Else intMode = TXOFF 'Sends three bytes to the device and reads two bytes back. Buffer(0) = intMode Buffer(1) = Int(sngTestFreq * 10) / 256 Buffer(2) = Int(sngTestFreq * 10) Mod 256 HIDComm1.WriteTo Buffer, 2 Buffer = HIDComm1.ReadFrom(2) intModeRtn = Buffer(0) intCommResult = Buffer(1) If intModeRtn = intMode Then If intCommResult = GOOD Then cmdBroadcast.Caption = "Start Broadcasting" cmdChkFreq.Enabled = True cmdAutoScan.Enabled = True 17 Else If intCommResult = BAD Then MsgBox "error", vbOKOnly Else MsgBox "error", vbOKOnly End If End If Else MsgBox "error", vbOKOnly End If End If End Sub Private Sub cmdChkFreq_Click() intMode = SCAN 'Sends three bytes to the device and reads two bytes back. sngTestFreq = txtFreq.Text Buffer(0) = intMode Buffer(1) = Int(sngTestFreq * 10) / 256 Buffer(2) = Int(sngTestFreq * 10) Mod 256 HIDComm1.WriteTo Buffer, 3 Buffer = HIDComm1.ReadFrom(2) intModeRtn = Buffer(0) intCommResult = Buffer(1) If intModeRtn = intMode Then If intCommResult = GOOD Then cmdBroadcast.Enabled = True txtFreq.Text = sngTestFreq MsgBox "The AFeL is ready to begin broadcasting", vbOKOnly, "Success" Else If intCommResult = BAD Then MsgBox "Please choose a different frequency", vbOKOnly, "Unclear Frequency" Else MsgBox "error", vbOKOnly End If End If Else MsgBox "error", vbOKOnly End If End Sub Private Sub cmdDecrement_Click() txtFreq.Text = Round((CSng(txtFreq.Text) - 0.2), 1) If (txtFreq.Text < 92.3) Then txtFreq.Text = 107.9 End If End Sub 18 Private Sub cmdIncrement_Click() txtFreq.Text = Round((CSng(txtFreq.Text) + 0.2), 1) If (txtFreq.Text > 107.9) Then txtFreq.Text = 92.3 End If End Sub Private Sub Form_Load() ReDim Buffer(3) frmFirst.Hide frmMain.Hide HIDComm1.Connect cmdBroadcast.Enabled = False sngBCFreq = GetSetting("AFEL", "STARTUP", "BCFreq", 25) If sngBCFreq = 25 Then sngBCFreq = 92.3 frmFirst.Show Else frmMain.Show End If txtFreq.Text = sngBCFreq End Sub Private Sub Form_Unload(Cancel As Integer) If cmdBroadcast.Caption = "Cancel Broadcasting" Then Call cmdBroadcast_Click End If HIDComm1.Disconnect HIDComm1.Uninit SaveSetting "AFEL", "STARTUP", "BCFreq", sngBCFreq End Sub Private Sub txtFreq_LostFocus() cmdChkFreq.Enabled = True cmdChkFreq.Default = True cmdBroadcast.Enabled = False On Error GoTo ErrorHandler If ((txtFreq.Text * 10) Mod 2) <> 1 Then txtFreq.Text = Round(CSng(txtFreq.Text) + 0.1, 1) End If If ((txtFreq.Text * 100) Mod 10) <> 0 Then txtFreq.Text = Round(CSng(txtFreq.Text), 1) End If sngTestFreq = CSng(txtFreq.Text) If sngTestFreq > 107.9 Or sngTestFreq < 92.3 Then Err.Raise (13) End If Exit Sub ErrorHandler: txtFreq.Text = "92.3" sngTestFreq = 92.3 19 Resume Next End Sub Private Sub txtFreq_Change() If cmdBroadcast.Enabled = True Then If cmdBroadcast.Caption = "Cancel Broadcasting" Then Call cmdBroadcast_Click cmdBroadcast.Enabled = False End If End If End Sub 20 PIC Code #include <stdio.h> #include <stdlib.h> #include "usb.h" #include <pic.h> #define SCAN 1 #define TXON 2 #define TXOFF 3 #define GOOD 11 #define BAD 13 #definePORTBIT(adr, bit) ((unsigned)(&adr)*8+(bit)) static bit static bit RXStatus @ PORTBIT(PORTA, 0); TXStatus @ PORTBIT(PORTA, 1); static bit static bit Done @ PORTBIT(PORTA, 2); Done1 @ PORTBIT(PORTA, 3); static bit static bit RX @ PORTBIT(PORTB, 0); TX @ PORTBIT(PORTB, 1); static bit static bit static bit CE @ PORTBIT(PORTB, 2); CK @ PORTBIT(PORTB, 3); DA @ PORTBIT(PORTB, 4); static bit static bit static bit EN @ PORTBIT(PORTB, 5); CLK @ PORTBIT(PORTB, 6); DIN @ PORTBIT(PORTB, 7); static bit C_bit @ PORTBIT(STATUS, 0); unsigned int hibyte; unsigned int lobyte; void setup_tx_pll(void) { CLK = 0; DIN = 0; 21 EN =1; CLK = 1; CLK = 0; CLK = 1; CLK = 0; CLK = 1; CLK = 0; CLK = 1; CLK = 0; CLK = 1; CLK = 0; CLK = 1; CLK = 0; CLK = 1; CLK = 0; DIN = 0; EN = 0; CLK = 1; CLK = 0; CLK = 1; CLK = 0; CLK = 1; CLK = 0; DIN = 1; CLK = 1; CLK = 0; DIN = 0; CLK = 1; CLK = 0; EN = 1; //PLL IS NOW RESET 22 //SETUP C REG DIN = 0; EN = 0; CLK = 1; CLK = 0; DIN = 1; CLK = 1; CLK = 0; CLK = 1; CLK = 0; DIN = 0; CLK = 1; CLK = 0; CLK = 1; CLK = 0; DIN = 1; CLK = 1; CLK = 0; DIN = 0; CLK = 1; CLK = 0; CLK = 1; CLK = 0; EN = 1; //SETUP REF DIVIDER // 000000000111100 DIN = 0; EN = 0; CLK = 1; CLK = 0; CLK = 1; CLK = 0; CLK = 1; 23 CLK = 0; CLK = 1; CLK = 0; CLK = 1; CLK = 0; CLK = 1; CLK = 0; CLK = 1; CLK = 0; CLK = 1; CLK = 0; CLK = 1; CLK = 0; DIN = 1; CLK = 1; CLK = 0; CLK = 1; CLK = 0; CLK = 1; CLK = 0; CLK = 1; CLK = 0; DIN = 0; CLK = 1; CLK = 0; CLK = 1; CLK = 0; EN = 1; } void tune_tx_pll(void) { int ctr; 24 CLK = 0; EN = 0; C_bit=0; for (ctr=0;ctr<=7;ctr++) { asm("rlf _hibyte,f"); DIN = C_bit; CLK = 1; CLK = 0; } for(ctr=0;ctr<=7;ctr++) { asm("rlf _lobyte,f"); DIN = C_bit; CLK = 1; CLK = 0; } DIN = 0; EN = 1; } void main() { int mode; TRISA=(0b00000011); TRISB=(0); Done1 = 1; setup_tx_pll(); Done = 1; hibyte=3; lobyte=217; tune_tx_pll(); Done1 = 0; for(mode=0;mode<=3000;mode++){} InitUSB(); SoftDetachUSB(); ConfiguredUSB(); 25 while(1) { Done = 1; for(mode=0;mode<=3000;mode++){} Done = 0; for(mode=0;mode<=3000;mode++){} } } 26 Troubleshooting FCC Rules & Regulations *Please Refer to this section of Manual Completed First check for loose connections between the USB and PC, the USB and AFeL Box. Also check to make sure DC adapter is plugged in and the AFeL Box has been turned on. If the AFeL user interface software is not able to run, check to see what Operating System is running on the PC. The AFeL program is meant to run on Windows® 98/95. The AFeL will not run on other systems. If your standard FM radio is picking up your transmission and what sounds like interference from another station change your station immediately. Please refer to FCC Rules & Regulations. 27 FCC Rules & Regulations Your Rights According to FCC Rules & Regulations, unlicensed FM broadcasting, used by the AFeL, do not have any rights over the licensed FM Broadcasting stations. This means that any interference the AFeL may cause with licensed FM Broadcasting must be dealt with immediately. This can easily be done by changing your AFeL FM transmitting station. Unlicensed FM broadcasting is discussed further in the FCC Rules & Regulations part 15. To order your copy of FCC Rules & Regulations part 15, call the US Government, Superintendent of Documents, at 202.512.1800, or fax at 202.512.2250. To order the correct document, ask for “CFR Title 17: Parts 1 to 199.” The cost is $24.00. Master Card and Visa are accepted. 28 References for Specifications For Specification Sheets on Microchip™ PIC visit Microchip: www.microchip.com For more information on the Ramsey™ FM25-A Kit visit: www.ramseyelectronics.com For Specification Sheets on Rohm™ Audio LSIs visit: www.rohm.com For Specification Sheets on Murata™ components visit: www.murata.com For Specification Sheets on Soshin™ components visit: www.soshinelec.com 29