ECE 4760 Final Project

A Remote Controlled DMM With Minimum Mass Wireless Coupler

By: Xiaofeng Gu (xg46), Jia Yang (jy363)



Introduction

In this project, we built a digital multi-meter utilizing near-field communication concept.

The system established a bidirectional wireless communication between the measurement unit and the base unit. The measurement unit is in charge of measurement and transmitting the result to the base, while the base is the user interface for measurement mode selection and output display. The two units are electrically and mechanically isolated. The intended communication range would be between 10 and 15cm.

The mechanical and electrical isolation improves the safety of measurement under some high voltage or high power situations, where direct electrical connection is dangerous.

High Level Design

1. Overview

The major goal of the project is to build a short distance transceiver with as simple circuitry and components as possible. Since we are not requiring a long distance communication (and we intentionally want to keep it short to avoid interference) or a high communication data rate, the design can be kept very simple and elegant, which is opposite to those commercial RF transceivers. We use a tuned LC tank as the antennas and the On-Off keying modulation scheme. The crude antenna and the modulation scheme turn out to work well since the signal to noise ratio is high due to the short communication range. We use the carrier frequency of 181.18 KHz, which is a legal band to use under certain constraints according to FCC. The data is organized in the form of serial package. ATMega644 is used to both process the received signal and to drive the antenna for transmission. Due to the budget and time constraint, the communication system is half-duplex. An op-amp is used to amplify the received signal before the MCU can process it. On the base unit, a LCD is used for output and two switches are included for user to select the measurement mode. The measurement unit has three independent probes (one for each type of measurement) and protection circuit for measurement purpose.

2. Logical Structure

(a) Hardware

The hardware of this project has two main parts: the base unit which takes input from the user and controls the measurement unit, and the measurement unit which implements instruction of the user and send the measurement results back to the base unit. Both units have the circuit for near field wireless communication and a MCU for data processing. As a result, the two circuits would look similar. However, while the base unit has switches takes input from the user, the measurement unit includes circuits for measuring voltage, frequency and current as well as the circuit protection units. Below is a high level illustration of the hardware blocks.

High Level Hardware Diagram

(b) Software

The software part of the project consists of two main parts: the code for the base unit and the code for the measurement unit. The two units share some code and have others different. Below are the block diagrams of the software for both units:

Block Diagram of the Code of Measurement Unit

Block Diagram of the Code of Measurement Unit

Block Diagram of the Code of Base Unit

Block Diagram of the Code of Base Unit

The code for the RF system is divided into two parts: system level and infrastructure level. The infrastructure level conducts the operation of sending or receiving one byte, and the two units share the same infrastructure level code for RF system. The system level controls the timing between receiving and transmission, and this part is different in the two units.

The measurement part of code is similar to what we have done in lab2. The LCD update, update system state and the user input detection are rather straight forward parts.

3. Software Hardware Tradeoff

The first tradeoff we faced is that whether we should add some error checking mechanism in the communication protocol to be more noise-resistant. If there is an error checking embedded, it will be more demanding on the software but less emphasis on the hardware. The software has to do more complex processing on signal. In addition, the overhead of the error checking will decrease the effective data transmission rate, requiring more smart coordination between transmission and receive (due to the half-duplex nature of the system) to mitigate the effect. But we can accept a lower signal to noise ratio, putting less constraints on the hardware. As we will see later in the software design section, we embedded error checking mechanism for our control signal but not for the data signals to balance the tradeoff.

The second tradeoff is about if we should insert hardware processing between the antenna and the MCU. If the MCU is directly interfacing with the antenna, the software will do more processing on the received raw signal. If there is intermediate hardware doing pre-processing work, the MCU can free its computation power from the signal processing and do more computation-intense tasks (although the tasks in our project are not computation-intense). The other issue related to this tradeoff is the carrier frequency. Since our MCU is running at a frequency of 16 MHz, the theoretical upper bound for the carrier frequency is 16 MHz (the actual working upper bound is a lot lower) without the pre-processing by the hardware. This limits our choices of the communication bands as well as the rate of data transmission. With hardware pre-processing, we could go beyond the limit of 16 MHz, having more choices on the bands and higher data rate. In our specific situation here, the DMM does not require a high data transmission rate, nor does it have computation-intense tasks. In addition, we want to keep the hardware as simple as possible and heavily leverage the versatility of the MCU. Therefore we finally choose to make MCU directly interfacing with antenna.

4. Related Standards

Since our project involves RF transceiver, we have to abide by the regulations from Federal Communication Committee (FCC). The band we propose to use is 160KHz to 190KHz. This band is regulated by FCC 15.209, 15.213 and 15.217 for the following requirements, which we believe that our system meets:

  1. The total input power to the final radio frequency stage (exclusive of filament or heater power) shall not exceed one watt. Our antenna would consume very low power since they are small and close together.
  2. The total length of the transmission line, antenna, and ground lead (if used) shall not exceed 15 meters. Since we are going to use LC tank to build the antenna, the length of the antenna would be about 5.5*4*14*2=308cm which is much shorter than the maximum total length. The length of the other components will be even shorter.
  3. All emissions below 160 kHz or above 190 kHz shall be attenuated at least 20 dB below the level of the unmodulated carrier.
  4. the emissions from an intentional radiator shall not exceed the field strength levels specified in the following table:

    Frequency (MHz)

    Field strength (microvolts/meter)

    Measurement distance (meters)

    0.009–0.490

    2400/F(kHz)

    300

    0.490–1.705

    24000/F(kHz)

    30

    1.705–30.0

    30

    30

Table.1 FCC regulation

5. Intellectual Property and Copyright

In our final project, we reuse some codes from the Minimum Mass Wireless Coupler project from Dick Cappels’ project website page. We obtain the permission to use and modify the code from the author. We also use one of the antenna designs from the website in our project.

Hardware Design

The hardware of this project is composed of two parts, the base unit and measurement unit. We will first elaborate on the base unit which reads input from the user and controls the state of the measurement.

1. The Base Unit

The graphs below show the basic structure and the circuit diagram of the base unit.

Base Unit circuit Image

Base Unit circuit Image

Base unit circuit diagram

Base unit circuit diagram

The base unit circuit can be divided into four major parts: antenna, op-amp, MCU and LCD. Their functions are briefly illustrated in the diagram below.

Base Unit Hardware Flow Chart

Base Unit Hardware Flow Chart

The antenna is composed of an LC tank with a 31.1 μH inductor and a two 2.2nF capacitors in parallel. The inductor is physically a 32 round 5.5cm rectangular copper coil. We chose this specific number of rounds because it is feasible and it will have reasonably large mutual inductance with the measurement unit inductor than a coil with fewer rounds. We chose this number after a number of steps. We first chose a number of rounds of 25. The value of the inductor is estimated from the formula L=k*N^2 where k is a constant and N is the number of the rounds of the coil. In the software design, we have chosen a frequency in the range of from 160k to 190 kHz to transmit signal. Therefore the values of the capacitors are chosen to make the resonance frequency of the LC tank around 180kHz. The resonance frequency is determined from a band pass circuit as shown below. W connected the left and right ends of the circuit to the function generator and the end from the LC tank to the oscilloscope. The output to the oscilloscope would be maximum around the resonance frequency.

LC Tank Illustration

LC Tank Illustration

However, the closest capacitor we can get in lab is 2.2nF and we paralleled two capacitors to have a net capacitance of 4.4nF. Then we iterated back to the inductor and adjust the number of rounds of the coil so that the resonance frequency remains around 180 kHz.

The signal from the LC tank passes a high-pass capacitor around 0.1 μF which DC decouples the LC tank from the op-amp. Since the analog comparator on the ATMega644 will output a high when +ve is greater than -ve, the DC bias at the +ve input of the op-amp is set to 2V to allow a reasonable swing and tolerance of noise, while the -ve is fixed at 2.5V. The 500mV different makes sure that small voltage flunctuations due to noise will not create a rising edge at the analog comparator's output. In addition, when the AC signal from the LC tank is significantly large, and makes the +ve voltage input before the op-amp instantly below 1.3V, we observe that the op-amp saturates and will result in glitches which will change the frequency of the received signal. Therefore we also connect a diode biased around 2.5V to regulate the voltage so that it always stays above 1.3V. The values of the resistors are chosen so that when the diode is turned on, the current through the diode is much smaller than that through the 3 kΩ resistors, and hence the bias voltage before the diodes changes little.

The op-amp is designed to have gain of 11. During testing, we observe that, when the peak-to-peak voltage of the transmitter is 5V, the peak-to-peak voltage of the receiver would be about 400mV when the transmitter and receiver coil are placed face to face and separated by about 18cm. When the distance is decreased to 5cm, the peak-to-peak voltage at the receiver increases to around 2 V. Theoretically, the output peak to be peak voltage and the amplifier would be 4.4V and 20V if the amplifier has a unlimited output range.  However, since the output of the LF353 amplifier is limited in the range 0~5Vs (in reality the up bound is close to 3.5 V measured using oscillator partly due to the output impedance of the amplifier), the peak-to-peak voltage at the output of the amplifier is much more stable than the input.. Initially, we have used LM358 for the op-amp, but it does not have a large enough Gain-Bandwidth product and therefore we shifted to LF 353. However, the Gain Bandwidth product of our circuit (about 2MHz) is quite close to the limit of LF 353 at 4MHz. We did not further increase the gain of the op-amp to leave some safety margin.

The output from the amplifier is then connected to the MCU PortB2 to be processed as measurement result from the measurement unit. The MCU in the base unit is used to interpret data received from the antenna, take user input of two switches at Port B4and Port B5 to determine the state of measurement mode. The control instructions are sent from Port D7 to the antenna and then transmitted to the measurement unit. Port B3 connects the 2.5V reference voltage for rising edge detection.

2. Measurement Unit

The image and the circuit diagram of the measurement units are as shown in the graph below. The circuit can be divided into four parts: antenna, op-amp, MCU and measurement circuit.

The function of the antenna and op-amp in the measurement unit is very similar to that in the base unit. The MCU unit in the amplifier checks the validity and interprets the instructions from the signal from the antenna at input Port B2. It outputs the measurement result from Port D7 to the antenna.

Measurement Unit Circuit Image

Measurement Unit Circuit Image

The measurement circuit includes voltage, frequency and current measurement units. The measurement circuits are protected by diodes to avoid hazards caused by large positive or negative voltages. There is also a current limiting resistor to protect the circuit from high currents. The frequency and voltage measurements are similar to what we did in Lab 2. We have separated the DMM probes and the protection circuits of voltage, frequency and current measurements so that we can implement the three measurements at the same time without any significant interference with each other. The user will determine which measurement to be displayed on the LCD using the controls in the base unit. 

Measurement Unit Circuit Diagram

Measurement Unit Circuit Diagram

For current sensor, we choose a Hall Effect current sensor with part number 480-3254-ND from digikey. It connects in series to the circuit in interest and outputs a voltage corresponding to the measured current. The diagrams4 below shows its transfer function and circuit connection. We also use a pair of diodes to prevent the voltage raise above 5V or fall below 0V. 

Current Sensor Transfer Function

Current Sensor Transfer Function

3. Combine the Two Units

As shown in the graph below, during the measurement, base unit will be brought close to the measurement unit. Even when the two coils are placed side to side, there units are able to communicate with each other. It is preferred to place the two units face to face to ensure stronger signal transmission. When the user changes modes of measurement at the base unit, the measurement unit will immediately respond and give the correct measurement result and transmit the result to the base unit to be displayed on LCD .

Combined Hardware Circuit Image

Combined Hardware CIrcuit Image

Software Design

1. RF System

The RF part code consists of two levels. The first level is the infrastructure level, which works with the hardware and takes care of details to receive and transmit data on a byte level. The second level works at the system level, which controls the timing of receiving and transmission and manages coordination of the RF system with other subsystems. Such a design splits the implementation and the functionality, allowing us to focus on one point at a time.

(a) Infrastructure Level (RF.S)

For the code of infrastructure level, we adopted it mainly from the Dick Cappels’ project Minimum Mass Wireless Coupler. The code on the website was originally written for an ATMega8 working at 4MHz in AVR assembly language. We modified the code so that it now works for an ATMega644 working at 16MHz, and the code is now in GCC assembly. The advantages of writing code in assembly is that you know exactly how many cycles an instruction will take, which is a critical issue in RF communication system. The base unit and the measurement unit share the same infrastructure.

The infrastructure code contains four callable subroutines, PostXmitDelay(), PostRCVDelay(), SendRFByte() and ReceiveRFByte().

i. PostXmitDelay()

The PostXmitDelay() wait for antenna to settle down from last transmit operation if a receive operation is to follow. The delay allows the oscillation in the antenna to die out so that the system will not mistakenly treat the ringing in the antenna from last transmission as the incoming signal. This code should be called when a receive operation shortly follows a transmit operation. The implementation of the delay is by doing an empty for loop in assembler. A code snippet is presented to illustrate the idea better:

delay:                   ;Delay - load 00 into r18 for max delay, 01 for minimum delay.;r18 and r17 destroyed.
lptrf1:         clr     r17
lptrf12:dec  r17
brne  lptrf12
dec    r18
brne  lptrf1
ret

The delay subroutine will do a nested loop for both r17 (inner loop) and r18(outer loop). r18 is initialized to 20 before calling the delay subroutine. And brne here takes 2 cycles in most of the cases, it will approximately take

Number of cycle = 20 * (256*3 + 1) = 15380 cycle

The PostXmitDelay() will call delay subroutine four times with r18=20. At 16MHz, it results in a delay of

Delay time = 4 * 15380 / 16000000 = 3.84ms

Delay time in unit of bit time = 3.84ms / (1 / 1200) =4.61 bit time

ii. PostRCVDelay()

The PostRCVDelay() is very similar to the PostXmitDelay() except it is called when a transmit operation shortly follows a receive operation on the system. The delays aims to allow the other transmitter to have its antenna settle down before switching into receive operation. The implementation is pretty the same except that it waits seven times longer than the PostXmitDelay() does.

iii. SendRFByte()

The SendRFByte() subroutine will send a byte (pass in as a parameter) in addition with one start bit (1) and two bits (0). The 8-bit data will be sent from the LSB to the MSB. With a baud rate of 1200, each baud will take

One baud time = 1/1200 = 0.833 us

and send on byte of data will take

One byte time = 0.833 us * 11 = 9.17 ms

A brief description of the implementation follows: the subroutine uses Timer0 overflow to get the precise timing. To get a specific timing, we will choose the initial value for TCNT0 together with the prescaler so that Timer0 will overflow at the time point where other time critical events are scheduled. To send a bit 1, it toggles a pin at the frequency of 181.18 KHz, which is the carrier frequency of our system. To send a bit 0, it simply does an empty loop. After looping for one baud time in both 0 and 1 cases, the Timer0 overflow interrupt service routine will kick in, exit the loop and get the function to send the next bit. For detailed implementation, please refer to the appendix of the code section.

iv. ReceiveRFByte()

The ReceiveRFByte() subroutine will wait a start bit for 63.75 bit time. The return type is an int, with the lower byte stores the received data (if any) and the LSB of the higher byte indicate whether a byte is received. If no start bit presents in the 63.75 bit times at the carrier frequency, the subroutine will return with LSB of the higher byte setting to 0. If a start bit is detected within the time frame, the following 8 bits (the data) will be recorded and returned with the LSB of the higher byte setting to 1.

A brief description of the implementation follows: When detecting a bit, the subroutine will sample T/4 period, where T is one bit time. The input of the signal is directed into the analog comparator, and each rising edge in the input will increase a counter by 1 through analog comparator interrupt. If the signal is at 181.18KHz, we expect

Number rising edge in T/4 = 181.18E3 / 1200 / 4 = 37.75

Therefore if the counter has value around 37.75, we would say we have a 1. Otherwise we treat it as 0. After getting the start bit, the routine will sample the following 8 bits, each for T/4 period and determine whether it is 0 or 1 based on the number of rising edges. For the details of the implementation, please refer to the appendix of the code section.

(b) System Level (Base.c, Meansurement.c)

The system level of the RF part code is in charge of the timing of receiving and transmitting data, as well as the coordination with other subsystems, such as the measurement system (measurement unit) and the LCD update system (base unit). Since the base unit and the measurement unit have different tasks, the system level designs are different for the two units. Before going into each individual design, there are some general overviews of the system level design of the RF system.

i. Overview

The communication in our system is bi-directional. The measurement unit has to receive signals from the base unit to determine the measurement mode, and transmit back the measurement result for output. Therefore there are two types of communication here. The first is the measurement data, and the second is the control signal. The measurement data will be periodically transmitted to update the output several times a second. The control signal will only be sent if the user selects the new measurement mode through the switches. This indicates that measurement data is transmitted more frequently than the control signal. If one measurement data is corrupted during the transmission, it is not a problem at all as long as the base knows it is corrupted because there will be another measurement data transmission soon. But if a control signal is corrupted during the transmission, without any explicit fail-safe design, the system will not work properly until the user selects another new measurement mode and the base initiate another control signal transmission.

Given the situation above, we decide that the measurement data will be transmitted in a manner similar to the UDP protocol. The measurement unit just periodically transmits the measurement data, and does not care about if the data is corrupted or missing during the transmission. There will be no error checking on the network interface level (although there is some error checking procedure carried out inside the base unit after receiving the signal). The feasibility of this design relies on the fact that the communication system has a relatively low rate of missing or corruption, which puts a higher demand on the hardware and the infrastructure. The advantage of this design is avoiding the overhead of error checking at the network level. After all, we only have a baud rate of 1200, which is relatively slow. Avoiding the overhead of error checking on the measurement data transmission will be a huge save.

Illustration of the Measurement Data Transmission Process

Illustration of the Measurement Data Transmission Process

On the other hand, the transmission of the control signal has an explicit error checking process. Once the measurement unit receives a control signal, it will echo it back to the base unit. The base unit will compare the echo-back signal with the control signal it transmitted. If the two signals match, the transmission is successful and the system will proceed. Otherwise, the base unit will repeat the process above again and again until the echo-back signal matches with the sent control signal. Such design ensures that the measurement unit successfully receives the control signal at the cost of decreasing the effective data rate on channel. But since the transmission of a control signal is less frequent, the overhead is not a big deal to the overall performance of the system.

Illustration of the Control Signal Transmission Process

Illustration of the Control Signal Transmission Process

Provided the two transmission processes above, we can see that the communication between the two units is asynchronous. With asynchronous bi-directional communication, one unit may often start receiving at the middle of the other’s transmission, resulting in a corrupted received signal. This issue can substantially decrease the rate of successful transmission, lowering the effective data rate. We proposed a technique to significantly boost the success rate.

Let’s set up a scenario to explain the technique. The measurement unit has to periodically transmit the measurement result to the base unit for output. When the base unit starts receiving the signal, it has no idea if the measurement unit is in the middle of transmission or is not transmitting. Therefore the first 1 the base unit sees is not necessarily a start bit. It may be a data bit 1 in the middle of a data. To address this issue, we make the measurement unit repeatedly send out the measurement data (each measurement data consists of 4 bytes, as you will see later). After each measurement data is sent, the measurement unit will call the PostRCVDelay(), waiting for around 32 bit times, and transmit the same measurement data again. At the base unit side, every time the base receives a byte, it will keep receiving the following seven bytes. As long as the eight bytes are filled up, we claim there must one valid measurement data inside these eight bytes.

The reasoning is that if the base starts receiving before the measurement unit starts transmission, it is trivial that the first four bytes will be the valid measurement data. However, if the base unit starts receiving at the middle of the measurement unit’s transmission, the first N bytes will be corrupted (0<N<5). But since there is a delay after each 4-byte (a complete package of measurement data) transmission, and the base unit keeps looking for the incoming signal, the base unit must be able to lock into the start bit of the first byte of the measurement data package. To determine where the valid measurement data is located inside the eight bytes, we will look for the known label, which we added intentionally into the measurement data package. Using such a technique can greatly boost the success rate, thus increasing the effective data transmission rate.

The last thing in the overview section is the data encoding. For control signals, the data are simply “V”, “I”, or “F” and they are encoded using the ASCII table, which is a great choice since our data is transmitted in bytes. For the measurement data, it is encoded into four bytes. The first step is to convert the number into scientific representation. For example,

0.0023 = 2.3 m

20.3 = 20.3

5679 = 5.68 K

And we divide the scientific representation into four parts: integer part, period, decimal part and order part. The integer part and the decimal part will be numbers less than 100. To distinguish with the 0, which may be confusing in some cases since it also means no value transmitted, we add an offset of 21 to both the integer and decimal parts before transmission and subtract the offset after receiving the signal. The period is encoded using the ASCII table and it serves as the “known label” to determine the location of the valid measurement data in the 8 bytes. The order part will be one of “m”, “N”, “K”, where “N” is used when there is no actual order part and to distinguish the case from no signal. The advantage of this encoding scheme is that it has a fixed package length, which makes things a lot easier in our asynchronous bi-directional communication system. Secondly it has only four bytes with one redundant byte (the period) as the known label for error checking purpose. We can transmit a reasonable amount of data with four bytes one measurement data package and 110 bytes a second (approximately).

Illustration of Measurement Data Encoding

Illustration of Measurement Data Encoding

ii. Base Unit

With the understanding of some common techniques and designs of the RF system, the remaining that is specific to the base unit is the timing. How to allocate the time for each tasks running on the base unit is what we are going to discuss in this section.

The tasks running on the base unit include: receive measurements, detect switch change for measurement mode selection, transmit mode selection control signal and the LCD update. Every 400ms, there will be 350ms spent on receiving measurement signals from the measurement unit. We allocate so much time for receving in order to increase the time frame overlap between the base unit’s receiving and the measurement unit’s transmission, therefore maximizing the probability that there will be at least one valid measurement received in every cycle. The rest 50ms will be used to check if the switches have changed their states, indicating a new measurement mode. If there is no change, it will proceed and wait for the next 400ms cycle to come. If there is a switch change, the base unit will enter a blocking process, where it loops around sending control signal, receiving echo-back signal and comparison, and exit the blocking process until an echo-back signal matches with the control signal sent. Below is a state diagram describing the RF-related tasks (the LCD update task is not included in this state diagram).

State Diagram of the Base Unit

State Diagram of the Base Unit (LCD update not included)

And the LCD updates every 400ms, independent of the RF-related tasks as long as the system is not blocked by the control signal transmission part.

iii. Measurement Unit

The tasks running on the measurement unit include: take measurement, transmit measurement data, receive control signals and update the system accordingly. The system is working on cycles of 300 ms. In the first 300 ms, the unit will first take the measurement based on the current measurement mode and then repeatedly transmit the measurement data for 300 ms. In the following cycle, the unit will do exactly the same thing. The two consecutive 300 ms again aims to achieve a big overlap between the receive period of the base unit and the transmission period of the measurement unit. In the third 300 ms, the unit will look for any incoming control signal. If no control signal shows up, the system loops back to take measurement and transmit measurement data. If the measurement unit receives valid control signal, it will echo the signal back, update the measurement mode, and loop back to take measurement under new mode and transmit the data.

State Diagram of the Measurement Unit

State Diagram of the Measurement Unit

2. Measurement

Our DMM is capable of measuring voltage from 0 to 5V, frequency from 10 HZ to 100 KHz, and current from -150mA to 150mA. Auto-ranging is applied to improve the measurement accuracy.

The code for the voltage measurement is pretty the same as lab2 except that we exclude the functionality of manually select the measurement range. PinA0 is used to read in the analog voltage. The ADEN bit in ADCSRA is set to high to turn on ADC and the ADC prescalar is set to 128. Since we are only using 8-bit accuracy, we set ADLAR to 1 so we only to read ADCH for the conversion result. When the system takes the first measurement, the REFS0 is set to high so that the reference voltage is AVCC=4.97V. By changing the REFS0:1 bits in the ADMUX register, we can vary the reference voltage to 1.1V or 2.52V for low and medium voltage measurements. After the ADC conversion is finished, we read from the left-adjusted ADCH register. The measurement voltage will be compared to the reference voltages. If the measurement falls in the range of medium or in, the proper reference voltage will be chosen and a second measurement will be taken for better accuracy.

The code for current measurement is completely new since we do not have current measurement in our lab2. Because our current sensor will take in current and output voltage, we will directly measure the voltage and then calculate the corresponding current. This transforms the problem into a voltage measurement problem, which is our first measurement type. Add an extra line of calculation will convert the measurement voltage into the current measurement.

The code for the frequency measurement is also similar to what we have done in lab2. The first difference is that in lab2, we used analog comparator to trigger the input capture function of Timer1. In our final project, the analog comparator is reserved for the receive operation of the RF communication. Therefore we directly use the input capture pin (ICP, PIND.6) to trigger the input capture function. The second difference is that we incorporated the auto-ranging functionality while it is not implemented in lab2. The default prescaler of Timer1 is 1 to achieve the best measurement accuracy. For signal with frequency lower than 244 Hz, the prescaler of Timer1 will be tuned to 64 to avoid Timer1 overflow while achieving reasonable accuracy. Each time the input capture function is triggered, the corresponding ISR will be triggered and calculate the number of ticks elapsed since last input capture ISR. Given the number of counts between two ISRs and the prescaler, we can therefore calculate the frequency of the input signal.

Results of the design

1. Accuracy and Reliability

We tested our circuit and verified the measurement using commercial DMM and oscilloscope in the lab. Our DMM is able to measure voltages from 0.2 volt to 5 volts within 2% accuracy and Frequency from 100 to 100 KHz with 1% (at all frequencies) accuracy. The base unit and the measurement unit are able to communicate with each other at a distance of 10cm when placed top-bottom and at a distance of 4cm (edge to edge distance) when placed side by side. The relative orientation of the two units may also affect the communication range slightly, but not too much. The current sensor, however, always gives a zero Vout no matter how we change the current. We suspect that the current sensor may have gotten fried during soldering or damaged during transportation. Nevertheless, we are able to enter the mode of current measurement, although the measurement result is not correct.

In testing the RF antenna, we first used the oscilloscope to measure the transmitted and the received signal. The graph below shows the transmitted signal from the base unit MCU (CH1) and received signal into the measurement unit MCU (CH2). The signals are identical. We also tested multiple test cases in U_art to make sure that the antenna is functioning properly.

Transmited and Received Signal

Transmited and Received Signal

In implementing the user input into the system, we used switches instead of push buttons. Because the action of pushing a button is instant and would require debounced button every 30 to 50ms. However, we have to make sure the MCU is always focused on transmitting and receiving signal so that it will not miss any signal. Therefore, it would be undesirable to interrupt the MCU and use it to detect button push. On the other hand, switches will be able to change the measurement state directly and would cost no MCU computation.

2. Safety

Although one of the important usages of near field communication wireless DMM is high voltage/current measurement, we limited our voltage below 5V and current below 200 mA for safety. In future development of the product, we can add voltage dividers in the circuit to be able to measure high voltage and change to more powerful current sensors for current measurement. On the other hand, our design can be used directly in isolated systems because the two units have no wiring with each other and communication works well at a distance of 15cm.

3. Interference with the Background

When there is signal to be measured, there are still very small measurements based on our DMM. For example, during frequency measurement, when the measurement circuit is only connected to the white board, the base unit would give a result of 60Hz which is possibly due to the numerous oscilloscopes and function generators in the background which works or 60Hz AC. These signals will produce induce a weak noise in the white board and hence affect our measurement result.

4. Usability

Our system is very easy to use, unless the user has physical disability or blindness that prevents them from turning on or off the switches and seeing the LCD. The user only has to connect the respective probes and use switches to choose the desired measurement mode. During testing, we found that the op amps and the MCUs are the units most likely to become dysfunctional. We used a number header pins to make sure that the user can easily replace these units if they found any problem.

Conclusion

1. Summary

The results of our experiments meet with our expectations. Although the current sensor is not working properly, current measurement is not a essential part of our project and our focus is on near field half-duplex communication which is very reliable in this case. Since the LC tank resonates at our transmission frequency, our design is resistant to signals at other frequencies. Also, because we have used known labels to check the validity of the received signal, our design is also resistant to noise and disruptive signals even at the exactly same frequency.

Due to the time constraint, we did not finish the design of sleep wake-up function, which is a pitty. And due to budget constraint, we are not able to implement a full duplex system. If we are allowed to use four MCUs and four antennas which will exceed the budget, the base unit will be able to receive measurement result from the measurement unit at the mean time of transmitting the user input. On the other hand, the measurement unit will also be able to receive the user instruction at the meantime of transmitting measurement data.

Our design can be implemented using ATMega32 microcontrollers. However, because we don’t have libraries for LCD display and uart in using ATMega32 microcontrollers, we used ATMega644 instead. In addition, as mentioned before, due to safety considerations, we did not attempt to measure high voltage and large current. In the future when we are more experienced with electric circuits, we can further develop circuits to become able to safely measure high voltage and large current.

2. Intellectual Property and Copyright

In our final, we reused some codes from the Minimum Mass Wireless Coupler project from Dick Cappels’ project website page. We obtained the permission to use and modify the code from the author. We also use one of the LC tank antenna designs from the website in our project. The code on the website was originally written for an ATMega8 working at 4MHz in AVR assembly language. We modified the code so that it now works for an ATMega644 working at 16MHz, and the code is now in GCC assembly.

3. Ethical Considerations

We finished our project in strict accordance to the IEEE Code of Ethics. Our project meets the safety and health requirements and does not infringe upon the welfare of the public. In fact, our project is meant to reduce the hazard from high voltage and current measurements and make it convenient to make measurements from isolated circuits. We have tested our design thoroughly and the measurement results are verified using commercial DMM and oscilloscope. Results show we have achieved reasonable accuracy. We have reported our results truthfully and we have acknowledged the limitations of our project. We are open to any criticisms to our work regardless of race gender or age. We have not attempted to bribe others or received bribe of any form. During lab work, we have received much help from the instructor, TAs and fellow classmates. We also tried our best to help others when they are in need.

We would like to express special thanks to our instructor Bruce Land and TAs who gave much inspiration in our design and Dick Cappels who gave us the basis for our design of the half-duplex near-field wireless communication system. We have acknowledged others’ work and addressed what modifications we have made to adapt them into our system.

4. FCC Regulations

In our design, we used a frequency at 181.18 kHz regulated by FCC 15.209, 15.213 and 15.217 for the following requirements:

  1. The total input power to the final radio frequency stage (exclusive of filament or heater power) shall not exceed one watt. Our antenna has a peak voltage at 5V and we have a placed a resistance of 75 ohm resistor in series with the LC tank. The power of our amplifier is less than 1/3 watt even at peak voltage.
  2. The total length of the transmission line, antenna, and ground lead (if used) shall not exceed 15 meters. Since we are going to use LC tank to build the antenna, the length of the antenna would be about 5.5*4*32*2=1408cm which is shorter than the maximum total length. The length of the other components are negligible.
  3. The total length of the transmission line, antenna, and ground lead (if used) shall not exceed 15 meters. Since we are going to use LC tank to build the antenna, the length of the antenna would be about 5.5*4*32*2=1408cm which is shorter than the maximum total length. The length of the other components are negligible
  4. the emissions from an intentional radiator shall not exceed the field strength levels specified in the following table:

    Frequency (MHz)

    Field strength (microvolts/meter)

    Measurement distance (meters)

    0.009–0.490

    2400/F(kHz)

    300

    0.490–1.705

    24000/F(kHz)

    30

    1.705–30.0

    30

    30

Table.1 FCC regulation

The signal in our design dies out very quickly when the distance is increased. When the distance is more than half a meter, there is virtually no signal at all. 

Appendix

Commented Code

RF.S
Base.c
Measurement.c

For codes about LCD and uart (lcd_lib.h, lcd_lib.c, uart.h, uart.c), please refer to the codes on http://people.ece.cornell.edu/land/courses/ece4760/labs/s2012/lab1.html

Schematics

Base unit circuit diagram

Base unit circuit diagram

Measurement Unit Circuit Diagram

Measurement Unit Circuit Diagram

Cost Details

Part Description Quantity Unit Price Source
ATMega644 MCU 2 6 Bruce Land
DIP socket for MCU and op-amp 4 0.5 Bruce Land
LCD Display unit 1 8 Bruce Land
Switch two way switch 2 0.5 Bruce Land
Solder Board   3 2.5 Bruce Land
Current Sensor DigiKey #: 480-3254-ND 1 18.16 DigiKey
Header Connection for LCD, target board 75 0.05 Bruce Land
Op-amp LF353. Amplify received RF signal 2 0.55 Bruce Land
Target board the interface for MCU 2 4 Bruce Land

Work Distribution

Xiaofeng Gu Jia Yang
Code Hardware Design
Hardware Test (30%) Soldering
Website Hardware Test (70%)

Reference

Data Sheets

  1. ATMega8
  2. ATMega644
  3. LF353P
  4. CSLW6B200M

Vendor

  1. DigiKey

References

  1. FCC Regulation
  2. ECE4760 Spring 2012 Lab2 DMM
  3. Minimum Mass Wireless Coupler
  4. AVR Assembler Guide
  5. Mixing C and Assembler
  6. ARM Reference

Background

  1. MCU Target Board