Senior Design Project

42
UAV Electric and Magnetic Fields Sensing System Anthony Wilson Chauncy Curtis Cody Griner Gary Chambers Hoa Nguyen Karl Maurmann Kassie Busque Mike Dinan Project Mentor: Dr. David Allee December 11, 2015

Transcript of Senior Design Project

Page 1: Senior Design Project

UAV Electric and Magnetic Fields Sensing System

Anthony WilsonChauncy CurtisCody Griner

Gary ChambersHoa Nguyen

Karl MaurmannKassie BusqueMike Dinan

Project Mentor: Dr. David Allee

December 11, 2015

Page 2: Senior Design Project

2

Executive Summary

The objective of this senior design project comprised the development of a portable electric field sensing system that can read data from fields produced by a transmission line. It will be accomplished by merging two systems; a 3­axis analog circuit capable of sensing the electric field, and a digital data logger that will be able to record the 3­axis electric field data. The scope also includes constructing a sine wave generator circuit that is able to output a 60Hz signal with low distortion used with a lock in amplifier. The analog system needs to be able to measure and manipulate the signals from the electric fields and provide power for the digital system, all while trying to minimize space weight and power consumption. The data logger system should have the capability to remotely turn on and off when mounted on an unmanned aerial vehicle (UAV). It must also be able to create a new data file remotely without the user manually creating the file beforehand. Most of the code for this project was written in C using the Energia development environment. To design the sine wave generation circuitry, the AD9833 module from Maxim will be used to generate a sine wave. Testing was done in stages throughout the design process resulting is a fully successful field test. Overall, the goal to complete the 3­axis electric field and data collection system by the end of December 2015 with as small a budget as possible was accomplished. The current budget for the analog portion of this project was approximately $293.34, and the budget for the digital portion of this project was approximately $238. This comes to a total of $534.34. However it is important to note that this total does not included costs for what was gifted from previous teams.

Page 3: Senior Design Project

3

Table of ContentsExecutive Summary1Introduction5Preceding Work5

Analog Front End1. Introduction62. Design Approach63. Added Circuitry8

3.1 5V Reference Generation103.2 Reference Signal Interface103.3 ­1.25V Reference Generation113.4 Output Signal Interface113.5 Terminal Blocks and Test Points12

4. Testing125. Budget15

Digital Front End6. Introduction157. Remote Activation16

7.1 Requirements167.2 Implementation167.3 Interface with Digital Front End17

8. Sinewave Generation178.1 Requirements178.2 Implementation188.3 Interface with Analog Front End18

9. Analog To Digital Conversion189.1 Requirements189.2 Timer Interrupt199.3 ADC Setup199.4 Time and Space Tradeoff199.5 Problems and Solutions20

10. Data Acquisition2110.1 Background of Petite FAT File System2110.2 FAT File System and Implementation21

Page 4: Senior Design Project

4

10.3 Problems and Solutions2211 Program Flow2212 PCB Board2313 Results24

13.1 Spring Semester Achievements2413.2 Fall Semester Achievements24

14 Budget25Field Tests26Recommended Improvements27Conclusion28Appendixes29References40

Page 5: Senior Design Project

5

List of Illustrations1 Schematic of 1D lock­in circuitry (Figure 1)72 Assembled PCB (top view) (Figure 2)73 Assembled PCB (bottom view) (Figure 3)84 3­Axis Schematic (Additional Circuitry Highlighted) (Figure 4)85 Layout of 3D lock­in circuitry (Figure 5)96 5V reference for MSP430 power supply (Figure 6)107 Reference signal interface (Figure 7)108 ­1.25V Reference for shifting circuit (Figure 8)119 Shift/Scaling circuit for MSP430 input (Figure 9)1110 Terminal Blocks and Test Points (Figure 10)1211 Lab Testing Setup (Figure 11)1312 Integration with digital team MSP430 (Lab Testing) (Figure 12)1313 Linearity Plot (Perpendicular sensor 62mm from top capacitor plate) (Figure 13)1414 Linearity Plot (Perpendicular sensor 3mm from top capacitor plate) (Figure 14)1415 Analog Front End Budget (Table 1)1516 Layout of the MSP430F5529 (Figure 15)1617 Turnigy Receiver (Left) and Receiver Controlled Switch (Right) (Figure 16)1718 AD9850 (Previous Design) (Figure 17)1819 AD9833 (Current Design) (Figure 18)1820 ADC measurements of 60Hz sine wave when ADC clock is 25MHz (Figure 19)2021 ADC measurements of 60Hz sine wave when ADC clock is 5MHz (Figure 20)2022 MicroSD Card Module (Figure 21)2123 Program Flow Diagram for the Data Logger System (Figure 22)2324 PCB board design (Figure 23)2325 Circuit used for successful remote activation (Figure 24)2426 Generation of sine wave from AD9833 (Figure 25)2527 Power consumption of the data logging system (Table 2)2528 Digital Front End Budget (Table 3)2629 Test site with 500kV transmission lines (Figure 26)2630 Electric field strength of three axis from power line (Figure 27)27

Page 6: Senior Design Project

6

IntroductionModern society heavily depends upon power transmission. Malfunction can occur in segments of any network due to natural disasters or man made errors. This can bring the activity of a community to a sudden halt. The ability to monitor and identify the breakpoint in the transmission line will help to restore power to the community quickly. This, in turn, will reduce resources and money necessary to maintain a functioning power grid.

The objective of this project is to design a system that will determine the voltage of a power line by measuring the electric fields. This report will illustrate the design of a system that measures the X, Y, and Z planes of the electric field. This project was managed by two separate teams with independent focuses. The first team focused on the analog system. This consisted of designing a 3­axis system as well as minimizing the overall size of the analog design. The focus of the second team was to design a digital data logger system and sine wave generator circuit that will enable data acquisition from the 3­axis analog system. This project is a continuation from the efforts of past teams who have assembled key components such as a 1­axis design. Recently, the project has seen some important success in collecting actual data from a powerline during field testing. The final objective of this design project is to incorporate both the digital and analog components onto a UAV and to demonstrate that electric field can be reliably recorded. All of these objectives will be combined with efforts to further reduce space, weight, power, and cost. This report will consist of two primary sections. Each of these sections will illustrate the work accomplished by each team respectively.

Preceding WorkThis project was initiated by Dr. Allee in the Fall of 2013 in collaboration with the US Army Research Lab. From this work, Dr. Allee was able to demonstrate the linear relationship between the voltage from a conductor and the output voltage from the lock­in amplifier using a D­dot sensor. From the basis of this work, the first team commenced the project in Fall 2013 and Spring 2014 to replicate the data collected by Dr. Allee. Their work focused on miniaturizing the lock­in circuitry to take electric field measurements from the transmission line, building a basic data logger system using the MSP430F5529 to record the electric field on a SD card module, and constructing an UAV to carry the circuitry that would take the measurement. So far, the first team has demonstrated a working prototype that gave reliable readings of the electric field. The second team that finished up during the spring of 2015 focused on expanding the measurement capability to magnetic field, while maintaining the same level of accuracy and precision measurement in the electric and magnetic fields.

Page 7: Senior Design Project

7

Analog Front End

1 IntroductionAs a continuation of a multi­year project, this team will improve upon the single axis electric field design that was previously developed. The primary focus will be to implement three dimensional detection as well as reducing space, weight, and power (SWAP) of the current design. This section details the preceding work, the projects goals, design approach and testing as well as the budget required to successfully achieve these goals.

2 Design ApproachThe miniature lock­in amplifier will consist of various electronic components ranging from resistors to IC chips. The design incorporates four major sections which includes voltage regulation circuitry, six lock in channels, transimpedance amplifiers and a Pulse Width Modulator (PWM) to sine converter. The single axis design from the previous group can be seen in Figure 1. The D­dot sensor is a metal conductor that supplies the input signal to the miniature lock­in amplifier. Electric flux will induce a current on the D­dot sensor which will then be amplified by the transimpedance amplifier. There will be two channels per axis which will multiply two sinusoids at a target frequency using an AD630. The first channel is an in phase representation of the product of two sinusoids, one of which is the signal induced on the d­dot sensor and the other is a created reference signal. The output will yield a signal with both a DC component and one at twice that frequency. Passing this analog signal through a low pass filter will eliminate the higher frequency and will then be processed using a digital signal processor. The second channel will output the same sinusoid, but will be 90 degrees out of phase. The magnitude of these two channels will be processed within the AD630 and give a pure DC value that’s proportional to the electric fields. The 3­axis version has been designed and implemented in PCB123’s software. Fabrication of the board has taken place over the summer. In Figures 2 and 3 the assembled 3­axis version of the design can be viewed. The board is setup in a way such that it can easily interface with the digital back end that our peer senior team has designed. Upon integration of the analog and digital circuity, noise reduction features will be added to the design.

Page 8: Senior Design Project

8

Figure 1: Schematic of 1D lock­in circuitry

Figure 2: Assembled PCB (top view)

Page 9: Senior Design Project

9

Figure 3: Assembled PCB (bottom view)

3 Added Circuitry

Figure 4: 3­Axis Schematic (Additional Circuitry Highlighted)

Page 10: Senior Design Project

10

Figure 5: Layout of 3D lock­in circuitry

The Analog Front End circuitry outputs a total of six signals which are represented by three pairs of signals denoted as terms A and B. Each pair of signals represents the voltage coming off the transmission lines referred back to a single D­dot sensor.

This circuit uses a signal being transmitted from three D­dot sensors oriented orthogonal to each other in order to obtain a 3­axis measurement of the electric field. Each D­dot sensor represents a single axis where the output refers to a single pair of the six total values. Charge builds on these sensors creating a current which flows to the input of the circuit. The A term of the circuit takes this current and passes it through a transimpedance amplifier converting it to a voltage. This voltage is then passed through a modulator in order to multiply it with a reference voltage at the same frequency. The output of this modulation contains a low frequency component as well as a high frequency component. This is then sent through a low pass filter in order to attenuate all high frequency terms. The ending signal is a DC voltage with varying phase since the input phase is unknown. The B term uses the same input signal which is also passed through a transimpedance amplifier. The difference in this path is that before going through the modulation chip the reference signal is first shifted by 90 degrees. The output is also passed through a low pass filter leaving a DC voltage with varying phase. The variance between the two final outputs is that one is a cosine term while the other is a sine term. Through trigonometry and the law of cosines these terms are fed to a digital board where they are squared and left with a pure DC signal. The other two D­dot sensors follow the same path with matching components placed on the board.

Page 11: Senior Design Project

11

3.1 5V Reference Generation

Figure 6: 5V reference for MSP430 power supply

A 5V reference was generated to act as a power supply for the digital components (MSP430). This was achieved by passing the positive 9V rail through a voltage divider. A potentiometer was used to scale the 9V down to 5V, which is then passed through a unity gain amplifier to ensure a stable voltage at the output. It was later found that the MSP430 consumed too much current that the op amp was unable to deliver. This circuit utilized the OPA4227 which is a low noise operational amplifier as well as a 500kΩ potentiometer.

3.2 Reference Signal Interface

Figure 7: Reference signal interface

The MSP430 has the capability of generating the sine wave used as a reference signal for the analog circuitry. The output given from the digital board is 600mVpp with a 500mVDC offset. The reference signal utilized by the analog circuitry needs the wave centered about zero. The 100uF capacitor blocks the DC offset of the incoming signal, thus centering the sine wave on

Page 12: Senior Design Project

12

zero. The op amp is configured with a gain of 4.12 as shown in Figure 7. Amplifying this signal achieves the target 2.5Vpp reference that is used during all testing.

3.3 ­1.25V Reference Generation

Figure 8: ­1.25V Reference for shifting circuit

A ­1.25V reference is generated to provide a bias voltage for the analog to digital interface. This was done by passing the negative 9V rail through a voltage divider. A potentiometer was used to scale the ­9V down to ­1.25V and then fed through a unity gain amplifier to ensure stability at the output. This circuit also utilized the OPA4227 as well as a 500kΩ potentiometer.

3.4 Output Signal Interface

Figure 9: Shift/Scaling circuit for MSP430 input

The MSP430 requires a positive input signal with a max voltage of 3.3Vpp. Therefore a shifting and scaling circuit was created to allow proper integration between the digital and analog aspects of the project. After the higher order frequencies are removed from the signal, a buffer guarantees the signal will not fluctuate based on the load. A potentiometer then has the ability to scale this voltage to the allowable 3.3Vpp range. Using the op amp in the configuration shown in

Page 13: Senior Design Project

13

Figure 9, the signal is shifted above zero into the positive range that is necessary for ADC. This portion of the circuit uses the OPA4227 as well as 100kΩ potentiometers.

3.5 Terminal Blocks and Test Points

Figure 10: Terminal Blocks and Test Points on PCB board

In order to keep the circuit cleaner two terminal blocks were added for convenience when connecting input or output wires; where TB1 contains input signals and TB2 contains output signals. Adding terminal blocks helped to ensure that wires would not become lose during testing and create any false data acquisition.

In addition to adding terminal blocks in the layout, test points were also added in order to verify the right signal was being output at crucial points throughout the circuit. The five blocks located at the right most corner of Figure 10 are all of the test points available on the board. Going from right to left the first test point (V_s) is for the voltage shift where the voltage is brought to ­1.25 V, and (V5_V) is the 5V reference voltage coming from the board. The next two blocks (V_90 and Vref+) are the reference signal and the reference signal after having gone through the 90 degree phase shift. The last two blocks are the test points for the voltage rails. The smallest terminal block (TB3) is the input for the reference signal from the MSP430 to the board. There is also an output for the PWM reference signal created on board that can contain a jumper wire to the input reference signal point if the internal reference signal wants to be used.

4 TestingTesting was performed to validate the implementation of the new design. A 20 V peak to peak sine wave was applied to two copper plates to produce an electric field. To prevent interference from surrounding equipment, a sinusoidal voltage at 97 Hz was used to create an electric field across a parallel plate capacitor. For testing in the lab, trans­impedance feedback resistors were set to 200 MΩ. This provided for maximum gain while avoiding clipping of the output signal. Lab testing successfully validated the new design implementations. In Figures 13 and 14 we show the linear relationship of the board’s output vs E­field strength. Testing was then performed to verify the system integration between our board and the digital analysis circuitry designed and built by another team, which can be seen in Figure 12. Tests confirmed the successful integration of the analog and digital circuitry. A cube was 3D printed to hold the 3 d­

Page 14: Senior Design Project

14

dot sensors and ensure orthogonality. The cubes outer dimensions are 30mm x 30mm x 30mm, which holds the 20mm x 20mm x 1.6mm d­dot sensors. Lab results confirmed linearity of the output signal vs input signal applied to the parallel plates. In order to transition from lab testing to field testing, the feedback resistors were scaled to accommodate the increase of the E­field. Lastly field tests were performed using active 500 kV power lines.

Figure 11: Lab Testing Setup

Figure 12: Integration with digital team MSP430 (Lab Testing)

Page 15: Senior Design Project

15

0.010 0.100 1.000 10.000 100.000

Voltage Generating E‐Field (V)

0.01

0.1

1

10

Outpu

t Voltage (V

)

Linearity Plot

Z‐Axis Y‐Axis X‐Axis

Figure 13: Linearity Plot (Perpendicular sensor 62mm from top capacitor plate)

As can been seen in Figure 13, the output has a linear correlation to the voltage that is generating the electric field. However, the sensors are recording the same data independent of their orientation. In theory the sensor that is perpendicular to the electric field should be linear while the other two sensors that are parallel to the electric field should be constant across all input voltages.

0.010 0.100 1.000 10.000 100.000

Voltage Generating E‐Field (V)

0.01

0.1

1

10

Outpu

t Voltage (V

)

Linearity Plot

Z‐Axis Y‐Axis X‐Axis

Figure 14: Linearity Plot (Perpendicular sensor 3mm from top capacitor plate)

Page 16: Senior Design Project

16

Additional tests were run to validate that a stronger output signal will be received when the sensors are closer to the source. Figure 14 demonstrates that a sensor placed 3mm from the source produces a larger output than when place 62mm away as shown in Figure 13.

5 BudgetThe budget shown in Table 1 accounts for the total cost spent to integrate the PCB with newer technology. Other budgets were not accounted for, because costs were incurred in past year’s project and irrelevant to the scope of the current year’s project.

Table 1: Analog Front End Budget

ComponentsQuantity (Unit) Cost per Unit ($) Subtotal ($)

CAP CER 0.1uF 50V 5% X7R 1206 5 0.28 1.40CAP CER 22uF 6.3V 10% X5R 1206 15 0.49 7.29CAP CER 1uF 16V 5% X7R 1206 15 0.41 6.09

RES SMD 10K OHM 1% 1/4W 1206 80 0.05 4.38TRIMMER POT 100K OHM 0.1W SMD 15 0.27 3.98TRIMMER POT 500K OHM 0.1W SMD 6 0.27 1.62DIODE SCHOTTKY 40V 1A DO214AC 6 0.37 2.22IC OPAMP GP 8MHZ 8SOIC (OPA227) 2 3.43 6.86IC OPAMP GP 8MHZ 14SOIC (OPA4227) 8 9.93 79.44

IC OPAMP GP 1.3MHZ RRO 8SOIC (LMC6081) 6 2.62 15.72

IC MOD/DEMOD BAL 2MHZ 20­SOIC (AD630) 6 22.44 134.64

TERM BLK SIDE ENTRY 12POS 2.54mm 4 5.58 22.32TERM BLK SIDE ENTRY 2POS 2.54mm 2 1.57 3.14

PC TEST POINT MINI SMD 14 0.30 4.24CUSTOM PCB

Total 293.34

Digital Front End

6 IntroductionThe objective of this project is to build a digital data logger system and sine wave generator circuit that will enable data acquisition of a 3­axis electric field. This project is a continuation from the efforts of past teams who have assembled key components that contribute heavily to its present state. Recently, the project has seen some important success in taking data remotely via a remote program activation switch, as well as generating a reference sine wave signal. This allowed the actual data collection and storage via the MSP430 (Figure 15) which it does by analog to digital conversion. The final objective of this design project is to incorporate both the

Page 17: Senior Design Project

17

digital and analog components onto a UAV and to demonstrate that electric field can be reliably recorded. All of these objectives will be combined with efforts to further reduce space, weight, power, and cost.

Figure 15: Layout of the MSP430F5529

7 Remote Activation

7.1 RequirementsOne major issue with the current design is power consumption. As of now, the process of collecting data with the MSP430 uses 9V batteries, allowing it to run approximately 30­40 minutes. In addition, the only way to collect data is to manually activate the process. This is, however, inefficient when multiple samples are needed consecutively in a short amount of time. The actual data collection doesn’t take more than 1 minutes, so much of the battery power is wasted during setup, manual activation, and take down time. One way to conserve battery power is to install a remote activation feature which allows the MSP430 to be powered on remotely. This means multiple samples could be taken quickly, allowing the batteries to be used only when data is ready for collection.

7.2 ImplementationThis solution will be implemented through the use of a receiver which relays the signals sent from the controller to the flight control module. The receiver being used is from the Turnigy 9X series (seen in Figure 16), which comes with eight relay channels for communication with the UAV via the flight controller. Four of these channels are dedicated to each of the four motors powering the propellers. By connecting a fifth channel, we gain the capability of incorporating a switch from the flight controller to add the needed functionality of an activation switch. Once the flight controller was programmed to the appropriate switch, we were ready to connect our signal

Page 18: Senior Design Project

18

circuit. The Turnigy Receiver Controlled Switch (RCS) (seen in Figure 16) was used to convert the signal sent to the receiver into an on/off switch. Then, the voltage source was connected to one end of the switch and the active high pin of the MSP430 to the other end. With this switch functioning, the MSP430 merely needs to be programmed to receive the signal and respond accordingly.

7.3 Interface with Digital Front EndOnce the RCS was functioning as expected, a large scale test was implemented, involving the analog front end team. With the MSP430 properly programmed and the analog board ready, all the necessary connections between the two boards were made. With the RCS connected to the MSP430 wake­up pin, and with everything else properly connected, the overall tests were conducted. First we powered on the MSP430, which immediately went into low power mode as it was programmed to do. In this low power mode (LPM4) the MSP430 consumes 180nA/MHz instead of the constant 300μA/MHz it would normally consume. The wakeup signal was then sent to the receiving pin on the MSP430 via the RCS and confirmed that the MSP430 fully powered up. In addition to waking up, the MSP430 successfully collected meaningful data from the analog board as it was programmed to do.

Figure 16: Turnigy Receiver (Left) and Receiver Controlled Switch (Right)

8 Sinewave Generation

8.1 RequirementsA clean sinusoidal signal is necessary for this application because such a signal will be used in the signal processing procedure to separate meaningful measurements from environmental noise. As noted by the first team in their previous work1, minimal frequency difference between the field and reference voltage can cause the output to have ripple. Specifically, when the frequency difference is greater than 0.1Hz, the resulting ripple is noticeable from the background noise. Therefore the signal generation circuit must be able to tune to the desired frequency with the resolution of less than 0.1Hz. Moreover, the new signal generation circuit must consume less

Page 19: Senior Design Project

19

than 200mW, the power consumption of the Arduino, in order to prolong the data acquisition time and improve power consumption.

8.2 ImplementationThe previous implementation of the portable sinewave generation used the AD9850, shown in Figure 17, to produce the reference sinusoidal waveform. Although the module has good frequency resolution, its power consumption is too high as compared to the theoretical values specified by the data sheet. When in active mode, the module consumes about 188mW, compared to the 88mW used when in idle mode. This is probably because the module uses a 125MHz clock. To optimize power consumption, the AD9833, shown in Figure 18, will be used in the design. This model consumes around 24mW when active and 9.9mW when idle. The significant reduction in power is due to the fact that the AD9833 implements a low­power architecture and uses lower clock speed, 25MHz as compared to 125MHz. Moreover, the AD9833 at 25MHz can achieve the frequency resolution of 0.1Hz by using a 28­bit programmable frequency registers. This satisfies the requirement that was discussed previously. Higher frequency resolution of 0.004Hz can be achieved by lowering the clock speed to 1MHz.

Figure 17: AD9850 (Previous Design) Figure 18: AD9833 (Current Design)

8.3 Interface with Analog Front EndSince the signal coming out of the AD9833 module is only positive, a voltage shifter circuit will have to be created in order to center the sinusoidal waveform about the 0V level. A phase shifter circuit will also be needed to obtain a sinusoidal output that is 90o out of phase with the original waveform. These two circuits will be implemented using simple op amp circuit configurations and created by the analog front­end team in order to achieve better integration with the analog circuitry.

9 Analog to Digital Conversion

Page 20: Senior Design Project

20

9.1 RequirementsData coming from the analog front end must be digitized and stored into a SD card to allow further analysis. To achieve this objective, the analog and digital conversion (ADC) module of the MSP430F5529 will be used. This module must be able to achieve the minimum sampling rate of 1kHz with adjustable means to allow the module to run at different sampling rate. The ADC should utilize the highest possible resolution in order to capture accurate data and be able to capture analog data on six analog channels.

9.2 Timer InterruptEnergia IDE has a built­in function that allows users to easily delay the program by a specific amount of time. However, this method is not ideal for obtaining an accurate sampling rate since it introduces a delay to the whole system, thus wasting CPU resources that can be used for something else. In order to overcome this problem, the timer module is used to precisely tell the ADC module when a new sample should be taken. This is accomplished by loading a value into a 16­bit register of the timer. Whenever the timer increments to this value, a signal is sent to the ADC module to signal collection of another round of analog data. Decreasing the value in the timer increases the sampling rate and the same can be said in reverse. Timer utilization to trigger the ADC module has two advantages: first it allows precise timing to obtain a precise sampling rate, and second, it allows the whole program to flow without delaying the CPU to obtain analog data.

9.3 ADC SetupIn order to obtain maximum performance from the ADC module, setup of the ADC module must be configured appropriately for a given application. Energia IDE has a built­in function to allow the user to easily obtain analog data from any given analog channel. For this given application in which sampling rate can be high, calling the built­in function to obtain analog data introduces a lot of overhead because the built­in function re­initializes the ADC module every time the function is called. This is made worse since we have to sample six analog channels while trying to obtain the minimum delay between each channel. To overcome this challenge, the ADC module will be initialized to take analog data from a sequence of channels at the beginning of the program flow. When the timer triggers the ADC module, the module will run through each channel in sequence and collect one sample from each channel in order to minimize the delay between channels.

9.4 Time and Space TradeoffIn order to have the fastest sampling rate, data from the ADC module must be stored to a temporary buffer so that it will not be overridden by new data that comes into the ADC. This is a problem due to the fact that the time it takes for data to be written into the SD card is an order of magnitude slower than the sampling rate. One way of storing this data is to store it into the RAM buffer since RAM has the fastest access time. However, the MSP430F5529 only has around 8kB of RAM memory on it. This could limit the amount of sample data that we wish to take. To solve

Page 21: Senior Design Project

21

this problem, flash memory can be used as a buffer instead. While the MSP430FF5529 has 128kB of flash memory on it, the access time for this memory is significantly slower than the RAM. This will reduce the maximum sampling rate that we can achieve with the MSP430F5529. We will use RAM as our buffer since the sampling rate is higher priority.

9.5 Problems and SolutionsOne of the problems facing the team when developing the ADC system was overclocking the ADC module. The initial plan was to clock the system with the maximum clock speed, which is 25MHz, in order to minimize the time delay between channels as much as possible. However overclocking the ADC module at this speed results in distorted measurements at half the range of the reference voltage. The results are shown in Figure 19 for the input of a 60Hz sinusoidal wave. To rectify this problem, the ADC module is configured to run at 5MHz clock speed, the maximum clock speed recommended by the datasheet. This reduction in clock frequency results in much smoother and accurate measurements in all six channels as shown in Figure 20. Another potential problem that the team faced is the fact that MSP430 can be powered through the ADC channels if the voltage on those channels exceed 3.3V. In this case, disconnect the ADC channels so that power consumption does not fry the MSP430 and make sure that the voltage is between 0V and 3.3V.

Figure 19: ADC measurements of 60Hz sine wave when ADC clock is 25MHz

Page 22: Senior Design Project

22

Figure 20: ADC measurements of 60Hz sine wave when ADC clock is 5MHz10 Data Acquisition

10.1 Background of Petite FAT File SystemIn order to collect data from the MSP430 microcontroller, the Petite FAT file system was implemented to allow seamless transfer of data between the microcontroller, SD cards, and the general computer. This architecture of data storage requires minimal amounts of memory storage; however, the file system only allows appending new data to an existing file, not creating new files on the fly. This limitation greatly diminished the ability of the UAV to take multiple segments of data without overwriting the old data in flight. The ability to create new files to store different measurement blocks will greatly enhance the readability of the data.

10.2 FAT File System and ImplementationThe plan to acquire data will be accomplished by interfacing the MSP430 microcontroller2 with a Secure Digital (SD) card using a FAT16 format and a microSD card module as shown in Figure 21. The SD card is a type of flash memory card designed as a removable storage device with a

Figure 21: MicroSD Card Module

9­pin interface. There are three different modes of operation: Serial Peripheral Interface (SPI), one­bit SD, and four­bit SD. SPI will be the mode of operation chosen. The plan is to upgrade from the Petite FAT file system to the FAT file system to provide more features, such as appending an existing file, creating a new file, etc. This file system will allow the

Page 23: Senior Design Project

23

microcontroller to create a new file every time it is instructed to record data using a switch on the flight controller.

In order to implement the FAT file system, the team has adopted using one of the FAT file system libraries created for the Arduino platform. The reasons for this implementation are first, similarity between the MSP430 platform and the Arduino platform reduces the development time, and second, the encapsulation of the hardware specific functions allows developers to focus on the software functionality. Since the MSP430 platform shares much similarity with the Arduino platform, only slight modifications are needed in order to make the library work with the MSP430 microcontroller. These modifications include changing the hardware pin so that it matches with the MSP430 SPI pin layout and deleting header files that are specific to the Arduino platform. Moreover, this library implementation hides away the intricate complexity of the working of the SD card and the FAT file system. Functions like open() and close() automatically recognize the current directory where a new file should be created as well as naming, formatting, and closing the file on the fly.

10.3 Problems and Solutions Since the MSP430F5529 has one SPI module, this forces the team to tie the sinewave generator AD9833 and SD card to the same common pins on the microcontroller board. A test was carried out in the lab to determine whether or not sharing the same SPI module would affect the functionality of either the AD9833, or the SD card, or both. It was determined that the initial configuration of both peripherals went smoothly. However, when the communication is switched to the SD card during mid­operation, the microcontroller was unable to detect the SD card. This is a problem since field testing will require the microcontroller to switch between the AD9833 and the SD card. In order to rectify the problem, other digital pins are used to simulate SPI communication with the AD9833. Although using other digital pins that are not designated to be used in SPI communication results in lower communication speed, it is not a concern in this application. We only wish to turn on and off the AD9833, not see how fast we can communicate with it.

11 Program FlowThe program flow of the whole system is shown in Figure 22. The program starts out initializing all the variables necessary for the process. These include sampling rate, pin configurations, data buffer, and file names. The process will subsequently put the microcontroller into sleep mode in order to conserve energy. While in the idle mode, a remote switch can wake up the microcontroller through an interrupt process. The interrupt will then disarm itself so that it does not trip itself during the main process. The program flow will then proceed to enable the AD9833 (the portable sinewave generator mentioned above) together with the timer peripheral and create a new file on the microSD card. Then the system enters the main loop where it will check for new data to be put into the SD card. Inside this loop, the timer interrupt can start the

Page 24: Senior Design Project

24

writing process in order to collect ADC samples at regular intervals. After all data has been collected and written into the microSD card, the program proceeds to disable the AD9833, the ADC module, and the timer interrupt. It will then re­arm the remote switch interrupt and go back into the sleep mode.

Figure 22: Program Flow Diagram for the Data Logger System

12 PCB BoardVarious components such as the AD9833, MSP430, SD card and GPS are all required to complete the proposed design. However, connecting these components proved to be challenging and messy. To remedy this complication a PCB board was designed, this board can be seen below in Figure 23. This board helps resolve a few problems, the first of which is wiring. It would be devastating to the system if a wire got caught in a propeller or disconnects due to turbulence. In addition the PCB design also aids in making the overall system compact. All of the components have been incorporated into this board and will allow for a clean stacked design.

Page 25: Senior Design Project

25

Figure 23: PCB board design

13 Results

13.1 Spring Semester Achievements During the semester a lot of headway was made for the project. There were two main goals to be achieved this semester and the group was able to accomplish both. The first task as stated above was the remote activation. This task was accomplished by splitting up the work into two sections, the MSP430 and the receiver for the wireless controller. First the MSP430 was programmed to stay in sleep mode then when it receives an external signal it will interrupt the sleep mode and run the program. From here the receiver and receiver controlled switch combination enables the signal from the controller to reach the MSP430 and trigger the external interrupt. The group was able to successfully test this design and Figure 24 below shows the circuit used for the remote activation. In addition to the success of the remote activation the sine wave generation was also tested and solved with the aid of the AD9850 board. The team was able to program the AD9850 board to generate a sine wave signal. Not only was it a success but the sine wave it generates is accurate as well. The wave generated was within a range of +/­ 0.01Hz when set to 60Hz.

13.2 Fall Semester Achievements In the second semester, the team decided to switch to the new model AD9833 after testing with the AD9850 revealed that the old model consumed too much energy. FAT file system and ADC module were implemented in order to collect analog data and store it to the microSD card. Steps were taken in order to ensure that the program flow was smooth and flexible in a way that it allows others to change the sampling rate or the output of the sinusoidal frequency with minimum modification to the main code. Shown below is also the table detailing the power consumption of the system.

Page 26: Senior Design Project

26

Figure 24: Circuit used for successful remote activation

Figure 25: Generation of sine wave from AD9833

Table 2: Power consumption of the data logging system

Device Idle (mW) Active (mW)

SD card 0.66 132

Sinewave Generator (AD9833) 9.9 24

Timer & ADC N/A 1.32

Page 27: Senior Design Project

27

MSP430 0.99 24.75

Total 11.22 185.7

14 BudgetThroughout the semesters there were a few purchases that need to be included in the budget. First, two separate AD9850 boards were purchased for the purpose of the sine wave generation. Dissatisfaction with the AD9850 forced the team to purchase AD9833. The second item is the switch used for the remote activation. The third item purchased by the team is a set of rechargeable 9v batteries. These will be used to power the boards. The fourth and final item purchased is the PCB board. This board will be used to simplify the combination of all the components used in the design. There are a number of other parts also used in the design that were previously purchased. Table 3 shows a budget of the various parts including the extra AD9833 board.

Table 3. Digital Front End BudgetItem Quantity Total Price($)

AD9833 2 14MSP430F5529 Microcontroller 1 10

SD card booster pack 1 79V Rechargeable battery 4 25

APM 2.6 1 60Switch adapter 1 12PCB board 2 110

Total 238

Field TestsField tests were conducted in order to test the validity of both the analog and digital parts under real world application. The tests were conducted in an open dirt field with the testing apparatus situated midway between two power line poles to avoid any electric field line anomaly. A stake was driven to the earth in order to establish the most stable ground for the whole entire system. Picture of the test site is shown in Figure 26. Data points were taken 5m apart for the total of 10 data points. Field data was then analyzed and graphed in MATLAB. The results are shown in Figure 27. From the graph, voltage of all three axis are proportionally inverse with varying distance. However, magnitude in the x axis is significantly less than the magnitude in the other axes. This should not be the case since lab results indicated that all axes must have roughly the same magnitude. Future improvements to the project must understand, and be able to eliminate this problem.

Page 28: Senior Design Project

28

Figure 26: Test site with 500kV transmission lines

Figure 27: Electric field strength of three axes from power line

Recommended Improvements Using the information found from this project, there are a few things that should be considered for improving the system. The most necessary improvement needs to be the addition of some sort of Faraday cage to protect the system. When running field tests there were issues with the electric field triggering the system independent of the trigger. This cage could possibly be implemented using a 3D printer. However redesigning the system to better suit the UAV will also be a part of this step. One way to minimize the design could be to build one long complete

Page 29: Senior Design Project

29

PCB. This way the whole design can be flat and narrow. Thus distributing the weight on the quadcopter and simplifying the circuit.

When looking at the digital side specifically, there are two methods of taking data from the ADC peripheral and passing it through to the microcontroller RAM. The first is to explicitly write the code to take the data from the ADC and pass it through to the RAM buffer. Another approach is to use Direct Memory Access (DMA) in order to transfer data from the ADC peripheral to the specific location in the RAM. Due to limited time on the project, the team chose to go with the first method due to its simplicity. However, it is recommended that the second approach be implemented in the future. This is because DMA does not require the microcontroller processing time in order to transfer data to the RAM. Instead the DMA peripheral bypasses the microcontroller and transfers data directly into the RAM. This method requires less time as compared to the first method and potentially reduces the latency between measurements from each ADC channel.

In addition, the team found that it would be desirable to know the location where each measurement was acquired in the field. This can be done through implementation of a Global Positioning System (GPS). In addition to the writing transmission line data to the SD card, the team recommends that GPS data also be written to the SD card to show where the transmission line signal was measured.

Even though the team was able to scale down the power consumption of the MSP430 hardware, power consumption of the MSP430 Launchpad hovered around 50~60mA. This can be explained by the fact that the Launchpad also includes an eZ­FET onboard. This peripheral allows a programmer to debug the MSP430 through USB connection without using a JTAG device. In final production, a custom circuit should be built in order to eliminate unnecessary peripherals that increase the overall power consumption. However, at this testing stage, we encourage any future endeavor to use the Launchpad out of sheer convenience and a custom circuit should only be built when everything is finalized and ready for production.

ConclusionThe overall purpose of the project consisted of two primary tasks; to build an analog circuit that can sense electric field from the power line in three dimensions and to build the digital circuit that is capable of storing 3D electric field information to an SD card using the MSP420F5529. We have demonstrated that the whole system works in the lab as well as in the field by showing that the electric field is inversely proportional to distance. However, there is much more work to be done in the future in order to bring the system to manufacturing stage. These include building a customized circuit that houses both the analog and digital parts in order to improve cost, weight, and power, incorporating GPS into the system in order to accurately pinpoint the location

Page 30: Senior Design Project

30

of the measured electric field, and integrating the system onto an UAV so that the end goal of portable electric and magnetic sensing of the power line can be achieved.

Page 31: Senior Design Project

31

Appendixes

/* Copyright (C) 2015 Hoa Nguyen. All rights reserved.

This software may be distributed and modified under the terms of the GNUGeneral Public License version 2 (GPL2) as published by the Free SoftwareFoundation and appearing in the file GPL2.TXT included in the packaging ofthis file. Please note that GPL2 Section 2[b] requires that all works basedon this software must also be made publicly available under the terms ofthe GPL2 ("Copyleft").

Contact information­­­­­­­­­­­­­­­­­­­

Hoa Nguyen Email: [email protected]: This program control the AD9833 to output sinusoidal wave. It also samples data from 6 ADC channels and put them into the SD card.*/

#include <SD.h>#include <SPI.h>#include <signalAD9833Serial.h>

#define SD_LED RED_LED // Use to signify whether or not SD card is present. On means card is not present. #define ACTIVE_LED GREEN_LED // Use to signify whether or not the MSP430 is active. On means MSP430 is active. #define SD_CS P2_6 // Use for chip select of SD card#define sine_data P2_5 // Use for data pin of the AD9833#define sine_clock P2_4 // Use for clock pin of AD9833#define sine_CS P1_5 // Use for chip select of AD9833#define remote_switch P1_2 // Use for remote switch of the microcontroller

const int sine_freq = 61; // This controls the frequency output of the AD9833 in Hz. signalAD9833 sine(sine_data, sine_clock, sine_CS, sine_freq); // Call to create an AD9833 object

const uint16_t sample_num = 550; // Number of sample to be collected. To be safe should not exceed 550 samples. volatile uint16_t current_sample = 0; // Need to be volatile so the compiler will not optimize this variable uint16_t sample_write = 0; const char * file_name [] = "Data0.txt", "Data1.txt", "Data2.txt", "Data3.txt", "Data4.txt", "Data5.txt", "Data6.txt", "Data7.txt", "Data8.txt", "Data9.txt"; // Names of data file

Page 32: Senior Design Project

32

int data [sample_num][6]; // Data buffer int max_file_num = 10; // Number of unique files int next_file = 0; // Use to point to the next file nameString space = " "; String column_name = "EX1" + space + "EX2" + space + "EY1" + space + "EY2" + space + "EZ1" + space + "EZ2" + space;

const int samp_rate = 100; // Use to change the sampling rate of the ADC module const int timer_value = 32768/samp_rate; // Value for TimerB

void setup() pinMode(SD_LED, OUTPUT); pinMode(ACTIVE_LED, OUTPUT); pinMode(SD_CS, OUTPUT); digitalWrite(ACTIVE_LED, HIGH); while (!SD.begin(SD_CS)) // Check for the present of an SD card digitalWrite(SD_LED, HIGH); digitalWrite(SD_LED,LOW); delay(1000); pinMode(remote_switch,INPUT_PULLDOWN); attachInterrupt(remote_switch, turn_on, RISING); // Pin P1_2 is used to receive external interrupt signal. Can be changed to any other digital pin. digitalWrite(ACTIVE_LED, LOW); sine_turn_off(); suspend(); //MSP430 enters LP4

void loop() digitalWrite(ACTIVE_LED, HIGH); sine_turn_on(); delay(1000); //1s delay so the AD9833 output can stabilize timer_setup(); ADC_setup(); write_data(); timer_stop(); sine_turn_off(); attachInterrupt(remote_switch, turn_on, RISING); digitalWrite(ACTIVE_LED, LOW); suspend();

Page 33: Senior Design Project

33

/* This interrupt will be used to turn on the whole entire board from LP4. It also disables itself to prevent another similar interrupt from running while the main loop is running. */void turn_on() detachInterrupt(remote_switch); wakeup();

// Turn on the AD9833void sine_turn_on() sine.start_signal();

// Turn off the AD9833void sine_turn_off() sine.stop_signal();

/* This functions write all the data into one data file. If no new data file can be created, the function will loop around and start appending sequentially to the first, second, third, ect.. data file. */void write_data() File dataFile = SD.open(file_name[next_file], FILE_WRITE); dataFile.println(column_name); // Check if we have written all data samples while ( current_sample < sample_num | sample_write < current_sample) // Check if we have new sample to write if (sample_write < current_sample) // Write data from six channels to the SD card for(int k = 0; k < 6; k ++) dataFile.print(String(data[sample_write][k]) + space); dataFile.println();

Page 34: Senior Design Project

34

sample_write ++; dataFile.close(); sample_write = 0; current_sample = 0; next_file++; next_file%= max_file_num;

// Setup the TimerB to trigger the ADC modulevoid timer_setup() P5SEL |= BIT7; // P5.7/TB1 option select P5DIR |= BIT7; // Output direction //Setup Timer B0 TBCCR0 = timer_value; TBCCR1 = 0x0002; TBCCTL1 = OUTMOD_3; // CCR1 set/reset mode TBCTL = TBSSEL_1+MC_1+TBCLR; // ACLK, Up­Mode

// Stop TimerBvoid timer_stop() TBCTL = MC_0;

// Setup the ADC module to collect data in sequency from analog channel 0, 1, 2, 3, 4, and 5. void ADC_setup() ADC12CTL0 = ADC12SHT0_4+ADC12MSC+ADC12ON;// Sampling time 64 cycles, MSC, ADC12 on ADC12CTL1 = ADC12SHS_3+ADC12CONSEQ_1 + ADC12SSEL_0 + ADC12SHP; // Use sampling timer; ADC12MEM0, 5MHz Clock // Sequence­channel ADC12MCTL0 = ADC12SREF_0+ADC12INCH_0; // V+=AVcc V­=AVss, A0 channel ADC12MCTL1 = ADC12SREF_0+ADC12INCH_1; ADC12MCTL2 = ADC12SREF_0+ADC12INCH_2; ADC12MCTL3 = ADC12SREF_0+ADC12INCH_3; ADC12MCTL4 = ADC12SREF_0+ADC12INCH_4; ADC12MCTL5 = ADC12SREF_0+ADC12INCH_5 + ADC12EOS; // End of channel A5 ADC12IE = 0x0020; //enable interrupt on memory 5 ADC12CTL0 |= ADC12ENC;

Page 35: Senior Design Project

35

// ADC interrupt that will transfer ADC data from the ADCMEMx memory to the data buffer#pragma vector=ADC12_VECTOR__interrupt void ADC12ISR (void) data[current_sample][0] = ADC12MEM0 & 0x0FFF; //lower 12 bit result data[current_sample][1] = ADC12MEM1 & 0x0FFF; data[current_sample][2] = ADC12MEM2 & 0x0FFF; data[current_sample][3] = ADC12MEM3 & 0x0FFF; data[current_sample][4] = ADC12MEM4 & 0x0FFF; data[current_sample][5] = ADC12MEM5 & 0x0FFF; ADC12CTL0 &= ~ADC12ENC; current_sample++; // Check to see if all samples have been collected if( current_sample < sample_num) ADC12CTL0 |= ADC12ENC;

Page 36: Senior Design Project

36

/* Copyright (C) 2015 Hoa Nguyen. All rights reserved.

This software may be distributed and modified under the terms of the GNUGeneral Public License version 2 (GPL2) as published by the Free SoftwareFoundation and appearing in the file GPL2.TXT included in the packaging ofthis file. Please note that GPL2 Section 2[b] requires that all works basedon this software must also be made publicly available under the terms ofthe GPL2 ("Copyleft").

Contact information­­­­­­­­­­­­­­­­­­­

Hoa Nguyen Email: [email protected]: This is the header file for the AD9833 driver. */#ifndef signalAD9833Serial_h#define signalAD9833Serial_h

#include "Energia.h"//#include <SPI.h>

#define freq_mask 0b01000000000000000100000000000000#define set_mask 0b0010000100001000#define start_mask 0b0000000000001000#define stop_mask 0b0000000011001000#define phase_mask 0b1100000000000000#define AD9833_clock 1000000

class signalAD9833

public:signalAD9833(int data_pin, int clock_pin, int CS_pin, uint32_t freq); void start_signal(); void stop_signal(); void update_freq(uint32_t freq);

private:void begin_signal();void transfer_freq_data(); uint32_t __freq;int __CS_pin;int __data_pin;int __clock_pin;

;

#endif;

Page 37: Senior Design Project

37

/* Copyright (C) 2015 Hoa Nguyen. All rights reserved.

This software may be distributed and modified under the terms of the GNUGeneral Public License version 2 (GPL2) as published by the Free SoftwareFoundation and appearing in the file GPL2.TXT included in the packaging ofthis file. Please note that GPL2 Section 2[b] requires that all works basedon this software must also be made publicly available under the terms ofthe GPL2 ("Copyleft").

Contact information­­­­­­­­­­­­­­­­­­­

Hoa Nguyen Email: [email protected]: This is the driver implementation of the AD9833. */#include "signalAD9833Serial.h"

/* Description: Initialize an instance of signalAD9833. Input: Digital pins that will control w_clk, FU_UD, data, and reset on the sinewave generator AD9850. Also include the desired output frequency. Example: data_pin = P2_5, clock_pin = P2_4, CS_pin = P1_5, freq = 60 Output: None */signalAD9833::signalAD9833(int data_pin, int clock_pin, int CS_pin, uint32_t freq)

pinMode(CS_pin, OUTPUT);digitalWrite(CS_pin, HIGH); pinMode(data_pin, OUTPUT);pinMode(clock_pin, OUTPUT);

__CS_pin = CS_pin; __data_pin = data_pin;__clock_pin = clock_pin;

update_freq(freq);

/* Description: Transfer data to the freq register of AD9833. Input: None. The freq data is taken from the object.Output: None.

*/void signalAD9833::transfer_freq_data()

shiftOut(__data_pin, __clock_pin, MSBFIRST, set_mask >> 8); digitalWrite(__clock_pin, HIGH);

shiftOut(__data_pin, __clock_pin, MSBFIRST, set_mask);

Page 38: Senior Design Project

38

digitalWrite(__clock_pin, HIGH);

shiftOut(__data_pin, __clock_pin, MSBFIRST, __freq >> 8); digitalWrite(__clock_pin, HIGH);

shiftOut(__data_pin, __clock_pin, MSBFIRST, __freq); digitalWrite(__clock_pin, HIGH);

shiftOut(__data_pin, __clock_pin, MSBFIRST, __freq >> 24); digitalWrite(__clock_pin, HIGH);

shiftOut(__data_pin, __clock_pin, MSBFIRST, __freq >> 16); digitalWrite(__clock_pin, HIGH);

shiftOut(__data_pin, __clock_pin, MSBFIRST, phase_mask >> 8); digitalWrite(__clock_pin, HIGH);

shiftOut(__data_pin, __clock_pin, MSBFIRST, phase_mask); digitalWrite(__clock_pin, HIGH);

/* Description: Set Chip Select(CS) low for data transfer. Input: None.Output: None.

*/void signalAD9833::begin_signal() digitalWrite(__CS_pin,LOW);

/* This function turns on the sinewave generator AD9850. Input: None Output: None */void signalAD9833::start_signal()

begin_signal(); transfer_freq_data();

shiftOut(__data_pin, __clock_pin, MSBFIRST, start_mask >> 8); digitalWrite(__clock_pin, HIGH);

shiftOut(__data_pin, __clock_pin, MSBFIRST, start_mask); digitalWrite(__clock_pin, HIGH); digitalWrite(__CS_pin, HIGH);

Page 39: Senior Design Project

39

/* This function turns off the sinewave generator AD9850. Input: None Output: None */void signalAD9833::stop_signal()

begin_signal();shiftOut(__data_pin, __clock_pin, MSBFIRST, stop_mask >> 8); digitalWrite(__clock_pin, HIGH);

shiftOut(__data_pin, __clock_pin, MSBFIRST, stop_mask); digitalWrite(__clock_pin, HIGH);

digitalWrite(__CS_pin, HIGH);

/* This function updates the frequency Input: frequency of type unsigned long Output: None */void signalAD9833::update_freq(uint32_t freq)

if(freq >0)float f = (freq * 268435456.0)/AD9833_clock;__freq = (uint32_t) f; uint32_t high = (__freq << 2) & 0b00111111111111110000000000000000; uint32_t low = __freq &0b00000000000000000011111111111111; __freq = high | low | freq_mask;

Page 40: Senior Design Project

40

/* Copyright (C) 2015 Hoa Nguyen. All rights reserved.

This software may be distributed and modified under the terms of the GNUGeneral Public License version 2 (GPL2) as published by the Free SoftwareFoundation and appearing in the file GPL2.TXT included in the packaging ofthis file. Please note that GPL2 Section 2[b] requires that all works basedon this software must also be made publicly available under the terms ofthe GPL2 ("Copyleft").

Contact information­­­­­­­­­­­­­­­­­­­

Hoa Nguyen Email: [email protected]: MATLAB script used to graph field data. */

samp_rate = 100; range = 550; begin = 1; x = 0:1/samp_rate:(range­1)/samp_rate;x_axis = ones(1,11); y_axis = ones(1,11); z_axis = ones(1,11); Distance_in_meter = [0 5 10 15 20 25 30 35 40 45 50]; for i = [0:10] name = strcat('DATA',int2str(i),'.txt'); data = load(name); % Find the level shift ch1_mean = (min(data(:,1)) + max(data(:,1)))/2 *3.3/4095; ch2_mean = (min(data(:,2)) + max(data(:,2)))/2 *3.3/4095; ch3_mean = (min(data(:,3)) + max(data(:,3)))/2 *3.3/4095; ch4_mean = (min(data(:,4)) + max(data(:,4)))/2 *3.3/4095; ch5_mean = (min(data(:,5)) + max(data(:,5)))/2 *3.3/4095; ch6_mean = (min(data(:,6)) + max(data(:,6)))/2 *3.3/4095; % Apply the level shift so the outputs are centered around 0V ch1_data = (data(begin:range,1))/4095*3.3 ­ ch1_mean; ch2_data = (data(begin:range,2))/4095*3.3 ­ ch2_mean; ch3_data = (data(begin:range,3))/4095*3.3 ­ ch3_mean; ch4_data = (data(begin:range,4))/4095*3.3 ­ ch4_mean; ch5_data = (data(begin:range,5))/4095*3.3 ­ ch5_mean; ch6_data = (data(begin:range,6))/4095*3.3 ­ ch6_mean;

Page 41: Senior Design Project

41

% Do the square and square root calculations and takes the average values of many samples x_data = mean((ch1_data.^2 + ch2_data.^2).^.5); y_data = mean((ch3_data.^2 + ch4_data.^2).^.5); z_data = mean((ch5_data.^2 + ch6_data.^2).^.5); x_axis(i+1) = x_data; y_axis(i+1) = y_data; z_axis(i+1) = z_data; end semilogx((Distance),(x_axis), 'r');hold on semilogx((Distance),(y_axis), 'b');semilogx((Distance),(z_axis), 'g');hold offxlabel('Distance(m) ','FontSize',14); ylabel('Voltage Amplitude(V)','FontSize',14); legend('X Axis', 'Y Axis', 'Z Axis'); grid on

Page 42: Senior Design Project

42

References

[1] W. D. Ye, S. Vora, K. Scowen, J. Sciacca, D. Allee, “Electric Field Sensing of High Voltage

Transmission Lines in Rural Areas,” November 3, 2014

[2] Lee R Wallace, “Interfacing a MSP430 with an SD Card,” University of Florida, April 3,

2012

[3] “Waveform Generation with AD9833,” ­ Northwestern Mechatronics Wiki. [Online].

Available at: http://hades.mech.northwestern.edu/index.php/waveform_generation_with_ad9833.

[Accessed: Sep­2015].