Posts with «phototransistor» label

DIY Puff-Suck Interface Aims for Faster Text Input

Puff and Suck (or Sip and Puff) systems allow people with little to no arm mobility to more easily interact with computers by using a straw-like unit as an input device. [Ana] tells us that the usual way these devices are used to input text involves a screen-based keyboard; a cursor is moved to a letter using some method (joystick, mouse emulator, buttons, or eye tracking) and that letter is selected with a sip or puff into a tube.

[Ana] saw such systems as effective and intuitive to use, but also limited in speed because there’s only so fast that one can select letters one at a time. That led to trying a new method; one that requires a bit more work on the user’s part, but the reward is faster text entry. The Puff-Suck Interface for Fast Text Input turns a hollow plastic disk and a rubber diaphragm into bipolar pressure switch, able to detect three states: suck, puff, and idle. The unit works by having an IR emitter and receiver pair on each side of a diaphragm (one half of which is shown in the image above). When air is blown into or sucked out of the unit, the diaphragm moves and physically blocks one or the other emitter-receiver pair. The resulting signals are interpreted by an attached Arduino.

How does this enable faster text input? By throwing out the usual “screen keyboard” interface and using Morse code, with puffs as dots and sucks as dashes. The project then acts as a kind of Morse code keyboard. It does require skill on the user’s part, but the reward is much faster text entry. The idea got selected as a finalist in the Human-Computer Interface Challenge portion of the 2018 Hackaday Prize!

Morse code may seem like a strange throwback to some, but not only does the bipolar nature of [Ana]’s puff-suck switch closely resemble that of Morse code input paddles, it’s also easy to learn. Morse code is far from dead; we have pages of projects and news showing its involvement in everything from whimsical projects to solving serious communication needs.

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. 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.)


Filed under: freshman design seminar Tagged: Arduino, bioengineering, colorimeter, engineering education, photodiode, phototransistor

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. 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.)


Filed under: freshman design seminar Tagged: Arduino, bioengineering, colorimeter, engineering education, photodiode, phototransistor

Sixth day of freshman design seminar

Today I went into class with a long list of things to get done, but didn’t quite get to all of them:

  • Feedback on first homework.
  • Look at data sheets together.
  • Get class consensus on resistor values from homework due today.
  • Demo the Arduino Data Logger with the phototransistor and photodiode.
  • Discuss next homework (designing a colorimeter).
  • Start talking about Arduino programming.

The feedback on the homework went pretty much as planned.  I told them that the homework was not graded, but that I had both individual and general feedback on it.  Here is a summary of the general feedback:

  • College homework should be typed.  Professors expect it, even if they never say so.  The one exception is math homework, and I recommend to students that they learn LaTeX and typeset even their math.
  • Homework should always be stapled, not loose sheets, which get separated and lost.
  • Hand-drawn pictures are ok for this class (and many other classes), but I strongly recommend learning to use a drawing tool.  Adobe Illustrator is a popular one for those who have money, but Inkscape is an adequate tool for 2D diagrams and is free, though its user interface is rather clunky.  For more professional engineering drawings, I believe that AutoCAD has a free (or very low-cost) version for students. Sketchup and Blender are popular free tools for 3D modeling.  For schematic capture, I now use DigiKey’s SchemeIt, which I demoed briefly for the students (after having some trouble with the wireless connection in the room—I’ll have to check to see whether there is a live DHCP port by the projector cable in the room).
  • Most students added little to what we did in class. I pointed out that K–12 teachers mainly wanted them to spit back what they had been told, but that college professors were usually looking for added value—stuff from reading outside class or from original design.
  • I pointed out the importance of vocabulary (“diffraction” vs. “refraction”, “focus” vs. “collimate”) and of getting the right physical phenomena (Bragg’s Law for diffraction gratings, Snell’s Law and optical dispersion for prisms).  I told them to read the Wikipedia article on optical dispersion, so that they could understand the complexity of determining the wavelength-to-refraction-angle transformation, which is highly dependent on the material the prism is made of.
  • I also suggested that just dumping factoids (like the Bragg’s Law formula) on the paper without explaining the connection to the design didn’t really buy them much.
  • I pointed out the difficult design problem I had given them (300nm–700nm) with a diffraction grating would result in the second diffraction of 350nm at the same location as the first diffraction spot for 700nm—to handle both one would need two optical filters: one for the long wavelength, one for the short.  Even if we limit the range we’re interested in (say to 400nm–700nm), we’d still need a filter, since the sensor would still detect the 2nd-order 350nm spot, even though we weren’t interested in it.
  • I showed a couple of designs for a collimator (a lens and a slit, or a pair of slits on either end of a black tube) and explained why collimation was needed for a spectrometer (none of them had included a collimator).

The feedback took about the amount of time I expected, and I think I managed to communicate the problems without crushing anyone’s egos.  I was careful to tell them that I was not grading them on the homework, but providing feedback for them to do better later on things that would count—particularly that other faculty would often have these expectations of them without ever articulating them.  This freshman class is intended in part to help the students adapt to the college culture in a low-stakes environment.

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!

We then looked at the WP3DP3BT phototransistor data sheet together.  First, I explained the mechanical drawing (dimensions in mm, the diameter sign , the two different ways that the case indicates which lead is which—both the flat and the shorter lead indicating the collector). This prompted a question about the naming of the collector and emitter (since it seemed strange to them that the collector went to the power lead and the emitter to the resistor), so I briefly explained that it was a NPN transistor, that the N’s stood for negative doping resulting in an excess of electrons as charge carriers, and that the emitter emitted the electrons and the collector collected them. I don’t know if that helped anyone.

I then asked the students what they needed help understanding for the numeric part of the data sheet. We ended up talking about 5 of the 7 parameters provided, covering a lot of different things (like that nA stood for nanoamps, not “not available”—a confusion I had not anticipated). I briefly went over milli-, micro-, nano- and explained that engineers preferred using those prefixes to expressing powers of 10, so that the prefer to express the dark current as 100nA, rather than 10-7A. Some scientific calculators provide engineering notation, in which only multiples of 3 are used as the power of 10, and the numbers are between 1 and 999.999999… .

I had to explain the difference between collector-to-emitter and emitter-to-collector voltages, and show the current vs. VCE curve with the two breakdowns. We talked a bit about the saturation voltage (0.8V with an irradiance of 20mW/cm2 and a current of 2mA). I’m not sure I understand that specification that well myself—it mainly tells me that we want to stay well below a 2mA current.

I asked the students for their resistance values from their homework, expecting some fairly random values that would reveal different misunderstandings. What I had not expected is that most of the class had nothing—not even a guess—at the resistance. I would have expected them to ask questions on the class e-mail list if they didn’t understand, but the notion of asking each other (or a faculty member) for help still seems completely foreign to them.

So we spent some time going over how to interpret the on-state collector current: 0.2 nA at an irradiance of 1mW/cm2 of 940nm light. I then had the look for more information that was given in the question, which no one had in front of them:

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.

Eventually someone figured out that we wanted a 5v output to correspond to 204.8μW/cm2. I asked what current that irradiance produced. Note that this is a simple linear scaling of the 0.2 nA at an irradiance of 1mW/cm2. It took several minutes for them to do this on their calculators, and several tries before the class agreed on a value (luckily the right one). Now that they had a voltage and a current, I asked them for the resistance that was needed. One student quickly mentioned Ohm’s law, and they set about doing the division. It took them a couple of minutes to do this division on their calculators, and then most of them got it wrong (getting values in the µΩ range!).  Eventually they managed to converge to 122.1kΩ, after almost settling on 12.2kΩ, but what I had expected to be a 30–60-second computation for computing the resistance had taken 10–15 minutes.  The arithmetic and algebra skills of college freshmen are even lower than I had feared.

I showed them a chart of standard resistance values and helped them round to 120kΩ.  I showed them a 120kΩ resistor and measured it with a multimeter to make sure I had the right resistor.  I passed around an Arduino board and a breadboard and explained the point of ther breadboard. I hooked the resistor up in series with the phototransistor (on a pre-prepared breadboard) and used the Arduino data logger to show them the voltage changing as I covered and uncovered the phototransistor. (Next year I should probably reduce the sensitivity they are requested to match to 0.1µW/cm2 per step, as the classroom light was bright enough to move the voltage almost full scale.)

Class had been over officially by 10 minutes at this point (the first time I looked at my watch), so I gave each student a cuvette and asked them to look up what a colorimeter was and design one around the cuvette.

We still need to discuss the photodiode resistance value (I’ll see if anyone figures it out by Wednesday, when I’ve asked them to turn in the homework for real).  We have lab tours on Wednesday, though, so there won’t be time to discuss colorimeters before they design them.  I hope they have the sense to read about them on Wikipedia or the many web sites that give high school labs using them. The actual assignment was

By Mon 2014 Feb 3, design a colorimeter around the cuvette you picked up in class. Your design report should describe the function of the device, explain how it works, have a detailed drawing (with dimensions) of it, have a materials list of what is needed to build it, and give instructions for using it. If there are any computer components, an outline of the needed software should be included also.


Filed under: freshman design seminar Tagged: Arduino, bioengineering, colorimeter, engineering education, homework, photodiode, phototransistor

Sixth day of freshman design seminar

Today I went into class with a long list of things to get done, but didn’t quite get to all of them:

  • Feedback on first homework.
  • Look at data sheets together.
  • Get class consensus on resistor values from homework due today.
  • Demo the Arduino Data Logger with the phototransistor and photodiode.
  • Discuss next homework (designing a colorimeter).
  • Start talking about Arduino programming.

The feedback on the homework went pretty much as planned.  I told them that the homework was not graded, but that I had both individual and general feedback on it.  Here is a summary of the general feedback:

  • College homework should be typed.  Professors expect it, even if they never say so.  The one exception is math homework, and I recommend to students that they learn LaTeX and typeset even their math.
  • Homework should always be stapled, not loose sheets, which get separated and lost.
  • Hand-drawn pictures are ok for this class (and many other classes), but I strongly recommend learning to use a drawing tool.  Adobe Illustrator is a popular one for those who have money, but Inkscape is an adequate tool for 2D diagrams and is free, though its user interface is rather clunky.  For more professional engineering drawings, I believe that AutoCAD has a free (or very low-cost) version for students. Sketchup and Blender are popular free tools for 3D modeling.  For schematic capture, I now use DigiKey’s SchemeIt, which I demoed briefly for the students (after having some trouble with the wireless connection in the room—I’ll have to check to see whether there is a live DHCP port by the projector cable in the room).
  • Most students added little to what we did in class. I pointed out that K–12 teachers mainly wanted them to spit back what they had been told, but that college professors were usually looking for added value—stuff from reading outside class or from original design.
  • I pointed out the importance of vocabulary (“diffraction” vs. “refraction”, “focus” vs. “collimate”) and of getting the right physical phenomena (Bragg’s Law for diffraction gratings, Snell’s Law and optical dispersion for prisms).  I told them to read the Wikipedia article on optical dispersion, so that they could understand the complexity of determining the wavelength-to-refraction-angle transformation, which is highly dependent on the material the prism is made of.
  • I also suggested that just dumping factoids (like the Bragg’s Law formula) on the paper without explaining the connection to the design didn’t really buy them much.
  • I pointed out the difficult design problem I had given them (300nm–700nm) with a diffraction grating would result in the second diffraction of 350nm at the same location as the first diffraction spot for 700nm—to handle both one would need two optical filters: one for the long wavelength, one for the short.  Even if we limit the range we’re interested in (say to 400nm–700nm), we’d still need a filter, since the sensor would still detect the 2nd-order 350nm spot, even though we weren’t interested in it.
  • I showed a couple of designs for a collimator (a lens and a slit, or a pair of slits on either end of a black tube) and explained why collimation was needed for a spectrometer (none of them had included a collimator).

The feedback took about the amount of time I expected, and I think I managed to communicate the problems without crushing anyone’s egos.  I was careful to tell them that I was not grading them on the homework, but providing feedback for them to do better later on things that would count—particularly that other faculty would often have these expectations of them without ever articulating them.  This freshman class is intended in part to help the students adapt to the college culture in a low-stakes environment.

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!

We then looked at the WP3DP3BT phototransistor data sheet together.  First, I explained the mechanical drawing (dimensions in mm, the diameter sign , the two different ways that the case indicates which lead is which—both the flat and the shorter lead indicating the collector). This prompted a question about the naming of the collector and emitter (since it seemed strange to them that the collector went to the power lead and the emitter to the resistor), so I briefly explained that it was a NPN transistor, that the N’s stood for negative doping resulting in an excess of electrons as charge carriers, and that the emitter emitted the electrons and the collector collected them. I don’t know if that helped anyone.

I then asked the students what they needed help understanding for the numeric part of the data sheet. We ended up talking about 5 of the 7 parameters provided, covering a lot of different things (like that nA stood for nanoamps, not “not available”—a confusion I had not anticipated). I briefly went over milli-, micro-, nano- and explained that engineers preferred using those prefixes to expressing powers of 10, so that the prefer to express the dark current as 100nA, rather than 10-7A. Some scientific calculators provide engineering notation, in which only multiples of 3 are used as the power of 10, and the numbers are between 1 and 999.999999… .

I had to explain the difference between collector-to-emitter and emitter-to-collector voltages, and show the current vs. VCE curve with the two breakdowns. We talked a bit about the saturation voltage (0.8V with an irradiance of 20mW/cm2 and a current of 2mA). I’m not sure I understand that specification that well myself—it mainly tells me that we want to stay well below a 2mA current.

I asked the students for their resistance values from their homework, expecting some fairly random values that would reveal different misunderstandings. What I had not expected is that most of the class had nothing—not even a guess—at the resistance. I would have expected them to ask questions on the class e-mail list if they didn’t understand, but the notion of asking each other (or a faculty member) for help still seems completely foreign to them.

So we spent some time going over how to interpret the on-state collector current: 0.2 nA at an irradiance of 1mW/cm2 of 940nm light. I then had the look for more information that was given in the question, which no one had in front of them:

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.

Eventually someone figured out that we wanted a 5v output to correspond to 204.8μW/cm2. I asked what current that irradiance produced. Note that this is a simple linear scaling of the 0.2 nA at an irradiance of 1mW/cm2. It took several minutes for them to do this on their calculators, and several tries before the class agreed on a value (luckily the right one). Now that they had a voltage and a current, I asked them for the resistance that was needed. One student quickly mentioned Ohm’s law, and they set about doing the division. It took them a couple of minutes to do this division on their calculators, and then most of them got it wrong (getting values in the µΩ range!).  Eventually they managed to converge to 122.1kΩ, after almost settling on 12.2kΩ, but what I had expected to be a 30–60-second computation for computing the resistance had taken 10–15 minutes.  The arithmetic and algebra skills of college freshmen are even lower than I had feared.

I showed them a chart of standard resistance values and helped them round to 120kΩ.  I showed them a 120kΩ resistor and measured it with a multimeter to make sure I had the right resistor.  I passed around an Arduino board and a breadboard and explained the point of ther breadboard. I hooked the resistor up in series with the phototransistor (on a pre-prepared breadboard) and used the Arduino data logger to show them the voltage changing as I covered and uncovered the phototransistor. (Next year I should probably reduce the sensitivity they are requested to match to 0.1µW/cm2 per step, as the classroom light was bright enough to move the voltage almost full scale.)

Class had been over officially by 10 minutes at this point (the first time I looked at my watch), so I gave each student a cuvette and asked them to look up what a colorimeter was and design one around the cuvette.

We still need to discuss the photodiode resistance value (I’ll see if anyone figures it out by Wednesday, when I’ve asked them to turn in the homework for real).  We have lab tours on Wednesday, though, so there won’t be time to discuss colorimeters before they design them.  I hope they have the sense to read about them on Wikipedia or the many web sites that give high school labs using them. The actual assignment was

By Mon 2014 Feb 3, design a colorimeter around the cuvette you picked up in class. Your design report should describe the function of the device, explain how it works, have a detailed drawing (with dimensions) of it, have a materials list of what is needed to build it, and give instructions for using it. If there are any computer components, an outline of the needed software should be included also.


Filed under: freshman design seminar Tagged: Arduino, bioengineering, colorimeter, engineering education, homework, photodiode, phototransistor

Actual homework on data sheets and photodetectors

To save people the trouble of finding the homework on the class web page, I’ve copied the assignment that I mentioned in Fifth day of freshman design seminar here:

  • By Thursday night, 2014 Jan 23, e-mail your photospectrometer design to the class e-mail list, so that everyone can share the designs.
  • 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.)Update 2014 Feb 6: Q1 is intended to be an NPN phototransistor, not PNP as shown here!
    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.

  • Before Monday 2014 Feb 3, get an Arduino board (I recommend Uno Rev 3, but any ATMega Arduino board should do), install Arduino software (more instructions in the Getting started guide), and start doing some of the on-line tutorials.

Filed under: freshman design seminar Tagged: Arduino, bioengineering, engineering education, homework, photodiode, phototransistor

Actual homework on data sheets and photodetectors

To save people the trouble of finding the homework on the class web page, I’ve copied the assignment that I mentioned in Fifth day of freshman design seminar here:

  • By Thursday night, 2014 Jan 23, e-mail your photospectrometer design to the class e-mail list, so that everyone can share the designs.
  • 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.)Update 2014 Feb 6: Q1 is intended to be an NPN phototransistor, not PNP as shown here!
    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.

  • Before Monday 2014 Feb 3, get an Arduino board (I recommend Uno Rev 3, but any ATMega Arduino board should do), install Arduino software (more instructions in the Getting started guide), and start doing some of the on-line tutorials.

Filed under: freshman design seminar Tagged: Arduino, bioengineering, engineering education, homework, photodiode, phototransistor

Fifth day of freshman design seminar

Today we continued the design exercise I started last week (see also 4th class) designing a photospectrometer.

I started the class by collecting the work I had asked them to do on fleshing out the design of the photospectrometer, which I have not read yet.  Just glancing at the pile, it looks like most wrote very little, and just drew a picture of the components we talked about in class, not adding much. I’ll know more about the class once I’ve had a chance to look at what they did more carefully.  I have asked them to mail their work to the class e-mail list by tomorrow night, so that the rest of the class can see what everyone has done.

I then told them that we’d do some electronics and computer programming, since many of them had requested that on the first-day survey, and that we’d use Arduino boards to do that learning.  I suggested that they get Arduino Uno Rev 3 boards as being the current standard (about $30), but told them that almost any Arduino board that used an ATMega processor would be fine—the older boards, like a Uno that is not Rev 3, are often half the price.  They can probably get the boards from the University through BELS (the lab support group for the engineering labs), but it might be cheaper on line.

I then asked them for some details that they had added to the photospectrometer design.  The first one to come up was the photodetector, so we started talking about different photodetectors. They came up with photodiode, photomultiplier, and photocell, to which I added phototransistor and photoresistor.  I asked them what sort of characteristics might be important to a photodetector, and (with some prompting) got them to come up with the ideas of sensitivity and which wavelengths the detector was sensitive to.

One student came up with “resolution” for the sensor, and I took that as an opportunity for a digression into the differences between accuracy, precision, and resolution.  I also talked about resolution being a property of the whole system (how many digits were in the numbers), but that there was a property of sensors that was related—how much noise they had. Sometime later in the class (I forget exactly when), I talked about Arduinos having a 10-bit analog-to-digital converter, and asked them to guess what that meant.  The only guess was that it meant that there were 10 different levels.  I was actually fairly pleased with this answer, as it got to the notion of resolution, and I could correct it from 10 to 210 without making anyone feel stupid. I told them that they should remember 210=1024, as that was a frequently used “magic” number in computers.

I quickly sketched rough sensitivity plots for phototransistors/photodiodes and photoresistors, and explained that that was why photoresistors were used as ambient light sensors—because of how they matched human visual sensitivity.  I also mentioned the slowness of photoresistors and said that they weren’t used for much for other applications.

I told them how to find datasheets—either by Googling “photodiode data sheet” or by doing a search on Digi-key, choosing the cheapest part that seemed to do what they want, and looking up its data sheet.  I assigned them the task of finding and trying to read a photodiode and a phototransistor data sheet.  I’ll make that more explicit on the class web page later tonight.  I’ll probably give them a part number for one, and make them look for the other from just a description.

I showed them the schematic symbol for a phototransistor (though, unfortunately, not for a photodiode), but I didn’t attempt to explain how it works.  I just told them that the current through the phototransistor was proportional to the light intensity as long as voltage across the transistor was at least 0.7v.  (I’ll have to tell them where to find that information on the data sheet.)  I also mentioned the notion of “dark current”, which prevents the phototransistor from getting down to 0 current.

I then tried to get them to figure out how to convert the current into a voltage that could be measured by the Arduino.  After a few tries, one of them finally remembered Ohm’s Law (V=IR), and they decided they needed a resistance.  I told them that there were fairly constant resistance devices available (called “resistors”) and mentioned the notions of resistor tolerance and that resistors had thermal coefficients, so that the resistance changed as a function of temperature.

I then gave them the phototransistor circuit below (though not the photodiode circuit):

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!

We then spent a fairly long time before they figured out that they needed to know what value resistor to use in the circuit. I got them (eventually) to the point where they realized that the maximum light intensity determined the maximum current, and if we set the maximum voltage to be as high as possible while keeping the transistor properly biased, the desired resistor was determined by R=Vmax/Imax. I showed them how increasing the value of R made the circuit more sensitive, but that if we made R too big the circuit would not be able to handle high light intensity.

We then looked at the overall spectrometer design, and saw how the optics coupled everything together: the brightness of the light, the absorbance of the sample, the efficiency of the monochromator, and the sensitivity of the photodetector. I introduced the notion of interface specifications, so that design problems could be divided up among a team, and the need for negotiating changes to the interface specs rather than just “throwing problems over the fence” for some other part of the team to solve. I gave the example of the lamp designer finding out that the initial spec called for an expensive, bright light (like and HID bulb) but being able to reduce the cost and power enormously with a somewhat less bright LED. The change to the spec might be accommodated by shortening the optical path in the sample (but that would need non-standard cuvettes) or by making the light sensor more sensitive (which is pretty cheap to do).

We ran out of time then, so did not get to looking at any other parts of the design.

Some of the students were amazed at how much thinking went into just one little detail of the design (one resistor value). They are used to big-picture, fuzzy thinking, where getting the general idea is what is important, and are not used to sweating the details. Part of getting them to “think like engineers” is getting them to realize that the details do matter.

For homework, I’ll ask them to figure out good values for R1 and R2 for particular parts (or maybe for one part that I specify and one that they choose), based on the data sheets and some light spec. In class on Monday, I’ll build the design they specified, and we’ll test it with the Arduino data logger.  If I happen to pick a bad resistor choice, either because I gave them a bad light intensity to design for or because their math was wrong, we’ll get bad results, and I’ll show them how to debug the design and iteratively improve it.


Filed under: freshman design seminar Tagged: Arduino, bioengineering, engineering education, photodiode, phototransistor, spectrometer, spectrophotometer, spectroscope

Fifth day of freshman design seminar

Today we continued the design exercise I started last week (see also 4th class) designing a photospectrometer.

I started the class by collecting the work I had asked them to do on fleshing out the design of the photospectrometer, which I have not read yet.  Just glancing at the pile, it looks like most wrote very little, and just drew a picture of the components we talked about in class, not adding much. I’ll know more about the class once I’ve had a chance to look at what they did more carefully.  I have asked them to mail their work to the class e-mail list by tomorrow night, so that the rest of the class can see what everyone has done.

I then told them that we’d do some electronics and computer programming, since many of them had requested that on the first-day survey, and that we’d use Arduino boards to do that learning.  I suggested that they get Arduino Uno Rev 3 boards as being the current standard (about $30), but told them that almost any Arduino board that used an ATMega processor would be fine—the older boards, like a Uno that is not Rev 3, are often half the price.  They can probably get the boards from the University through BELS (the lab support group for the engineering labs), but it might be cheaper on line.

I then asked them for some details that they had added to the photospectrometer design.  The first one to come up was the photodetector, so we started talking about different photodetectors. They came up with photodiode, photomultiplier, and photocell, to which I added phototransistor and photoresistor.  I asked them what sort of characteristics might be important to a photodetector, and (with some prompting) got them to come up with the ideas of sensitivity and which wavelengths the detector was sensitive to.

One student came up with “resolution” for the sensor, and I took that as an opportunity for a digression into the differences between accuracy, precision, and resolution.  I also talked about resolution being a property of the whole system (how many digits were in the numbers), but that there was a property of sensors that was related—how much noise they had. Sometime later in the class (I forget exactly when), I talked about Arduinos having a 10-bit analog-to-digital converter, and asked them to guess what that meant.  The only guess was that it meant that there were 10 different levels.  I was actually fairly pleased with this answer, as it got to the notion of resolution, and I could correct it from 10 to 210 without making anyone feel stupid. I told them that they should remember 210=1024, as that was a frequently used “magic” number in computers.

I quickly sketched rough sensitivity plots for phototransistors/photodiodes and photoresistors, and explained that that was why photoresistors were used as ambient light sensors—because of how they matched human visual sensitivity.  I also mentioned the slowness of photoresistors and said that they weren’t used for much for other applications.

I told them how to find datasheets—either by Googling “photodiode data sheet” or by doing a search on Digi-key, choosing the cheapest part that seemed to do what they want, and looking up its data sheet.  I assigned them the task of finding and trying to read a photodiode and a phototransistor data sheet.  I’ll make that more explicit on the class web page later tonight.  I’ll probably give them a part number for one, and make them look for the other from just a description.

I showed them the schematic symbol for a phototransistor (though, unfortunately, not for a photodiode), but I didn’t attempt to explain how it works.  I just told them that the current through the phototransistor was proportional to the light intensity as long as voltage across the transistor was at least 0.7v.  (I’ll have to tell them where to find that information on the data sheet.)  I also mentioned the notion of “dark current”, which prevents the phototransistor from getting down to 0 current.

I then tried to get them to figure out how to convert the current into a voltage that could be measured by the Arduino.  After a few tries, one of them finally remembered Ohm’s Law (V=IR), and they decided they needed a resistance.  I told them that there were fairly constant resistance devices available (called “resistors”) and mentioned the notions of resistor tolerance and that resistors had thermal coefficients, so that the resistance changed as a function of temperature.

I then gave them the phototransistor circuit below (though not the photodiode circuit):

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!

We then spent a fairly long time before they figured out that they needed to know what value resistor to use in the circuit. I got them (eventually) to the point where they realized that the maximum light intensity determined the maximum current, and if we set the maximum voltage to be as high as possible while keeping the transistor properly biased, the desired resistor was determined by R=Vmax/Imax. I showed them how increasing the value of R made the circuit more sensitive, but that if we made R too big the circuit would not be able to handle high light intensity.

We then looked at the overall spectrometer design, and saw how the optics coupled everything together: the brightness of the light, the absorbance of the sample, the efficiency of the monochromator, and the sensitivity of the photodetector. I introduced the notion of interface specifications, so that design problems could be divided up among a team, and the need for negotiating changes to the interface specs rather than just “throwing problems over the fence” for some other part of the team to solve. I gave the example of the lamp designer finding out that the initial spec called for an expensive, bright light (like and HID bulb) but being able to reduce the cost and power enormously with a somewhat less bright LED. The change to the spec might be accommodated by shortening the optical path in the sample (but that would need non-standard cuvettes) or by making the light sensor more sensitive (which is pretty cheap to do).

We ran out of time then, so did not get to looking at any other parts of the design.

Some of the students were amazed at how much thinking went into just one little detail of the design (one resistor value). They are used to big-picture, fuzzy thinking, where getting the general idea is what is important, and are not used to sweating the details. Part of getting them to “think like engineers” is getting them to realize that the details do matter.

For homework, I’ll ask them to figure out good values for R1 and R2 for particular parts (or maybe for one part that I specify and one that they choose), based on the data sheets and some light spec. In class on Monday, I’ll build the design they specified, and we’ll test it with the Arduino data logger.  If I happen to pick a bad resistor choice, either because I gave them a bad light intensity to design for or because their math was wrong, we’ll get bad results, and I’ll show them how to debug the design and iteratively improve it.


Filed under: freshman design seminar Tagged: Arduino, bioengineering, engineering education, photodiode, phototransistor, spectrometer, spectrophotometer, spectroscope

Failed attempt at pulse oximeter

In Optical pulse monitor with little electronics  and Digital filters for pulse monitor, I developed an optical pulse monitor using an IR emitter, a phototransistor, 2 resistors, and an Arduino.  On Thursday, I decided to try to extend this to a pulse oximeter, by adding a red LED (and current-limiting resistor) as well.  Because excluding ambient light is so important, I decided to build a mount for everything out of a block of wood:

Short piece of 2×2 wood, with a 3/4″ diameter hole drilled with a Forstner bit partway through the block. Two 1/8″ holes drilled for 3mm LEDs on top, and one for a 3mm phototransistor on the bottom (lined up with the red LED). Wiring channels were cut with the same 1/8″ drill bit, and opened up a with a round riffler. Electrical tape holds the LEDs and phototransistor in place (removed here to expose the diodes).

My first test with the new setup was disappointing.  The signal from the IR LED swamped out the signal from the red LED, being at least 4 times as large. The RC discharge curves for the phototransistor for the IR signal was slow enough that I would have had to go to a very low sampling rate to see the red LED signal without interference from the discharge from the IR pulse.  I could reduce the signal for the IR LED to only twice the red output by increasing the IR current-limiting resistor to 1.5kΩ, and reduce the RC time constant of the phototransistor by reducing the pulldown resistor for it to 100kΩ The reduction in the output of the IR LED and decreased sensitivity of the phototransistor made about a 17-fold reduction in the amplitude of the IR signal, and the red signal was about a thirtieth of what I’d previously been getting for the IR signal.  Since the variation in amplitude that made up my real signal was about 10 counts before, it is substantially less than 1 count now, and is  too small to be detected even with the digital filters that I used.

I could probably solve this problem of a small signal by switching from the Arduino to the KL25Z, since going from a 10-bit ADC to a 16-bit ADC would allow a 64 times larger signal-to-noise ratio (that is, +36dB), getting me back to enough signal to be detectable even with the reductions..  I’ve ordered headers from Digi-Key for the KL25Z, so next week I’ll be able to test this.

I did do something very stupid yesterday, though in a misguided attempt to fix the problem.  I had another red LED (WP710A10ID) that was listed on the spec sheet as being much brighter than the one I’d been using (WP3A8HD), so I soldered it in.  The LED was clearly much brighter, but when I put my finger in the sensor, I got almost no red signal!  What went wrong?

A moment’s thought explained the problem to me (I just wish I had done that thinking BEFORE soldering in the LED).  Why was the new LED brighter for the same current?  It wasn’t that the LED was more efficient at generating photons, but that the wavelength of the light was shorter, and so the eye was more sensitive to it.

Spectrum of the WP3A8HD red LED that I first used. It has a peak at 700nm and dominant wavelength at 660nm. I believe that the “dominant wavelength” refers to the peak of the spectrum multiplied by the sensitivity of the human eye.  Spectrum copied from Kingbright preliminary specification for WP3A8HD.

Spectrum of the WP710A10ID brighter red LED that didn’t work for me. The peak is at 627nm and the “dominant wavelength” is 617nm. The extra brightness is coming from this shorter wavelength, where the human eye is more sensitive. Image copied from the Kingbright spec sheet.

1931 CIE luminosity curve, representing a standardized sensitivity of the human eye with bright lighting (photopic vision). The peak is at 555nm. Note that there are better estimates of human eye sensitivity now available (see the discussion of newer ones in the Wikipedia article on the Luminosity function).
Image copied from Wikipedia.

The new LED is brighter, because the human eye is more sensitive to its shorter wavelength, but the optimum sensitivity of the phototransistor is at longer wavelengths, so the phototransistor is less sensitive to the new LED than to the old one.

Typical spectral sensitivity of a silicon photodiode or phototransistor. This curve does not take into account any absorption losses in the packaging of the part, which can substantially change the response. Note that the peak sensitivity is in the infrared, around 950nm, not in the green around 555nm as with the human eye. Unfortunately, Kingbright does not publish a spectral sensitivity curve for their WP3DP3B phototransistor, so this image is a generic one copied from https://upload.wikimedia.org/wikipedia/commons/4/41/Response_silicon_photodiode.svg

This sensitivity is much better matched to the IR emitter (WP710A10F3C) than to either of the red LEDs:

Spectrum for the WP710A10F3C IR emitter, copied from the Kingbright spec sheet. The peak is at 940nm with a 50nm bandwidth. There is no “dominant wavelength”, because essentially all the emissions are outside the range of the human eye.

Furthermore, blood and flesh is more opaque at the shorter wavelength, so I had more light absorbed and less sensitivity in the detector, making for a much smaller signal.

Scott Prahl’s estimate of oxyhemoglobin and deoxyhemoglobin molar extinction coefficients, copied from http://omlc.ogi.edu/spectra/hemoglobin/summary.gif
Tabulated values are available at http://omlc.ogi.edu/spectra/hemoglobin/summary.html and general discussion at http://omlc.ogi.edu/spectra/hemoglobin/
The higher the curve here the less light is transmitted. Note that 700nm has very low absorption (290), but 627nm has over twice as high an absorption (683).  Also notice that in the infrared

I had to go back to the red LED (WP3A8HD) that I started with. Here is an example of the waveform I get with that LED, dropping the sampling rate to 10Hz:

The green waveform is the voltage driving the red LED and through a 100Ω resistor. The red LED is on for the 1/30th of second that the output is low, then the IR LED is on (through a 1.5kΩ resistor) for 1/30th of a second, then both are off. THe yellow trace shows the voltage at the phototransistor emitter with a 680kΩ pulldown.
This signal seems to have too little amplitude for the variation to be detected with the Arduino (the scale is 1v/division with 0v at the bottom of the grid).

I can try increasing the signal by using 2 or more red LEDs (though the amount of current needed gets large), or I could turn down the IR signal to match the red signal and use an amplifier to get a big enough signal for the Arduino to read.  Sometimes it seems like a 4.7kΩ resistor on the IR emitter matches the output, and sometimes there is still much more IR signal received, depending on which finger I use and how I hold it in the device.

I was thinking of playing with some amplification, but I could only get a gain of about 8, and even then I’d be risking saturation of the amplifier.  I think I’ll wait until the headers come and I can try the KL25Z board—the gain of 64 from the higher resolution ADC is likely to be more useful.  If that isn’t enough, I can try adding gain also.  I could also eliminate the “off-state” and just amplify the difference between IR illumination and red illumination.  I wonder if that will let me detect the pulse, though.


Filed under: Circuits course, freshman design seminar Tagged: Arduino, biquad filter, digital filter, IIR filter, IR emitter, LED, phototransistor, pulse, pulse monitor, pulse oximeter