Gas station without pumps

2015 March 18

Freshman design projects moderately successful

I just finished grading this year’s freshman design projects. I think that the projects were more successful this year than last year, in part because I kept the students focussed on electronics and programming (for which they had lab access and which I could help them debug), and in part because the projects were somewhat less ambitious.

There were two groups doing EKGs and 4 groups doing blood pressure meters.  Both EKG groups managed to demonstrate their projects working, as did one of the blood-pressure groups.  (I’m being fairly generous here about what “working” means—they had to get their electronics to work, capture the data, and plot the waveforms, but further interpretation or software was not required.)  The other three blood pressure groups did not manage to demonstrate their projects, but one of them managed to plot waveforms for the pressure measurements (without getting their high-pass filter and amplifier working for the pulse measurements).

Some things I learned for next year:

  • Tell the students what op amp to get.  A number of students picked op amps that turned out to be rather old-fashioned ones with very low input impedance (as low as 2MΩ), rather limited output ranges, and external nulling circuits. The cheap MCP6002 or MCP6004 chips would have worked better at lower cost.  In fact, I gave one group that seemed to have a good schematic (but couldn’t get their circuit to work) an MCP6002 chip, which they wired in place of the op amp they had been using, and their circuit worked immediately.  I would have done the same for other groups, but the others with poorly chosen op amps were about a week behind and did not have circuits that were that close to being functional.
  • Warn students sooner not to use FedEx.  My son’s and my experience with FedEx this year has been that they are ludicrously slow. At least one group was burned by a ridiculously long delivery time, having ordered with FedEx delivery just hours before I warned the class about them.  (The US Post Office is faster and cheaper for lightweight electronics orders from Digi-Key.)
  • Students who never ask questions in class probably don’t understand much that is going on—all the groups that successfully demonstrated their projects had at least one active participant in class.
  • Students who fail to turn in their progress report are almost certainly not going to complete the project on time—I need to be more assertive in getting them moving and demanding that they show me their schematics.  Almost everyone had errors in their schematics on their first design (and one of the successful groups went through 4 incorrect designs before getting to one that worked).  Students that are afraid to show me incorrect or incomplete work don’t get the feedback they need to correct the problems—I need to normalize errors more and insist on seeing stuff, even if it is wrong.
  • The MXP5050DP pressure sensors are very easy for students to use, though a bit pricey at $16 each.  The built-in amplifier makes doing pressure measurements with an Arduino fairly trivial (hook up the three wires of the sensor to A0, +5V, and GND).  They were a good choice for the freshman design seminar, though I’ll continue to use MPX2053DP sensors without an integrated amplifier for the applied circuits class—that assignment is intended to get students to design with an instrumentation amp and to understand a bit about strain gauges.
  • Get the students to plot stuff earlier in the quarter. One group tried installing gnuplot on a Mac in the lab in the last few hours, which did not go well for them.  They did eventually find a plotting program that they could install and run, but then did not have time to run the data they collected through the filtering program I’d written for the class.  Their signals were pretty clean, though, and the plots they produced were good even with just the RC high-pass filter in their amplifier, without digital filtering.
  • The students seemed (for the most part) pretty excited about the projects—even those whose projects didn’t quite work seem to have gotten a lot out of the lab times.  I should look in a couple of years to see how many have stuck with engineering majors (I suspect that some might switch to computer science or computer engineering, rather than sticking with bioengineering, but that’s ok).

2014 July 18

How to sell a widget

SparkFun has a tutorial on how to sell “widgets” through them at How to Sell Your Widget on SparkFun – Learn.SFE:

Have an awesome electronic widget that you want to get to market? Great! We are always listening for new ideas from our customers and the community. We get many inquires on this topic, so read this tutorial carefully to keep your product pitch from getting lost in the shuffle.

We’re lucky, here at SparkFun, to have an amazingly creative and talented group of customers. Not only can they identify gaps in the catalogs of electronics suppliers, they can create a gizmo that fills that hole. But, going beyond a prototype or even a limited-quantity production run, often the hardest task in getting your world-altering product out there is producing, marketing, and/or selling it to the masses. That’s where we come into the picture.

The advice there is seems fairly reasonable.  They offer a choice of two models: make it yourself and have them sell for you, or have them make it and pay you royalties.  They tell you how to pitch products to them and how to design for them to be able to manufacture stuff.  Most of the stuff they sell is PCB boards, so they give quite a bit of advice about PCB design to fit their pipeline—they use Eagle, but ‘All parts are placed on a 0.005″ grid. If possible, use a .05″ grid.’ That must get irritating with modern parts that are convenient round metric numbers, not mils.   They also want version numbers in the bottom copper, which is reasonable for some designs, but not all.  They also encourage people to use their Eagle libraries, but my son and I have found their pad layouts to be very sloppy (putting silkscreen over SMD layers, getting the keep-out areas off by a little bit, not fixing the fonts on the “>NAME” and “>VALUE” labels to meet their own requirements, and so forth).

Still, it is good that they put out their design rules and provide clear guidelines to new designers.

I’ve thought a few times about putting out some of my designs through SparkFun or Adafruit Industries—perhaps an improved version of the blinky EKG as a kit.  SparkFun now sells EKG electrodes and snap leads for them, and even have a heart-rate monitor board (based on the AD8232 chip) and the “BITalino” biomedical board, so I suspect that they are interested in the market.

The BITalino is outrageously expensive and their EKG electrodes are about 3 times the price of buying them at Amazon, but the AD8232 chip actually looks like a nice one for building an EKG front-end and reasonably priced, so I’m not sure they’d have much interest in a through-hole part kit for do-it-yourself EKG that isn’t quite as good, unless it could be sold very cheaply or as an educational product (which is what the blinky EKG is aimed at, anyway).

I have some other ideas for products that I might be marketable, but I don’t know whether I have the time to refine them to the point of pitching them to SparkFun.  I can justify some time spent on doing electronics as a hobby, some as necessary learning for teaching my applied electronics course for bioengineers, and some as engineering-for-manufacture experience (something I never had any instruction in, despite my years as an engineering professor). But when the electronics work starts cutting into the time I need to spend on writing my book, teaching my classes, or doing collaborative research with other faculty, then I have to draw the line.  I’ve also got a lot of administrative responsibilities now (undergrad director and faculty adviser for two BS degrees, Program Chair for bioengineering, and Vice Chair for the Biomolecular Engineering Department), so writing time and research time have gotten doubly precious.

I do have one project this summer that I’m going to try to get fabricated for me—it is all SMD parts, including some that are hard to solder by hand (pads under the chips), so I don’t want to do it myself.  The project also calls for a lot of identical boards (20 to 50 of them), so a prototyping house seems like the way to go.

I’m looking currently at Smart Prototyping to do the PC board fabrication and assembly—they may not be the cheapest, but they have a comprehensible pricing scheme on their website, and they replied within 12 hours of my request for a quote. They also have a nearly turnkey system—I send them the Gerber files and the Bill of Materials (BOM), and they’ll make the boards, buy the parts, and assemble the boards.  They’ll even test them for an additional charge, though these boards are simple enough that I can test them myself at about 5 seconds a board, so their testing would not be worthwhile unless they guaranteed their assembly (which none of the prototype houses can afford to do with untested designs).

I also considered Elecrow, which has a similar service, but their pricing information on the web page is rather vague: “For BGA or IC with pads under IC, The quotation will be a little higher.” and “We will give a discount for the PCB assembly service according the some factors (assembly time,Hard or Easy to assemble or requirements etc.).” I prefer sites that have clear pricing even if it is slightly higher, so that there are no surprises. I suppose I could ask Elecrow for a quote and see if they respond as promptly as Smart Prototyping did.

Incidentally, my design does not follow all SparkFun’s guidelines—for one thing, I placed parts on a 0.5mm grid, not a 0.005″ gird, and the board is not rectangular.  Still, if the design I’m working on turns out well, I might pitch it to them, as I see some potential for it appealing to the open-source hardware market, and the violations of their design guidelines made good sense for this application.  Note: I’m deliberately not saying what the design is—I’ll reveal it once I’ve gotten a working prototype, when I’ve decided whether I want to commercialize it or not.

2014 July 6

Battery connectors

Filed under: Uncategorized — gasstationwithoutpumps @ 02:32
Tags: , , , , , , , ,

I spent a little time today working on my book, but I got side tracked into a different project for the day: designing a super-cheap coin-cell battery connector. I’ve used coin-cell battery holders before, like on the blinky EKG board, where I used a BH800S for 2 20mm CR2032 lithium cells. That battery holder is fairly large and costs over $1—even in 1000s it costs 70¢ a piece. So I was trying to come up with a way to make a dirt cheap coin-cell holder.

The inspiration came from the little LED lights that “glovers” use inside their gloves. They are powered by two CR1620 batteries (that means a 16mm diameter and 2.0mm thickness for the battery). Because the lights have to be made very cheaply, they don’t use an expensive holder, but put the negative side of the batteries directly against a large copper pad on the PC board. The batteries are held in place by the positive contact, which is a piece of springy metal pressing the battery against the board—and each manufacturer seems to have a slightly different variant on how the clip is made.

