<<

Micro-RF Receiver for Bat-Like Robot Final Report

ECE445 Senior Design Spring 2015

Zhongzhu Guo, Temitayo Ade-Oshifogun TA: Dennis Yuan Project 62

i Abstract

In this project, we aimed to design a micro-RF receiver for the remote control of the movement of a bat-like robot. The receiver platform was built on consumer FM radio product, and due to its unique encoding of control signal, an RF circuit was also built to pair-up with the receiver. However, due mostly to lack of workforce and lack of time, we were unable to finish implementing the full design within the given time. Nevertheless, we were able to establish the basic communication from receiver host microcontroller to FM receiver IC, collect input samples using Analog-to-Digital Converter, and show functional PCBs with microscopic traces and parts.

A List of abbreviations used in this report: ADC – Analog-to-Digital Converter ADC10 – Analog-to-Digital Converter, 10-bit precision ADC12 – Analog-to-Digital Converter, 12-bit precision AWG – American Wire Gauge CCS – Code Composer Studio® DAC – Digital-to-Analog Converter DMA – Direct Memory Access DSP – Digital Signal Processing FCC – Federal Communications Commission FFT – Fast Fourier Transform FM – Frequency Modulation GPIO – General-Purpose Input/Output I2C – Inter-Integrated Circuit I2S – Integrated Interchip Sound IC – Integrated Circuits IEEE – Institute of Electrical and Electronic Engineers ISR – Interrupt Service Routine LED – Light Emitting Diode MCU – Microcontroller Unit MSB – Most Significant Bit PCB – Printed Circuit Board RF – Radio Frequency Rx – Receiver SoC – System on Chip SNR – Signal-to-Noise ratio SPI – Serial Peripheral Interface TI – Texas Instruments® Tx – Transmitter

ii Table of Content

1 Introduction...... 1 1.1 Purpose...... 1 1.2 Objectives...... 1 2 Design...... 1 2.1 Design Procedure...... 1 2.1.1 RF Platform and Controller...... 1 2.1.2 Audio Interface with FM IC...... 1 2.1.3 Signal Encoding and Decoding Schemes...... 2 2.1.4 Firmware Development...... 2 2.1.5 Design...... 2 2.1.6 Precision Clock Source...... 3 2.1.7 Overview...... 3 2.2 Design Specifications...... 4 2.2.1 Transmitter Circuit...... 4 2.2.2 Receiver Circuit...... 5 2.2.3 PCB Design...... 6 2.2.4 Antenna Design...... 6 2.2.5 FM Software Tuning Procedure...... 7 2.2.6 I2C Multiple Byte Transmission...... 9 2.2.7 SPI to I2S Interface (For Transmitter MCU only)...... 10 2.2.8 ADC10 and ADC12...... 11 2.2.9 Using DMA...... 12 2.2.10 Control Signal Encoding & Decoding...... 13 3 Verification and Testing...... 15 3.1 Summary of Verifications of the Initial Requirements...... 15 3.2 Testing of I2C Interface...... 16 3.2.1 Debug Run of I2C Communication to Si4705...... 16 3.2.2 Clock Generator I2C Testing...... 16 3.3 ADC12 Testing...... 17 3.4 Clock Generator Integrity Testing...... 18 3.5 Other Miscellaneous Testing...... 18 4 Cost Analysis...... 19 4.1 Labor Cost...... 19 4.2 Materials Cost...... 19 4.3 Total Cost of Development...... 19

iii 5 Conclusion...... 19 5.1 Accomplishments...... 19 5.2 Uncertainties...... 19 5.3 Future Work...... 20 5.4 Ethical Considerations...... 20 6 References...... 21

iv 1. Introduction

1.1 Purpose

The purpose of project is designing and building a micro-RF receiver for Prof. Hutchinson's prototype bat robot to allow remote control. And if necessary, a specially designed RF transmitter should also be built to match the receiver for sending the required control signal.

1.2 Objectives Goals . Implement a micro-RF receiver to allow remote control; . The receiver should have max PCB area of 2cm2 and max weight of 1.5g, plus an antenna with weight under 6 grams, to be carried by the bat robot. Features  Receive RF signal from a commercial or custom-built RC plane controller;  Receive at least 2 control signals at the same time (i.e. having at least 2 “control channels”) for robotic movement possibilities;  Such RF communication range should be at least 3 meters.

2. Design 2.1 Design Procedure

2.1.1 RF Platform and Controller First of all, the RF platform for remote control is very carefully selected. There are several compelling solutions, among which are Silicon Labs Si47xx FM radio products, Nordic nRF9E5 RF SoC, Linx Tehnology LR-series digital RF transmitter, TI CC3200 SimpleLink Wi-Fi SoC, and even building our custom RF receiver at IC level.

Among these solutions, Silicon Labs Si4705-D50 software-tuned FM IC is chosen, because it provides the smallest physical size (3x3 mm with minimum external components), good range, and requires minimum RF design. Its drawbacks include low efficiency and non-optimization for remote control application, requiring custom written analog protocol.

The Si4705 receiver also requires a host microcontroller (MCU) to operate. Only a selected few from TI MSP430FR5xxx family have desired small size (4x4 mm). MSP430FR5738 is chosen as receiver host MCU, due to its relative high computational performance. 2.1.2 Audio Interface with FM IC The FM ICs have both analog and I2S digital audio interfaces. For transmitter, the host MCU needs to provide audio output. If using analog audio, an external DAC is required, because the MCU has no analog output. This adds additional complexities, therefore the digital interface is used.

1 The MCU has no I2S interface; however it has SPI, which is compatible with I2S left-justified mode, except that it lacks a “Digital Frame Selection (DFS)” signal. The DFS signal is the SPI clock divided by 8 and synchronized with data byte. TI recommended obtaining the DFS signal using a combination of external counter circuits [1]; but the same function can be implemented using the Timer module in MCU, which reduces circuit components.

For receiver, the host MCU needs to accept audio input. The I2S-to-SPI digital connection (as mentioned above) is more noise-resistant and energy efficient, but requires 3 termination resistors and 1 capacitor. The analog audio interface consumes more energy, but requires no additional components. Since size is the most important factor in this project, analog audio interface is chosen. 2.1.3 Signal Encoding and Decoding Schemes Because Si4705 receiver only processes stereo audio up to 48kHz, the encoded control signal for bat robot must be carried in audio format. Two reasonable encoding methods are proposed.

A. Parallel amplitude modulation: each control signal channel occupies a distinct audio frequency.

B. Serial direct transmission: each control signal channel number corresponds to a distinct voltage level in left audio channel, and the value of the control signal is directly represented by voltage level of right audio channel. To decode, the receiver MCU reads the channel number from the voltage of left audio channel, and obtains the numerical value directly from right audio channel, through ADC.

Method A requires the receiver MCU to calculate the windowed FFT of input signal, FFT, which is too computationally demanding for the microcontroller chosen, and will result in a difficult-to-test DSP system. Method B does not require extensive computation. Therefore, method B is desired.

Due to this unique signal encoding method, a dedicated FM transmitter is required to generate the control signal and match the receiver. The transmitter is built with Si4713 transmitter IC and MSP430FR5969 host MCU. The software tuning operation and pin layout of Si4713 are similar to those of Si4705, and MSP430FR5969 is code compatible with MSP430FR5738. These measures simplify firmware development. 2.1.4 Firmware Development The firmware of transmitter and receiver MCUs share many common codes. In order to reduce delay in real-time operation, the firmware extensively used interrupts and DMA. As designed, encoded signal output, signal decoding and I2C transmission are handled in Interrupt Service Routines (ISR), while all repeated high-speed data transfer (ADC and SPI) are handled with DMA. 2.1.5 Antenna Design Both FM transmitter and receiver ICs support standard half-wave antenna, embedded headphone antenna, embedded power supply cable antenna, monopole whip or , and PCB antenna options. Monopole whip antenna was chosen, because it requires minimum additional component (only 1 ), results in the smallest size and lightest weight, is the easiest to modify, and has acceptable performance.

2 2.1.6 Precision Clock Source Both FM ICs require a 32768 Hz precision clock source with at most 100ppm (50ppm favorable) frequency deviation for tuning to the desired FM frequency and maintaining FM channel stability. Using quartz oscillator to provide clock requires 1 quartz plus 2 capacitors, with at least 9 sq.mm of PCB space. However Silicon Times SiT1533 clock generator requires only 3 sq.mm of PCB space, while meeting the precision requirements; therefore it is chosen for the design. 2.1.7 Overview In summary, the design results in the system represented by the functional block diagram below. The flow of the control signal is marked in red.

Figure 1: High Level System Block Diagram

The highest level software flowcharts for both transmitter and receiver host MCUs are also shown below:

Figure 2: Highest Level Software Flowchart

3 2.2 Design Specifications

2.2.1 Transmitter Circuit

The transmitter circuit diagram is shown below:

Figure 3: Transmitter circuit diagram

The transmitter circuit operates from 2.7V to 3.3V. Four 10kΩ fine-tuning potentiometers provide the variable input voltage to represent the positions of control joysticks. The added REG1117 regulator allows up to 5V power supply. The circuit also includes 3 LED indicators.

The detailed component list with “bill of material” is shown below:

