Gas station without pumps

2014 February 13

Tenth day of freshman design seminar

Filed under: freshman design seminar — gasstationwithoutpumps @ 17:22
Tags: , , ,

Yesterday’s class was originally planned to be an Arduino demo of analogRead() and Serial.print(), using either a pressure sensor or a phototransistor, but the class ended up going in a totally different direction.

At the beginning of class, I passed around a cheap vernier caliper and showed students how to measure the disposable cuvettes to 0.05mm precision. This was part of my continuing effort to expose students to simple tools that they should have seen in high school, but for the most part have not.

I started the class by collecting the proposals for design projects.  Since these were group efforts, there were only three proposals: a centrifuge, an incubator, and a PCR thermal cycler.  I’ve not read the proposals yet (I’m still under the weather, and ended up falling asleep last night right after dinner, and only waking up this morning barely in time to get to the department research seminar at noon), but I did read the titles in class, and started talking about what computer aspects there might be for each project.  The centrifuge is mainly a mechanical design, but a non-contact sensor (probably optical) for measuring the rotor speed would be useful—one might even want to include a motor speed control, but that depends on what they use for a motor. The other two designs both depend on regulating a temperature.  Important parameters include how tightly controlled the temperature has to be and how fast you have to move from one temperature to another.  An incubator generally needs to have a fairly fixed temperature, and only needs to respond to slow heat loss, except when the incubator is opened.  A PCR machine has to switch rapidly between three temperatures,  generally around 95° C, 50° C, and 75° C.

So we ended up talking about thermal control.  First I described the basic idea of having a “set point” and of simple on-off heater control, with high threshold and a low threshold.  We talked about temperature sensors, including the old-fashioned bimetal-strip thermostats, thermistors, thermocouples, and RTD sensors. I talked a little about how to choose among the different types (thermocouples for high temperature, RTD for high precision, thermistors for low cost and ease of interfacing).  I also mentioned semiconductor temperature sensors, which are used in a lot of integrated circuits (like CPUs and GPUs on their laptops), but are not very good for general temperature measurement.

We focused on thermistors as the simplest to use with the Arduino, and I showed them a data sheet for the NTCLE413E2103F520L thermistor we use in the Applied Circuits lab.  This lead to a discussion of how the thermistor resistance varies with temperature, and I showed them the Wikipedia page on thermistors, with its discussion of the Steinhart-Hart equation and the “B” parameterization of the formula.  I also explained what the B25/85 specification on the data sheet meant (measuring resistance at only 25° C and 85° C, and solving for B).

I then tried to get the class to come up with a circuit to convert resistance variation into voltage variation, but they were stumped. So I showed them a voltage divider and had them work out as a class what the output voltage was using just Ohms law. They were then able to see that replacing one resistor with a thermistor would allow them to see a voltage variation as a function of temperature. I told them about the first homework in the Applied Circuits course (figuring out the optimal value for the fixed resistor, to get the maximum change in voltage with temperature at a particular operating temperature), but did not assign the problem. Not everyone in the class has had calculus yet, and the problem really does require being able to differentiate and use the chain rule.

I ran out of time before doing anything with the Arduino! I did assign them an Arduino homework, though:

For Wednesday 2014 Feb 19 (no class Monday Feb 17), write an Arduino program that will report over the USB cable once every two seconds the status of pins 8, 9, and 10, whether that pin is high or low. The report should be viewable on the Arduino Serial Monitor. It should look something like

 8:HIGH 9: LOW 10: LOW
 8: LOW 9:HIGH 10: LOW
 8: LOW 9:HIGH 10: LOW
 8: LOW 9: LOW 10: LOW

As a matter of common programming style, there should be a “block comment” at the beginning of every program telling what the program does (from a user’s standpoint, not how it works from a programmer’s standpoint), who wrote it, and when it was written. You may work on the programs in pairs (not larger groups), but the names of everyone who worked on