Unfortunately, I was unable to find any suppliers who sold the little clips—though I found several companies that make battery contacts, it seems that most are custom orders.

My first thought was to bend a little clip out of some stainless steel wire I have sitting around (not the 1/8″ welding rod, but 18-gauge 1.02362mm wire). That’s about the same thickness as a paperclip (which is made out of either 18-gauge or 19-gauge wire), but the stainless steel is stiffer and less fatigue-prone than paperclips. I was a little worried about whether stainless steel was solderable, so I looked it up on Wikipedia, which has an article of solderability. Sure enough, stainless steel is very hard to solder (the chromium oxides have to be removed, and that takes some really nasty fluxes that you don’t want near your electronics). So scratch that idea.

I spent some time looking around the web at what materials do get used for battery contacts—it seems there are three main ones: music wire, phosphor bronze, and beryllium copper, roughly in order of price. Music wire is steel wire, which gets nickel plated for making electrical connections. It is cheap, stiff, and easily formed, but its conductivity is not so great, though the nickel plating helps with that. The nickel oxides that form require a sliding contact to scrape off to make good electrical connection. Phosphor bronze is a better conductor, but may need plating to avoid galvanic corrosion with the nickel-plated battery surfaces. Most of the contacts I saw on the glover lights seemed to have been stamped out of phosphor bronze. Beryllium copper is a premium material (used in military and medical devices), as it has a really good ratio of yield strength to Young’s modulus, so it can be cycled many times without failing, but also has good conductivity.

Since I don’t have metal stamping machinery in my house, but I do have pliers and vise-grips, I decided to see if I could design a clip out of wire. It is possible to order small quantities of nickel-plated music wire on the web. For example, pianoparts.com sells several different sizes, from 0.1524mm diameter to 0.6604mm diameter. I may even be able to get some locally at a music store.

My first design was entirely seat-of-the-pants guessing:

First clip design, using 19-guage wire, with two 1mm holes in PC board to accept the wire.

First clip design, using 19-gauge wire, with two 1mm holes in PC board to accept the wire. This design is intended for two CR1620 batteries.

The idea was to have a large sliding contact that made it fairly easy to slide the batteries in, but then held them snugly. Having a rounded contact on the clip avoids scratching the batteries but can (I hope) provide a fair amount of normal force to hold the batteries in place. But how much force is needed?

I had a very hard time finding specifications on how hard batteries should be held by their contacts. Eventually I found a data sheet for a coin battery holder that specified “Spring pressure: 50g min. initial contact force at positive and negative terminals”. Aside from referring to force as pressure and then using units of mass, this data sheet gave me a clear indication that I wanted at least 0.5N of force on my contacts.

I found another battery holder manufacturer that gave a tiny graph in one of their advertising blurbs that showed a range of 100g–250g (again using units of mass). This suggests 1N-2.5N of contact force.

Another way of getting at the force needed is to look at how much friction is needed to hold the batteries in place and what the coefficient of friction is for nickel-on-nickel sliding. The most violently I would shake something is how fast I can shake my fingertips with a loose wrist—about 4Hz with an peak-to-peak amplitude of 22cm, which would be a peak acceleration of about 70 m/s^2. Two CR1620 cells weigh about 2.5±0.1g (based on different estimates from the web), so the force they need to resist is only about 0.2N. Nickel-on-nickel friction can have a coefficient as low as 0.53 (from the Engineering Toolbox), so I’d want a normal force of at least 0.4N. That’s in the same ballpark as the information I got from the battery holder specs.

So how stiff does the wire have to be? I specified a 0.2mm deflection, so I’d need at least 2N/mm as the spring constant for the contact, and I might want as high as 10N/mm for a really firm hold on the batteries.

So how should I compute the stiffness of the contact? I’ve never done mechanical engineering, and never had a statics class, but I can Google formulas like any one else—I found a formula for the bending of a cantilever loaded at the end:
\frac{F}{d} = \frac{3 E I}{L^{3}}, where F is force, d is deflection, E is Young’s modulus, I is “area moment of inertia”, and L is the length of the beam. More Googling got me the area moment of inertia of a circular beam of radius r as \frac{\pi}{4} r^{4}. So if I use the 0.912mm wire with an 8mm beam I have
F/d = 200E-6 mm E.

More Googling got me some typical values of Young’s modulus:

material E [MPa = N/(mm)^2]
phosphor bronze 120E3
beryllium copper 135E3
music wire 207E3

If I used 19-gauge phosphor bronze, I’d have about 24N/mm, which is way more than my highest desired value of 10N/mm. Working backwards from 2–10N/mm what wire gauge would I need? I get a diameter of 0.403mm to 0.603mm, which would be #6 (0.4064mm), #7 (0.4572mm), #8 (0.5080mm), #9 (0.5588mm), or #10 (0.6096mm), on the pianoparts.com site. I noticed that battery contact maker in Georgia claims to stock 0.5mm and 0.6mm music wire for making battery contacts, though they first give the sizes as 0.020″ and 0.024″, so I think that these are actually 0.5080mm and 0.6096mm (#8 and #10) music wire.

It seems that using #8 (0.020″, 0.5080mm) nickel-plated music wire would be an appropriate material for making the contacts. Note that the loop design actually results in two cantilevers, each with a stiffness of about 4N/mm, resulting in a retention force of about 1.6N. The design could be tweaked to get different contact forces, by changing how much deflection is needed to accommodate the batteries.

How much tweaking might be needed?  I found the official specs for battery sizes (with tolerances) in IEC standard 60086 part 2: The thickness for a 1620 is 1.8mm–2mm, the diameter is 15.7mm–16mm, and the negative contact must be at least 5mm in diameter.  The standard also calls for them to take an average of 675 hours to discharge down to 2v through a 30kΩ resistor (that’s about 56mAH, if the voltage drops linearly, 67mAH if the voltage drops suddenly at the end of the discharge time).  If the batteries can legally be as thin as 1.8mm, then to get a displacement of 0.2mm, I’d need the zero-point for the contacts to be only 3.4mm from the PC board, not 3.8mm, and full thickness batteries would provide a displacement of 0.6mm, and a retention force of about 4.8N.

If I were to do a clip for a single CR2032 battery, I’d need to have a zero-point 2.8mm from the board, to provide 0.2mm of displacement for the minimum 3.0mm battery thickness.

So now all I need to do is get some music wire and see if I can bend it by hand precisely enough to make prototype clips.  I’d probably change the spacing between the holes to be 0.3″ (7.62mm), so that I could test the clip on one of my existing PC boards.

Update 2014 July 6: I need to put an insulator on the verticals (heat shrink tubing?), or the top battery will be shorted out, since the side of the lower battery is exposed.

 

2014 June 29

Soldered EKG from op amps

Filed under: Circuits course — gasstationwithoutpumps @ 20:34
Tags: , , , , , ,

Today I decided to solder the EKG design from Instrumentation amp from op amps fine for EKG onto one of my instrumentation amp protoboards, leaving out the instrumentation amp chip—I wanted to see how much trouble it would be.  As it turned out, the build was fairly straightforward, but a little tedious. There are only dedicated spaces for 8 resistors on the board, but there are 9 resistors in the design I used, so one had to go elsewhere on the board.  I deliberately left out the low-pass filter on this implementation (eliminating one capacitor), which did not make a huge difference—I ended up with about 58µV peak-to-peak of 60Hz noise on my input signal (compared to about 40µV in the previous design with a capacitor for low-pass filtering), which is fairly small compared to the 870µV R spike or the 220µV T wave.  The 60Hz interference was large enough to interfere with the P wave and make it difficult to see whether or not there was a U wave.  Of course, these measurements were made in my bedroom/lab, which has a lot less 60Hz interference than the lab the students work in.  I’ll have to take the board into work and see how bad the interference is in that space.

Using a digital filter to remove the 60Hz noise reduced the 60Hz interference to under 100nV peak-to-peak (way lower than other noise components), producing very nice waveforms, even when sampling at 360 Hz.  I’ll probably want to include a digital filter Python script in the book so that people can see the cleaned up signals, even if there isn’t room in the course to design digital filters.

I still have to decide whether to have students do the EKG amplifier without the INA126P chip, using only op amps. Wiring up the bigger circuit takes time, and I’m not sure that 6 hours of lab will be enough time for students to debug their design and get it soldered—it took them long enough to solder the EKG with the INA126P chip, which has fewer components and fewer wires to route.  It took me quite a while to solder up the board, so it would probably take the students far too long.  Is the pedagogic value of designing and building a 2-op-amp instrumentation amp worth the time? I do want the students to end up with an EKG to take home, as it is a tangible artifact that can demo the function of.  I’m thinking that I could even drop the soldering of the pressure-sensor amp (since they don’t take home pressure sensors), and add soldering of the microphone pre-amp.  If I do that, I’ll probably want to redesign the protoboard again, making it an op-amp protoboard with no instrumentation amp slot, but with more resistor spaces.

Cutting one part that costs about $2.70 and the $1.90 thermometer might justify my switching back to the resistor assortment I used in Winter 2013:  1120 piece resistor assortment for $17.39 instead of 1280 piece resistor assortment (currently $10.65) without raising the lab fee.  Why would I want fewer resistors at a higher price? The 1120-piece assortment is 10 each of 112 values, while the 1280-piece assortment is 20 each of 64 values.  Also the 64 values don’t seem to be very repeatable from set to set, and some sets has duplicates (so only 62 or 63 different values).  The 112-value sets seem more reliably useful.  A hobbyist might be better off going one step further to the 3700-piece resistor assortment (25 each of 148 values), but I can’t justify the $31.48 price for my class. (The extra $14 would probably raise the lab fee.)

 

2014 June 26

Instrumentation amp from op amps fine for EKG

Filed under: Circuits course — gasstationwithoutpumps @ 22:55
Tags: , , , , ,

As I mentioned in Instrumentation amp from op amps still fails, I’ve been trying to decide whether to have students build an instrumentation amp out of op amps in the circuits course.  I decided that it wouldn’t work for the pressure-sensor lab, because of the large DC offset.  One could calibrate each amplifier, either in software (by recording a a few seconds of 0 pressure difference, and subtracting a constant fit to that region from the data) or in hardware, but I’d rather they had a more straightforward experience where the DC offset was small enough to be ignored.

I conjectured that instrumentation amp built from discrete op amps would work ok for the EKG lab, though, as the EKG already has to deal with much larger input voltage offsets due to differing electrode-skin contact.  So I added a second stage  with a gain of 81 to the instrumentation amp in the previous post with a gain of 19, to get a combined gain of 1539.  I put in the high-pass filter needed to eliminate the DC offset, and a low-pass filter to reduce noise slightly (and make aliasing less of a problem).  The corner frequency is a bit high (60Hz noise is not going to be reduced much), but that may allow a better view of the fast R spike in the EKG waveform.

    The EKG circuit has four modules: a virtual ground (here set to 0.5v), an instrumentation amp, a high-pass filter to eliminate DC bias, and a second-stage non-inverting amplifier with some low-pass filtering.

The EKG circuit has four modules: a virtual ground (here set to 0.5v), an instrumentation amp, a high-pass filter to eliminate DC bias, and a second-stage non-inverting amplifier with some low-pass filtering.

The amplifier worked surprisingly well. I did sometimes have trouble with 60Hz noise, but it did not seem to be any worse than the amplifier based on the INA126P. I can remove the noise by digital filtering, though I’ve only played with that by post-processing the data files, not by designing a notch filter to run in realtime on the KL25Z (something to do when I have more time).

Here are a few traces made with EKG circuit above, feeding into the PTE20-PTE21 differential input on the KL25Z board, recorded using PteroDAQ.

This is lead I, without filtering, showing a rather disturbingly large 60Hz noise signal.

This is lead I (LA–RA), without filtering, showing a rather disturbingly large 60Hz noise signal.

This is lead I (LA-RA), showing how the digital filter cleans up the signal. This was Bessel bandpass filtered to 0.3Hz to 100Hz, followed by notch 57Hz–63Hz, followed by notch 117Hz–123Hz. Each filter was a 5th-order Bessel filter, applied first forward in time then backward in time (using scipy's filtfilt function).

This is lead I (LA–RA), showing how the digital filter cleans up the signal. This was Bessel bandpass filtered to 0.3Hz to 100Hz, followed by notch 57Hz–63Hz, followed by notch 117Hz–123Hz. Each filter was a 5th-order Bessel filter, applied first forward in time then backward in time (using scipy’s filtfilt function).

This is lead II (LL-RA), which for some reason had rather low noise even without filtering.

This is lead II (LL–RA), which for some reason had rather low noise even without filtering.

I noticed that sampling at 360Hz allowed me to see a bit more of the structure of the S and T complex than I’ve seen previously, particularly in lead II, and I can even make out a little bump of a U wave just after the T wave.

I now have to decide whether to have students do the EKG amplifier without an INA126P chip, using only op amps. The design will be fairly heavily constrained, as they’ll need to get it all working on a single MCP6004 chip, but it will justify my spending a bit more time on how instrumentation amps work.

I may redesign the blinky EKG to use a single MCP6004 chip also, which would reduce the price of that substantially.

Next Page »

The Rubric Theme. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 309 other followers

%d bloggers like this: