Posts with «bioengineering» label

Temperature lab, part 3: voltage divider

In Temperature lab, part2, I carefully measured the resistance vs. temperature curve for the Vishay BC Components NTCLE413E2103F520L thermistor, finding that either my thermometer was badly miscalibrated, or the manufacturer’s data sheet was misleading.  I got a resistance of 9.7kΩ (not 10kΩ±1%) at 25° C and a B-value of 3174°K, not 3435°K±1%.  A big part of the discrepancy is that I calibrated over a different temperature range, and the measured values deviated most from the manufacturer’s spec at low temperatures.

Actually, the manufacturer’s data sheet is not as bad as all that.  They give specs for the ratio of the resistance at various temperatures to the resistance at 25° C, and their numbers do not fall along a simple curve.  The report the B-value as a 2-point fit for T=25° C and T=85° C, but they also report resistance values every 5° C from –40° C to 105° C.  One can compute the B-value for any pair:

But even if I use their calibration data down to 0° C, I don’t get as small a B-value as I get from my measurements. My calibration curve does not fit their spec, even if I look at the table, rather than the simple B-value model (though the table is closer to my measurements, it doesn’t match).

How big a difference would if make if I used their curve rather than mine?  At R=6685Ω, we get the same temperature either way (96.446° F).  At the resistance they claim for 0° C (27348Ω), their B-value model would give 33.90° F and mine would give 29.37° F.  At the resistance I measured for 0° C (25.5kΩ), their model would give 36.67° F, while mine gives 32.32° F (which is closer than the measurement error I had on temperatures).  So it looks like relying blindly on their B-value model introduces an error of over 4° F at low temperature, but in a digital thermometer for human body temperature, one would get nearly the same result with either calibration.

Voltage divider

The second part of the lab was to use the calibration curve to design a circuit to convert the resistance variation into a voltage variation that is nearly linear with temperature, at least over a small range.  The simplest circuit to convert a resistance to a voltage is a voltage divider, which just requires a voltage source and another resistor.

A simple voltage divider for converting the thermistor resistance to a voltage. Because I want the output voltage to increase with temperature, but the resistance R(T) decreases with temperature, I put the thermistor on the top branch and fixed resistance on the lower branch.
Circuit drawn with the Circuit Lab editor.

The formula for the output voltage is simple: , where we are approximating for temperature T in Kelvin. We’d like the voltage to be as linear as possible, which means we want the second derivative of Vout with respect to T to be zero. Obviously, we can’t do that for all values of T, but we might be able to do it for a particular value of T, and to have a small second derivative in that neighborhood.

We can take the derivatives by hand (or use a tool like Maple or Mathematica):


The second derivative is 0 if , that is if .

We can use this formula to set the value for any temperature, for example, if we want linearity around 98.6° F (310.15° K), we can set the series resistor to 4323.64Ω.

Expected voltage curve using a voltage divider with series resistor optimized for 98.6° F. Note that the curve is fairly linear from about 70° F to about 130° F (where the red non-linear curve and the green linear approximation at 98.6° F are quite close.

Of course, commercially available resistors don’t come in values like 4323.64Ω, so in doing a design one has to pick an available resistor, using the EIA table of standard resistor values.  A 4.7kΩ resistor looks pretty close, which would be color code yellow-violet-red.  Too bad that I don’t have one.  I do have a 5.1kΩ resistor, which would be optimal for linearizing at 90.06° F.  We should, of course, ask students to do the resistor selection for a different temperature than the one we use in an example, and they should be using their own B-value.

Testing the voltage divider

I set up the voltage divider on a breadboard.  Because I knew my wall wart had a huge ripple, I added a low-pass RC filter consisting of a 100Ω resistor and a 470µF electrolytic capacitor.  This slightly complicates the analysis of the voltage output, since the Vdd voltage is itself dependent on a voltage divider.

Low-pass filter to clean up the output of the wall wart. With the low-pass filter in place, we can model the power supply as a 5.166V source and 100Ω series resistor.

Here is what the low-pass filter looks like on the breadboard. The red and black wires from the bottom come from the connector to the wall wart. The 100Ω resistor runs vertically up the center, and the electrolytic capacitor connects across to the ground. The red clip lead is from the multimeter and is set up for measuring the voltage at the output of the filter.

Here is the full breadboard, showing the RC filter, the series resistor, the leads to the thermistor (the red and yellow lines with the crimp-on connectors), and the clip leads to the multimeter (the red and black alligator clips). I’ve found it very handy to have a number of double-sided header pins to make easy connection points on the breadboard for clip leads.

Here is the setup used for testing. The thermistor and thermometer are in the ceramic-cup water bath, with the thermometer held to keep the bulb in contact with the thermistor. You can see that the least-significant digit of the LCD display is a bit hard to read—applying some pressure to the display often makes it readable. Clip leads are essential to doing this experiment—holding the multimeter probes to test points would be a major hassle.

I only made 21 measurements of voltage, since I was not going to be fitting a model to the data, but just using the model I fit from the resistance measurements.

Plot of measured and theoretical voltage vs. temperature for the thermistor. The non-linear theoretical curve seems to be a pretty good fit (though it was not fit on this data, but on the previous series of resistance measurements).

The range of the voltages with the series resistor (from about 0.85v at freezing to 4.15v at boiling) is fairly reasonable for direct conversion to digital for the Arduino 10-bit ADC. In the middle of the range, the slope is about 0.0233 V/°F, which would give a resolution of about 0.2°F for Arduino readings.  (Of course, with the Arduino, we would not need the low-pass filter, and Vdd would be a well-regulated 5v, so this calibration curve would have to be redone.)  Even if we use the computational power of the Arduino to correct the non-linearity of the voltage curve, it is still useful to select the series resistor for the temperature we are most interested in, since that point gets the largest slope and hence the highest temperature resolution for fixed-size steps in voltage quantization.

Series-parallel

A lot of thermistor circuits on the web have a resistor in parallel with the thermistor, as well as the one in series. I wondered what the effect of this extra resistor was.

Circuit with resistor in parallel with the thermistor, as well as in series.

I tried analyzing this circuit also, using the same brute-force approach of computing the second derivative of the voltage and setting it to zero.  I got a result that surprised me initially:  the second derivative is zero if , where is the resistance one would get for putting the series and parallel resistors in parallel. This is exactly the same condition as before, but with replacing the series resistor .

After I thought about this for a while, I realized that I should have been able to get there directly. If you think of the circuit as connecting the thermistor to a voltage divider consisting of R2 and R1, then you can replace the ground and that voltage divider by the Thévenin equivalent, which would be a voltage source with voltage and a series resistor consisting of  R1 and R2 in parallel: .  The only reason to put in a parallel resistor would be to restrict the voltage range (which might be useful if the output were to be amplified, but is not useful if the output is going directly into an analog-to-digital converter whose full-scale range is 0 to Vdd).


Filed under: Circuits course Tagged: Arduino, bioengineering, circuits, course design, teaching, temperature measurement, Thévenin equivalent, thermistor, voltage divider

Temperature lab, part2

The thermistors that I ordered (see More musings on circuits course: temperature lab and Buying parts for circuits course) arrived today, about 2.1 days after I ordered them.  So I’ll try playing with them today, and see whether I can do the lab I’m thinking of for the students.

My son is still working on the Arduino data logger.  The Arduino code has been done for a while, but he’s been working on the Python front end.  He’s decided to do two front ends: a minimal one with no GUI and a fancy one using PyGUI.  He’s run into some problems (like PyGUI not supporting autoscrolling in TextEditor components), but everything seems to be solvable at this point.  He had a GUI interface working, but decided he needed to refactor his code to have a proper API for the datalogger, so that the user interface and the datalogger core code were as independent as possible with a documented interface between them—he’s teaching himself a lot about software engineering for this project, which is the first one for which he has had an external client.

The action plan for testing out a temperature measurement lab that I posted in More musings on circuits course: temperature lab was

  • Get some thermistors and some thermometer probe sheaths and see if I can make adequate temporary waterproofing for pennies per student.  I’ll probably have to solder on wires to lengthen the leads.
  • Try calibrating thermistors using a multimeter, cups of hot and cold water, and an accurate thermometer.
  • Try reading the thermistor using a voltage divider and the Arduino ADC.  Plot the temperature and Arduino reading over a wide temperature range (say, as a cup of boiling water cools).
  • Try linearizing the thermistor readings  using a parallel resistor and voltage divider.
  • Try designing an amplifier to read the thermistor with much lower current through it (and so less self-heating).

I’ve got three types of thermistors (all 10kΩ nominal resistance at 25° C), none of which are intended for immersion:

  • Vishay BC Components NTCLE100E3103JB0 a very cheap (23.5¢ each in quantities of 10) with B-value 3977°K).  There is high variation in the resistance (±5%), but low variation in the B-value (±0.75%).  These are glass-bead thermistors with 2cm uninsulated leads, so will need waterproofing. I bought 10 of these, but am hoping that I don’t need them.
  • Vishay BC Components NTCLE413E2103F520L (34.9¢ each in quantities of 10) has 4cm leads and is epoxy coated, but with the warning “Not intended for fluid immersed applications or continuous contact with water.”  It has B-value 3435°K, both resistance and B-value ±1%.  I plan to find out today if it is waterproof enough for the relatively short duration of the labs. I bought 10 of these also, and have the highest hopes for these being the ones we use in the lab.
  • Murata Electronics North America NXFT15XH103FA2B100 (66¢ each in quantities of 10) with B-value 3431°K, both resistance and B-value ±1%. The 9.5cm leads make these likely to be the easiest to use with thermometer probe covers, but they are more expensive.  I bought 4 @ 87¢, so as to keep the cost per thermistor type below $3.50. Note: the specs give different B-values depending which pair of temperatures used—I’ll have to look to see if they have specs for higher-order models of the resistance as a function of temperature.

The setup at 110°F, showing 4.60kΩ as the resistance.

I’ll try the epoxy-coated ones with the 4cm leads first. The first step is calibrating one with an ohmmeter. I used clip leads to connect a cheap multimeter to the thermistor, then dunked the thermistor in a glass of warm water with a thermometer (note: we’ll need to get some thermometers for this lab). The thermometer I used is a pasteurizing thermometer that I’ve had for years—it is, unfortunately, calibrated in Fahrenheit, not Celsius. Of course, we ideally want temperature in Kelvin.

I put a table of the measurements on a separate page, to avoid cluttering up the post with a table of 28 measurements.

I don’t expect many of the students will have the patience to make 28 measurements, but if we provide some different hot water sources (water boiled in a teakettle and ice water in a thermos), they should be able to make 10 measurements across a wide range of temperatures. I stopped at 28 measurements, because the alligator clip broke the wire and I didn’t feel like stripping more of the insulation and reconnecting.

I tried to fit the Steinhart-Hart equation to the data, where R is the resistance in Ω and T is the temperature in degrees Kelvin. But gnuplot got as good a fit using just A and B as using the third order fit, with providing an excellent fit.

Fitting the first two terms of the Steinhart-Hart model for thermistor behavior.

 

Simple Arrhenius fit for the data. When I fit the equation , which is the equation most often used in thermistor specs, I get A=0.24Ω and B=3157°K, which is not that close to the spec (10kΩ @ 25°C, B=3435±35°K, so A=0.0992Ω). Note that the spec curve fits the data quite well for warm temperatures, but deviates badly for cold ones.

There could be systematic problems with either my temperature readings or my resistance readings. The multimeter is more suspect than the thermometer, but the readings would have to be off by 500Ω to get that sort of error in the B-value. The numbers look particularly bad around 110°F. I think I need to get some new batteries for my other other cheap multimeter (which I think is a bit better) and see if it gives more reasonable results.

Wait a minute! I have an old Fluke 8060A multimeter (between 26 and 30 years old) that has a bit of a wonky LCD display, and a blown fuse on the 10A input, but is otherwise still probably my most accurate meter. If its batteries aren’t dead, I may be able to use it to get better measurements.

I tried measuring some known resistors, to see if the meters are way off. I tried an 11.8kΩ ±1% resistor: Fluke meter says 11.77Ω and the suspect multimeter says 11.67kΩ, while for a 732Ω±1% resistor, the Fluke meter says 731.1Ω, while the suspect meter says 718Ω. So the suspect meter appears to be reading 1–2% low, while the Fluke meter is within the accuracy of the resistors. So I boiled up some more water and tried another series of readings (the 63 readings are in a table on a separate page to avoid clutter here.)

Note that there are three runs of data: cooling down from boiling, cooling down from hot tap water, and cooling with ice from room temperature. I found it easiest to do this work on the counter in the bathroom, where I could easily adjust the temperature by pouring out some water and adding more hot or cold water. I was also very careful to make sure that the bulb of the thermometer was in contact with the thermistor while making the measurement, so that they were as nearly the same temperature as I could make them.

Let’s see what sort of fit we can get with this data.

The second data set, with 63 data points, is much cleaner than the first data set, and is well fit by a simple 2-parameter model (leaving out the third term of the Steinhart-Hart equation. Because it is hard to read the thermometer to better than 0.5°F, the fit is really quite good.

The data once again does not match the specified B-value of 3435°K±1%, but B=3174°K, though the curves are quite close for warmer temperatures.

The data sheet reports the 3435°K B-value as a B25/85 measurement, that is, it is based on values at 25°C (77°F) and 85°C (185°F).  If we just fit over that range, we can get the B-value up to 3236°K, which is still a long way short of the specified B-value.

Since I now trust that the resistance measurements are fairly good, the large error in the B-value has to be either from the thermometer or the thermistor. Because I don’t have a more accurate thermometer, and I’m not inclined to get one, I’m a bit stuck at this point in determining whether the thermistor meets the spec or not.

Doing a large number of measurements like this took far too long for the first part of a lab.  A lot of the time was spent waiting for the temperature of the water bath to change (or trying to make change by adding water or ice). We’ll probably have to ask for just 5 or 6 values, perhaps providing them with 5 or 6 water baths in thermoses that they can run their thermistors through one after another, to get the measurements rapidly. We will need some decent thermometers, capable of reading to ±0.2°C, if they aren’t too expensive.

Tomorrow I’ll try doing the electronics part of the lab, adding series and parallel resistors and measuring the voltage with the Arduino.


Filed under: Circuits course Tagged: Arduino, bioengineering, circuits, course design, teaching, temperature measurement, thermistor

Buying parts for circuits course

I’m going to need some parts to play with for the circuits course.  While I probably could get the parts I need at work from the Baskin Engineering Lab Support (BELS) staff, it would probably involve a bit of hassle, as there isn’t even a course number for the course yet, and so they’d have a difficult time figuring out which department to charge for the 30¢ and 60¢ parts—the cost in staff time (and my time) would be ridiculous.  So I decided to buy my own parts with my own money from Digikey.  My experience with them in the past is that in-stock parts generally get delivered by US mail within 2 days of ordering (it helps that they are not far away).

One experience we don’t give the students (at least, not until the senior design project) is trying to figure out what parts to buy.  It can be an overwhelming task—DigiKey has in stock 10,917 chips that come up in response to a search for op amps. We can reduce that to 1,249 if we restrict ourselves to through-hole rather than surface-mount parts. Adding a request for rail-to-rail outputs reduces that number to 314.  Sorting by price and looking through those under $1 shows many from Microchip Technology, each with slightly different specs.  I don’t see any way that a student in a beginning circuits class could make sense of most of the specs.

Thermistors are almost as bad, as there are a lot of specs for them also, and the price range is huge.  You have to know that you want NTC (negative thermal coefficient) devices, which gets you down to 1,369 thermistor types.  Eliminating surface mount parts reduces the number to 479, ranging in price from 23.5¢ each to $20 each.

I’ve decided to play with three different thermistors:

  • Vishay BC Components NTCLE100E3103JB0 a very cheap (23.5¢ each in quantities of 10) 10kΩ thermistor with B-value 3977K).  There is high variation in the resistance (±5%), but low variation in the B-value (±0.75%).  These are glass-bead thermistors with short leads and will need some sort of waterproofing for the labs.
  • The epoxy-coated Vishay BC Components NTCLE413E2103F520L has 50mm leads and is epoxy coated, but with the warning “Not intended for fluid immersed applications or continuous contact with water.”  It is a 10kΩ thermistor with B-value 3435K, both ±1%, and costs 34.9¢ each in quantities of 10. It may be waterproof enough for the relatively short duration of the labs, and the 2″ leads may make it easier to use with disposable thermometer covers from the drugstore.
  • Murata Electronics North America NXFT15XH103FA2B100 a 10kΩ thermistor with B-value 3431K, with low resistance variation (±1%) and moderate B-value variation (±1%).  Note: the specs give different B-values depending which pair of temperatures used—I’ll have to look to see if they have specs for higher-order models of the resistance as a function of temperature. Although these thermistors cost more (66¢ each in quantities of 10), they have 100mm insulated, flexible leads, which should be long enough that we use these in a coffee-cup water bath, though they come with the warning not to use them in wet or humid locations, nor “Places with salt water, oils, chemical liquids or organic solvents”.  The long flexible leads may make this one the easiest to use with disposable thermometer covers.

It looks like I’d have to go to $2–$4 per part for thermistor probes with a brass, copper, or plastic sheath, and even then the manufacturers don’t say that they are waterproof.

I also decided to get myself some op-amp chips to play with, since we will certainly be assigning some op-amp labs. Because I don’t have a bench power supply, I want to use a single power supply, like a 5v wall wart (or the 5v supply for the Arduino).  I also want a DIP package, so that I can use the op amp on a breadboard.  I looked for cheap op amps on Digikey, and the best choice I found was a Microchip Technology MCP6002-I/P (33¢ each in quantities of 10) for a dual op amp with rail-to-rail output.  It is a bit slow (1MHz gain-bandwidth product, 0.6V/µsec slew rate), but has a low input bias current (1pA) and will run on a single power supply anywhere from 1.8V to 6V, so should be easy to use with batteries or the Arduino power supply.

I will have to be careful not to blow up the chips with my function generator, though, as I believe it has a 10V peak-to-peak output.  Maybe I won’t have to worry about it—I just tried to turn on my function generator to check the output voltage, and it won’t turn on.  The fuse looks ok, but I don’t even get a power-on light, much less any signal at the output.  I don’t know whether I want to try debugging it or not, given that I don’t even have a manual for it, much less a schematic.  It worked fine the last time I turned it on, so I’ve no idea what the problem is.  I suppose I should have expected it, buying cheap, old equipment on e-bay, but I didn’t expect the function generator to fail after I had checked that it was working.  It will be harder for me to develop a lab that uses a function generator, though, if I don’t have a functional one to test the lab with.  I wonder whether it is better to try to fix the one I have or get another one.

The students will have Agilent 33120A Function/Arbitrary Waveform Generators to work with, which are very nice instruments, but out of my price range ($1300 refurbished on e-bay, $2200 MSRP).  I could get a cheap Victor VC2002 for about $130, which is about as good a price as the used stuff on e-bay.

 

 


Filed under: Circuits course Tagged: Arduino, bioengineering, circuits, course design, function generator, op amp, teaching, temperature measurement, thermistor

More musings on circuits course: temperature lab

I’ve decided to do a lot of my musing about the course design on my blog, so that others could contribute to the course design (or at least participate vicariously).  I think that having an open log of our thinking on the course design will be useful to grad students or new faculty who are having to do their own course designs, to show how us old farts do it (whether they wish to copy our methods or avoid using them).

The relevant posts so far are

Changing teaching plans
More on electronics course design
Yet another project idea
Another way to think about course design

I’ve got my son working on Arduino software to act as a data logger, so that students can have an easy-to-use tool that requires no programming, but which is easily modified if they want to do their own programming.  He has Arduino code for alpha testing already, and I think he’ll have a user interface ready for beta testing by the end of the week, but he’ll only have tested it on a Mac—we’ll need to get him access to a Windows machine to do testing there, because there are some operating system dependencies in talking to USB devices like the Arduino from a Python program. He’s been consulting with me on desired specs for the data logger, but doing all the coding himself. It is good practice for him both in interrupt handling and in user-interface design. He’s also having to think about portability for the first time, as the data logger has to run on Windows and Mac OS X (I think that Linux users should have no trouble with the version that works on Mac OS X, but we probably won’t be testing it). He’ll have to write user documentation and installation instructions also. Some of the packages he likes to use (like PyGUI) are enough of a pain to install that he’ll probably provide a stripped-down interface without a GUI for those who want to do minimal installation (Arduino software, Python, and PySerial are only essentials).

The first lab I’ve been thinking about is for temperature measurements. For the small temperature ranges normally needed in biosensor applications, the sensitivity, low thermal mass, and low cost of thermistors make them probably the best approach, and I think that they are what are used in the cheap digital oral thermometers sold in drug stores.  I wonder what techniques the manufacturers use to get medically acceptable calibration for those devices.

I’ve been thinking about the thermistor lab—it seems like we could do that in stages: first just reading resistance with a meter, then adding a series resistor to make a voltage output, then adding a parallel resistor to try to linearize the exponential curve a bit, finally adding larger series resistors and an amplifier to avoid self-heating currents through the thermistor and to allow nearly the full range of the ADC to be used.  This series of lab exercises could be spread out over the quarter, as students learn more about circuits.

For them to calibrate the thermistor, we could use hot and cold water baths, if the thermistor was in a waterproof package. From what I can see, that raises the price of a thermistor with leads from about 25¢ (for something like the NTCLE100E3333JB0 by Vishay BC Components) to $1.55 (for USP10982 from US Sensor) or $3 (for USP10973RA from US Sensor).  [Prices from DigiKey 10-unit price.]

I think that having the students do their own waterproofing is probably not a good idea.  Potting components gets to be a mess, and adding a large blob around the thermistor will slow its response time a lot.  I wonder whether using 5¢ disposable thermometer probe covers would work, or whether they tear too easily.  I probably need to look at some at the drug store, to see whether there is thicker one on the market that the cheap thermistors would fit into.

If waterproofing a cheap thermistor turns out to be too difficult, we need to think about whether to use the more expensive parts or work out some cheap, measurable temperature sources that are not wet.  We could make something like is used in PCR machines, with a couple of blocks of aluminum and a Peltier device, but I don’t think that the price is worth it—better to use the sort-of waterproof probes, a cup of water, and a thermometer.

I’ve noticed that for some applications, people are choosing voltage-output temperature sensors that rely on the thermal
coefficient of a transistor, rather than on a thermistor, like the MCP9700-E/TO from Microchip Technology (25 cents).  They have a fairly linear 10mv/degree C output, but their absolute accuracy is even worse than thermistors. These may be a better choice than thermistors in many applications, but would not provide the same teaching opportunities for a circuits class.

Using a thin-film platinum resistor temperature sensor (RTD) like the US Sensor PPG102C1RD would allow more accurate temperature measurement without calibration. With calibration, RTDs can be the most precise electronic temperature sensors, though I don’t know if the high precision is available in thin-film resistors, or only in the more expensive wire-wound ones. I suspect that repeatability from part to part is higher in the wire-wound RTDs, but that the thermal coefficients are the same, so that calibrating at one temperature should give about equal accuracy either way.

The naturally linear response of RTDs (100Ω at 0°C and 138.5Ω at 100°C in a very straight line) does not lend itself to as much circuit design as thermistors. On second thought, converting the 3850 ppm/°C resistance change into a voltage range readable by the Arduino ADC is not a bad circuit exercise, particularly if self-heating is to be avoided, though it is not as difficult as flattening the highly nonlinear response of a thermistor.  The biggest problem with RTDs is their price: at over $10 for a bare sensor they may be too expensive for class use.

Another possible temperature sensor is a thermocouple, which generates a voltage based on the temperature difference of two electrically connected junctions of dissimilar metals. One article in the engineering toolbox claims that thermocouples are cheap and RTDs expensive, and I think that is true if you are looking for high-temperature devices (like thermocouples for detecting pilot lights in furnaces), but not so true if you are looking for careful measurement in corrosive wet materials (like most biosensing applications). See Choosing and using a temperature sensor for more info comparing RTDs and thermocouples. Thermocouples have relatively low precision and sensitivity, and they measure only the difference in temperature between two points, and so are probably not very interesting for biosensing.

Action plan for testing out a temperature measurement lab:

  • Get some thermistors and some thermometer probe sheaths and see if I can make adequate temporary waterproofing for pennies per student.  I’ll probably have to solder on wires to lengthen the leads.
  • Try calibrating thermistors using a multimeter, cups of hot and cold water, and an accurate thermometer.
  • Try reading the thermistor using a voltage divider and the Arduino ADC.  Plot the temperature and Arduino reading over a wide temperature range (say, as a cup of boiling water cools).
  • Try linearizing the thermistor readings  using a parallel resistor and voltage divider.
  • Try designing an amplifier to read the thermistor with much lower current through it (and so less self-heating).

 

 


Filed under: Uncategorized Tagged: Arduino, bioengineering, circuits, course design, teaching, temperature measurement, thermistor

Another way to think about course design

Continuing the series about designing an applied electronic circuits course for our bioengineering majors (with more project ideas and another project idea), I want to talk about another lab-oriented view of what we want the course to teach—what lab skills they should have by the end of the course. Eventually, I’ll get around to textbook-concept view of the course, but I’m trying to stay away from that for a while, since the course we are trying to replace was faulted for being far too theoretical.  I want to start with the practical goals first, and work out form there what are the most important theory topics and what order they should go in.

Again, this is all very preliminary brainstorming—I have to talk with my co-instructor about what lab skills are feasible to teach in the class, which ones he sees as essential, and which are beyond the scope of the class.  Here is a tentative list of technician-level skills that every engineer should have:

  • Reading voltage, current, and resistance with a multimeter.
  • Using an oscilloscope to view time-varying signals:
    • Matching scope probe to input of scope.
    • Adjusting time-base.
    • Adjusting voltage scale.
    • Using triggering.
    • Reading approximate frequency from display.
    • Measuring time (either pulse width or time between edges on different channels)
  • Using a bench power supply.
  • Using a signal generator to generate sine waves and square waves.  Hmm, only the salinity conductance meter uses an AC signal so far—I may have to think of some other project-like labs that need the signal generator.  Perhaps we should have them do some capacitance measurements with a bridge circuit before building a capacitance touch sensor.
  • Using a microprocessor with A/D conversion to record data from sensors.
  • Handling ICs without frying them through static electricity.
  • Using a breadboard to prototype circuits.
  • Soldering through-hole components to a PC board.  (I think that surface-mount components are beyond the scope of the class, and freeform soldering without a board is too “arty” for an engineering class.)

There are probably a lot more skills to add to this list, which I haven’t thought about yet, and details within these skills that I’ve not thought about.  Luckily, my co-instructor has been teaching beginning students how to use electronic lab equipment for over 15 years, so I’m sure he knows what needs to be covered.

The bigger problem here is motivating students to want to develop these skills quickly—the EE and computer engineering students see the skills as directly related to their chosen profession, but the bioengineers will need to know why anyone would care about resistance, voltage, or current.  Getting a simple biosensor in right from the beginning would probably help.  I wonder if we should start with a thermistor lab for resistance, voltage, and current measurement.  How soon can we cover voltage dividers, so that they can design a resistance-to-voltage converter for interfacing to the ADC on an Arduino? Can we do that in the first lab?

 


Filed under: Uncategorized Tagged: Arduino, bioengineering, circuits, course design, teaching

Yet another project idea

I wrote earlier this week about an applied electronic circuits course for our bioengineering majors  and added some more project ideas in another post.  This weekend, while in southern California for my niece’s wedding, I was given another idea for a project by my sister: a pulse oximeter.

I knew that a pulse oximeter worked by looking at ratios of two different wavelengths of light shining through a finger or earlobe, which have different absorption by oxyhemoglobin and deoxyhemoglobin, but I had never thought about the details.  The first thing that concerned me was how a single ratio of two light intensities could be used—there must be huge variations in how much absorption there is that have nothing to do with oxygenation of hemoglobin.  Rather than puzzle through this on my own, I looked up the Wikipedia article on pulse oximetry.

It turns out that different techniques have been used over the decades.  Some of the early methods used more than two wavelengths of light including some that did not distinguish between the two states of the hemoglobin, in an attempt to quantify the total amount of hemoglobin as well as the ratio of oxy- to deoxy-.  The modern approach, though, is much simpler and more elegant.  The ratio measurements are made repeatedly, and only the fluctuating part of the readings is used.  The arterial blood flow shows a strong pulse signal (at around 0.5–3 Hz), while contaminating signals (hemoglobin in veins, absorption due to tissue other than hemoglobin, fingernail polish, …) are constant. By ignoring the DC signal and using only the fluctuating signal, the oxygen ratios are fairly easily measured.  Note that a pulse is essential to this measurement—continuous flow would not work—hence the name “pulse oximetry”.

There is at least one homebrew pulse oximeter on the web (like this one done by some Polish students and described in Polish, with a Google translation).  As far as I can tell, they used a PWM output from the microprocessor to provide signals alternately to the two LEDs, and to demultiplex the signals from the sensor and do separate analog filtering of the two signals.  It would probably make more sense to reduce the sampling rate to about 100Hz and do all the processing digitally. One thing they did that might be a bit trickier on the Arduino was to adjust the current to the LEDs to keep the DC signal level roughly constant, despite differences in the thickness and opacity of the fingers they were shining the light through.  The Arduino provides PWM outputs, but not real digital-to-analog channels.

They also do not seem to have thought about how to calibrate the device, which could be a problem for our lab also. Since commercial pulse oximeters only cost about $30 these days, we could simply have a couple in the lab for students to compare their results to, making a calibration chart of their reading vs the commercial reading.  (The hard part would be finding variation in oxygenation, since every one in the lab will likely be in the normal range of 95–99% oxygenated.)

The pulse oximeter would be a nice step up from the simple one-channel pulse sensor.  Unfortunately, most of  the design work seems to be on the digital side, rather than the analog side, which may make it a poor fit for the circuits course.


Filed under: Uncategorized Tagged: Arduino, bioengineering, circuits, course design, teaching

More on electronics course design

I wrote earlier this week about an applied electronic circuits course for our bioengineering majors that Steve P. and I will be designing over the summer, and how it will be designed backwards from the labs we plan to have them do.  That wasn’t quite an accurate description of our design process though, as the selection of the labs is based on more fundamental curricular goals.  I think that Steve and I have similar goals for the course, based on our discussions of it, but we’ve not tried to write them down formally yet.  I believe that we’ll need to do this for ABET, if the bioengineering program goes for full engineering accreditation.

I know that the EE Department wants the course to have a wider appeal than just to bioengineering majors taking it because it is (well, will be) required, as fluctuations in the cohort size for engineering majors has been large (biggest in computer science, which has been on a roller-coaster ride nationwide for the past couple of decades). The BME department chair, who is also the bioengineering undergrad director and main adviser, estimates a class size of 30–50 students if the course is offered this coming winter, and expects growth to 50–60 over the next few years.  The labs have room for about 20 students at a time, so this means 2 lab sections this year, growing to 3.  If we had a wider appeal, we might be able to pick up some computer science students, some game design students, or some Digital Arts and New Media (DANM) students, who are currently avoiding EE courses despite some interest in electronics because of the highly theoretical EE 101 course that is prereq to everything.  One problem with this broadening is that most of the potentially larger audience will not have been required to take the physics electricity and magnetism class, which I think is going to be an essential prereq.

Trying to put these two ideas, the need for more explicit goals for choosing labs and a wider potential market for the course, together, I came up with a possible theme for the class to guide lab selection and topics for the course:

Students completing this course will be able to design and build simple biosensors  for measuring chemical, electrical, or physical properties of biological systems (especially humans) and recording the measurements for computer analysis or interaction.

I still have to run this idea by Steve, and we’ll almost certainly need to tweak it a bit before we’re happy with it.  I’m particularly interested in two words in the goal (which I think Steve will agree with): design and build.  I don’t want this class to be a theoretical circuits course, in which students learn to formulate and solve large systems of linear equations, with no connection in their minds to any design problems.  I also want the students to learn to make things that they can take home, not just breadboard prototypes, though I may have to compromise a bit on this one, with most labs being breadboard only, and only one or two getting them to the next stage: a soldered prototype. Designing PC boards is probably beyond the scope of the class.

The labs I talked about in the previous post all fit within this theme:

  • Skin conductance meter.
  • Electrical field measurements in an electrophoresis gel.  This one is a bit of a stretch for the new theme, as electrophoresis gels are a standard lab tool, but not a biological system.
  • Conductivity of saline solutions. Used for measuring ecosystems (like rivers).
  • Do-it-yourself EKG
  • Optical pulse detector
  • Breathalyzer
  • Thermistor-based temperature measurement.

Since that post I’ve come up with a couple of other ideas:

  • Capacitance touch sensor (nice intro in Microchip application note AN1101).  This one is more ambitious than the EKG even, in that it involves a capacitance-sensitive oscillator design, but the oscillator is low frequency and the frequency sensing can be done by a microprocessor. They could use the same Arduino that they use for recording voltage data in other labs, but we’d have to provide them with a different program, since we are planning on having no programming required in the class or as prereqs to the class.  If the oscillator is a low enough frequency (say around 1kHz), then the program could be almost identical to the interrupt-driven data logger that my son wrote for the homemade super pulley, but interpreting the interrupt times differently.
  • Potentiometer-based goniometer for measuring joint angles.  Like the thermistor lab, this one is mainly a voltage-divider lab. The design problems are more mechanical than electrical, but it would be useful for students in understanding noise problems in sensors, since potentiometers are notorious for the noise in the signals.  It would also prepare students well for later work (outside this class) using servos, since most servo motors use a potentiometer-based angle measurements in their feedback loop.  I wonder whether the guts of a servo circuit are within the scope of this class—probably not, as much of it is concerned with handling the power demands and voltage spikes of the inductive load of the motor.

There have been a few ideas that I’ve had to reject as being overly ambitious for a first circuits course or too expensive to implement:  anything involving a microscope or micromanipulator setup is too expensive (eliminating most of the nanopipette work done in Pourmand’s lab), anything requiring weeks of practice to set up is also out (eliminating much of the nanopore work in Akeson’s lab, since forming the bilayers is still an art that few master quickly, also eliminating most work that would require growing neural cell cultures).  The nanopipettes and nanopores also require measuring currents in the picoamp range, which requires very sensitive electronics and extreme attention to noise control (including doing everything in a Faraday cage), which is probably beyond the scope of a first circuits class.  A subsequent bioelectronics class could cover patch-clamp amplifiers and other specialized measuring circuitry.

We probably do want some lab that measures ionic current, though, as that is fundamental to both the nanopipette and nanopore work.  I wonder whether we can do a scale model of the nanopore (with pin-prick size holes in plastic or Teflon), so that the students can measure the currents without the picoamp scale problems.

I suspect that when we try out the labs, we’ll find that only about half of them work well for us, and that several of them rely on the same basic circuit ideas (like voltage dividers to convert resistance into voltage).  In the latter case, we may give students the choice of several different labs to do.  I’ve always liked the approach of giving students a number of different design problems (of roughly comparable difficulty and covering the same fundamental concepts) and letting them choose which ones to work on.  I’ve never implemented this approach in any of my classes, though, as I’ve either been faced with a pre-designed set of lab exercises that I didn’t have the authority or time to redesign or I’ve gone for quarter-long independent projects which are not even attempting equivalence between projects.

Whether we end up rejecting some of these labs or merging some into alternative choices for a single lab, we’re obviously going to need more lab ideas.  Does anyone have any?


Filed under: Uncategorized Tagged: Arduino, bioengineering, circuits, course design, teaching

Changing teaching plans

It turns out that I won’t be teaching an introduction to programming for biologists, as I announced in February.  Funding was found for that class to be taught by the instructor who has been teaching it, freeing me up to take on a different class as overload.  (I already pretty much committed myself to teaching an overload this year.)

I decided that the most pressing need was for an applied electronic circuits course for our bioengineering majors (the current EE circuits class is way too theoretical).  The School of Engineering’s best EE instructor (Steve P.) and I had discussed doing such a course before I went on sabbatical, and our respective department chairs were enthusiastic, but funding was not found for it.  Everyone was even more enthusiastic this time around, so Steve and I are going to design the course this summer and try teaching it together in Winter (at least, if all the enthusiasm converts into a secure position for him—otherwise he’s going to have to pick up another couple of courses from a different department and not teach the new one).  We probably won’t know for sure about the funding until November, so we’re going to go ahead and design the course on spec, hoping that we get to teach it.

If Steve becomes unavailable, I don’t think I have the confidence to teach circuits by myself, since I’ve never taken a circuits course, being almost entirely self taught (my Dad taught me a little, including a German joke about a Wien bridge, when I was in high school).  After we co-teach it once, I think either of us could do the course alone, though co-teaching with a master teacher like Steve is fun.  (If the applied circuits course falls through for this year, I’ll probably try to cobble together a graduate genome assembly and annotation course, based in part on the Banana Slug Genomics class but adding a bunch of new material, so I’ll end up with a teaching overload and working on a new course this year no matter what happens.)

I’m looking forward to designing a course with Steve. We’ve both designed many courses before, and co-taught senior design project courses, but we’ve not designed a course together before. I’ve lost track of how many I’ve designed—something like 15–20, depending how you count the courses that someone else started but I extensively modified.

The approach that Steve and I are taking to the course design is to start by looking for lab projects for the students to do.  We need 10 labs (one a week for 10 weeks) ranging from very basic getting-to-know-the-equipment labs up to real (but small) design challenges.  We will try out the labs ourselves separately, then compare notes on how things went before writing up the lab handouts.  After we have the labs figured out, we’ll make sure that we cover the theory needed to understand the labs and do the designs, pacing the lectures to stay just a little ahead of the labs.  At least, that is how we both envision the process currently.

Here are a few labs that I’ve been thinking about—I’d appreciate a lot more suggestions.

  • Skin conductance meter.  There are a lot of do-it-yourself lie detector circuits for measuring skin resistance (“electrodermal response” if you want to sound medical).  I like the “Lego” sensor that just uses the inputs of a Lego RCX brick to read the resistance between two fingers. But getting RCX bricks for the lab just to measure resistance is silly.
    I wonder if we should give them something that reads and records voltage (like an Arduino or other microprocessor with an A/D converter) and have them make a voltage divider to read resistance.  This could be a good first lab, with them making a single measurement with a multimeter, choosing an appropriate resistor for the voltage divider, then recording a few minutes of skin resistance, perhaps on the inside of the wrist.  We could have them use fancy silver chloride gel electrodes at 500/$80, rather than Al foil and velcro—it’d probably end up cheaper.
  • When I told my son that we wanted to design the labs so that they could be done by the students without hand holding, he suggested the experiment where you pass a (small) current through a chain of people holding hands.  This might not be a bad idea also for a lecture demo.
  • Electrical field measurements in an electrophoresis gel.  The students would cast a gel (possibly agarose, but maybe just agar, to make it cheaper) with a standard buffer, apply a small voltage (much less than usually used in electrophoresis, since we’ll be working without the safety shield of a closed electrophoresis box), then use a handheld voltmeter to measure the voltage at different points in the gel.  We would also have them measure voltage and current.  We might even have them time the movement of a loading dye at different voltages, but I think that would take too long.
    One problem with this lab is that it requires using the wet lab, and neither Steve nor I are really wet-lab people.  I wonder if we could borrow a TA for a week from another course.  Perhaps a bioengineering senior undergrad could be hired, as many of them have some experience at casting gels.
  • Conductivity of saline solutions.  It is standard to measure the ionic content of fresh water and even sea water by measuring its conductivity—Wikipedia has a decent article on the theory of electrolyte conductivity.  A conductivity calculator gives an equivalence of 1 ppm total dissolved solids as 1.56 µS/cm, though they don’t specify the temperature or include a temperature correction.  The City of Santa Cruz 2011 Consumer Confidence Report lists the drinking water in town as 280–760 µS/cm (though they use the charming older name: µmhos/cm), while a 2004 San Lorenzo River Watershed Management Plan gives the conductivity in the estuary as 260–44,860 µS/cm, depending when and where the sample is taken (though they label their table wrong)
    The tricky part here is that the conductivity testing has to be done with an AC signal, not a DC one, to avoid problems at the electrodes. If we trust the students not to spill salt water into the equipment, we could probably do this lab in the electronics lab, and use the bench oscillator and meters.  Later in the quarter we might have them design their own rectifier circuit to communicate with a microprocessor, but I suspect that doing an oscillator may be beyond the scope of the class.
    We may also want to get silver/silver chloride electrodes (or fine silver wire at $0.90/foot and soak it in bleach).    Using thin wires as the electrodes may cause problems with the resistance being very high.  I wonder if we should try doing something cheaper first, like using a pair of pennies cleaned in vinegar and rinsed.  They wouldn’t last long in salt water, but even demonstrating the problem might be instructive.
  • A good project for late in the quarter would be a do-it-yourself EKG, which requires a simple amplifier (and gets another use for the silver/silver-chloride gel electrodes).
  • We could also do an optical pulse detector, using an LED and a light sensor, though we’d probably end up making our own, rather than buying one for $20.
  • Breathalyzer.  A resistance-output sensor for alcohol on the breath looks like it only costs about $5.  This may be too simple.
  • [Added 14 June 2012, after first publishing this post] Thermistors. A different application of voltage dividers, and one that would be relevant for both EE and BIOE students is thermistors.  The intro at http://www.mstarlabs.com/sensors/thermistor-calibration.htmlgives a nice overview of the subject for students. This would be a cheaper lab than the gel electrophoresis, with less cleanup needed.It would be easy to do three temperatures in water baths (ice water, room temperature water, hot water) and do 3-point calibration.  The design exercise of figuring out the best resistance to get fairly linear voltage vs. temperature plot is a useful one, and not too hard (I think).

Several of these labs look like they would be most interesting if they involved hooking up to an Arduino or other cheap microprocessor that can record time-course data.  Since programming is outside the scope of the circuits course, we could have the students buy an Arduino for about $20–30 online and give them a simple recording program (perhaps I can get my son to write them a versatile one, based on the one he wrote for our super pulley recording).  The students could sell the Arduino used if they weren’t interested in doing anything with it (the Digital Arts and New Media students use them and probably would be glad of cheap ones).

Obviously, we’re going to need more lab ideas.  Does anyone have any?


Filed under: Uncategorized Tagged: Arduino, bioengineering, circuits, teaching

Changing teaching plans

It turns out that I won’t be teaching an introduction to programming for biologists, as I announced in February.  Funding was found for that class to be taught by the instructor who has been teaching it, freeing me up to take on a different class as overload.  (I already pretty much committed myself to teaching an overload this year.)

I decided that the most pressing need was for an applied electronic circuits course for our bioengineering majors (the current EE circuits class is way too theoretical).  The School of Engineering’s best EE instructor (Steve P.) and I had discussed doing such a course before I went on sabbatical, and our respective department chairs were enthusiastic, but funding was not found for it.  Everyone was even more enthusiastic this time around, so Steve and I are going to design the course this summer and try teaching it together in Winter (at least, if all the enthusiasm converts into a secure position for him—otherwise he’s going to have to pick up another couple of courses from a different department and not teach the new one).  We probably won’t know for sure about the funding until November, so we’re going to go ahead and design the course on spec, hoping that we get to teach it.

If Steve becomes unavailable, I don’t think I have the confidence to teach circuits by myself, since I’ve never taken a circuits course, being almost entirely self taught (my Dad taught me a little, including a German joke about a Wien bridge, when I was in high school).  After we co-teach it once, I think either of us could do the course alone, though co-teaching with a master teacher like Steve is fun.  (If the applied circuits course falls through for this year, I’ll probably try to cobble together a graduate genome assembly and annotation course, based in part on the Banana Slug Genomics class but adding a bunch of new material, so I’ll end up with a teaching overload and working on a new course this year no matter what happens.)

I’m looking forward to designing a course with Steve. We’ve both designed many courses before, and co-taught senior design project courses, but we’ve not designed a course together before. I’ve lost track of how many I’ve designed—something like 15–20, depending how you count the courses that someone else started but I extensively modified.

The approach that Steve and I are taking to the course design is to start by looking for lab projects for the students to do.  We need 10 labs (one a week for 10 weeks) ranging from very basic getting-to-know-the-equipment labs up to real (but small) design challenges.  We will try out the labs ourselves separately, then compare notes on how things went before writing up the lab handouts.  After we have the labs figured out, we’ll make sure that we cover the theory needed to understand the labs and do the designs, pacing the lectures to stay just a little ahead of the labs.  At least, that is how we both envision the process currently.

Here are a few labs that I’ve been thinking about—I’d appreciate a lot more suggestions.

  • Skin conductance meter.  There are a lot of do-it-yourself lie detector circuits for measuring skin resistance (“electrodermal response” if you want to sound medical).  I like the “Lego” sensor that just uses the inputs of a Lego RCX brick to read the resistance between two fingers. But getting RCX bricks for the lab just to measure resistance is silly.
    I wonder if we should give them something that reads and records voltage (like an Arduino or other microprocessor with an A/D converter) and have them make a voltage divider to read resistance.  This could be a good first lab, with them making a single measurement with a multimeter, choosing an appropriate resistor for the voltage divider, then recording a few minutes of skin resistance, perhaps on the inside of the wrist.  We could have them use fancy silver chloride gel electrodes at 500/$80, rather than Al foil and velcro—it’d probably end up cheaper.
  • When I told my son that we wanted to design the labs so that they could be done by the students without hand holding, he suggested the experiment where you pass a (small) current through a chain of people holding hands.  This might not be a bad idea also for a lecture demo.
  • Electrical field measurements in an electrophoresis gel.  The students would cast a gel (possibly agarose, but maybe just agar, to make it cheaper) with a standard buffer, apply a small voltage (much less than usually used in electrophoresis, since we’ll be working without the safety shield of a closed electrophoresis box), then use a handheld voltmeter to measure the voltage at different points in the gel.  We would also have them measure voltage and current.  We might even have them time the movement of a loading dye at different voltages, but I think that would take too long.
    One problem with this lab is that it requires using the wet lab, and neither Steve nor I are really wet-lab people.  I wonder if we could borrow a TA for a week from another course.  Perhaps a bioengineering senior undergrad could be hired, as many of them have some experience at casting gels.
  • Conductivity of saline solutions.  It is standard to measure the ionic content of fresh water and even sea water by measuring its conductivity—Wikipedia has a decent article on the theory of electrolyte conductivity.  A conductivity calculator gives an equivalence of 1 ppm total dissolved solids as 1.56 µS/cm, though they don’t specify the temperature or include a temperature correction.  The City of Santa Cruz 2011 Consumer Confidence Report lists the drinking water in town as 280–760 µS/cm (though they use the charming older name: µmhos/cm), while a 2004 San Lorenzo River Watershed Management Plan gives the conductivity in the estuary as 260–44,860 µS/cm, depending when and where the sample is taken (though they label their table wrong)
    The tricky part here is that the conductivity testing has to be done with an AC signal, not a DC one, to avoid problems at the electrodes. If we trust the students not to spill salt water into the equipment, we could probably do this lab in the electronics lab, and use the bench oscillator and meters.  Later in the quarter we might have them design their own rectifier circuit to communicate with a microprocessor, but I suspect that doing an oscillator may be beyond the scope of the class.
    We may also want to get silver/silver chloride electrodes (or fine silver wire at $0.90/foot and soak it in bleach).    Using thin wires as the electrodes may cause problems with the resistance being very high.  I wonder if we should try doing something cheaper first, like using a pair of pennies cleaned in vinegar and rinsed.  They wouldn’t last long in salt water, but even demonstrating the problem might be instructive.
  • A good project for late in the quarter would be a do-it-yourself EKG, which requires a simple amplifier (and gets another use for the silver/silver-chloride gel electrodes).
  • We could also do an optical pulse detector, using an LED and a light sensor, though we’d probably end up making our own, rather than buying one for $20.
  • Breathalyzer.  A resistance-output sensor for alcohol on the breath looks like it only costs about $5.  This may be too simple.

Several of these labs look like they would be most interesting if they involved hooking up to an Arduino or other cheap microprocessor that can record time-course data.  Since programming is outside the scope of the circuits course, we could have the students buy an Arduino for about $20–30 online and give them a simple recording program (perhaps I can get my son to write them a versatile one, based on the one he wrote for our super pulley recording).  The students could sell the Arduino used if they weren’t interested in doing anything with it (the Digital Arts and New Media students use them and probably would be glad of cheap ones).

Obviously, we’re going to need more lab ideas.  Does anyone have any?