Turn in a printout of your program. This program is simple enough that I don’t need evidence of it working—for other class you may be asked to turn in the source code electronically, so that the graders can test the program, or provide input-output pairs that show evidence that the program is working correctly.

For those who find this program too easy, you can challenge yourself to do more ambitious programs:

  • Read analog inputs from A0 through A5 and report the values.
  • Accept characters from the USB serial line that change which pins you examine. (For example, getting the character ‘8’ with might turn on looking at pin 8, and getting ‘*’ might turn it off looking at pin 8.)
  • Write a little control program that turns on the on-board LED (pin 13) when some combination of conditions is true and off when the conditions are false.

At the end of class, I had everyone use my wire strippers to cut and strip a few small pieces of wire, so that they could do the hardware portion of the Arduino programming.

2014 February 11

Ninth day of freshman design seminar

Filed under: freshman design seminar — gasstationwithoutpumps @ 17:10
Tags: , , , , ,

The astute reader of this blog may notice that there was no “eighth day of freshman design seminar” post.  I was sick last Wednesday and unable to attend class, so I had the group tutor (a senior in bioengineering) take the class and have them discuss possible projects to take on.  I asked them to turn in proposals yesterday, but forgot to collect them—I’ll collect them tomorrow.  We’re about halfway through the course, so it is time for students to start on their projects.

I returned two homeworks yesterday: the colorimeter design and the RGB LED resistor sizing.

The colorimeter designs were not very good, lacking necessary details, but were somewhat better than previous spectrometer attempts. I think I’ll try reversing the order of those assignments in future, as the colorimeter is a simpler device. The biggest problem with the designs is that most of them were pieced together from web pages, with no citations.  Two of them were blatantly copied from Science Buddies, which has a decent design, but the students did not cite the source. I yelled “Cite your sources!” at the class, and explained that I could have flunked several of them out for plagiarism, and that in an upper-division course I would have. I hope they get the message, so that they don’t fail out later on. I decided not to prosecute academic integrity cases in this 2-unit, optional course, though I am making the science-buddy copyists redo the assignment.

I then explained to students the mistake I had made in the photodiode explanations (see Lying to my students) and corrected the understanding of the “open-circuit voltage” spec from the photodiode datasheets. I think that the students are a little more comfortable about finding things on datasheets now—I hope that lasts for them.

We then went over one of the RGB LED datasheets and did the resistor sizing for it.  About a third of the class had done a decent job on that assignment, and I cleared up the common mistakes:

  • If a battery is used in a schematic, both ends need to be connected.  Other options are to use +5v and Gnd port symbols, or a +5V DC voltage source symbol.
  • The LED diode must be forward biased (with a large current flow), and the triangular shape of the diode symbol shows which way conventional current flows.
  • The voltage needed for determining the resistance is the voltage across the resistor, not the voltage across the diode, so it is 5v–VF, not VF.

I think I managed to get these points across—I relied fairly heavily on asking the students to do each step, so I’m pretty sure that at least half the class can now size a resistor for an LED.

Finally we could get to some new material. I wanted to show them how to program an Arduino, so we built up the standard blinking-LED first example for an Arduino.  To make it a little more interesting, I started with a true statement—I did not know whether the LED on pin 13 was hooked up with the anode or the cathode connected to pin 13.  We looked at the two possible circuits and how they would behave differently when the pin was high and when it was low.  I then explained “void setup()”, “void loop()”, and “pinMode(13,OUTPUT);”.  I had the students come up with the body of loop, feeding them the important constructs (digitalWrite and delay) only once they had expressed the action they wanted.  We ended up with a loop that help pin 13 high for a second and low for ¼ second.  After I typed in the program we had written, I showed them how to select the appropriate board type and download it to the Arduino.  The light blinked, and the students were able to figure out from the pattern of on and off that the LED was connected between pin 13 and GND (with a series resistor), with the anode towards pin 13.

I ran out of time and material at about the same time (a first for this quarter), and assigned the students to read about Arduino programming from the Arduino reference website, with particular attention to “if”, “while”, “pinMode”, “digitalWrite”, “digitalRead”, “analogRead”, and the timer functions.  I expect to go over some analogRead stuff in class tomorrow, and assign a small programming assignment over the weekend, probably using “Serial”.

2014 February 6

Lying to my students

I’ve been lying to my students a bit with the simple circuit I gave them for measuring light levels:

Simple circuits for measuring light with an Arduino.

Simple circuits for measuring light with an Arduino.

First, previous schematics have been showing a PNP phototransistor, when an NPN one was clearly needed (and I’ve been talking all along to them about NPN phototransistors, and simply not noticing that I was drawing a PNP one).  I’ll have to correct this in class!

Second, although the simple circuit that I gave them is sometimes used, photodiodes are usually used with a constant voltage drop across the diode, with a transimpedance amplifier to measure the current:

The standard design for using a phototransistor uses a current-to-voltage (transimpedance) amplifier.  This holds the voltage across the photodiode constant and provides an output voltage proportional to the current

The standard design for using a phototransistor uses a current-to-voltage (transimpedance) amplifier. This holds the voltage across the photodiode constant and provides an output voltage proportional to the current.

Two common bias voltages are used: one which puts zero volts across the photodiode, so that there is no dark current, and one that puts a few volts of reverse bias on the diode, so that the depletion region at the diode junction is thicker and parasitic capacitance of the junction reduced (improving the bandwidth of the detector).

An even better design, and the one that I would probably use if I wanted to hook up a photodiode to an Arduino or KL25Z for good measurements is a two-stage amplifier:

This two-stage amplifier provides current-to-voltage conversion in the first stage and a simple non-inverting voltage gain in the second stage.  Using two stages allows using a much smaller value for R1, which in turn means a much wider frequency response.  Again the V_bias voltage can be adjusted for minimum dark current (V_bias=V_ref) or for better bandwidth (V_bias several volts lower than V_ref).

This two-stage amplifier provides current-to-voltage conversion in the first stage and a simple non-inverting voltage gain in the second stage. Using two stages allows using a much smaller value for R1, which in turn means a much wider frequency response. Again the V_bias voltage can be adjusted for minimum dark current (V_bias=V_ref) or for better bandwidth (V_bias several volts lower than V_ref).

Of course, the biggest lie I told them was about the meaning of the Open Circuit Voltage spec for photodiodes. A photodiode acts like a tiny photocell, and if not externally biased will produce a small voltage. With the simple circuit at the top of the page, using a PD204-6C photodiode and a 5.6MΩ resistor for R2, I got V2 output voltages from 3mV up to 5.55V.  The photovoltaic effect can raise the voltage substantially above the 5V power rail!  This is not a problem with transimpedance amplifier designs, since the amplifier can provide enough current to keep the cathode of the photodiode clamped at V_ref.  The phototransistor design also does not have the same problem with the photovoltaic effect—using WP3DP3BT as Q1 and R1=120kΩ, I get readings from 1mV to the full 5v, but not beyond 5v.

I think I’ll let the freshman design class know about this problem with the photodiode circuit, and that there is a relatively simple solution, but I don’t think I’ll try to get them to design the improved circuit.  I think it would be a good replacement for the rather unsuccessful phototransistor lab in the applied circuits course, though, especially as transimpedance amplifiers are fundamental to a lot of bioelectronics (patch-clamp measurements of ion channels, nanopores, nanopipettes, …).

2014 February 3

Seventh day of freshman design seminar

Today we continued looking at photodiodes, phototransistors, and LEDs, in the context of the colorimeter I had asked them to design.  I think that next year I may go to the colorimeter first, and then to the more complex photospectrometer.  Since the students weren’t familiar with spectrometry, starting with it was of no help, and all the other concepts (absorbance, irradiance, linearity of phototransistors, …) are more than enough to start with.

I started the class by collecting the work I had asked them to do on fleshing out the design of the colorimeter, which I have not read yet. I’ll have to grade their colorimeter designs before Wednesday, but I hope we can start learning some Arduino programming by then (probably just setup, loop, analogRead, Serial.print, and delay), rather than going over the homework.

After reading what they turned in for photospectrometer and photodiode assignment, I’m not setting my expectations very high for the colorimeters.  I think (hope?) that the students are getting something out of the class, if not quite as quickly as I would like. I guess it takes some time for them to turn around habits of a lifetime and start generating new answers and new questions to answer, rather than just coughing back what the teacher said.

I wanted to get to Arduino programming today, but we didn’t get that far. I started with going over the homework, which was to find the resistor values for the following circuit:

Simple circuits for measuring light with an Arduino.

Simple circuits for measuring light with an Arduino. Update 2014 Feb 6: Q1 is intended to be an NPN phototransistor, not PNP as shown here!

  • For Monday, 2014 Jan 27, as individuals (not groups), find a data sheet for the phototransistor WP3DP3BT. Also, select a cheap photodiode that is available in the same size and shape of package as the WP3DP3BT phototransistor and look up its data sheet.For the photodiode and the phototransistor, report the dark current, the voltage drop across the device (that would be collector-emitter saturation voltage for a phototransistor and the open-circuit voltage for a photodiode), and the sensitivity (current at 1mW/cm2 at λ=940nm, which is the wavelength where silicon photodiodes and phototransistors are most sensitive).Find a plot of the spectral sensitivity of a silicon photodiode or phototransistor (it need not be from the data sheets you found—all the silicon photodiodes and phototransistors have similar properties, unless the packaging they are in filters the light).

    We want to make a circuit so that the full-scale (5v) reading on the Arduino corresponds to an irradiance of 204.8μW/cm2 at 940nm, so that each of the 1024 steps corresponds to an increment of 0.2μW/cm2. Remember that 1000μW=1mW. (We may not be able to use the full range, as the circuit should saturate at a somewhat lower value, depending on the saturation voltage or open-circuit voltage of the photodetector.)

    For the circuits above, figure out what values of R1 and R2 to use to get the desired voltage range at A1 or A2. Look up what standard resistance values are available with 2% tolerance, and pick the nearest one. (Hint: Google is your friend for finding tables of information.)

    In class on Monday, we’ll try building this circuit and seeing how it works with the Arduino Data Logger.

  • By Wed 2014 Jan 29, redo the homework originally due on Monday, and turn it in on paper, typed, with the questions echoed and answered in full sentences. If you have any questions, discuss them on the class e-mail list. (I don’t want “I don’t know” to come up for the first time in class—you should have been asking for help over the weekend!)

The first thing I did in class was to go over that homework, giving them useful advice for adapting to college courses:

  • No one computed R2 correctly. It didn’t bother me (much) that no one knew how to do it, but it did bother me that no one asked for help. I tried to impress on them that asking for explanation is not a sign of weakness, and that it should not be their goal to hide from view when they are confused about something. I don’t know whether this rant got through to them, but maybe if they hear it enough they’ll start asking questions in class or on the e-mail list.
  • Only one person cited a source for the plot of spectral sensitivity for silicon photodiodes, and that more by accident than by design (the URL was printed by the browser). I explained the notion of plagiarism to them, how it was the most serious of academic sins, and how other engineering faculty (and me in other courses) might fail them for the course if they continued to claim other people’s work as their own (which is what an uncited figure is).
  • I told them that they had to get very comfortable with the metric prefixes (only femto, pico, nano, micro, milli, kilo, mega, giga—they mostly won’t have much use for the smaller and larger ones) and their single-letter abbreviations.  This is clearly something they need to work on, as one of the common problems in the homework was off-by-a-factor-of-1000 errors, as students changed µW to mW without scaling the numbers.
  • I also impressed on them the importance of typing part numbers accurately—several had mistyped the part numbers for the photodiode they were specifying, and it took me a little detective work to figure out what they had really meant.  Some had not provided part numbers at all, and I could not check whether their numbers were right (those students still got the computations wrong).
  • Only three students found photodiodes that matched the specs: “a cheap photodiode that is available in the same size and shape of package as the WP3DP3BT phototransistor ” and that was sensitive to visible light.  That meant finding a 3mm diameter, through-hole package.
  • Several students found photodiodes in black packages that block visible light, which was not useful for this application.  I explained why such parts exist (listening to IR emitters like in remote controls, without being swamped by ordinary light).
  • Many students, having found photodiodes, could not accurately specify the sensitivity of the photodiode.  Most just reported a current, without specifying the irradiance that caused that current. We went over the notion of linearity and that what we were interested in was the slope of the line, and that units were µA/(mW/cm^2). I mentioned that some spec sheets specified responsivity in A/W, but that had to be divided by the sensor area to get the more useful unit. I then had them compute the current at the specified maximum irradiance and the resistance that would be needed to get that current with 5v across the resistor.  It took them a very long time (algebra skills are much lower than I would have expected for college freshmen—I have more sympathy now for the teachers of freshman physics), but they did eventually get the right answers for both the current and the resistance.
  • I spent a fair amount of time letting students know that units were their friends, and that they should carry the units throughout the computation.  I don’t know if the message got through, but I hope for their sakes that it will eventually.

Finally we could get to some new material. I asked them about monochromatic light sources for the colorimeter.  Some thought of LEDs, but one student mentioned that he had seen incandescent bulbs as much cheaper than LEDs. It took me a second to figure out where this confusion came from—at the power levels used for room lighting, incandescents are indeed cheap and LEDs expensive.  But we don’t need 5–20W of power—we’re not trying to cook what is in the cuvette.  I pointed out that the maximum light level expected for the phototransistor was only 20mW/cm^2, so we needed only mW of power from the light, and at that light level, LEDs were much cheaper than incandescent bulbs.

I showed them the data sheet for a red LED,  and explained some of the concepts. One concept was the difference between peak and dominant wavelength—the peak is where the light has the highest intensity, and the dominant is where it shifts to when multiplied by human visual sensitivity.  I also explained what the “spectral line half bandwidth” was, though I did not go into the difference between half amplitude and half power—it was not important at the moment.

I then went over the symbol for a diode, how I remember that electrons move from the cathode to the anode (bring up vacuum tubes and cathode rays), and showing them a rough sketch of a diode current-vs-voltage curve.  I showed them where various parameters were on the data sheet, though the particular LED data sheet I was using did not include the threshold voltage, just the forward voltage at high current.

The students brought up the notion of having multiple LEDs to get multiple colors, so I introduced them to  RGB LEDs, showing both the common-anode and common-cathode circuits. They figured out, with a lot of prompting, which way round power had to be connected (the mnemonic device I used was that producing light required power, and power is voltage times current, so there had to be current flowing through the diode).

It doesn’t help that photodiodes are used backwards—the photodiode is reverse biased, and current flows only when light produces electron-hole pairs at the back-biased junction.  I carefully did not talk about that while we were looking at the LEDs, as I’m sure it would have confused them.

By this point we were almost out of time, so I assigned a homework:

For Wed 2014 Feb 5, find a through-hole (not surface mount) RGB LED that is common-cathode, and design a circuit to power it from a +5V power supply. Make each color be as bright as possible without exceeding maximum current (you can leave a safety margin of up to 25%). Explain your design and how you sized the resistors for it.

I recommend using Digi-key’s search feature (looking for RGB LED) to see what parameters are usually most important to designers. I recommend using Digi-key’s free web tool SchemeIt for drawing a circuit diagram. They don’t have an RGB LED symbol, but you can make one out of 3 LED symbols (I’d use variant 1 for that).

Bonus: find an RGB LED that is common-anode, and do the same design exercise with it. (If Digi-Key’s search doesn’t turn up a part, try using Google.)

I did show them the prototype colorimeter I made over the weekend out of black foamcore, but did not have time to demo it. I was also going to demonstrate the use of vernier calipers to measure the cuvettes, but again ran out of time.  I’ll probably do a blog post about my first colorimeter prototype later this week, but I’ll need to get to bed early tonight, as I’m grading an elementary school science fair early tomorrow, and I’ve got a bad cold that is leaving me exhausted.  (I’ll have another science fair to judge Thursday morning, so this is not a good week for me to have a cold.)

2014 January 31

Biomed lab tours and online discussions

Filed under: freshman design seminar — gasstationwithoutpumps @ 09:22
Tags: , , , , ,

I forgot to type up notes after the sixth day of the freshman design seminar, because I had a meeting right afterwards.  I’ll try to make up the deficit now, two days later.

At the beginning of class I collected the homework (which had originally been due Monday, but which I had given an extension on, so that students could do it right).  I’ve not looked at it yet, but I could tell when I collected it that students had taken to heart the message to type up their homework and put some care into it.  I hope that spills over into their other classes—not only will it benefit them, but it will help our department if the bioengineering students get a reputation for being diligent and meticulous.

Most of the class time was spent on lab tours in the Biomed building, given by four grad students who work there.  The tours were good, providing students with some idea what sort of work was being done and what sort of equipment was available for doing the work.  They saw high-temperature incubators for hyperthermophiles, a glovebox for working with anaerobic organisms, a qPCR machine, an ultracentrifuge, a cell sorter, a large warm room (hardly being used—there was one shaker table with one flask, which would easily have fit in a benchtop incubator),  mammalian cell culture facilities, and a teaching microscope for mouse surgery.  (And other stuff that I won’t bother to list here.)

The whole Biomed building seems to be half empty and even the occupied lab bays have a huge amount of space per person, especially compared to the rather cramped labs stuffed with students and researchers that we saw in Baskin a couple of weeks ago, which makes it irksome that the University administration has been preventing our department from doing recruiting for wet-lab faculty for lack of lab space.  All the space is earmarked for growth in a different department, which would take them 10 years to fill (if they ever manage to do so).  The space planning on our campus seems to be done by turf wars between deans with no central rebalancing, and one dean (not ours) now holds all the empty space on campus.  Our dean has an unimproved warehouse 3 miles away which would cost millions to convert into anything usable, even if it made sense to exile active researchers from campus.

The lab tour ran a bit long, and half the class had to leave, but the other half got an interesting discussion about getting into research as an undergrad from a grad student who had been an undergrad here.

The e-mail mailing list for the class is still not serving its function of providing an out-of-class discussion space.  Only eight students have posted anything and no student has responded to another student.  The list is still useful for my making announcement (like when homework has been posted on the web site), but it isn’t working as a discussion forum.  I’m apparently not very good at creating online discussions—I’ve not gotten them to work in classes yet, and even this blog has 86 views for every comment (and 40% of those comments are mine, so the ratio is more like 144 views per external comment).

I looked for some stats on MOOC discussion groups, to see how my online discussion compares with classes that are only on-line.  I found a series of blog posts by Jeffrey Pomerantz where he analyzes the data for a MOOC course he is teaching.  The one about online discussions showed him getting 1787 posts and 707 comments in 8 weeks, for a class whose size was 27623 total registrants, 14130 active students,  9321 video viewers, 2938 who did one homework, or 1418 who completed the course (numbers from his post about course completion).  If we take the video viewers as the most realistic measure of the class size, we get about 3.3% of the students posting or commenting per week.  Maybe my 60% participation in one week is not as bad as I feared, even if it doesn’t have the feel of a discussion yet.

« Previous PageNext Page »

%d bloggers like this: