Download - Electronic Normalizer
1
.
Electronic Normalizer
ECE 445
Spring 2015
Design Review
Sean Barowsky, Mike Goodlow, Jonathan May
TA: Braedon Salz
February 24, 2015
2
Table of Contents
1. Introduction .................................................................................................................................................. 3
1.1 Statement of Purpose ................................................................................................................................. 3
1.2 Objectives .................................................................................................................................................. 3
1.2.1 Goals & Benefits ...................................................................................................................... 3
1.2.2 Functions and Features ............................................................................................................. 3
2. Design ............................................................................................................................................................ 4
2.1 High Level Block Diagram and Software Flow Chart .............................................................................. 4
2.2 Block Descriptions & Reasoning .............................................................................................................. 6
2.2.1 Power Meters ........................................................................................................................... 6
2.2.2 Photon Detectors ...................................................................................................................... 6
2.2.3 Analog Filter Circuit ................................................................................................................ 7
2.2.4 Division Circuit ...................................................................................................................... 11
2.2.5 Microcontroller ...................................................................................................................... 16
2.2.5A 24-Bit ADC ........................................................................................................... 17
2.2.6 Display ................................................................................................................................... 18
2.2.7 User Interface ......................................................................................................................... 18
2.2.8 Memory .................................................................................................................................. 19
2.2.9 Power Supply ......................................................................................................................... 20
2.3 Software Component Schematics ............................................................................................................ 21
2.4 Analog Filter Design ............................................................................................................................... 23
3. Requirements and Verification ................................................................................................................ 25
3.1 Table of Requirements, Verification ....................................................................................................... 25
3.2 Tolerance Analysis .................................................................................................................................. 28
3.3 Ethical Issues ........................................................................................................................................... 28
3.4 Safety Statement ...................................................................................................................................... 29
4. Cost and Schedule ....................................................................................................................................... 30
4.1 Cost Analysis ........................................................................................................................................... 30
4.1.1 Labor ...................................................................................................................................... 30
4.1.2 Parts........................................................................................................................................ 30
4.1.3 Total Cost ............................................................................................................................... 30
4.2 Schedule .................................................................................................................................................. 31
4.3 Contingency Plan .................................................................................................................................... 32
5. References .................................................................................................................................................... 33
3
1. Introduction
1.1 Statement of Purpose
The University of Illinois physics department has an optics laboratory which
performs tests to determine the transmittance of different materials. The lab technicians
currently perform two separate measurements: a reference measurement from a light
source transmitted only through air, and a second measurement on light through the
tested materials. Both light beams come from the same source through a beam splitter.
Tedious hand calculations are necessary to then compare the two measurements. Also,
momentary changes in the optical source's strength can hinder accurate results. Our
project aims to solve these problems by automatically calculating a correction factor, and
applying that correction factor to future measurements. Not only will this eliminate the
necessity for awkward and possibly erroneous hand calculations, but it will also allow
corrections faster than a human could perform readings.
1.2 Objectives
1.2.1 Goals & Benefits
Eliminate unnecessary hand calculations
Eliminate erroneous calculations
Perform calculations faster than possible by lab technician
Graph results in a quick and efficient manner
1.2.2 Functions & Features
Intuitive user interface
User Selectable sampling rate
Simple Data Display
Minimal additional experiment steps
Storage media for data output
4
2. Design
2.1 High Level Block Diagram and Software Flow Chart
Photon Detector
Power Meter
Division Circuit
MicrocontrollerMemory
Display
Power Supply
User Interface
Photon Detector
Detector Switch
Analog FilterCircuit
Analog Filter Circuit
Power Meter
Detector Switch
LEGEND External Device Software Circuit Design
Figure 1: High level block diagram
5
SETTINGS
WAIT
CALIBRATE
SAMPLE DATA
DISPLAY MEMORY
POWER ON
BEGINSTOP
STORE
START
WRITE
CONTINUE
CLEARMEMORY
RESET
RESET
OFF
Figure 2: Software Flow Chart
6
2.2 Block Descriptions & Reasoning
2.2.1 Power Meter (External Component)
Inputs: The input of this device is photons coming from an external source of light that is not a
design component.
Outputs: The output for this device is a scaled analog signal from 0-2Volts.
Description: One of the two possible sources for our circuit will be the power meters. They
provide a power representation (Intensity) of the light source being used in a measurement.
Physics labs typically use a variety of different meters however they all have the same features
that will allow each model to be integrated into our design. Each power meter has an analog
output BNC connector capable of producing a 0-2 Volt output. The output of this power meter is
not wavelength or zero corrected. The detectors internal settings allow for the 0-2V signal to be
scaled down, but not higher than the 2V maximum. These power meters are required to be used
at both the source and reference measurements for the device.
2.2.2 Photon Detector (External Component)
Inputs: The input of this device is photons coming from an external source of light that is not a
design component.
Outputs: The output for this device is 2 Volt, 10ns DC pulse.
Description: The Physics labs most common photon detector is the id100 series manufactured
by IDQ technologies. This detectors output is a SMB female jack that provides a 0-2 Volt digital
output at a maximum rate of 100 MHz. The photon detector sends a 10 ns DC pulse every time a
photon is detected. The photon detector expects a 50 ohm load at its output. The device’s
operation in our circuit will be to produce a value representing photons/second using the
frequency of incoming pulses as a basis for the measurement. These photon detectors are
required to be used at both the source and reference measurement for the device.
Figure 3: id100 Photon Detector
7
A sample output is shown in figure 4. The output pulse is a square wave with a 10ns on
time and 90 ns off time when detecting at the maximum rate. The magnitude of the wave is 2
volts. The detector sends one pulse each time it detects a photon. [1]
Figure 4: Sample detector output
2.2.3 Analog Filter Circuit
Inputs: The input to the filter is the 2V pulses from the photon detector. This input will be in a
range of 0-2 V at a maximum frequency of 20 MHz. The connection is made via a BNC
connector at the photon detector end and PCB trace at the input to the filter.
Outputs: The output of the filter is routed into the division circuit. This output will be in a range
of 0-2 V. The output of the filter is connected to the input of the division circuit via a matching
network on the custom PCB.
Description: The use of a low pass filter allows the easy conversion of the square wave output
of the photon detector into a nearly constant DC voltage. This low pass filter is of order 3 and
easily realizable with a few discreet passive components.
Photon Detector
FilterDivision Circuit
0-2V 0-5V
0-2V 0-5V
Figure 5: Conversion Block Diagram
8
The simplest way to convert the output of the photon detector to a signal that is usable in the
division circuit is to use a low pass filter between the detector and the division circuit. This filter
will convert a pulsed signal coming from the photon detector into a DC voltage which can be
used in the division circuit. This convert and then divide method allows the end user to mix
types of detectors. Photon counters can be paired with power meters and vice versa.
Simulation: Using the output of the photon detector as input to a low pass Butterworth filter
with a passband frequency of 500 kHz, shown in the circuit diagram in Figure 6. This filter is not
a realistic filter as it is of order 14. Regardless, it is important to show here how varying
frequency content at the input of the filter effects its output, shown in figure 7. Our filter will be
of a much lower order. We were able to show that higher detection rates directly correspond to
higher filter output voltages.
Figure 6: Simulation circuit
Figure 7: Simulation output
Butterworth Filter Simulation Circuit
Jonathan May
2/24/2015
9
From the output of the simulation, it can be seen that the output voltage stabilizes within
8 microseconds. This is an acceptable rate because our ADC, at the microcontroller, will sample
this output on the order of a thousand samples per second. This sampling rate is well below the
stabilization rate and thus there is little chance of a sample being taken before the output has
stabilized.
Table 1 shows how the output voltage changes with changing frequency of detection
from the photon detector. Decreasing frequency of detection gives a decreasing output voltage.
In this case, when the frequency of incoming pulses goes below the cutoff frequency of the filter,
the entire signal is effectively passed through the filter and the output becomes unusable.
Table 1: Output voltage vs. detection frequency
Input Frequency Output Voltage
20 MHz. 0.40 V
10 MHz. 0.19V
2 MHz. 0.04V
500 kHz Unstable Output
Another important consideration is the cutoff frequency of the low pass filter. A filter
with a lower cutoff frequency gives an output which is less smooth in the passband and stabilizes
more slowly. A filter with a higher cutoff frequency gives an output which stabilizes more
quickly and is smoother in the passband. A good cutoff frequency for the detection levels needed
is 500 kHz. This cutoff frequency gives a stabilization time less than the sampling time and a
flat passband. An example of the output of two different cutoff frequency filters given the same
input is shown below in figure 8.
Figure 8: Filters with different cutoff frequencies.
10
Analog Filter Schematic: Using Butterworth analog filter design techniques the filter in figure 9
was realized. The filter is of order 3, has a maximally flat passband and 20dB attenuation in the
stop band. This filter has a cutoff frequency of 50 kHz. Here a termination resistance of 50 Ohms
is used, in the final design a matching network will be placed between the filter and the division
circuit such that maximum power is transferred from the filter to the division circuit. In this
simulation the maximum photon detection rate is again used to prove the filter is working. [2]
Figure 9: Analog Butterworth filter of order 3
Butterworth Filter Component Circuit Jonathan May 2/24/2015
11
2.2.4 Division Circuit
Overview
This circuit performs the division of the source and target detector outputs. The circuit will be
implemented using analog signals and will perform the division function through a series of op-
amps. 0-2V DC inputs are provided from external power meters and/or the photon counter filter
circuits, and the output will be a 0-5V DC signal, representing the ratio of the two input signals,
on a logarithmic scale. The output will be used by the microprocessor. The overall schematic for
the circuit is shown below, in Figure 10.
Figure 10: Division Circuit
The division circuit can be broken down into three smaller “stages”: 1st, the input
selection switches; 2nd, the logarithmic amplifiers; and 3rd, a differential amplifier. The details of
these three stages will be explained below. The desired output from the circuit is a logarithmic
representation of the ratio between the two input voltages.
Input Selection
Inputs: 0-2 V DC signals are provided by a combination of power meters (PM1 and PM2) and
photon counter circuits (PC1 and PC2)
Outputs: 0-2 V DC signals, which will be the inputs to the logarithmic op amp circuits.
Description: The purpose of switches S1 and S2 are to simply change which inputs are being
used during the experiment. This allows for any combination of Power Meters and Photon
Counter to be used.
12
Logarithmic amplifiers
Inputs: The input will be 0-2V signals from the input switches
Outputs: The output will be the input signals converted to a logarithmic scale, for use by the
differential amplifier in the next stage.
Description: The purpose of the logarithmic amplifier stage is to convert the input voltages to a
logarithmic scale for later division. A simplified circuit is shown in Figure 11.
Figure 11: Logarithmic Amplifier
With the non-inverting terminal held at ground, and using ideal op-amp calculations, the
inverting terminal will also be at ground. Therefore, the current through the input resistor will be
equal to the current through the diode.
𝐼𝐷 = 𝐼𝐼𝑁 =𝑉𝐼𝑁
𝑅 (Equation 2.1)
The current through the diode is also represented by the ideal diode equation [3]:
𝐼𝐷 = 𝐼𝑆 (𝑒(
𝑉𝐷𝑉𝑇
)− 1) (Equation 2.2)
Using Kirchhoff’s Voltage Law, the output voltage (VOUT) is equal to the inverse of the
diode voltage (VD). By combining the previous equations, we get the final equation below, which
shows that the output voltage is proportional to the natural log of the input voltage, and is scaled
by the input resistance (R), the saturation current of the diode (IS), and the thermal voltage of the
diode (VT).
𝑉𝑂𝑈𝑇 = −𝑉𝐷 = −𝑉𝑇 ln (𝑉𝐼𝑁
𝐼𝑆𝑅) (Equation 2.3)
13
A representation of the logarithmic relationship between diode current and voltage is shown in
Figure 12, from the 1N4007 diode datasheet. [4]
Figure 12: Diode I-V Curve
Differential amplifier
Inputs: The inputs are the two signals from the logarithmic amplifiers.
Outputs: The output is an amplified difference between the two input signals. The values of R3,
R4, R5, and R6 are selected in order to scale the difference to the necessary 0-5V DC output.
Description: The differential amplifier provides the “division” for the divider circuit. The basic
circuit is shown in Figure 13.
Figure 13: Differential Amplifier
14
The two logarithmic signals from the previous stage are provided to the op amp via the resistors
shown. The output can be calculated by superposition. First, with V1 providing an input, and V2
at zero:
𝑉1 − 𝑉−
𝑅3=
𝑉− − 𝑉𝑂𝑈𝑇
𝑅4
Because V2 = 0V, V+ and V- are also 0V. Therefore, the equation becomes:
𝑉1
𝑅3= −
𝑉𝑂𝑈𝑇
𝑅4
Solving for Vout gives the following relationship:
𝑉𝑜𝑢𝑡 = −𝑉1(𝑅4
𝑅3) (Equation 2.4)
Now, with V2 as the input, and V1 at zero:
𝑉− = 𝑉+ = 𝑉2(𝑅6
𝑅5 + 𝑅6)
And
𝑉𝑂𝑈𝑇 − 𝑉−
𝑅4=
𝑉−
𝑅3
By combining the two equations, and solving for Vout, the resulting equation is:
𝑉𝑜𝑢𝑡 = 𝑉2 (𝑅6
𝑅5 + 𝑅6) (
𝑅3 + 𝑅4
𝑅3)
Selecting resistors so that R3 = R5, and R4 = R6, the equation simplifies to:
𝑉𝑜𝑢𝑡 = 𝑉2(𝑅4
𝑅3) (Equation 2.5)
And finally, by Superposition, Vout will be the sum of the Equations 2.4 and 2.5:
𝑉𝑂𝑢𝑡 = 𝑉2 (𝑅4
𝑅3) − 𝑉1 (
𝑅4
𝑅3) = (𝑉2 − 𝑉1) (
𝑅4
𝑅3) (Equation 2.6)
15
Division Circuit Summary: By taking the equations from the differential amplifier and
logarithmic amplifier stages, and combining them, the final equation for the divider circuit
becomes:
𝑉𝑂𝑢𝑡 = (−𝑉𝑇 ln (𝑉1
𝐼𝑆𝑅) − −𝑉𝑇 ln (
𝑉2
𝐼𝑆𝑅)) (
𝑅4
𝑅3) = −𝑉𝑇 (
𝑅4
𝑅3) (ln (
𝑉1
𝐼𝑆𝑅) − ln (
𝑉2
𝐼𝑆𝑅)) = −𝑉𝑇 (
𝑅4
𝑅3) l n (
𝑉1
𝑉2)
𝑽𝒐𝒖𝒕 = 𝑽𝑻 (𝑹𝟒
𝑹𝟑) 𝐥 𝐧 (
𝑽𝟐
𝑽𝟏) (Equation 2.6)
So the final output of the divider circuit will be the desired ratio of the two input signals
in logarithmic form, and scaled by the biasing resistors and diode thermal voltage. The
logarithmic ratio will later be converted back into a linear ratio by the microprocessor.
In the application for this circuit, the reference voltage will always be greater than or
equal to the testing voltage, and therefore, V2 will be the reference input, ensuring that Vout will
always be positive. Because the natural log of V2/V1 approaches infinity as V1 approaches zero,
the proper resistance ratio for R4/R3 could not be obtained through simple mathematical
calculation. Instead it was obtained through pSpice simulations, with a ratio of 10.125/1 giving a
maximum of 5V output when V1 approached zero. Figure 14 below shows this simulation result,
with the reference voltage V2 held constant at the maximum 2V, and the test voltage swept
through the entire range of 0-2V. On a design note: Because the simulation is an ideal scenario
without noise or temperature effects, real world testing may necessitate a change to this ratio.
Figure 14: Division Circuit Simulation
16
2.2.5 Microcontroller
Inputs: The microcontroller has two inputs. The microcontroller reads data from the division
circuit through SPI via a 24-bit external ADC and reads inputs from the user interface via I2C
communication.
Outputs: There are two outputs that the microcontroller sends out. The first is data sent to the
memory via SPI. The second is data sent to the display via I2C communication.
Description: The microcontroller is the main source of control in this circuit. It is the
communication center between the memory, display, interface, and performs the data sampling
from the division circuit using an ADC. The microcontroller used in this device will be an
Arduino Uno R3. It is powered by a 7-12V input and operated at a clock rate of 16MHz. Its
functionality consists of initialization, data sampling, memory output, and data display. [13]
The microcontroller will be coded using the Arduino integrated development environment (IDE)
which is a set of C/C++ functions. [13] In order to save processing power, operations that can be
easily programmed through direct interaction with on-board components will be utilized instead.
The microcontroller will be programmed to acknowledge inputs and perform the correct
operation. It will require a state machine to work in synchronization with the display. It will also
need to be able to be interrupted at all major states.
There will be two different methods of communication, I2C and SPI; therefore both
programming libraries will be used in the code. The microcontroller will have to be able to
communicate with two different SPI devices and one I2C device simultaneously and with
minimal delay. The microcontroller is also responsible for the write speed to the memory and
will be writing to the memory continuously while interacting with all three communication
modules at the same time.
Inverse Logarithmic Function
The microcontroller will be handling the data that is passed from the ADC. A huge component in
this device is that the microcontroller will serve as an anti-logarithmic amplifier. Due to the
differential op amp serving as a divider, and these ratios possibly approaching ‘1’, diodes and
transistors do not have a wide enough operating range for us to produce a perfect ratio out of the
dividing circuit. In order to compensate this the microcontroller will read the data from the ADC,
scale it up to normal exponential value, and perform an inverse-logarithm to the voltage.
Equation 2.7 shows how the ratio is obtained from the value sent from the ADC (Vin). In the
equation ‘A’ represents the value that will scale Vin back to normal. The negative is taken
because negative voltages cannot be passed through the ADC.
17
𝑅𝑎𝑡𝑖𝑜 ≡𝐼2
′
𝐼1′= 𝑒−(
𝑉𝑖𝑛
𝐴) (Eq. 2.7)
Working out the exact value for scaling factor A will be done after the division circuit is
completed. It will have to be measured in the field to account for all the noise and loss within
each device. It will be a simple operation of using function generators and scaling the output to
our estimated value.
2.2.5A 24-Bit ADC
Inputs: The input will be the 0-5V signal coming off the last amplifier in the division circuit.
Outputs: The output for this device will be the converted from an analog to a digital signal sent
to the microcontroller via SPI.
Description: The intention of the 24-Bit ADC is to provide a high-resolution solution to get
more accuracy from the division circuit. The Arduino UNO only allows for 10 bits of resolution
and this device is required to meet a minimum of 6 significant figures after the ratio is taken. The
only way this is possible is with a high-resolution ADC. The ADC used will be the LTC2440 by
Linear Technology and operates on a voltage between Vcc+0.3V and -0.3V. [5] The device is very
prone to being overloaded especially on the negative voltage end and therefore can be easily
blown.[12] To prevent this the output from the division circuit will be limited and scaled in a way
that will prevent the circuit from reaching these high and low specifications. The ADC will have
10 different sampling speed options that will be programmed through its serial interface. The
higher amount of samples per second, the less resolution in the data and vice versa. [5] [8]
Figure 15: 24 bit ADC Circuit [3]
18
2.2.6 Display
Inputs: The input to the display will be I2C communication from the microcontroller. [7]
Outputs: No outputs
Description: There are two primary functions of the display: To display the current sampled
measurement and display a navigable user interface. Working directly with the microcontroller it
will have calibration, setting, measurement, and reset submenus. These will be scrollable via the
user interface and can be seen in figure 16. There will also be additional menus or prompts after
going into each submenu.
Main Menu
CalibratePerform
MeasurementClear Memory RESET
Figure 16: Main Menu for LCD Display
Clear Memory: Overwrites the entire SD card to allow for a new and clean set of data.
Calibration: The calibration menu will establish the calibration measurement for the device
when the user is ready. After pressing the user acknowledges the prompt, the circuit will run for
10 seconds to stabilize and the last recorded measurement will be stored. Display will update to
main menu after the 10 seconds.
Settings: The settings menu will offer two functions. The first will be to choose the sampling
rate of the memory unit. The second will be to choose the update rate on the display. Once in
submenu, options to scale each sampling rate will be available via the user interface.
2.2.7 User Interface
Inputs: No inputs
Outputs: The output will be 4 directional buttons plus a select button that will communicate
over I2C.
19
Description:
The user interface allows for the user to navigate the display. This is done through passing bits
over I2C for the button pressed. The buttons will function as a directional interface for the
displays menu as well as select buttons to choose different options. They will function to select
the display rate and sampling rate of the device, reset the device, clear the memory, and navigate
the display. Figure 17 shows the interface mapping to each button. Certain buttons will not be
active while in some submenus. [7]
STOP
ScrollLeft
ScrollRight
Select or Reset
Power On/Off
Figure 17: Bi-Directional User Interface
Scroll Left / Scroll Right: Move between different menus and scale sampling rates when in
settings submenus.
Stop: Active only during the MEASUREMENT state, ending the measurement.
Select / Reset: Select button acts exactly as it sounds, serving as an ‘OK’ button to verify
selection of different tasks and menus. Button becomes a reset button when in the
MEASUREMENT state.
Power On / Off: This will be the power button for the microcontroller and display. When
pressed to turn the device off, a prompt will pop up to verify this is what the user wishes to do.
2.2.8 Memory
Inputs: The input of the memory will be data transferred from the microcontroller to the
memory via SPI.
Output: The memory will be a SD card that can be removed externally and read by a SD card
reader.
Description: The memory unit will be a micro SD adapter for the Arduino made by Adafruit. It
20
will interface between both FAT32 and FAT16 formatted SD cards, depending on the size SD
card needed by the lab. The board is powered directly through the Arduino’s 5V on-board power
supply and is compatible with the Arduino Uno. The memory’s primary function is the store
every single sample so that the Physics lab can easily plot the data over time.
Memory Storage Calculation: This project requires storage over long sampling intervals. In
order to estimate the ideal operating time for this device a calculation a simple calculation is
performed. Multiplying the amount of memory per sample by the number samples per unit time
multiplied by the time of the experiment will produce the memory required for a certain interval.
This calculation can be seen in Eq. 2.8.
(Eq. 2.8)
Using Eq. 2.8 and some ideal values we can obtain our time interval. Using an 8Gigabyte SD
card, a max sampling rate from the ADC of 3.5 KHz, and 4bytes per sample, we obtain 158.63
hours of write time. This is a good baseline to acknowledge we will have plenty of time to work
with.
2.2.9 Power Supply Circuit
Inputs: 120V AC from a standard building supply
Outputs: + and - 12 V DC
Overview: The purpose of the power supply circuit is to convert 120V AC from a standard wall
socket into the necessary DC power levels required for the design. The output voltage levels
should be consistent from no load to full load, with minimal ripple and noise. Because this
design does not use batteries, the efficiency is not a concern.
Requirements: The devices powered by this supply include: Arduino microprocessor and
associated LCD display, and operational amplifiers in the division circuit. The power
requirements for these devices is shown below in Table 2. To meet the requirements for all
devices and power levels, a supply capable of providing +/- 12V DC, at up to 6 watts will be
used.
21
Table 2: Power Requirements
Device Voltage
Required
Max. Current
(mA)Note 1
Voltage Required Max. Current (mA)Note
1
Arduino
Microprocessor
and LCD
Display
+9 to +12 VDC
~80 mA for Arduino
~100 mA @ 5V for
LCD display
-- --
Division
Circuit
Amplifiers (x3) +5 to +18 VDC 4 mA each -5 to -18 VDC 4 mA each
Note 1: Maximum Currents are approximate based on datasheets and catalogues, with an added 15% for
safety margin
Design: Shown below in Figure 16 is the power supply design. It consists of a 6W self-contained
PWM switching power supply.[9] A 1 amp slow blow fuse is provided on the input to provide
fault protection. The 12uF capacitors (C3 and C4) provide an extra level of filtering to reduce
output voltage ripple, while the smaller 0.024uF capacitors (C1 and C2) are placed near the
power converter outputs for decoupling purposes.
Figure 18: Power Supply Circuit
2.3 Software Component Schematics
Displayed in figure 2.3(Page 22) is the software configuration for the device. The
components featured are the microcontroller, memory, SD card, user interface, display, and
ADC. The only input coming from the circuit design is the data transferred from the ADC via
serial connection, and therefore is not included in the schematics. The circuit design
schematics can be referenced in their respective block descriptions in section 2.2.
The schematic shows two inputs to the SPI ports for the 24-Bit ADC and the SD memory
card. Using the DC pin 9 on the Arduino a second slave can be used so the second device can
interact with the BUS. The RGB LCD display is also shown, connecting to analog 4 and 5 on
the Arduino to communicate by I2C. The schematic is the full wiring diagram and shows no
pin conflicts with the Arduino Uno R3.
22
Drawn By: SAB
Microcontroller Schematic
TITLE: Microcontroller Circuit
FIGURE 2.3 REV: 1A
Date: 2/24/2015 10:58:27 AM Sheet: 1/1
23
2.4 Analog Filter Design
MATLAB code
As the filter generated by Agilent’s Advanced Design System is of order 14, MATLAB was used
to generate a filter of a reasonable order. The following code generates a Butterworth low pass
filter of order 3. This filter is a physically realizable filter with just a few components. Also, the
plot generated of the filtered signal shows that the order 3 filter is capable of performing the
work of the higher order filter to within reason. This filter takes about 100 microseconds to
stabilize. This is still acceptable as we will be sampling the output signal at a much slower rate,
on the order of thousands of samples per second. The input signal generated in the following
MATLAB code is comparable to that of the photon detectors limitations of detection. [10]
3 function Hd = filter
4 % ECE 445
5 % Jonathan May
6 % jmmay3
7 % 2/23/2015
8
9 % design a filter and apply it to a square wave
10 % observe the response of the filter to determine order 11 % and best cutoff frequency 12 13 %FILTER Returns a discrete-time filter object. 14 15 % MATLAB Code 16 % Generated by MATLAB(R) 8.3 and the Signal Processing Toolbox 6.21. 17 % Generated on: 23-Feb-2015 16:38:46 18 19 % Butterworth Lowpass filter designed using FDESIGN.LOWPASS. 20 21 % All frequency values are in kHz. 22 Fs = 10000; % Sampling Frequency 23 N = 3; % Order 24 Fc = 50; % Cutoff Frequency 25 26 % Construct an FDESIGN object and call its BUTTER method. 27 h = fdesign.lowpass('N,F3dB', N, Fc, Fs); 28 Hd = design(h, 'butter'); 29 30 % Get the transfer function values. 31 [b, a] = tf(Hd); 32 33 % Convert to a singleton filter. 34 Hd = dfilt.df2(b, a); 35 36 % define the input signal 37 t = linspace(0, 100, 1000 );
24
38 duty = 10; 39 x = square(t,duty); 40 41 % remove negative values 42 x = x + ones(1,length(x)); 43 44 plot(x) 45 hold on 46 47 % apply the filter 48 y = filter(b,a,x); 49 plot(y, ' r') 50 title('filtered photon detector signal'); 51 ylabel('magnitude(V)');xlabel('time(us)'); 52 legend('signal','filtered signal'); 53 54 % [EOF]
Figure 19: MATLAB plot showing the input signal and the output of the filter
25
3. Requirements and Verification
3.1 Table of Requirements, Verification
Requirements Verification Points
Filter
1. Filter output varies at a rate lower than
the sampling rate of 1kHz
2. Filter power consumption is minimal.
3. Attenuation in the passband is <1dB,
stopband attenuation is >20dB
4. -3dB point lies at the cutoff frequency
5. Filter noise floor is below the noise
floor of the division circuit
6. Filter output is in range 0-5V
Filter
1. Use function generator to provide a
signal which varies over a range from
10 kHz to 20 MHz with 2 Volt
amplitude, check that filter output is
stable within one period of sampling
time on an oscilloscope.
2. Measure power at the input terminals of
the filter and the output terminals of the
filter, power loss should be very near
zero
3. Using a network analyzer, observe the
frequency response of the filter in the
frequency domain, ensure attenuation is
<1db in the passband and >20dB in the
stopband
4. Using a network analyzer locate the -
3dB point ensure it lies at the cutoff
frequency of 50 kHz
5. Using an oscilloscope observe the noise
of both the division circuit and the filter
when they both have nothing connected
to them, observe that the filter noise
floor is lower than the division circuit
noise floor.
6. Using an oscilloscope, observe the
output of the filter, ensure it is in the
range of 0-5 V
15
Division Circuit
1. Divides two analog signals properly
2. Outputs a 0-5V signal to
microcontroller
Division Circuit
1. Using known inputs from 2 separate
function generators, measure output
voltage and compare to ideal simulated
voltage output (Figure X). Readings
should agree within 1%.
2. With minimum difference (0V) between
the two input signals, circuit output
should be 0V (±1%), as read on
multimeter. With maximum difference
(2V), circuit output should be 5V
(±1%), as read on multimeter.
15
26
Microcontroller
1. Reads from the ADC, performs
calculations, and stores data at
greater than or equal to 3.5kHz
2. Stores calibration memory on
SRAM
3. Outputs ratio of current
measurement divided by calibration
measurement to the memory and
display at different rates
4. Write ratio to memory.
5. Communicates with 5 Interface
buttons on the display via I2C.
6. Ability to clear memory
7. Scaling factor for the software
inverse-log function scales to
accurate ratio
Microcontroller
1. Using calculations, run the Arduino
for a sampled period of time and
check to see if the estimated number
of samples are stored into the
memory.
2. Run the board and continuously
write SRAM to the memory to make
sure it is stored.
3. Verify output ratio is sampled value
divided by the calibration value.
4. Write ‘hello world’ continuously and
check if stored on memory.
5. Use on-board LED’s via I2C to test
buttons
6. Send clear signal from the
microcontroller to write over the SD
card. Check SD card via a computer
to make sure no data is entered.
7. Use function generators and test
ADC’s input to get correct scaling
factor
20
Memory
1. Writes over 1.4Kb/sec via SPI
2. Capable of over 1 hour of data
storage
3. Interfaces with FAT16 & FAT32
SD cards
Memory
1. Write test code that outputs data
with 4 bytes and run at the max 3.5
KHz rate of the ADC to see if
memory is writing quickly enough.
2. Run the system for over 1 hour
under ideal conditions and check
that the quantity of data entries
correspond to amount of samples
sent to memory.
3. Use both FAT16 and FAT32 SD
cards and test to see data is stored on
memory.
10
27
Power Supply
1. AC/DC converter provides +12V
and -12V at full load, ±1%.
2. Less than ±1% ripple on voltage
output at full load.
Power Supply
1. Under full load conditions,
measure power supply output
voltages with a multimeter.
2. Under full load conditions, and
using an oscilloscope, measure
output voltage. Voltage should
always fall between 11.88 and
12.12V
10
Display
1. Continuously updates measurements
at the display update rate
2. Prompts user to power down and to
reset when buttons are pressed
3. Displays a navigable interface
between menu options
4. Displays different settings for
display update rate and sampling
rate.
Display
1. Write test code using random
functions to see if the display will
continuously update values at the
correct interval.
2. Write interrupt code that prompts
user whether they actually want to
reset or power down. Verify that the
execution of these tasks does not
occur until another key press verifies
the task.
3. Use directional buttons on interface
to make sure menu scrolls
accordingly. Debug software if
incorrect.
4. Verify menu correctly displays the
rate levels when scrolling through
menu. Debug software if incorrect.
10
User Interface
1. All 5 buttons on the user interface
correctly output a signal when
pressed
User Interface
1. Program each button to an LED on
Arduino or memory unit LED’s and
check for light on key press.
10
Detector Switches 1. Routes the AC signals from the
power meter and detector switch
circuits
Detector Switches
1. Hook up both meters to the circuit
and run both into the switch. Use
two multimeters to verify the correct
signal is being passed through the
switch without interference.
10
28
3.2 Tolerance Analysis
The primary component to our design is the division circuit. Without the operating pieces in this
design performing precise measurements this device will be inaccurate and useless. Thus, the
components will have to be carefully selected and implemented in a way to have the least
amount of error when changing the signals. The main calculation this device will perform is a
ratio of two different AC signals coming from both power meters.
Power Ratio = (I2`/ I1’) / (I2 / I1) (Equation 3.1)
In equation 3.1 I2 and I1 denote measurements during initial baseline calibration, and I1’
and I2’ are the measurements following calibration, during actual testing. The ratio of the two
measurements will be converted to the representation shown above in software; however, the
division circuit will perform the actual mathematical work. This means that the division circuit
components will have to achieve <1% accuracy. Because the final output of our device is a ratio
of two measurement points at different times, simple variations in base values (I.E. R1 being
9.9k instead of 10k) will cancel out in the final conversion step. The main concern for our circuit
will be to minimize thermal noise and electromagnetic interference. The parts selected for the
division circuit were specifically chosen for their high-precision and low noise to minimize
cumulative error.
3.3 Ethical Statement
While the entire IEEE Code of Ethics points applies when designing and implementing
any engineering project, the most applicable points to this design project are noted below, with
the actions we will take to meet them:
“To accept responsibility in making decisions consistent with safety, health, and welfare
of the public…”[11]
o We will ensure that our completed design is safe for use by lab technicians, even
those unfamiliar with general electrical safety principles. This will include
ensuring there are no exposed electrical parts that could shock the user, as well as
including fault protection to prevent hazardous conditions.
“To avoid injuring others, their property…”[11]
o Because this design is meant to be used with power meters and photon counters
in the Physics Optical lab, our design must prevent the possibility of faults from
damaging other equipment.
“To be honest and realistic in stating claims...”[11]
o The Physics Department and Professor Kwiat are essentially our “customers” on
this project, and we must ensure that we realistic in our communications and not
oversell on something that we will not be able to deliver.
29
“To seek, accept, and offer honest criticism of technical work…”[11]
o Feedback from professors, teaching assistants, and fellow students on any work
should be taken constructively, and addressed as such. Also, external
contributions should be properly cited, with permissions obtained to use, if
necessary.
3.4 Safety Statement
Safety of our end users, and those who may be in indirect contact with our design, is of
utmost importance to our team. At all stages of design and implementation we will take all steps
necessary to ensure we produce a product safe for use when used properly. We will also ensure
our product will not fail catastrophically during normal operation or under extreme conditions.
The two primary safety concerns with our device are personnel safety, and preventing faults
from becoming a fire hazard.
Fire can be prevented through ensuring all components in our design are operated well
within their manufacturers designated range. Also, great care will be taken to make sure no
components which may heat up due to normal use will ever come in contact with another part of
the system which may be susceptible to combustion when heated. An overcurrent protection fuse
is used such that a fault will remove all power to the internal circuitry. This will not only protect
our components but prevent injury to the user and mitigate risk of fire. All external wiring will
be properly shielded to prevent personnel shock. Proper warning labels explaining all the risks
involved with using this device will be clearly placed on the outside of the device within plain
view during normal operation. Included in the instruction manual for the final product will also
be guidelines stating the risks due to improper use of the device as well as how to prevent injury
or death to the user and other people through the proper employment of our device.
30
4. Cost and Schedule
4.1 Cost Analysis
4.1.1 Labor
Engineer Hourly Rate Total Hours
Invested
Total = Hourly rate
x 2.5 x Total Hours
Invested
Jon $37.50 240 $22,500
Mike $37.50 240 $22,500
Sean $37.50 240 $22,500
Total
720 $67,500
4.1.2 Parts
4.1.3 Total Cost
Section Total
Labor $67,500.00
Parts $122.19
Grand Total $67,622.19
Design Section Type Description Manufacturer Part # Price Quantity Total
Inductor 160uH API Delevan Inc. DN2313TR-ND $1.39 2 $2.78
Capacitor 0.12uF Murata Electronics 490-6430-2-ND $0.12 1 $0.12
Photon Conversion Circuit Subtotal $2.90
Op-Amps High Precision, Low Noise Op-Amp Texas Instruments OPA2227-EP $9.00 2 $18.00
Diode 1 Amp Rectifier MCC D1n4007 $0.17 2 $0.34
Resistor 10kΩ (+- .1%) 1/4W Stackpole Electronics RNF14BTE10K0 $0.91 4 $3.64
Resistor 1kΩ (+- .1%) 1/4W Yageo MFP-25BRD52-1k $0.46 2 $0.92
Resistor 100Ω (+- .1%) 1/4W TE Connectivity 1622796-2 $0.67 2 $1.34
Resistor 20Ω (+- .1%) 1/4W TE Connectivity 3-1879026-2 $0.67 2 $1.34
Detector Selection Toggle Switches Single Pole, Double Throw Toggle Switch Copal Electronics, Inc. ATE1E2M3-10-Z $2.87 2 $5.74
Division Circuit Subtotal $31.32
Microcontroller Arduino Arduino Uno - R3 Arduino A000066 $24.95 1 $24.95
Microcontroller ADC 24-Bit Low Noise High-Precision ADC Linearr Technology LTC2440 $7.25 1 $7.25
Memory SD Reader MicroSD Card Breakout Board Adafruit 254 $14.95 1 $14.95
Memory SD Card 8GB Class 6 SD SDHC Flash Memory AGPTek 700697066869 $3.99 1 $3.99
Display LCD RGB LCD and Keypad Adafruit 714 $24.95 1 $24.95
The Brain Subtotal $76.09
Power Supply Converter 6W AC to +/- 12VDC Power Converter Recom Power RAC06-12DC $17.85 1 $17.85
Power Supply Fuse 1 Amp Slow-Blow, 250VAC Littelfuse, Inc. 0229001.MXP $0.69 1 $0.69
Power Supply Fuse Carriage Fuse Carriage Littelfuse, Inc. 02540101Z $1.19 1 $1.19
Power Supply Capacitor 12uF, 63V Ceramic Plate Capacitor Panasonic Electric EEU-FC1J120 $0.33 2 $0.66
Power Supply Capacitor .024uF, 50V Film Capacitor AVX Corp 08055C243JAT4A $0.06 2 $0.12
Power Supply Power Cord Generic AC Power Cord Multiple N/A $2.04 1 $2.04
$0.00
Miscellaneous Subtotal $22.55
TOTAL COST $132.86
31
4.2 Schedule
Week Task Responsibility 23-Feb Research Op Amps Mike
Research Microcontroller & Software Sean
Research & Design Power Source Converter Mike
Design Enclosure Sean
Research & Design Analog Filter Jon
2-March Test output of power meters and photon counters Mike
Order filter components Jon
Order op amps Mike
Order Enclosure & User Interface Sean
Order Microcontroller & Software Components Jon
9-March Program microcontroller Jon
Program Memory/Display Interface Jon
Purchase Switches Sean
Assembler Power Source Mike
Design Enclosure Sean
16-March Build PCB Sean
Order/Construct Enclosure Mike
Test Microcontroller Jon
Test power source Mike
Wire and connect components Sean
23-March Prepare Mock Demonstration Mike
Debug Microcontroller Jon
30-March Optimize device Sean
Run tests device Jon
6-April Mock Demo with TA Sean
13-April Mock Presentation Jon
Sign up for Demonstration Mike
Prepare Demonstration Sean
Research for final paper Mike
20-April Finalize Demonstration Sean
Sign up for Presentation Jon
Prepare Demonstration Jon
27-April Finalize Presentation Jon
Perform tolerance tests on device for final paper Sean
Write Final Paper Mike
4-May Lab Checkout Sean
Finalize and Turn in Paper Mike
32
4.3 Contingency Plan
In the event that this complete design becomes infeasible to complete by the deadline
(Week of April 20th, 2015), precautionary measures will be taken to ensure the successful
completion of this project. These measures will involve simplification of the overall design
dependent on which module is causing distress on the system. The following options will be used
depending on which module is impeding on that modules success.
I. Software
a. Remove SD card sampling rates
b. Simplify display menu
II. Division Circuit
a. Pass both input signals to microcontroller through 24-Bit ADC’s
III. Filter / Photon Detectors
a. Remove filter and switch from the circuit
33
5. References
[1]Photon Counter Manual. Id100 Series. ID Quantique. 1227 Carouge/Geneva Switzerland.
May 2011.
[2]Franke, Steven J. ECE 453 Wireless Communication Systems. Urbana IL: University of
Illinois, Fall 2014. Softcover.
[3] Sedra and Smith, Microelectronic Circuits, 6th ed., Oxford University Press. 2009.
[4] 1N4007 Diode Datasheet. Micro Commercial Electronics. Chatsworth, CA. Jan. 2013
[5] LTC2440 24-Bit High Speed Differential ADC Datasheet. Linear Technology. 1630
McCarthy Blvd., Milpita, CA 95035-7417
[6] General Applications of the LTC2440 24 Bit ADC Rev 2.2. Steve Luce. Jan. 2015
[7] RGB LCD Shield. Adafruit Industries. July 2014
[8] Interfacing to High Speed ADCs via SPI. Analog Devices. 2005-2007. P.O. Box 9106
Norwood, MA02062-9106, USA
[9] RAC06-C Datasheet. Recom Power International. Gmunden, Austria. Mar. 2014
[10] The Mathworks, Inc. MATLAB signal processing toolbox. 1994-2014. 3 Apple Hill Drive
Natick, MA 01760-2098
[11] IEEE Code of Ethics, IEEE Policies, section 7. Jan. 2015
[12] General Aplications of the LTC2440 24 BIT ADC. Rev 2.2. Steve Luce, Jan 2015
[13] ATMEL 8-BIT Microcontroller with 4/8/16/32KBYTES In-System Programmable Flash
Datasheet. Atmel Corporation. Oct. 2014. 1600 Technology Drive, San Jose, CA 95110 USA.