Component Value Packaging Price($) Description Si4713-B30 --- QFN-20 2.94 FM transmitter IC for consumer audio MSP430FR5969RGZ --- VQFN-48 5.92 Host Microcontroller SiT1533AI-H4-DCC-32.768E --- Special 1.17 32768Hz precision clock generator ANT1 ------0.01 Monopole whip antenna (15cm AWG24 wire) L1 130nH C0805 0.64 FM Tuning inductor C1 100nF C0603 0.023 FM IC decoupling capacitors C2 47nF C0603 0.06 C4 2.2pF C0603 0.08 SPI interface noise filtering capacitor C5, C7 1uF C0805 0.24 MCU decoupling capacitors C3, C8 100nF C0603 0.046 C6 100nF C0603 0.023 SiT1533 clock generator decoupling capacitor C9, C10 1uF C0805 0.24 REG1117 linear regulator filtering capacitor

4 R1, R2 4.7kΩ C0603 0.026 I2C pull-up resistors R3, R4, R5 1kΩ C0603 0.24 SPI termination/noise migration resistors R10, R11, R12, R13 0-10kΩ C0603 1 Joystick simulation potentiometers LED1, LED2, LED3 ------0.75 Through-hole LED indicators Table 1: Transmitter component list and bill of material

2.2.2 Receiver Circuit The receiver circuit diagram is shown below:

Figure 4: Receiver circuit diagram

The circuit operates from 2.7V to 3.3V with no power regulation. An LED indicator is added for debugging purpose. The detailed component list with “bill of material” are listed below:

Component Value Packaging Price ($) Description Si4705-D50 --- QFN-20 3.18 FM receiver IC for consumer audio MSP430FR5738RGE --- QFN-24 3.83 Host Microcontroller SiT1533AI-H4-DCC- --- Special 1.17 32768Hz precision clock generator 32.768E ANT1 ------0.01 Monopole whip antenna (15cm AWG24 wire) L1 130nH C0805 0.64 FM tuning inductor C1 100nF C0603 0.023 SiT1533 clock generator decoupling capacitor C2 100nF C0603 0.023 FM IC decoupling capacitors

5 C3 47nF C0603 0.06 C4 470nF C0603 0.1 Required CPU core decoupling capacitor of MCU C5, C6 10uF C0603 0.76 MCU decoupling capacitors C7, C8 100nF C0603 0.046 R1, R2 4.7kΩ C0603 0.026 I2C pull-up resistors LED1 --- C1206 0.3 SMD LED indicator Table 2: Receiver component list and bill of material

2.2.3 PCB Design

The transmitter (left) and 2 versions of receiver (right) PCB patterns are shown below (to scale):

Figure 5: Transmitter (left) and 2 receivers (right) PCB layout, square size = 1mm

The ECE service shop has constraints on making PCB: 2-layer board only, with no vias or solder mask. Plus, all parts are soldered by hand, which requires some minimum space. Therefore, the PCBs are designed unnecessarily large to accommodate these adverse conditions. The original receiver PCB dimension is 17 x 12mm. The receiver has an enlarged version (shown further right in Figure 5) to further facilitate soldering by hand.

The traces carrying high-frequency signals are carefully drawn to ensure signal quality. For example, the clock generator is placed very close to FM IC input with straight trace, and all the traces for SPI have 45 degree (instead of 90 degree) turning to avoid signal reflection.

In addition, due to the very tight space, the positions of all components and trace placements are extremely carefully selected. With 2 major ICs on the same side, there are 32 possible combinations of ICs placements, determined by their relative position and orientation. The one chosen in the PCB design results in shortest overall trace length, and least amount (only 1) of jumpers required. 2.2.4 Antenna Design For the embedded monopole whip antenna chosen, the FM ICs require no at antenna port. However, a single tuning inductor with Q factor of at least 30 is required. The circuit layout is the same for both transmitter and receiver, and is shown in the figure below:

6 Figure 6: Antenna circuit and tuning inductor range

The inductor value is determined by: 2 L = 1/(2πf) /( + Cchip) with f = operating frequency, and Cchip is the internal tuning capacitor of FM IC, which ranges from 0.25 ~ 47.75 pF [4]. At with antenna length much shorter than , the antenna impedance is capacitive, and this capacitance Cantenna can be estimated by:

Cantenna = Lantenna/198/3E8 AWG24 wire is recommended by Silicon Labs to make the antenna [4]. Longer antenna gives better signal quality, but results in heavier weight. As a trade-off, antenna length of 15cm was chosen, at 80 MHz operating frequency. With these parameters, the limits on inductor value are calculated and shown in the chart in Figure 6, beside the circuit figure. Silicon Labs recommend L = 120nH. In this design, 130nH inductor with Q = 50 was chosen. The tuning procedure of FM ICs also requires checking the actual value of chip capacitor by software, to make sure that inductor and antenna parameters are chosen correctly. If after tuning to the desired FM frequency, the chip capacitor is found to be out of range, the antenna must be changed to proper length. [4] 2.2.5 FM Software Tuning Procedure Both FM transmitter and receiver ICs are completely tuned by software, with similar tuning processes. The software tuning flowcharts for both transmitter and receiver ICs are listed below:

7 Figure 7: Flowcharts of software tuning procedures for FM ICs

At high level, the tuning procedure is as follows: reset → power up with selected mode → configure peripherals, set audio and FM parameters → tune to FM frequency → check tune results.

The actual tuning commands are written in 1 to 6 bytes of binary, and sent from the host MCU through I2C interface. The MCU must send all bytes of a command consecutively, then generate the I2C “STOP” condition. The FM IC generates a one-byte “status” for every command, indicating if it has finished executing the command, or if error occurs. To read this “status byte”, the host MCU must send a “READ” request first, after the “STOP” condition of the previous command [5]. Figure 8 illustrates such sequence of sending command bytes and reading status byte (all bytes sent by host MCU, except “Status 1”):

Figure 8: Sequence of sending command bytes and reading status byte

When the FM receiver executes the “set FM tune frequency” command, it is required that the I2C bus be temporarily stopped, to reduce noise interference during this noise-sensitive tuning process [5]. Therefore, the host MCU cannot send “READ” requests to check the status byte. Instead, an GPIO interrupt will be sent from FM receiver to the MCU, after the desired FM frequency is tuned to.

The “get chip revision”, “get Tx tune status” and “get tune status” commands generate additional 7 or 8 bytes of responses, which carry the requested information.

8 In addition, the transmitter voltage level is set to 100dBuV, which stays below the FCC maximum limit for “operation without pre-approval”. More details are provided in Section 5.4 “Ethical Considerations”.

The complete FM transmitter tuning operation including the sequence of sending commands, the value and meaning of each command, and associated return status, are shown in Figure 9 below:

Figure 9: Complete tuning operation for FM transmitter IC

Similarly, the complete FM receiver tuning operation is shown in Figure 10 below:

Figure 10: Complete tuning operation for FM receiver IC

2.2.6 I2C Multiple Byte Transmission The I2C modules of host MCU only transmit or read one byte of data. To transmit and receive multiple bytes of the FM tuning commands, a specially designed protocol is used, as described below:

9 The FM tuning command bytes to be sent are stored in individual C arrays. To send command, “main” function calls an “I2C transmit” function, which configures I2C module to transmit mode, copies the command into the intermediate buffer array, loads I2C transmission buffer with the first byte of command, and starts transmission. Once a single byte is transmitted, the “transmission done” interrupt is generated, which unconditionally branches the program into I2C ISR with interrupt vector 0x18. There, the transmission buffer is reloaded with the next byte of command, and the total number of transmitted bytes is checked. If every byte of the command is transmitted, a STOP condition is generated.

The I2C receive function works in similar ways, except that the value of receiver buffer is copied to “buffer array” each time ISR is entered, and I2C ISR uses interrupt vector 0x16 for handling receiving.

The register setup of I2C transmit and receive are listed below. The setup is identical for both transmitter and receiver MCU. The values are in C Macro definitions.

I2C initialization Register Operand Value Setting UCB0CTLW0 |= UCMST + UCMODE_3 + UCSYNC + I2C master mode, SMCLK, sync mode UCSSEL__SMCLK UCB0CTLW1 = UCGLIT_1 de-glitch time 25ns UCB0BRW = 0x001C I2C clock is SMCLK divided by 28 UCB0I2CSA = 0x11 7-bit slave address = 0010001 I2C transmit mode configuration UCB0CTLW0 |= UCTR transmit mode UCB0IE = UCTXIE0 + UCNACKIE enable transmit and non-acknowledge interrupt I2C receive mode configuration UCB0CTLW0 &= ~UCTR receive mode UCB0IE = UCRXIE0 + UCNACKIE enable receive and non-acknowledge interrupt I2C start and stop generation UCB0CTLW0 |= UCTXSTT start UCB0CTLW0 |= UCTXSTP stop Table 3: I2C configuration

2.2.7 SPI to I2S Interface (For Transmitter MCU only) In order to connect to I2S interface of Si4713 FM transmitter using the SPI module of host MCU, an on-chip timer module TA1 is configured into a 5-bit clock divider to provide the DFS signal required for I2S.The exact signal connection is shown below:

10 Figure 11: SPI to I2S interface signal connection

The register-level setting of Timer_A1 module is listed below, with register values written in C Macro definition. Once initially configured, the timer will run independently from CPU, and SPI module runs in its normal configuration unaffected.

Register Value Setting TA1CTL TASSEL_0 + ID_1 + MC_3 TA1CLK input, divider = 1, up/down mode, no interrupt TA1CCTL0 CM_0 + CCIS_2 + OUTMOD_0 No capture, compare mode, output constant 0 TA1CCR0 0x0008 Timer counts up to 8 TA1CCTL2 CM_0 + CCIS_0 + OUTMOD_3 No capture, compare mode, output mode = set/reset, no interrupt TA1CCR2 0x0000 Output will set when timer counts to 0 Table 4: Setting of Timer_A1 for SPI to I2S interface

2.2.8 ADC10 and ADC12 The transmitter MCU samples 4 inputs from potentiometers at 1kHz with ADC12, and receiver MCU samples 2 inputs from stereo audio at 48kHz with ADC10. The ADC sampling rates are controlled by on- chip timer modules, while the ADC module clock determines the “sample-and-hold” time base. The sampling settings require 4kHz from transmitter ADC timer, and 96kHz from receiver ADC timer. The timers' clock source is from the on-chip digital oscillator, with 2% frequency deviation. Since the control signal encoding and decoding are not time-sensitive, this 2% error in sampling rate is acceptable.

The positive and negative reference voltages are set to supply voltage and ground. The ADCs are to be run together with DMA for automated data transfer, and interrupts are not used. The actual configuration of both ADC10 and ADC12 is listed in Table 5, with register values written in C Macro definitions.

ADC_12 setting for transmitter MCU only (MSP430FR5969) Register Value Setting ADC12CTL0 ADC12SHT0_1 + ADC12MSC_0 + Sample & hold time = 8 ADC clock cycles, sampling ADC12ON triggered by timer, module on ADC12CTL1 ADC12PDIV_1 + ADC12SHS_6 + ADC clock pre-divide by 4, sampling triggered by TA3 ADC12SSEL_3 + ADC12CONSEQ_3 CCR1, ADC clock = SMCLK, repeated channel scan ADC12CTL2 ADC12RES_1 10-bit resolution ADC12CTL3 ADC12CSTARTADD_0 Start sampling from channel set by ADC12MCTL0 ADC12MCTL0 ADC12INCH_12 Input channel = A12

11 ADC12MCTL1 ADC12INCH_13 Input channel = A13 ADC12MCTL2 ADC12INCH_14 Input channel = A14 ADC12MCTL3 ADC12INCH_15 + ADC12EOS Input channel = A15, end of conversion sequence ADC_10 setting for receiver MCU only (MSP430FR5738) ADC10CTL0 ADC10SHT_0 + ADC10MSC_0 + Sample & hold time = 4 ADC clock cycles, sampling ADC10ON triggered by timer, module on ADC10CTL1 ADC10SHS_1 + ADC10DIV_1 + Sampling triggered by TA0.1, ADC clock divide by 2, ADC10SSEL_3 + ADC10CONSEQ_3 ADC clock = SMCLK, repeated channel scan ADC10CTL2 ADC10RES 10-bit resolution ADC10MCTL0 ADC10INCH_1 Start sequence of conversion from channel A1 Table 5: ADC configuration

The timer setup for controlling ADC sampling rate is listed in Table 6:

Timer A 3 setting for transmitter MCU only (MSP430FR5969) Register Value Setting TA3CTL TASSEL_2 + MC_1 Clock source = SMCLK, up mode TA3CCTL0 CM_0 + CCIS_2 + OUTMOD_0 No capture, compare mode, output constant 0 TA3CCR0 0x01F3 Timer counts up to 499 TA3CCTL1 CM_0 + CCIS_0 + OUTMOD_3 No capture, compare mode, output mode = set/reset TA3CCR1 0x00F9 Output sets when timer counts to 249 Timer A 0 setting for receiver MCU only (MSP430FR5738) TA0CTL TASSEL_2 + MC_1 Clock source = SMCLK, up mode TA0CCTL0 CM_0 + CCIS_2 + OUTMOD_0 No capture, compare mode, output constant 0 TA0CCR0 0x0014 Timer counts up to 20 TA0CCTL1 CM_0 + CCIS_1 + OUTMOD_3 No capture, compare mode, output mode = set/reset TA0CCR1 0x000B Output sets when timer counts to 11 Table 6: Timer setup for controlling ADC sampling rate

2.2.9 Using DMA To reduce delay, DMA is used in high-speed data transfer of ADC and SPI. The ADC samples are 10- bit, processed in “unsigned short” C arrays (16-bit), so DMA transfers ADC data in “word-to-word” format. The SPI data is 8-bit (and stored in C array of type “unsigned char”), and the DMA transfer type is “byte-to-byte”. Both ADC and SPI data is transferred in blocks.

Once configured, DMA transfers data automatically based on requests from peripherals. The DMA register-level settings are listed in Table 7 below. For receiver MCU, control signal encoding is done in DMA0 interrupt service routine, with interrupt vector = 0x02 (entered when “DMA0 transfer done”).

12 DMA setting for ADC data transfer, DMA channel = 0 Register Value Setting DMACTL0 DMA0TSEL_26 DMA0 trigger source = ADC conversion complete DMA0CTL DMADT_1 + DMADSTINCR_3 + Block transfer, destin. addr.++, source addr. static, DMASRCINCR_0 + DWSW + DMAEN + word-to-word, edge triggered, DMA & interrupt DMAIE (for receiver) enable DMADT_1 + DMADSTINCR_3 + Block transfer, destin. & source addr.++, word-to- DMASRCINCR_3 + DWSW + DMAEN + word, edge triggered, DMA & interrupt enable DMAIE (for transmitter) DMA0SA 0x0712 Source address = &ADC10MEM0 0x0860 Source address = &ADC12MEM0 DMA0DA array Destination address = target array in C DMA0SZ 0x0020 (for receiver) Block transfer size = 32 0x0008 (for transmitter) Block transfer size = 4 DMA setting for SPI data transfer, DMA channel = 1 DMACTL0 DMA1TSEL_15 (for receiver) DMA1 trigger source = UCA0TXIFG DMA1TSEL_17 (for transmitter) DMA1 trigger source = UCA1TXIFG DMA1CTL DMADT_1 + DMADSTINCR_0 + Block transfer, destin. addr. static, source addr.++, DMASRCINCR_3 + DBSB + DMAEN + DMAIE byte-to-byte, edge triggered, DMA & interrupt enable DMA1SA array Source address = source array in C DMA1DA 0x05CE (for receiver) Destination address = &UCA0TXBUF 0x05EE (for transmitter) Destination address = &UCA1TXBUF DMA1SZ 0x0032 Block transfer size = 32 Table 7: DMA Setting

2.2.10 Control Signal Encoding & Decoding The encoding process rounds the 10-bit ADC input (from potentiometers 1-4) to 8-bit, and aligns them with the channel number. The list of channel number is stored in a fixed array, with each channel number corresponding to a specific value listed in the table below (Vref+ = 3V):

Channel # Value in Array Voltage seen by ADC Channel # Value in Array Voltage seen by ADC 0 0x1A 0.3V 4 0x80 1.5V 1 0x33 0.6V 5 0x9A 1.8V 2 0x4D 0.9V 6 0xB3 2.1V 3 0x66 1.2V 7 0xCD 2.4V Table 8: Channel Number Values

The values are then serially written to SPI output, with channel number (carried in left audio channel) transmitted first, followed by the associated potentiometer voltage reading in 8-bit resolution (which is the value of specified channel, carried in right audio channel).

13 When switching channels, the voltage difference will create a sharp transition edge with high- frequency component. Since the FM audio system has 48 kHz sampling rate and contains cascaded ADC, DSP and DAC, it will cause temporary distortion in the waveform at the transition edge, due to the step response. A MATLAB simulation of this step response is performed to evaluate the distortion. The plot of the worst possible case is shown below, with source code listed beside.

Figure 12: MATLAB Simulated Response of 48kHz Audio System

It shows that, for the worst case (transition from 0V to Vcc), the signal magnitude seen at the ADC input of receiver MCU is able to stabilize within 10 samples. Temporary overflow (V > Vcc) of about 4 samples is generated; however by disabling overflow interrupt of ADC and waiting for the signal to stabilize (by using a simple delay loop), the overflow can be safely ignored.

14 3. Verification and Testing

3.1 Summary of verifications of the initial requirements The outcome of the project are verified with respect to the initial requirements (set during Design Review), and the results are listed in Table 9 below.

REQUIREMENT Testing Method Used Testing Result Requirement Met? 1. Receiver Size a. Receiver PCB area at most 2 a. Checking EAGLE layout 2.04 sq. cm Basically Yes square cm b. Receiver weight (without About 1 gram, excluding b. Estimated Yes antenna) at most 1.5 gram external wire connections 2. Communication Range a. Communication range at Not performed ------least 3 meters 3. Receiver Antenna a. Weight under 6 grams a. Estimated Under 0.5 gram Yes 4. FM Receiver a. Be able to receive FM radio signal of desired frequency Not performed ------band b. Output the modulation signal Not performed ------sent by the controller c. Show at least 5 signal to Not performed ------noise ratio 5. Control Signal Decoding a. Identify the command from Not performed ------the received control signal 6. Digital Output Interface a. Be able to send data to another processor (can be the Not performed ------same model) through any digital interface 7. Control Signal Encoding a. Controller can correctly Not performed ------encode controls signal 8. FM transmitter a. Correctly generates carrier Not performed ------frequency b. Be able to modulate signal Not performed ------Table 9: Requirements and Verifications

15 In summary, we did not have enough time to finish the full implementation of the system, and therefore most desired tests on the original list were not performed. However, we did perform other testing not specified on the list, which are summarized in this chapter. 3.2 Testing of I2C interface 3.2.1 I2C single-byte transmission demonstration

In order to fully understand the I2C operation at basic level, an I2C link was set between two MSP430G2553 launch pads, one as master and the other as slave. To implement this, both master and slave side must have parameters set as described in Table 3, before communication can begin. The full communicate cycle between the two launch pads could not finish successfully, however the slave address was successfully sent, which was required for initiating data transfer. However, the slave receiver could not acknowledged the address, returned a “non-acknowledge” bit by the end. An oscilloscope display of the associated waveform is shown in Figure 15 below.

Figure 15: I2C transmission waveform displayed on oscilloscope

3.2.2 I2C multiple-byte transmission directly to FM IC Multiple-byte I2C transmission directly to FM receiver and transmitter was also implemented. A step- by-step, bit-wise debug run in CCS showed that the host MCU (MSP430FR5738) was able to establish connection with Si4705. The following points were verified:

Host MCU was able to load the correct value to I2C transmit buffer register, interrupt enable register and other control registers, enter the correct interrupt service routine, and transmit multiple bytes or receive single byte of data;

Si4705 acknowledged slave address, “power-up” and “get chip revision” commands; it returned “error” status after “power-up” command, and returned normal status after “get chip revision” command;

However, the I2C program on host MCU had a problem with receiving multiple consecutive bytes, which prevented further verification with “get chip revision” command. A screen shot of the debug run, showing the correct Tx Buffer, slave address and interrupt vector values, is provided below:

16 Figure 13: Screen shot of CCS Debug Run of I2C transmission

3.3 ADC12 Testing The 12-bit ADC on transmitter MCU was configured for repeated single-channel sampling, and tested with analog voltage input. The ADC conversion result was formatted in unsigned integer (scaled), and the value was echoed to the console of Energia as decimal numbers. The testing showed correct conversion of analog voltage, and a plot of the transfer function is shown in Figure 14 below:

Figure 14: Transfer function of ADC12 conversion

17 3.4 Clock Generator Integrity Testing The SiT1533 clock generator was able to produce square waves of 32768Hz after power-up, which showed good soldering quality (since it has the smallest trace, and is the hardest part to solder). The oscilloscope waveform of the clock output is shown below:

Figure 14: Oscilloscope display of SiT1533 clock generator output 3.5 Other Miscellaneous Testing The PCBs were checked for continuity with multimeter at almost every connection, and showed no undesired disconnection or short circuit.

However, Pin 6 (P1.5) output of receiver MCU was -0.7V after power-up (normally, no pin should have negative voltage). Pin 18 (P4.2) of transmitter MCU was only +0.5V when turned ON by software (the normal value should be close to +3V). These suggested that the mentioned pins are damaged, likely due to the prolonged high temperature during soldering process, due to electrostatic discharge, or due to water leakage into the package. Nevertheless, both receiver and transmitter MCUs were able to successfully load and run programs, which showed normal CPU and memory structures.

18 4. Cost Analysis

4.1 Labor Cost Name Hourly Rate Hours Per Week Total Weeks Total Hours Invested Total Temitayo $27.50 35 12 420 $11,550.00 Zhongzhu $27.50 42 12 504 $13,860.00 Total ------924 $25,410.00 4.2 Materials Cost Item Note Cost Transmitter Circuit “Bill of material” including costs of individual parts can $13.4 Receiver Circuit be found in Table 1 and Table 2 $10.17 MSP-FET Flash Emulator Required for programming $115 PCB making --- $50 RC Plane Controller Box For housing the transmitter circuit $20 1.5V AAA Batteries x 2 Power supply of transmitter circuit $2 Total --- $210.57 4.3 Total Cost of Development Section Total Labor $25,410 Parts $210.57 Grand Total $25,620.57

5. Conclusion

5.1 Accomplishments

We were able to establish communication between the host MCU, and FM receiver or transmitter IC. We were able to transmit some FM tuning commands despite the mysterious, temporary error status from the FM receiver. We also had functional Analog-to-Digital Converter. In addition, we were able to make the PCB circuit working, with good soldering quality of microscopic parts. 5.2 Uncertainties A number of uncertainties still exist. The most important problem is that the design was not fully implemented. Besides, the I2C program on host MCU was not properly receiving multiple bytes. The FM receiver generated an unknown error status after power up, although this error status was cleared after the next command. Since the error status provides no further information, it will be extremely hard to find the exact cause, and its affect on FM operation is unknown. In addition, two GPIO pins (used to drive LED indicators) on host MCU were not functioning, leading questions to the integrity of some peripherals of the host MCU.

19 5.3 Future Work The most important further work is to finish the full implementation of the receiver software. Once finished, an “FM field testing” should be performed, by checking its quality of receiving a local FM radio station. The next step would be to finish the transmitter software implementation, and perform another FM field testing by monitoring its output RF spectrum using a spectral analyzer. Then, the transmitter and receiver shall be paired, and establish the communication link. A series of full system testing should finally be carried, to evaluate the performance of receiver and transmitter under real operating conditions.

With the quality of FM link verified, the receiver can be electronically integrated into the bat robot, through the serial interface (likely SPI), and using the power supply of the bat robot.

If desired, a 4-layer PCB can be made to further shrink the size of receiver, in order to fit into the bat robot. The transmitter PCB can also be fit into a used commercial RC plane controller box to use its joysticks, which can provide a much better a user interface. 5.4 Ethical Considerations Our project consistently followed the IEEE Code of Ethics; the content of the Code of Ethics can be found on IEEE website at: http://www.ieee.org/about/corporate/governance/p7-8.html

We accept full responsibility in making decisions that are consistent with the safety, health, and welfare of the public.

The solder tin used on our PCB contains lead, which is harmful to health and environment. We restricted the soldered PCB inside Senior Design lab, and made sure that it did not cause contamination or injury to any people. If we ever deliver the circuit to The Hutchinson Research Group, we should notify them of the health hazard of lead, and provide proper packaging or insulation to reduce skin contact with the PCB.

The maximum strength of FM transmitter output was limited, as stated in Section 2.5.5. We made sure that this stayed below the limits set by FCC, so no pre-approval from FCC was required for radio operation. In fact, we did not finish transmitter implementation, therefore we produced no FM radio broadcast. However, if we continue with the project, we should still abide with these regulations, and avoid causing radio interference to any other users.

20 6. References [1] Michael Burns, SLAA449A: Interfacing an I2S Device to an MSP430 Device, Texas Instruments, March 2010 http://www.ti.com/lit/an/slaa449a/slaa449a.pdf

[2] SLAU272C: MSP430FR57xx Family User Guide, Texas Instruments, Nov. 2013 http://www.ti.com/general/docs/lit/getliterature.tsp?baseLiteratureNumber=slau272&fileType=pdf

[3] SLAU367F: MSP430FR58xx, MSP430FR59xx, MSP430FR68xx, and MSP430FR69xx Family User's Guide, Texas Instruments, Jan. 2015 http://www.ti.com/lit/ug/slau367f/slau367f.pdf

[4] AN383: Si47XX Antenna, schematic, layout, and design guidlines, Silicon Labs, Sept. 2014 http://www.silabs.com/Support%20Documents/TechnicalDocs/AN383.pdf

[5] AN332: Si47xx Programming Guide, Silicon Labs, Sept. 2014 http://www.silabs.com/Support%20Documents/TechnicalDocs/AN332.pdf

[6] Si4704/05-D50 datasheet, Silicon Labs, Dec. 2010 http://www.silabs.com/Support%20Documents/TechnicalDocs/Si4704-05-D50.pdf

[7] Si4712/13-B30 datasheet, Silicon Labs, Feb. 2008 http://www.silabs.com/Support%20Documents/TechnicalDocs/Si4712-13-B30.pdf

[8] MSP430FR573x Mixed-Signal Microcontrollers datasheet, Texas Instruments, June 2014 http://www.ti.com/general/docs/lit/getliterature.tsp?genericPartNumber=msp430fr5738&fileType=pdf

[9] MSP430FR59xx Mixed-Signal Microcontrollers datasheet, Texas Instruments, Aug. 2014 http://www.ti.com/lit/ds/symlink/msp430fr5969.pdf

[10] SiT1533 datasheet, SiTime, Nov. 25, 2014 http://www.sitime.com/products/datasheets/sit1533/SiT1533-datasheet.pdf

[11] Best Design and Layout Practices for SiTime Oscillators, SiTime, Dec. 9, 2013 http://www.sitime.com/support2/documents/AN10006-Best-Design-Layout-Practices.pdf

[12] TLV1117LV datasheet, Texas Instruments, Feb. 2015 http://www.ti.com/lit/ds/symlink/tlv1117lv.pdf

[13] MSP430G2xxx Family User’s Guide, Texas Instruments, July 2013 http://www.ti.com/general/docs/lit/getliterature.tsp?baseLiteratureNumber=slau144&fileType=pdf

21