Gas station without pumps

2014 March 16

New phototransistor lab

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

 

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

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

2014 March 2

Colorimeter design—weird behavior

In Colorimeter design—almost working, I talked about the prototype colorimeter made out of foamcore, and the non-linear behavior of its phototransistor circuit. I suggested some possible reasons for the non-linearity, and I tried experiments this weekend to try to remove the problems.

The first thing I did was to remake the dilution series, with one drop of blue food dye in 10ml of distilled water for the highest concentration, then twofold serial dilution to get 1/2, 1/4, 1/8, 1/16, 1/32, 1/64, and 1/128, each in its own cuvette.

The next thing I did was to make a transimpedance amplifier (current-to-voltage converter), so that I could have a constant voltage across the phototransistor, even as the current changed. I also made it so that I could swap out the phototransistor and use a photodiode instead, to see if that gave me more linear behavior.

LED circuits and transimpedance amplifiers for phototransistor and photodiode. The phototransistor amplifier has a gain of 100kΩ, and the photodiode one a gain of 22.4MΩ.  Only the 627nm LED has been tested so far. Both are intended for differential (E20–E21) analog-to-digital conversion.

LED circuits and transimpedance amplifiers for phototransistor and photodiode. The phototransistor amplifier has a gain of 100kΩ, and the photodiode one a gain of 22.4MΩ. Only the 627nm LED has been tested so far.
Both are intended for differential (E20–E21) analog-to-digital conversion.

I have not yet managed to get full-scale range with the phototransistor—the 1/64 and 1/128 dilutions often come out having lower absorbance than the blank! I did manage to get some decent series with the photodiode:

I began and ended with a blank (distilled water only) cuvette.  The difference between the beginning and the ending values is fairly large (an absorbance of about 0.02), and probably reflects changes in alignment of the optical components, which are not very rigidly held by the foamcore.

I began and ended with a blank (distilled water only) cuvette. The difference between the beginning and the ending values is fairly large (an absorbance of about 0.02), and probably reflects changes in alignment of the optical components, which are not very rigidly held by the foamcore.

The high gain on the photodiode transimpedance amplifier causes another problem: 60Hz pickup from capacitive coupling. I get a 60Hz signal that is quite large compared to the DC signal I’m interested in. Adding a 0.022µF capacitor in parallel with the 5.9MΩ resistor got rid of most of the 60Hz noise (a corner frequency of about 1.2Hz). It may be better to use 0.01µF, for a corner frequency of 2.7Hz—that seems to work fairly well also, and may give a bit better time-domain response to changing absorbance.

My first calculation of the desired capacitor size was way off (what I get for doing it in my head instead of with a calculator).  Using only a 100pF capacitor did not reduce the 60Hz noise.

My first calculation of the desired capacitor size was way off (what I get for doing it in my head instead of with a calculator). Using only a 100pF capacitor did not reduce the 60Hz noise.

Adding a 0.022µF capacitor in parallel with the 5.6MΩ resistor did clean up the 60Hz noise.

Adding a 0.022µF capacitor in parallel with the 5.6MΩ resistor did clean up the 60Hz noise.

The values from three runs (no capacitor, 100pF, and 0.022µF) were monotonic (except for one or two measurements of 1/64 and 1/128), fairly consistent, and substantially larger than the error in the re-reading of the blank cuvette, so I tried plotting them against the relative concentration:

 Three different sets of measurements with the photodiode colorimeter. Ideally , the measured absorbance should be linear with the concentration, but I am getting a relationship that looks more like the square root of concentration!

Three different sets of measurements with the photodiode colorimeter. Ideally , the measured absorbance should be linear with the concentration, but I am getting a relationship that looks more like the square root of concentration!

I’ve been getting pretty frustrated with this design, as I have no idea where the non-linearity is coming from.  I’ve checked that both Beer’s Law and the current from a photodiode refer to the same measure of light intensity (W/cm2).

The non-repeatability of the measurements (which is probably due to changes in the light path from movement of the LED and photodiode) also limits the usefulness of this colorimeter.  If I could figure out was going wrong with the light measurement and conversion to absorbance, I could probably fix the changing light path by making a new holder out of sturdier materials—drilling 3mm holes in wood or aluminum is pretty simple.

I did try to do some debugging—the problem is not in the Freedom board or the software, as the voltages reported by the Freedom board are consistent with ones measured with a multimeter, and calculating absorbance from the multimeter measurements gives me the same numbers as the program on the Freedom board (within measurement errors).  The dilution series looks good—if I stack cuvettes,  1/2+1/4+1/8 is almost as dark as 1/1 (and similarly for other combinations).  That leaves only my understanding of how photodiode currents are generated and how transimpedance amplifiers convert current to voltage as potential failures (unless I’m missing something obvious).

2014 February 26

Colorimeter design—almost working

Filed under: freshman design seminar — gasstationwithoutpumps @ 00:34
Tags: , , , ,

Since my freshman design students did not show much interest in designing their own colorimeters, and my son has just gotten to the colorimetry labs in his online AP chemistry class, I decided to prototype my own colorimeter design.  (His AP lab relies on eyeballing the light through two columns of fluid and adjusting the length of the light path through one until the intensities seem to match—that’s a very low tech approach, but it seems rather tedious.)

I had made a prototype colorimeter out of black foamcore,which I mentioned in Seventh day of freshman design seminar. I’d meant to blog about it earlier, but I got a bad virus infection of some sort and was out of action for a while.  The prototype I’d made earlier was not very functional—it fit the cuvette tightly, but did not provide an easy way to remove the cuvette from the colorimeter.  I went through two more prototypes today that would allow me to remove the cuvette, but they looked like they would have bad light leaks.  I finally settled on a 4th design, that uses a separate lid, rather than trying to make a hinged lid.  I’ve included a PDF file that has the design for this version: Colorimeter-draft4.

I constructed the colorimeter by spray-gluing the pattern I made to the black foam core, then carefully cutting it out with a razor knife.  The dashed lines are cut only through the top layer of paper and part way through the foam—bending the foam core then snaps the rest of the foam and leaves the paper on the back as a hinge.  I used black electrical tape to hold the colorimeter together, and to block light from coming through the backs of the phototransistor and the LED.

Top view of the colorimeter with the lid in place.

Top view of the colorimeter with the lid in place.

Top view of the colorimeter with the lid off and the wings open to allow grasping the sides of the cuvette.

Top view of the colorimeter with the lid off and the wings open to allow grasping the sides of the cuvette.

I connected the LED through a current-limiting resistor to the 3.3v supply on the Freedom KL25Z board, and the phototransistor with a current-to-voltage resistor to E22. I actually ended up doing two different circuits, using different LEDs:

    I started with the circuit on the left, using a deep red LED that has a peak wavelength of 700nm. Later I switched to a different LED, with a peak wavelength of 627nm. In both cases, I picked the current-to-voltage resistor so that I got near full-scale readings on a blank cuvette.

I started with the circuit on the left, using a deep red LED that has a peak wavelength of 700nm. Later I switched to a different LED, with a peak wavelength of 627nm. In both cases, I picked the current-to-voltage resistor so that I got near full-scale readings on a blank cuvette.

When the KL25Z is reset, the analog-to-digital measurement on E20 is recorded as the intensity for the blank cuvette.  Then the transmittance (measurement/blank) and absorbance (–log10(transmittance)) are reported 10 times a second on the USB serial line.

With the 700nm LED, I could measure from A=0 to A=1.8 (with an opaque piece of foam core blocking the light). Light leakage around the cuvette and from the outside prevented me from measuring higher absorbancy.

The first thing we tried measuring was a solution of blue food coloring (blue dye #1). My son made a stock solution of 1 drop in 10 ml, and we measured the absorbance (with the 700nm LED) at about 0.0028, which seemed rather low to us. He then made a very concentrated solution with 5 drops in 5ml, which looked almost black to us, and the colorimeter reported it as having an absorbance of 0.157, which seemed absurd—that’s almost clear! We tried looking at the sky through the solution and noticed that the sky looked deep red through the blue. This lead me to suspect that the dye was transparent in the near IR where much of the light from the LED was concentrated.

When I switched to a 627nm LED, I had to use a larger current-to-voltage conversion resistor, as the phototransistor is less sensitive to those wavelengths. This meant that the noise level from light level was increased, and so an opaque object read as absorbance around 1. The stock solution read as 1, as did a 2-fold and 4-fold dilution. We went to a 40-fold dilution (so equivalent to 1 drop in 40ml) and got a reading of 0.637. From there, we started 2-fold dilutions:

dilution Absorbance at 627nm
1/40 0.637
1/80 0.407
1/160 0.230
1/320 0.139
1/640 0.0679
water 0.0040
1/1280 0.0380

I was worried that cuvette was stained by the dye, but putting in distilled water after the 1/640 dilution showed that any residual staining could only be contributing a small error.

Here is a plot of one run of the colorimeter:

The colorimeter is reset with a blank cuvette (filled with distilled water).  After a few seconds the blank is removed and the test cuvette is inserted.  After waiting about 20 seconds, it is removed and the blank re-inserted.  The absorbance is fit on the flat part in the middle.  Note that the colorimeter did not return exactly to 0 on this run.

The colorimeter is reset with a blank cuvette (filled with distilled water). After a few seconds the blank is removed and the test cuvette is inserted. After waiting about 20 seconds, it is removed and the blank re-inserted. The absorbance is fit on the flat part in the middle. Note that the colorimeter did not return exactly to 0 on this run.

The data from the run did not fit the straight line of Beer's Law.  It did fit a power-law curve, but the exponent is too low.

The data from the run did not fit the straight line of Beer’s Law. It did fit a power-law curve, but the exponent is too low.

I’m now trying to figure out why we did not get a good fit for Beer’s Law. Here are some possibilities:

  • The dilutions were not done accurately.  That would explain random fluctuations, but seems unlikely to give such a clean, consistent deviation from theory.
  • Beer’s Law doesn’t apply to this example.  That seems really, really unlikely, since this is the canonical experiment done by 1000s of students a year.
  • The colorimeter is not linear.  I’m relying on the phototransistor providing a current proportional to light intensity, even though the voltage across the phototransistor varies.  I think that this is likely to be the problem.  To check it, we’d have to redo the experiment with a different circuit—probably a transimpedance amplifier to do the current-to-voltage conversion.

Unfortunately, my son did not keep all the serial dilutions, so to test a different colorimeter circuit I’d have to make a new series.  I might do that this weekend if I have time.  At least I know what stock concentration to start with—about one drop of food color in 25ml of distilled water.

I’m also interested in trying the colorimeter design with an RGB LED, so that we could try different wavelengths—perhaps doing a Beer’s Law test with yellow food coloring.

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 Serial.read() 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”.

Next Page »

The Rubric Theme. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 260 other followers

%d bloggers like this: