Gas station without pumps

2014 April 5

Hysteresis lab on KL25Z

Relaxation oscillator used in the hysteresis lab.  The "variable capacitor" in this schematic is a person's finger and a touch plate made from aluminum foil and packing tape.

Relaxation oscillator used in the hysteresis lab. The “variable capacitor” in this schematic is a person’s finger and a touch plate made from aluminum foil and packing tape.

I spent today writing code for the KL25Z board to act as a period or frequency detector for the hysteresis lab, where they build a relaxation oscillator using a 74HC14N Schmitt trigger inverter and use it to make a capacitance touch sensor (pictures of last year’s setup in Weekend work). I had written code for the Arduino boards last year, and I started by trying to do the same thing on the KL25Z, using the MBED online development system.  The Arduino code used “PulseIn()” to measure pulse duration, and the MBED system does not have an equivalent function.  I could have implemented PulseIn() with a couple of busy waits and a microsecond-resolution timer, but I decided to try using “InterruptIn” to get interrupts on each rising edge instead.

The basic idea of last year’s code (and the first couple versions I wrote today) was to determine the pulse duration or period when the board is reset, finding the maximum over a few hundred cycles, and using that as a set point to create two thresholds for switching an LED on or off. I got the code working, but I was not happy with it as a tool for the students to use.

The biggest problem is that the touch plate couples in 60Hz noise from the user’s finger, so the oscillator output signal is frequency modulated.  This frequency modulation can be large compared with the change in frequency from touching or not touching the plate (depending on how big C1 is), so setting the resistor and capacitor values for the oscillator got rather tricky, and the results were unreliable.

I then changed from reading instantaneous period to measuring frequency by counting edges in a 1/60th-second window.  That way the 60Hz frequency modulation of the oscillator gets averaged out, and we can get a fairly stable frequency reading.  The elimination of the 60Hz noise allows me to use less hysteresis in the on/off decision for the LED, making the touch sensor more sensitive without getting flicker on transitions. The code worked fairly well, but I was not happy with the maximum frequency that it could handle—the touch sensor gets more sensitive if C1 is small, which tends to result in high frequency oscillations. The problem with the code was that MBED’s InterruptIn implementation seems to have a lot of overhead, and the code missed the edge interrupts if they came more often than about every 12µsec.  Because I was interrupting on both rising and falling edges, the effective maximum frequency was about 40kHz, which was much lower than I wanted.

To fix the frequency limitation, I replaced MBED’s InterruptIn with my own interrupt service routine for PortD (I was using pin PTD4 as the interrupt input). With this change, I could go to about 800kHz (1.6e6 interrupts per second), which is plenty for this lab.  If I wanted to go to higher frequencies, I’d look at only rising edges, rather than rising+falling edges, to get another factor of two at the high end.  I didn’t make that change, because doing so would reduce the resolution of the frequency measurement at the low end, and I didn’t think that the tradeoff was worth it here.

The code is now robust to fairly large variations in the oscillator design.  It needs a 20% drop in frequency to turn on the green LED, but the initial frequency can be anywhere in the range 400Hz–800kHz.

To make it easier for students to debug their circuits, I took advantage of having an RGB LED on the board to indicate the state of the program: on reset, the LED is yellow, turning blue once a proper oscillator input has been detected, or red if the oscillator frequency is not in range. When the frequency drops sufficiently, the LED turns from blue to green, turning back to blue when the frequency goes up again.

For even more debugging help, I output the frequency that the board sees through the USB serial connection every 1/60th second, so that a program like the Arduino serial monitor can be used to see how much the frequency is changing.  I took advantage of that feature to make a plot of the frequency as the touch sensor was touched.

Plot of frequency of hysteresis oscillator, as the touch pad is touched three times.  Note that the thresholds are very conservatively set relative to the noise, but that the sensitivity is still much higher than needed to detect the finger touches.

Plot of frequency of hysteresis oscillator, as the touch pad is touched three times. Note that the thresholds are very conservatively set relative to the noise, but that the sensitivity is still much higher than needed to detect the finger touches.

Overall, I think that the code for the KL25Z is better than what I wrote last year for the Arduino—now I have to rewrite the lab handout to match! I actually need to update two lab handouts this weekend, since week 3 will have both the hysteresis lab and the sampling and aliasing lab. Unfortunately, the features needed for those labs (trigger on rising and falling edges and downsampling) are not working in PteroDAQ yet.

Here is the code that I wrote for the frequency detector:

// freq_detector_own_isr
// Kevin Karplus 
// 2014 Apr 5

// This program is intended to be used as a "capacitive touch sensor" 
// with an external relaxation oscillator whose frequency
// varies with the capacitance of a touch.

// The program expects a periodic square wave on pin PTD4 with a frequency between 
// about 400Hz and 800kHz. (LOW_FREQ_LIMIT and HIGH_FREQ_LIMIT).
// On reset, it displays a yellow light, then measures the frequency to store as the "off" frequency.
//
// If the frequency is out of range (say for a disconnected input), then the light is set to red, 
//     and the off frequency checked again.
// Otherwise the LED is turned blue.
// 
// After initialization, if the program detects a frequency 20% less than the initial freq, 
// it turns the light green, 
// turning it blue again when the the frequency increases to 90% of the original frequency.
//
// No floating-point is used, just integer arithmetic.
//
// Frequency measurements are made by counting the number of rising and falling edges
// in one cycle of the mains frequency (1/60 sec), giving somewhat poor resolution at lower 
// frequencies.  
// The counting time is chosen to that frequency modulation by the mains voltages is averaged out.
//
// This version of the code uses my own setup for the interrupt service routine, because InterruptIn has
// too much overhead.  I can go to over 800kHz (1.6e6 interrupts/second) with this setup, 
// but only about 40kHz (80e3) interrupts/sec with mbed's InterruptIn.

#include "mbed.h"

#define PCR_PORT_TO_USE (PORTD->PCR[4])   // pin PTD3 is the pin to use

#define MAINS_FREQ (60)     // frequency of electrical mains in Hz
#define COUNTING_TIME (1000000/MAINS_FREQ)   // duration in usec of one period of electrical mains

// off_frequency must be between LOW_FREQ_LIMIT and HIGH_FREQ_LIMIT for program to accept it
#define LOW_FREQ_LIMIT (400)
#define HIGH_FREQ_LIMIT (800000)

// on-board RGB LED
PwmOut rled(LED_RED);
PwmOut gled(LED_GREEN);
PwmOut bled(LED_BLUE);
#define PWM_PERIOD (255)  // for the on-board LEDs in microseconds

// Set the RGB led color to R,G,B  with 0 being off and PWM_PERIOD being full-on
void set_RGB_color(uint8_t R, uint8_t G, uint8_t B)
{
    rled.pulsewidth_us(PWM_PERIOD-R);
    gled.pulsewidth_us(PWM_PERIOD-G);
    bled.pulsewidth_us(PWM_PERIOD-B);
}


// InterruptIn square_in(PTD4);
volatile uint32_t edges_counted;

uint32_t low_freq_threshold, high_freq_threshold;  // thresholds for detecting frequency changes


extern "C"{
// interrupt routine that counts edges into edges_counted
    void PORTD_IRQHandler(void) 
    {
       edges_counted++;
       PCR_PORT_TO_USE |= PORT_PCR_ISF_MASK;
    }
}

// return the frequency for the square_in input in Hz
uint32_t frequency(void)
{    
    PCR_PORT_TO_USE &= ~PORT_PCR_IRQC_MASK;  // disable interrupts on pin PTD3
    edges_counted=0;
    PCR_PORT_TO_USE |= PORT_PCR_ISF_MASK | PORT_PCR_IRQC(11);  // clear interrupt for PTD3, and enable interrupt on either edge
    wait_us(COUNTING_TIME);
    PCR_PORT_TO_USE &= ~PORT_PCR_IRQC_MASK;  // disable interrupts on pin PTD3
    uint32_t freq=edges_counted*MAINS_FREQ/2; 
    return freq; 
}



int main() 
{   
    rled.period_us(PWM_PERIOD);
    gled.period_us(PWM_PERIOD);
    bled.period_us(PWM_PERIOD);
    set_RGB_color(255,255,0);   // set light to yellow
    
    SIM->SCGC5 |= SIM_SCGC5_PORTD_MASK; // make sure port D has clocks on
    PCR_PORT_TO_USE &= ~PORT_PCR_MUX_MASK;  // clearing the MUX field
    PCR_PORT_TO_USE |= PORT_PCR_MUX(1);     // Setting pin as GPIO
    FPTD->PDDR &= ~ (1<<4);  // make sure pin is input pin
    NVIC_EnableIRQ(PORTD_IRQn);            // enable interrupts for port D
    
    __enable_irq();

    uint32_t off_frequency= frequency();
    while ( off_frequency<low_freq_limit ||="" off_frequency="">HIGH_FREQ_LIMIT)
    {   // timed out.  set color to red and keep trying
        set_RGB_color(255,0,0);
        printf("FREQ out of range: %luHz\n", off_frequency);
        off_frequency= frequency();
    }
    
    uint32_t low_freq= 8*off_frequency/10;  // 80% of off_frequency
    uint32_t high_freq= 9*off_frequency/10;  // 90% of off_frequency
    
    printf("off= %luHz lo_thresh=%luHz hi_thresh=%luHz\n",off_frequency, low_freq, high_freq);
    while(1) 
    {   uint32_t freq=frequency();
        printf("%lu Hz\n",freq);  
        if (freq < low_freq)
        {   // low_fequency found, turn LED green
            set_RGB_color(0,255,0);
        }
        else if (freq >= high_freq)
        {   // high frequency found, turn LED blue again
            set_RGB_color(0,0,255);
        }    
    }
}

2014 March 16

New phototransistor lab

Filed under: Circuits course — gasstationwithoutpumps @ 00:54
Tags: , , , , , ,

In Phototransistor I talked about one possible phototransistor lab, that looked at the response speed of a phototransistor, as a function of the load resistor.  I rejected that last year as insufficiently interesting for bioengineers.

The lab for phototransistors that I used last year was a “tinkering” lab, where I tried to get the students to play with the hysteresis oscillator that they had built, modulating it with light (see Idea for phototransistor/FET lab). I didn’t think that it was a very successful lab (see Tinkering lab reports show problems), and I’d rather have a lab that seems more directly “bio” oriented.

One lab I’ve not given in class, but have played with a lot at home, trying to find something that works at the right level of complexity for the students is an optical pulse monitor:

Scott Prahl's estimate of oxyhemoglobin and deoxyhemoglobin molar extinction coefficients, copied from http://omlc.ogi.edu/spectra/hemoglobin/summary.gif The higher the curve here the less light is transmitted.  Note that 700nm has very low absorption, but 627nm has much higher absorption.

Scott Prahl’s estimate of oxyhemoglobin and deoxyhemoglobin molar extinction coefficients, copied from http://omlc.ogi.edu/spectra/hemoglobin/summary.gif
The higher the curve here the less light is transmitted. Note that 700nm has very low absorption, but 627nm has much higher absorption.

I played around with the idea some more last week, using a transimpedance amplifier to convert current to voltage (as in Colorimeter design—weird behavior). I can easily get enough gain to see pulse for a 700nm LED shining through a finger, but I listed the “brighter” LED red diffuse 3mm 625nm WP710A10ID part for this year’s parts kit, so I need to test with it (or with LED IR emitter 5mm 950nm SFH 4512). Because I’ll be making the mechanical part of the pulse monitor for the students, I have to know whether a 5mm or 3mm LED will be used.

Because oxyhemoglobin has its lowest absorbance near 700nm, I expect that switching to either 950nm or 627nm will greatly reduce the signal, needing an extra gain of 5.

