# Gas station without pumps

## 2021 June 21

### Controlling current

Filed under: Circuits course — gasstationwithoutpumps @ 11:06
Tags: , , ,

In the electrode lab this year, students had even more trouble than usual in understanding that the the goal was to provide a constant current to the silver-wire electrodes for a measured time period, in order to produce a known amount of AgCl on the anode.  I will have to rewrite that section of the book for greater clarity.  I also plan to add a circuit that does the constant-current control for them, so that they don’t have to adjust the voltage to get the desired current (a concept that seems to have eluded many of them).

Here is a possible circuit:

This circuit provides a current from Ip to Im of Vri/Rsense, as long as the voltage and current limitations of the op amp are not exceeded.

The negative-feedback loop tries to bring the $I_m$ output to the voltage of the $V_{\rm ri}$ input, which is only possible if the current through the sense resistor is $I=V_{\rm ri}/R_{\rm sense}$.  Let’s say that we want 1mA from Ip to Im—then we would set $V_{\rm ri}= (1\,mA) R_{\rm sense} = (1\,mA)(100\Omega) = 100\,mV$.  If $V_{\rm rail}$ is 5V and the op amp is a rail-to-rail op amp, then we could get the desired 1ma of output as long as the load resistance from Ip to Im is less than 4900Ω (well, 4650Ω really, because of the internal resistance of the op amp).  With a higher load resistance, the voltage at Ip would hit the top rail and still not provide the desired current.  There is no lower limit to the load resistance—even with a short circuit the current would be the desired 1mA.

I chose 100Ω for the sense resistor, so that the control voltages do not get too close to the bottom rail, while leaving enough voltage range for fairly large load resistances.  By using 100Ω, it is possible to specify currents up to 50mA, which is beyond the capability of the op amp to supply.  Since the MCP6004 op amps have a short-circuit current of about 20mA with a 5V supply, about the most we can deliver is 14mA for a short-circuit load, because of the internal resistance of the op amp.

Using a 1kΩ resistor might also be reasonable, since the input voltage in volts would then specify the current in mA, but a 1mA output current would limit the voltage across the output ports to $V_{\rm rail} -1\,V$ (which is probably still fine for the electrode lab). With a 1kΩ resistor and a 5V supply, the maximum specifiable current would be 5mA, and the maximum obtainable is about 4mA.  If you needed 2V across the load, then you could not specify more than 2.4mA (still plenty for the electrode lab).

For the electrode lab, the currents required are low enough that this circuit is adequate, but what if we needed more current?  Here are a couple of circuits that can provide that:

By using a pFET, we can have the voltage output of the op amp control the current. No current is needed from the op amp, and we just need that Vrail is large enough that the pFET can be fully turned on.

If we use a PNP transistor, then we need to turn the voltage output of the op amp into a current for the base.  That current is about 1/50th or 1/100th of the collector current being controlled (depending on the transistor).

Both these designs have the positive and negative inputs of the op amp reversed from the low-current design, because the pFET or PNP transistor provides a negation—the voltage at Im rises as the voltage at the output of the op amp falls.  I reduced to the sense resistor to 10Ω, to allow specifying higher currents (up to 500mA for a 5V supply).  The main limitations on this design are the thermal limitations of the transistor and the resistor—there may be both a large voltage drop and a large current.  The worst case for the transistor is when the load is a short circuit and the voltage at Im is half the power-supply voltage—then the power dissipated in the transistor (and in the sense resistor) is $(V_{\rm rail}/2)^2/10\Omega$.  For a 400mW limitation on the transistor, we would want to limit $V_{\rm rail}$ to 4V.  For a ¼W resistor, we would want to limit $V_{\rm ri}$ to 1.58V (specifying 158mA), or up the resistor to 100Ω for a 5V limit (but then we could only specify up to 50mA).  We really need a 2.5W resistor if we want to have 10Ω and a 5V supply and use the full range.

For the book, I think I’ll just present the low-current version of the current control—we don’t need the high-current version, and students are likely to request too much current for the electroplating if they have it available (errors in computing the area of the electrodes that are off by a factor of 100 are pretty common—mixing up $({\rm mm})^2$ and $({\rm cm})^2$, for example).

## 2014 April 25

### Ag/AgCl electrode lab went fairly well

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

Today’s electrode lab also went fairly well.  Most of the students finished on time (or nearly), though  I stayed an hour late with the singleton student—this is a lab that goes much faster if one student records data while the other reads the meters, so I again served as meter-reader for him after everyone else had left.

The group that was working the fastest today—at least 40 minutes ahead of every other group—was embarassed when I noticed that they had connected up the probes wrong on one of the multimeters, so that the voltage measurements they had been taking on that meter were just noise from floating wires. This group was the one I expected the best work from, but by not checking their wiring carefully, they went from being the fastest group to the slowest one.  I think they did make up the time and still finish on time, redoing all the measurements.

The 1 liter of each salt solution was barely enough for 5 groups for the stainless steel and Ag/AgCl electrodes.  I think that next year I’ll want 150ml per student, to be sure of having enough. I’ll probably also switch to 1M, 0.1M, 0.001M, and tap water, reducing the measurements from 5 sets to 4 sets. I wish that there were an easy way to automate the measurements, as the frequency adjustment and data reading is fairly tedious.

I spent most of this evening catching up on my e-mail and writing the quiz for tomorrow’s class.I’ll have to get in somewhat early tomorrow, to get copies of the exam printed before class.

I won’t have much free time tomorrow, as I have my weekly office hours, and tomorrow is the deadline for students declaring majors. I’ve had a steady stream of students in my office for the past couple of weeks, but I suspect that there will be a lot of people who just figure that they can drop in at the last moment.  They’ll be out of luck, because I have 4 students scheduled for half hour slots, filling my 2 office hours.

## 2012 November 20

### Holder for Ag/AgCl electrodes

Filed under: Circuits course — gasstationwithoutpumps @ 16:41
Tags: , , , , , , ,

Holder for wires, to be laser cut from acrylic. The red lines are cut lines, the black ones are just engraved. The black lines are 1cm apart, and are intended for immersing the wires to a consistent depth.

Prototype holder laser cut from acrylic, with two loops of wire in the intended positions. (Note: this is 24-gauge brass wire, not sliver wire, as I’ve not yet had time to buy fine-silver wire.)

Over the weekend I designed a holder for silver wires for making and characterizing Ag/AgCl electrodes

Yesterday, I got a few minutes of assistance from a grad student from Gabriel Elkaim’s lab to cut the design out of a scrap of ¼” acrylic I had sitting around.

The picture to the left shows the new design, and the one to the right what the actual design looks like.  A silver wire is wound around one ear, through the “armpit”, and back up to the same ear, where it is wound again. Alligator clips can be clamped on the wires at the ears, to make the transition from silver to copper wires.

The left and right wires are parallel, about 2cm apart, and can be dipped to a depth of 1cm, 2cm, or 3cm (immersing 2cm, 4cm, or 6cm of wire on each side).  The feet and body are narrow enough to stand on the bottom of a standard 10 oz. clear plastic cup, and the alligator clips can be tilted to support the holder by resting against the top rim of the cup. We could probably even support the holder on the alligator clips, to adjust the depth.

I drew the design with Inkscape, but the laser cutter did not interpret the Inkscape SVG correctly, so I used the DXF output format from Inkscape to give to the laser cutter.
I’ll make a dozen of these for the lab, but for the final design I’ll make two modifications: I’ll engrave a face on holder (just for fun) and I’ll have the acrylic supported on blocks in the laser cutter, so that we don’t get the sloppy burn and melt marks on the back from the support grid.

## 2012 November 18

### New holder design for Ag/AgCl electrodes

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

Holder for wires, to be laser cut from acrylic. The red lines are cut lines, the black ones are just etched. The black lines are 1cm apart, and are intended for immersing the wires to a consistent depth.

I mentioned in Making Ag/AgCl electrodes that I was not really happy with the holder I had made for 18-gauge silver wires for Ag/AgCl electrodes.  I spent some more time thinking about the problem and came up with a different design, using 24-gauge fine silver wires.

The picture to the right shows the new design.  A silver wire is wound around one ear, through the “armpit”, and back up to the same ear, where it is wound again. Alligator clips can be clamped on the wires at the ears, to make the transition from silver to copper wires. The left and right wires will be parallel, 2cm apart, and can be dipped to a depth of 1cm, 2cm, or 3cm (immersing 2cm, 4cm, or 6cm of wire on each side).  The feet and body are narrow enough to fit in a standard 10 oz. clear plastic cup.  I envision using the holder by winding the wire, resting the holder on the bottom of the cup, and carefully pouring in liquid to the desired fill level.

The picture is derived from the SVG file that I plan to send to the laser cutter to cut a holder out of acrylic (wordpress.com doesn’t allow me to upload SVG files).  In the original SVG file, the thickness and color of the lines indicates which lines are to be used for cutting and which for etching—I had to fatten the lines a lot to make them visible in the PNG file, as “cutting” is signaled by red lines ≤0.001″ wide, which would be far less than a pixel in the PNG file.

I drew the outline with Inkscape, but the conversion to PNG was rather awkward as Inkscape’s conversion to PNG was awful for such thin lines.  I ended up putting out PDF from Inkscape, using Photoshop Elements to rasterize the PDF, then using blurring and level changing to get fat lines.

I’ve never used a laser cutter, so I’ve sent e-mail to the Mechatronics instructor whose classes use the laser cutter, in hopes that he can provide an undergrad to walk me through it the first time.  I also hope they have some scraps of acrylic that I can cut out one prototype from, to see if the notches work well enough.

Testing the prototype will probably be done with copper wire, since I don’t have 24-gauge silver wire, and it will take a while to get some.  If it works ok with copper wire, I’ll go ahead and order the silver wire, get some ¼” acrylic and cut out a dozen holders for the lab (plus a couple of spares in case someone breaks one).

## 2012 September 6

### Making Ag/AgCl electrodes

Filed under: Circuits course — gasstationwithoutpumps @ 12:11
Tags: , , , , ,

I mentioned in  Better measurement of conductivity of saline solution that I would try buying fine sliver wire and making Ag/AgCl electrodes, either with bleach or by electroplating on chloride from salt water. In Measuring Ag/AgCl electrodes, I described a simpler technique of sticking two Ag/AgCl gel electrodes I had for the EKG lab face-to-face.  That worked well, but I ended with the thought “Putting small Ag/AgCl electrodes into a saline solution, however, might have quite a different effect, where the resistance of the electrodes plays a more substantial role in the electronic behavior of the system. So maybe I do still need to order some silver wire and make my own Ag/AgCl electrodes (either by bleaching or by electroplating).”

Two pieces of fine silver wire clipped into slots on the sides of the 1″ diameter cup.

So I did buy some 18-gauge fine silver wire from FusionBeads.com, and I tried making a holder for it, since fine silver is so soft. My first thought was to make some sort of plastic clip to hold the wires a fixed distance apart that I could dip into saline solution, but I did not come up with anything for that yet. My second thought was to make the holder and the cup be the same item. I drilled a 1″ hole part way through a cutting board with a Forstner bit, and cut two slits in it with a hack saw to hold the wire. (I did this almost two weeks ago, but just got around to testing the holder today—I suppose I feared that it wouldn’t work.)

The wire can be pressed firmly into the slots and stays there well—I can even pick up the whole assembly by either wire. Unfortunately, water does not stay in the cup but wicks through the slot and slowly siphons out.  While I can get water to stay in long enough that I could probably do electroplating, this device would be too likely to cause problems in the electronics lab, with salt water getting all over the place.  Even though both Steve and I agree on the need for secondary containment for both the water baths of the thermistor lab and the salt solution for the electrode lab, I’d prefer a system that doesn’t leak.

I then tried using the same piece of plastic to hold the wires, realigning the wires so that they are flush on one side and both come out the other side. I could then dangle this from clip leads in a cup of salt water, very similar to the way the stainless steel electrodes were used. If we used a smaller silver wire (say 24 gauge, instead of 18 gauge), then the students could wrap it easily around a framework that has a couple of notches for spacing, rather than clipping the wires into slots. I think that would be easier to manage, and the wire would be a bit cheaper (1/4 the price per foot).

Warner Instruments recommends electroplating for about a minute at 1mA/cm2 of surface area. Since the 18-gauge wire has a diameter of 0.1024 cm (according to Wikipedia’s table of AWG wire gauges) or 0.10 cm with my calipers, if I immerse it 3.5 cm deep in saline solution, each electrode would have an area of 1.1 cm2, and so need about 1.1mA of current.  They recommend either using normal saline solution (a 0.9%  or 0.154M NaCl solution, about the same osmolarity as blood, and so commonly found in hospitals) or 1M KCl.  I suspect that any sufficiently large chloride concentration would do.

I used a 5V battery pack (4 NiMH cells), a variable resistor, and an ammeter to make my current source.  I adjusted the resistor until I got about 1.2 mA through the electrode in a 1M NaCl solution (it turned out to be about 2.6kΩ).  The electrode gradually darkened, but it took more like 3 minutes to get a fairly uniform coating, rather than 1 minute.  One important point—I had handled the wire a lot, and so it had finger grease on it, which resulted in a mottled plating after 1 minute. Wiping the wires off with a paper towel and continuing the plating resulted in a much more uniform plating. Students should be warned to clean the electrode before electroplating.

For characterizing the electrodes, I did the same electronic setup as before, with a sine wave driving the electrodes in series with a resistor.  I used a 10.0Ω resistor this time, since I expected low resistance for the high-concentration saline solution, and I didn’t want the voltage drop across the electrodes to get too small to measure.

Resistance of electrodes as a function of frequency for three different salt concentrations. The variation with frequency is much larger for high salt concentrations.

The frequency dependence is much lower than for the polarizable stainless steel electrodes, and doesn’t fit the R2+(C1||R1) model well.

Because the frequency dependence is much higher for large salt concentrations, I think that students should be instructed to do this lab with 1M NaCl. If they have time, they can repeat it at lower concentrations. Only at the highest frequencies is the conductance proportional to the concentration. With the Agilent multimeters in the lab, the students should be able to go up to 1MHz, but my ancient handheld Fluke meter doesn’t do true RMS AC at those frequencies. I’d be interested to see what happens at higher frequencies—does the power law continue?. (Actually the Agilent meter is only spec’ed up to 300kHz, but there is an implication in a footnote that the it can handle up to 1MHz with somewhat higher error.)

I’m curious about what causes the frequency dependence, and why the exponent on the power law changes with the concentration.

Next Page »