The mechanical design I’m thinking of using is a simple one: a 3/4″ diameter hole drilled 2″ deep into a 3″-long block of wood that is 1.5″ by 1.5″, with a 1/8″ hole drilled at right angles to accommodate the LED and phototransistor. Carving out a small channel allows the block to sit flat on the tabletop.
The block with LED in the top hole and the phototransistor in the bottom hole. The phototransistor has a bit of rim, necessitating a shallow 5/32" drill allow the phototransistor to go deep enough into the block for the block to sit flush on a tabletop.

The block with LED in the top hole and the phototransistor in the bottom hole. The phototransistor has a bit of rim, necessitating a shallow 5/32″ drill allow the phototransistor to go deep enough into the block for the block to sit flush on a tabletop.

Block viewed from end with 3/4" hole.  The cross hole for the LED (or phototransistor) and the channel for its wires can be seen on the front.

Block viewed from end with 3/4″ hole. The cross hole for the LED (or phototransistor) and the channel for its wires can be seen on the front.

To connect the LED and phototransistor to a breadboard, the leads need to be extended:

I added color-coded leads to the phototransistor and LED, making sure that the negative lead (the cathode for the LED and the emitter for the NPN phototransistor) were given the black wire. Careful folding and crimping with long-nose pliers gives a good mechanical connection.

I added color-coded leads to the phototransistor and LED, making sure that the negative lead (the cathode for the LED and the emitter for the NPN phototransistor) were given the black wire.
Careful folding and crimping with long-nose pliers gives a good mechanical connection.

Next the connections are soldered to make good electrical connections. It will be good for students to do a little freehand soldering, as their other soldering projects use PC boards.

Next the connections are soldered to make good electrical connections. It will be good for students to do a little freehand soldering, as their other soldering projects use PC boards.

Finally, one or both of the connections should be covered with electrical tape, so that the wires don't short.  (The students don't have electrical tape in their kits—I'll have to remember to bring some in.)

Finally, one or both of the connections should be covered with electrical tape, so that the wires don’t short. (The students don’t have electrical tape in their kits—I’ll have to remember to bring some in.)

In order to help me remember which side has the phototransistor and which the LED, I color-coded the leads differently (yellow wire for LED anode, green wire for phototransistor collector), and used colored electrical tape to hold the optoelectronic parts in the block (red tape for the LED, blue tape for the phototransistor—matching their package colors).

I did manage to get  the pulse monitor working sometimes, but it seems to be excessively finicky—I need very high gain with careful setting of the bandpass filter parameters to get a signal. The biggest problem is that the second stage of the amplifier, where I do the high-pass filtering to remove the DC component and slow drift, can end up getting saturated.  Because of the high impedance of the feedback resistor, the output stage takes a long time to recover from being saturated. Saturation is a frequent problem with high-gain amplifiers, but I’m not sure I want students dealing with it on this lab.

Initially, the light is bright and the amplifier saturates at one rail.  When a finger is inserted in the sensor, the light drops enormously, and the amplifier output swings to the other rail.  It takes a very long time (about 30 second here) before the limited current through the feedback resistor can charge the capacitor in the high-pass filter enough to restore the op-amp inputs being the same voltage.

Initially, the light is bright and the amplifier saturates at one rail. When a finger is inserted in the sensor, the light drops enormously, and the amplifier output swings to the other rail. It takes a very long time (about 30 second here) before the limited current through the feedback resistor can charge the capacitor in the high-pass filter enough to restore the op-amp inputs being the same voltage.

The combined gain of the two stages at 1Hz (about the frequency of my pulse) is around 132MΩ, and the output is still only about 0.25V, so the fluctuation in the input current must be around 2nA. That’s not as small as the signals in a nanopore, but it is small enough to be troublesome.

I tried a different set of components that gave me a gain of about 240MΩ at 0.9 Hz, and that amplifier started clipping the output, swinging from around -0.8v to +1.6v.

After the first stage (with a gain of about 1.7MΩ at 0.9Hz and 5.6MΩ at 0Hz), I see about a 10mV swing on top of a DC signal of 0.6 to 0.8v (with considerable drift). That implies about a 6nA signal at 0.9Hz, while the DC signal is about 125nA.  The magnitude of both the DC and the AC component varies a lot, depending on which finger I use and how firmly I press the finger against the sensor.  I can pretty consistently get 2–9nA of AC on top of 100–150nA DC.  I think that good corner frequencies for the low-pass and high-pass filters are around 0.3Hz and 30Hz. By making the gain of the transimpedance amplifier as high as I can (without saturating with the DC signal), I can keep the gain of the second amplifier low enough to avoid the problem of saturation in the second stage, and the pulse monitor can detect the pulse within 5 seconds.

 

Another option is to make the first-stage amplification be a logarithmic transimpedance amplifier, rather than linear one, by using a Schottky diode as the feedback element instead of a resistor.  But that is getting well outside what I’m comfortable assigning as a design exercise to the Applied Circuits class. I tried it anyway, but the signal from the log amplifier was too small:  a 10% variation in current only results in a 2.4mV change in the output of the log amplifier, needing a much higher gain than my second stage currently provides.

While the 700nm LED provides a stronger signal, the 627nm LED works well enough, and a 2-stage transimpedance amplifier is reasonable for the students to design.  I probably want it to be a 2-day lab, though, with the low-pass first stage designed and tested for the first day, then the high-pass second stage added to solve the problem of DC offset and drift.  That will require reworking my schedule, as I only allowed one day for the lab in the current schedule.

2013 September 22

Electronic sensors for water quality

Filed under: freshman design seminar — gasstationwithoutpumps @ 16:19
Tags: , , , , ,

I just read an article in AEE – Advances in Engineering Education—A Journal of Engineering Education Applications, vol. 3 #2, 2012, SENSE IT: Teaching STEM principles to middle and high school students through the design, construction and deployment of water quality sensors:

This paper describes the structure and impact of an NSF-funded ITEST project designed to enrich science, technology, engineering, and mathematics (STEM) education using educational modules that teach students to construct, program, and test a series of sensors used to monitor water quality.

The four sensors that they used for the middle school and high school students (thermistor for temperature, LED and photoresistor for turbidity, pressure gauge for depth, and electrodes for conductivity) would be suitable for the freshman design seminar. I already use the thermistor lab as the first lab in the circuits course, and I do a more sophisticated version of the conductivity and pressure sensor labs (measuring impedance with polarizable and non-polarizable electrodes and using a pressure sensor that is just a strain gauge, so that they need to build the amplifier for it).  Details of the curriculum and the sensors themselves can be found at http://senseit.org

The application to water quality measurements is reasonable, and for the freshman seminar it might be worth a field trip down to San Lorenzo River or Cowell beach to test out their designs.

We would use Arduinos or KL25Z boards, rather than Lego NXT bricks, and waterproofing their designs could be a part of the engineering. Using a drybox and a connector should not be too difficult. The robotics club has used IP68 Sealcon strain reliefs from www.productsforautomation.com for cables and Buccaneer mini IP68 connectors for disconnectable connections, both successfully. Some parts could be potted in epoxy, like the cameras for the underwater robot.

My main concern is that making the instruments be standalone might be too challenging, but just duplicating what the high school students do might not be challenging enough. I also don’t want to have to teach half the circuits course for the freshman design seminar, so I’d like to keep the necessary electronics to a minimum.

2013 May 27

Sounds like my course

Filed under: Circuits course — gasstationwithoutpumps @ 19:53
Tags: , ,

I’ve been reading an infrequent blog by a freshman at Olin Engineering, because it is one of the schools that my son is considering applying to.  He likes the idea of project-based learning, though he is more interested in computer science than in engineering, and Olin doesn’t have a straight CS option.

The post Burn Brilliant: Reflections on Second Semester, Part 2 describes a first-year course called Real-World Measurements:

The first half of RWM was formatted exactly like ModCon. It was centered around labs in which we used lots of different sensors. For example, we built an EKG, a circuit that could tell how far it was from a wall by sending and receiving sound signals, a strain gauge circuit to study beam bending, and a pulse oximeter. In lecture, we talked about op amps (in more detail than we had in ModCon), instrumentation amps, some more complicated filters, Bode plots, and Fourier series.

That sounds like it has a lot of overlap with my applied circuits course for bioengineers:  we also did an EKG and a strain-gauge circuit (though our strain gauge was in a pressure sensor not on a beam).  I considered doing a pulse oximeter, but I never figured out a way to calibrate the device—I wonder how the Olin students handled that.  If the pulse oximeter is doable as a one-week project, it would be worth adding to the course, even if something else is removed.

I should probably look for materials on the web about the course, or contact the instructor.

The Olin class was the second in a series, so they were able to go a bit further into sensor usage and electronics theory (we did Bode plots and simple RC filters, but not Fourier series), but the emphasis on sensors as the focus of a course is similar.  The Olin course had a second half that was more student-directed group project (part of the pedagogic approach at Olin that is so appealing for engineers), which I don’t think there is room for in my applied circuits course.

Large independent projects provide a lot of learning, but are a bit slower than more focused design exercises. Having only 10 weeks for the whole course limits how much time can be spent on projects. I can’t assume that students will pick up more material in subsequent engineering courses, since this is the last electronics course that most of them will take, so I made the tradeoff of doing more design exercises, but somewhat smaller ones.

2013 April 10

Supplemental sheets, draft 3

This post updates and replaces the Supplemental sheets, draft 2. It reflects the redesign of the course based on running a prototype version of the course in as a group tutorial in Winter 2013.

Lecture Course

Undergraduate Supplemental Sheet
Information to accompany Request for Course Approval
Sponsoring Agency: Biomolecular Engineering
Course #:
101
Catalog Title: Applied Circuits for Bioengineers

Please answer all of the following questions using a separate sheet for your response.
1. Are you proposing a revision to an existing course? If so give the name, number, and GE designations (if applicable) currently held.

This is not a revision to any existing course.A prototype version of the course was run as BME 194 Group Tutorial in Winter 2013. Notes on the design and daily running of that prototype can be found at https://gasstationwithoutpumps.wordpress.com/circuits-course-table-of-contents

2. In concrete, substantive terms explain how the course will proceed. List the major topics to be covered, preferably by week.

The Applied Circuits course is centered around the labs in the accompanying lab course.  Concepts are taught as needed for the labs, with design and analysis exercises in the lecture course cementing the understanding. The recurring theme throughout the course is voltage dividers: for change of voltage, for current-to-voltage conversion, for high-pass and low-pass RC filters, in Wheatstone bridges, and as feedback circuits in op amp circuits.  The intent of this course is to provide substantial design experience for bioengineering students early in their studies, and to serve both as as bridge course to entice students into the bioelectronics concentration and as a terminal electronics course for those students focussing on other areas.

  1. Basic DC circuit concept review: voltage current, resistance, Kirchhoff’s Laws, Ohm’s Law, voltage divider, notion of a transducer.
    The first week should cover all the concepts needed to do the thermistor lab successfully.
  2. Models of thermistor resistance as a function of temperature. Voltage and current sources, AC vs DC, DC blocking by capacitors, RC time constant, complex numbers, sine waves, RMS voltage, phasors. The second week should cover all the concepts needed to do the electret microphone lab successfully.
  3. Low-pass and high-pass RC filters as voltage dividers, Bode plots. Concepts necessary for properly understanding digitized signals: quantized time, quantized voltage, sampling frequency, Nyquist frequency, aliasing.
  4. Amplifier basics: op amps, AC coupling, gain computation, DC bias for single-power-supply offsets, bias source with unity-gain amplifier.  In the lab, students will design, build, and test a low-gain amplifier (around 5–10 V/V) for audio signals from an electret microphone. We’ll also include a simple current-amplifier model of a bipolar transistor, so that they can increase the current capability of their amplfier.
  5. Op amps with feedback that has complex impedance (frequency-dependent feedback), RC time constants, parallel capacitors, hysteresis, square-wave oscillator using Schmitt triggers, capacitance-output sensors, capacitance-to-frequency conversion.   Topics are selected to support students designing a capacitive touch sensor in the accompanying lab.
  6. Phototransistors and FETs for the tinkering lab and for the class-D amplifier lab. In preparation for the lab in which students model a pair of electrodes as R+(C||R), we will need a variety of both electronics and electrochemistry concepts: variation of parameters with frequency, impedance of capacitors, magnitude of impedance, series and parallel circuits, limitations of R+(C||R) model, and at least a vague understanding of half-cell potentials for the electrode reactions: Ag → Ag+ + e-, Ag+ + Cl- → AgCl, Fe + 2 Cl-→ FeCl2 + 2 e-.
  7. Differential signals, twisted-pair wiring to reduce noise, strain gauge bridges, instrumentation amplifier, DC coupling, multi-stage amplifiers.
    Topics are selected to support the design of a 2-stage amplifier for a piezoresistive pressure sensor in the lab.
  8. System design, comparators, more on FETs. Students will design a class-D power amplifier to implement in the lab.
  9. A little electrophysiology: action potentials, electromyograms, electrocardiograms. Topics are chosen so that students can design a simple 3-wire electrocardiogram (EKG) in the lab.There will also be a bit more development of simple (single-pole) filters.
  10. The last week will be review and special topics requested by the students.

3. Systemwide Senate Regulation 760 specifies that 1 academic credit corresponds to 3 hours of work per week for the student in a 10-week quarter. Please briefly explain how the course will lead to sufficient work with reference to e.g., lectures, sections, amount of homework, field trips, etc. [Please note that if significant changes are proposed to the format of the course after its initial approval, you will need to submit new course approval paperwork to answer this question in light of the new course format.]

The combination of BME101 and BME101L is 7 units (21 hours per week).  The time will be spent approximately as follows:

  • 3.5 hours lecture/discussion
  • 3.5 hours reading background and circuits text
  • 3 hours read lab handouts and doing pre-lab design activities
  • 6 hours lab
  • 5 hours writing design reports for lab

4. Include a complete reading list or its equivalent in other media.

No existing book covers all the material.  For the prototype run of the course, we relied heavily on Wikipedia articles, which turned out to be too dense for many of the students.  Other alternatives (such as Op amps for everyone by Ron Mancini http://www.e-booksdirectory.com/details.php?ebook=1469 Chapters 1–6 and Op Amp Applications Handbook by Analog Devices http://www.analog.com/library/analogDialogue/archives/39-05/op_amp_applications_handbook.html Sections 1-1 and 1-4) were also much too advanced.

In future we will most likely use the free on-line text All about Circuits as the primary text, with material not covered there (such as the various sensors) coming mainly from Wikipedia and the datasheets for the components.

5. State the basis on which evaluation of individual students’ achievements in this course will be made by the instructor (e.g., class participation, examinations, papers, projects).

Students will be evaluated primarily on design reports with some in-class or take-home quizzes to ensure that they do the needed reading on theoretical concepts.

6. List other UCSC courses covering similar material, if known.

EE 101 covers some of the same circuit material, but without the focus on sensors and without instrumentation amps.  It covers linear circuit theory in much more depth and focuses on mathematical analysis of complicated linear circuits, rather than on design with simple circuits.  The expectation for bioengineering students is that those in the bioelectronics track would take BME 101 before taking EE101, and that those in other tracks would take BME 101 as a terminal electronics course providing substantial engineering design.  The extra material in BME 101 would prepare the bioengineering students better for EE 101.

Physics 160 offers a similar level of practical electronics, but focuses on physics applications, rather than on bioengineering applications, and is only offered in alternate years.

7. List expected resource requirements including course support and specialized facilities or equipment for divisional review. (This information must also be reported to the scheduling office each quarter the course is offered.)

The lecture part of the course needs no special equipment—a standard media-equipped classroom with a whiteboard, screen, and data projector should suffice. Having a portable laptop-connected oscilloscope would make demos much easier to do, but is not essential.

The lecture course is not really separable from the associated lab course,whose equipment needs are described on the supplemental sheet for that course.

The course requires a faculty member (simultaneously teaching the co-requisite Applied Circuits lab course) and a teaching assistant or undergraduate group tutor for discussion sections and assistance in grading.  The same TA/group tutor should be used for both the lecture and the lab courses.

8. If applicable, justify any pre-requisites or enrollment restrictions proposed for this course. For pre-requisites sponsored by other departments/programs, please provide evidence of consultation.

Students will be required to have single-variable calculus and a physics electricity and magnetism course. Both are standard prerequisites for any circuits course. Although DC circuits can be analyzed without calculus, differentiation and integration are fundamental to AC analysis. Students should have already been introduced to the ideas of capacitors and inductors and to serial and parallel circuits.

The prerequisite courses are already required courses for biology majors and bioengineering majors, so no additional impact on the courses is expected.

9. Proposals for new or revised Disciplinary Communication courses will be considered within the context of the approved DC plan for the relevant major(s). If applicable, please complete and submit the new proposal form (http://reg.ucsc.edu/forms/DC_statement_form.doc or http://reg.ucsc.edu/forms/DC_statement_form.pdf) or the revisions to approved plans form (http://reg.ucsc.edu/forms/DC_approval_revision.doc or http://reg.ucsc.edu/forms/DC_approval_revision.pdf).

This course is not expected to contribute to any major’s disciplinary communication requirement, though students will get extensive writing practice in the design reports (writing between 50 and 100 pages during the quarter).

10. If you are requesting a GE designation for the proposed course, please justify your request making reference to the attached guidelines.

No General Education code is proposed for this course, as all relevant codes will have already been satisfied by the prerequisites.

11. If this is a new course and you requesting a new GE, do you think an old GE designation(s) is also appropriate? (CEP would like to maintain as many old GE offerings as is possible for the time being.)

No General Education code is proposed for this course, as all relevant codes (old or new) will have already been satisfied by the prerequisites.

Lab course

Undergraduate Supplemental Sheet
Information to accompany Request for Course Approval
Sponsoring Agency Biomolecular Engineering
Course #
101L
Catalog Title
Applied Circuits Lab

Please answer all of the following questions using a separate sheet for your response.
1. Are you proposing a revision to an existing course? If so give the name, number, and GE designations (if applicable) currently held.

This is not a revision to any existing course. A prototype version of the course was run as BME 194F Group Tutorial in Winter 2013. Notes on the design and daily running of that prototype can be found at https://gasstationwithoutpumps.wordpress.com/circuits-course-table-of-contents

2. In concrete, substantive terms explain how the course will proceed. List the major topics to be covered, preferably by week.

The course is a lab course paired with BME 101, Applied Circuits for Bioengineers.  The labs have been designed to be relevant to bioengineers and to have as much design as is feasible in a first circuits course.  The labs are the core of the course, with lecture/discussion classes to support them. There will be six hours of lab a week, split into 2 3-hour sessions. Lab assignments will generally take two lab sessions, with data collection in the first lab session, and data analysis and design between lab sessions.   Some of the more straightforward labs will need only a single session.  Except for the first intro lab, these labs have been used in the prototype run of the class as 3-hour labs.  Most did not fit in one 3-hour lab session and would benefit from being split into two separate lab sessions with data analysis and design between the sessions.

  1. Intro to parts, tools, and lab equipment (single session)
  2. Thermistor
  3. Microphone
  4. Sampling and aliasing (single session)
  5. Audio amp
  6. Hysteresis oscillator and soldering lab
  7. FET and phototransistor
  8. Electrode modeling
  9. Pressure sensor and instrumentation amp (soldered)
  10. Class-D power amplifier
  11. EKG (instrumentation amp with filters, soldered)
  1. Intro to parts, tools, and lab equipment
    Students will learn about the test equipment by having them use the multimeters to measure other multimeters. What is the resistance of a multimeter that is measuring voltage? of one that is measuring current? what current or voltage is used for the resistance measurement? Students will be  issued their parts and tool kits, learn to use the wire strippers and make twisted-wire cables for the power supplies to use all quarter.  They will learn to set the current limits on the power supplies and  measure voltages and currents for resistor loads around 500Ω.  This lab will not require a written lab report.
    Lab skills developed: wire strippers, multimeter for measuring voltage and current, setting bench power supply
    Equipment needed: multimeter, power supply
  2. Thermistor lab
    The thermistor lab will have two lab sessions involving the use of a Vishay BC Components NTCLE413E2103F520L thermistor or equivalent.
For the first lab session, the students will use a bench multimeter to measure the resistance of the thermistor, dunking it in various water baths (with thermometers in them to measure the temperature). They should fit a simple curve to this data based on standard thermistor models. A class period will be spent on learning both the model and how to do model fitting with gnuplot, and there will be a between-lab exercise where they derive the formula for maximizing | dV/dT | in a voltage divider that converts the resistance to a voltage.
    For the scond lab session, they will add a series resistor to make a voltage divider. They have to choose a value to get as large and linear a voltage response as possible at some specified “most-interesting” temperature (perhaps body temperature, perhaps room temperature, perhaps DNA melting temperature).  They will then measure and plot the voltage output for another set of water baths. If they do it right, they should get a much more linear response than for their resistance measurements. 
Finally, they will hook up the voltage divider to an Arduino analog input and record a time series of a water bath cooling off (perhaps adding an ice cube to warm water to get a fast temperature change), and plot temperature as a function of time.
    Lab skills developed: use of multimeter for measuring resistance and voltage, use of Arduino with data-acquisition program to record a time series, fitting a model to data points, simple breadboarding.Equipment needed: multimeter, power supply, thermistor, selection of various resistors, breadboard, clip leads, thermoses for water baths, secondary containment tubs to avoid water spills in the electronics lab. Arduino boards will be part of the student-purchased lab kit. All uses of the Arduino board assume connection via USB cable to a desktop or laptop computer that has the data logger software that we will provide.
  3. Electret microphone
    First, we will have the students measure and plot the DC current vs. voltage for the microphone. The microphone is normally operated with a 3V drop across it, but can stand up to 10V, so they should be able to set the Agilent E3631A  bench power supply to various values from 0V to 10V and get the voltage and current readings directly from the bench supply, which has 4-place accuracy for both voltage and current. Ideally, they should see that the current is nearly constant as voltage is varied—nothing like a resistor.  They will follow up the hand measurements with automated measurements using the Arduino to measure the voltage across the mic and current through it for voltages up to about 4v.  The FET in the microphone shows a typical exponential I vs. V characteristic below threshold, and a gradually increasing current as voltage increases in the saturation region.  We’ll do plotting and model fitting in the data analysis class between the two labs.
    Second, we will have them do current-to-voltage conversion with a 5v power supply and a resistor to get a 1.5v DC output from the microphone and hook up the output of the microphone to the input of the oscilloscope. Input can be whistling, talking, iPod earpiece, … . They should learn the difference between AC-coupled and DC-coupled inputs to the scope, and how to set the horizontal and vertical scales of the scope. They will also design and wire their own DC blocking RC filter (going down to about 1Hz), and confirm that it has a similar effect to the AC coupling on the scope. Fourth, they will play sine waves from the function generator through a loudspeaker next to the mic, observe the voltage output with the scope, and measure the AC voltage with a multimeter, perhaps plotting output voltage as a function of frequency. Note: the specs for the electret mic show a fairly flat response from 50Hz to 3kHz, so most of what the students will see here is the poor response of a cheap speaker at low frequencies.
    EE concepts: current sources, AC vs DC, DC blocking by capacitors, RC time constant, sine waves, RMS voltage, properties varying with frequency.Lab skills: power supply, oscilloscope, function generator, RMS AC voltage measurement.Equipment needed: multimeter, oscilloscope, function generator, power supply, electret microphone, small loudspeaker, selection of various resistors, breadboard, clip leads.
  4. Sampling and Aliasing
    Students will use the data logger software on the Arduino to sample sine waves from a function generator at different sampling rates.  They will need to design a high-pass RC filter to shift the DC voltage from centered at 0 to centered at 2.5v in the middle of the Arduino A-to-D converter range.  They will also design a low-pass filter (with corner frequency below the Nyquist frequency) to see the effect of filtering on the aliasing.
    EE concepts: quantized time, quantized voltage, sampling frequency, Nyquist frequency, aliasing, RC filters.
    Equipment needed:  function generator, Arduino board, computer.
  5. Audio amplifier
    Students will use an op amp to build a simple non-inverting audio amplifier for an electret microphone, setting the gain to around 6 or 7. The amplifier will need a a high-pass filter to provide DC level shifting at the input to the amplifier. Note that we are using single-power-supply op amps, so they will have to design a bias voltage supply as well. The output of the amplifier will be recorded on the Arduino (providing another example of signal aliasing).
    The second half of the lab will add a single bipolar transistor to increase the current and make a class A output stage for the amplifier, as the op amp does not provide enough current to drive the 8Ω loudspeaker loudly.
    EE concepts: op amp, DC bias, bias source with unity-gain amplifier, AC coupling, gain computation.
    Lab skills: complicated breadboarding (enough wires to have problems with messy wiring). If we add the Arduino recording, we could get into interesting problems with buffer overrun if their sampling rate is higher than the Arduino’s USB link can handle.
    Equipment needed: breadboard, op amp chip, assorted resistors and capacitors, electret microphone, Arduino board, optional loudspeaker.
  6. Hysteresis and capacitive touch sensor
    For the first half of the lab, students will characterize a Schmitt trigger chip, determining VIL, VIH, VOL, and VOH. Using these properties, they will design an RC oscillator circuit with a specified period or pulse width (say 10μs), and measure the frequency and pulse width of the oscillator.
    For the second half of the lab, the students will build a relaxation oscillator whose frequency is dependent on the parasitic capacitance of a touch plate, which the students can make from Al foil and plastic food wrap. In addition to breadboarding, students will wire this circuit by soldering wires and components on a PC board designed for the oscillator circuit. Students will have to measure the frequency of the oscillator with and without the plate being touched. We will provide a simple Arduino program that is sensitive to changes in the pulse width of the oscillator and that turns an LED on or off, to turn the frequency change into an on/off switch.  Students will treat the oscillator board as a 4-terminal component, and examine the effect of adding resistors or capacitors between different terminals.
    EE concepts: frequency-dependent feedback, oscillator, RC time constants, parallel capacitors.
    Lab skills: soldering, frequency measurement with digital scope.
    Equipment needed: Power supply, multimeter, Arduino, clip leads, amplifier prototyping board, oscilloscope.
  7. Phototransistor and FET
    First half: characterize phototransistor in ambient light and shaded.  Characterize nFET and pFET.
    Second half: students will “tinker” with the components they have to produce a light-sensitive, noise-making toy.
    EE concepts: phototransistors, FETs.
    Equipment needed: breadboard, phototransistor, power FETs, loudspeaker, hysteresis oscillator from previous lab, oscilloscope.
  8. Electrode measurements
    First, we will have the students attempt to measure the resistance of a saline solution using a pair of stainless steel electrodes and a multimeter. This should fail, as the multimeter gradually charges the capacitance of the electrode/electrolyte interface.Second, the students will use a function generator driving a voltage divider with a load resistor in the range 10–100Ω. The students will measure the RMS voltage across the resistor and across the electrodes for different frequencies from 3Hz to 300kHz (the range of the AC measurements for the Agilent 34401A Multimeter). They will plot the magnitude of the impedance of the electrodes as a function of frequency and fit an R2+(R1||C1) model to the data, most likely using gnuplot. There will be a prelab exercise to set up plotting of the model and do a little hand tweaking of parameters to help them understand what each parameter changes about the curve.Third, the students will repeat the measurements and fits for different concentrations of NaCl, from 0.01M to 1M. Seeing what parameters change a lot and what parameters change only slightly should help them understand the physical basis for the electrical model.Fourth, students will make Ag/AgCl electrodes from fine silver wire. The two standard methods for this involve either soaking in chlorine bleach or electroplating. To reduce chemical hazards, we will use the electroplating method. As a prelab exercise, students will calculate the area of their electrodes and the recommended electroplating current.  In the lab, they will adjust the voltage on the bench supplies until they get the desired plating current.Fifth, the students will measure and plot the resistance of a pair of Ag/AgCl electrodes as a function of frequency (as with the stainless steel electrodes).Sixth, if there is time, students will measure the potential between a stainless steel electrode and an Ag/AgCl electrode.EE concepts: magnitude of impedance, series and parallel circuits, variation of parameters with frequency, limitations of R+(C||R) model.Electrochemistry concepts: At least a vague understanding of half-cell potentials, current density, Ag → Ag+ + e-, Ag+ + Cl- → AgCl, Fe + 2 Cl-→ FeCl2 + 2 e-.Lab skills: bench power supply, function generator, multimeter, fitting functions of complex numbers, handling liquids in proximity of electronic equipment.Equipment needed: multimeter, function generator, power supply, stainless steel electrode pairs, silver wires, frame for mounting silver wire, resistors, breadboard, clip leads, NaCl solutions in different concentrations, beakers for salt water, secondary containment tubs to avoid salt water spills in the electronics lab.
  9. Pressure sensor and instrumentation amplifier
    Students will design an instrumentation amplifier with a gain of 300 or 500 to amplify the differential strain-gauge signal from a medical-grade pressure sensor (the Freescale MPX2300DT1), to make a signal large enough to be read with the Arduino A/D converter. The circuit will be soldered on the instrumentation amp/op amp protoboard. The sensor calibration will be checked with water depth in a small reservoir. Note: the pressure sensor comes in a package that exposes the wire bonds and is too delicate for student assembly by novice solderers. We will make a sensor module that protects the sensor and mounts the sensor side to a 3/4″ PVC male-threaded plug, so that it can be easily incorporated into a reservoir, and mounts the electronic side on a PC board with screw terminals for connecting to student circuits.  This sensor is currently being prototyped, and if it turns out to be too fragile, we will use a Freescale MPX2050GP, which has a sturdier package, but is slightly less sensitive and more expensive. (It also isn’t made of medical-grade plastics, but that is not important for this lab.) Note that we are deliberately notusing pressure sensors with integrated amplifiers, as the pedagogical point of this lab is to learn about instrumentation amplifiers.EE concepts: differential signals, twisted-pair wiring, strain gauge bridges, instrumentation amplifier, DC coupling, gain.Equipment needed: Power supply, amplifier prototyping board, oscilloscope, pressure sensor mounted in PVC plug with breakout board for easy connection, water reservoir made of PVC pipe, secondary containment tub to avoid water spills in electronics lab.
  10. Class-D power amplifier
  11. Electrocardiogram (EKG)
    Students will design and solder an instrumentation amplifier with a gain of 2000 and bandpass of about 0.1Hz to 100Hz. The amplifier will be used with 3 disposable EKG electrodes to display EKG signals on the oscilloscope and record them on the Arduino.Equipment needed: Instrumentation amplifier protoboard, EKG electrodes, alligator clips, Arduino, oscilloscope.

3. Systemwide Senate Regulation 760 specifies that 1 academic credit corresponds to 3 hours of work per week for the student in a 10-week quarter. Please briefly explain how the course will lead to sufficient work with reference to e.g., lectures, sections, amount of homework, field trips, etc. [Please note that if significant changes are proposed to the format of the course after its initial approval, you will need to submit new course approval paperwork to answer this question in light of the new course format.]

The combination of BME101 and BME101L is 7 units (21 hours per week).  The time will be spent approximately as follows:

  • 3.5 hours lecture/discussion
  • 3.5 hours reading background and circuits text
  • 3 hours read lab handouts and doing pre-lab design activities
  • 6 hours lab
  • 5 hours writing design reports for lab

4. Include a complete reading list or its equivalent in other media.

Lab handouts: there is a 5- to 10-page handout for each week’s labs, giving background material and design goals for the lab, usually with a pre-lab design exercise.  The handouts from the prototype run of the course can be found at http://users.soe.ucsc.edu/~karplus/bme194/w13/#labs
Data sheets: Students will be required to find and read data sheets for each of the components that they use in the lab.  All components are current commodity components, and so have data sheets easily found on the web.  Other readings are associated with the lecture course.

5. State the basis on which evaluation of individual students’ achievements in this course will be made by the instructor (e.g., class participation, examinations, papers, projects).

Students will be evaluated on in-lab demonstrations of skills (including functional designs) and on the weekly lab write-ups.

6. List other UCSC courses covering similar material, if known.

CMPE 167/L (sensors and sensing technologies) covers some of the same sensors and design methods, but at a more advanced level.  BME 101L would be excellent preparation for the CMPE 167/L course.

Physics 160 offers a similar level of practical electronics, but focuses on physics applications, rather than on bioengineering applications, and is only offered in alternate years.

7. List expected resource requirements including course support and specialized facilities or equipment for divisional review. (This information must also be reported to the scheduling office each quarter the course is offered.)

The course will need the equipment of a standard analog electronics teaching lab: power supply, multimeter, function generator,  oscilloscope,  computer, and soldering irons. The equipment in Baskin Engineering 150 (commonly used for EE 101L) is ideally suited for this lab. There are 12 stations in the lab, providing a capacity of 24 students since they work in pairs rather than as individuals.  The only things missing from the lab stations are soldering irons and circuit board holders (such as the Panavise Jr.), a cost of about $45 per station.  Given that a cohort of bioengineering students is currently about 35–40 students, two lab sections would have to be offered each year.

In addition, a few special-purpose setups will be needed for some of the labs, but all this equipment has already been constructed for the prototype run of the course.

There are a number of consumable parts used for the labs (integrated circuits, resistors, capacitors, PC boards, wire, and so forth), but these are easily covered by standard School of Engineering lab fees.  The currently approved lab fee is about $131, but may need some adjustment to change exactly what tools and parts are included, particularly if the students are required to buy their own soldering irons (a $20 increase).

The course requires a faculty member (simultaneously teaching the co-requisite Applied Circuits course) and a teaching assistant (for providing help in the labs and for evaluating student lab demonstrations). Because the lab is such a core part of the combined course, it requires faculty presence in the lab, not just coverage by TAs or group tutors.

8. If applicable, justify any pre-requisites or enrollment restrictions proposed for this course. For pre-requisites sponsored by other departments/programs, please provide evidence of consultation.

Students will be required to have single-variable calculus and a physics electricity and magnetism course. Both are standard prerequisites for any circuits course. Most of the labs can be done without calculus, but it is essential for the accompanying lecture course.

9. Proposals for new or revised Disciplinary Communication courses will be considered within the context of the approved DC plan for the relevant major(s). If applicable, please complete and submit the new proposal form (http://reg.ucsc.edu/forms/DC_statement_form.doc or http://reg.ucsc.edu/forms/DC_statement_form.pdf) or the revisions to approved plans form (http://reg.ucsc.edu/forms/DC_approval_revision.doc or http://reg.ucsc.edu/forms/DC_approval_revision.pdf).

This course is not expected to contribute to any major’s disciplinary communication requirement, though students will get extensive writing practice in the design reports (writing between 50 and 100 pages during the quarter).

10. If you are requesting a GE designation for the proposed course, please justify your request making reference to the attached guidelines.

No General Education code is proposed for this course, as all relevant codes will have already been satisfied by the prerequisites.

11. If this is a new course and you requesting a new GE, do you think an old GE designation(s) is also appropriate? (CEP would like to maintain as many old GE offerings as is possible for the time being.)

No General Education code is proposed for this course, as all relevant codes (old or new) will have already been satisfied by the prerequisites.

Next Page »

The Rubric Theme. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 276 other followers

%d bloggers like this: