Gas station without pumps

2013 July 4

Blinky EKG hard to debug

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

I’ve been having a frustrating couple of days trying to debug the Blinky EKG.  It worked when I first built it, but every time I’ve tried to demo it, the demo has failed, and I couldn’t get it working even at home on Tuesday.  I have another, very similar EKG circuit that I built on my instrumentation amp protoboard, which has worked fine every time I’ve tried to use it.

There are a few differences between the circuits (the blinky EKG is battery powered, for example, has an LED load on the final output, and has a trimpot for adjusting the gain of the second stage), but none that explain to me the difference in performance.

On Tuesday my experiments were limited to hooking up one or the other of the EKG boards and using an oscilloscope or Arduino data logger to observe the outputs or various internal signals.  Using the EKG board that worked convinced me that the EKG electrodes were providing a good 1mV signal (that had been a problem in the circuits course, as many students got EKG circuits that worked with electrodes on me, but no electrodes on themselves—we never figured out exactly why).  But I could not get anything from the blinky EKG—even the output of the instrumentation amp seemed to be constant.  I suspected that I had fried the amplifier chip, and was considering unsoldering it and putting in a new one.

Yesterday, I tried a different test, making an artificial input source, using resistors and my Elenco FG-500 function generator.

Test fixture for the EKG blinky board.  Note that with a 10V peak-to-peak oscillator input, the output would be a differential signal of about 1.8mV peak-to-peak.  The diagram was drawn with Digikey's SchemeIt.

Test fixture for the EKG blinky board. Note that with a 10V peak-to-peak oscillator input, the output would be a differential signal of about 1.8mV peak-to-peak. The diagram was drawn with Digikey’s SchemeIt.

With this test fixture, I convinced myself that the Blinky EKG board was amplifying the differential input signal correctly, over a range of about 1Hz to 40Hz, as long as the resistor for setting the DC bias was under about 300kΩ. Even with a 3.3MΩ resistor, I could see the output signal, but there was a fair amount of 60Hz noise added to it.  The gain was adjustable with the trimpot, but was high enough at all settings that I should be able to see EKG signals at the output clearly with the Arduino data logger—the gain control is mainly to get the LED to blink appropriately.

One effect I should have anticipated, but did not, was that the bias voltage showed a large change every time the LED turned on. If I redo the EKG Blinky design, I’ll probably use a voltage reference (like the TL431ILP) rather than just a voltage divider for the input to the Vbias op amp, and the LED will not be powered from the Vbias line.

In any case, the Blinky EKG board seems to be working as intended as an amplifier, and I’m still a bit mystified why it is not working when connected to the EKG electrodes.  About the only thing I can think of is that there is too large a DC offset between the EKG electrodes, as the Blinky EKG uses a large gain on the first stage and a relatively small gain on the second stage.  The DC-blocking high-pass filter is after the first stage. The EKG built on the protoboard used a smaller first-stage gain and larger second stage gain, so wouldn’t saturate the first stage as easily.  (I’d learned more about EKG electrodes by the time I’d designed that circuit.) I could fix the gains by changing a few resistors on the EKG blinky board, which may be worth the pain of unsoldering and resoldering resistors.  That may be worth trying today.

Note: I’m starting to use DigiKey’s SchemeIt for schematic capture, rather than Circuit Lab. There are a lot more symbols available in SchemeIt, and the user interface is fairly similar.  SchemeIt does not have simulation capabilities, but CircuitLab’s never worked for me anyway. SchemeIt’s  drawing is a bit cruder—they’ve not taken care to make sure that wires and components line up perfectly in the PNG output, but is better than Eagle‘s.  Best of all, I know how DigiKey monetizes their schematic capture system: you can turn the Bill of Materials (BOM) into a DigiKey order with a couple of clicks, so I have no expectation that they will start charging for SchemeIt.  I may even use the ordering capability in the way they intend, since I order from DigiKey fairly frequently already.

2012 August 13

EKG blinky boards arrived

Filed under: Circuits course,Printed Circuit Boards — gasstationwithoutpumps @ 22:20
Tags: , , , ,

I ordered an EKG-blinky printed circuit board from OSH Park, on 2012 July 25, and it arrived today, 2012 Aug 13, a delivery time of 19 days, which is not bad for $12.15  for 3 boards (including shipping).  I didn’t even have to create Gerber files, as they accepted the Eagle .brd file directly.

OSH Park’s artistic rendering of the EKG blinky board.

Actual front of EKG blinky board, as delivered.

I’m a little disappointed by the sloppy drill-and-break technique they used for separating the boards, as it leaves rather ugly tabs. I can cut the tabs off with diagonal cutters, but there will still be rough edges left.

I’ll take pictures of all the components tomorrow, and try soldering up the board. If everything works, I’ll try releasing pages for the parts list and assembly. I probably won’t be making kits for this version as I’m already thinking of some revisions.

OSH Park’s artistic rendition of what the back of the board should look like.

Actual EKG blinky board back, as delivered.

I’m a bit worried that I crowded the layout on back here a bit too much for easy soldering. I’ll have to see how tricky the soldering really is.

Some of the revisions I’m considering include

  • A heart-shaped board with symmetric drill holes on the top to make a pendant.  This would require mounting the battery centered, to keep the center of gravity in the middle.  It would also probably double the cost, as the board houses charge for the bounding box.  (Rotating the heart 45° would probably minimize the bounding box, but there would still be more waste than on this board.)
  • Using two LEDs (just below the drill holes?).
  • Perhaps trying a 2-electrode, rather than 3-electrode, EKG (as described by Dobrev et al, the design I copied and cited in the post Medical Instrumentation Chapter 6).
  • Providing different connectors instead of screw terminals for the leads and maybe something other than header pins for the analog output.
  • Using shielded twisted-pair cable for connecting to the electrodes.  It looks like Cat6 STP or SSTP cables with stranded wires would be a fairly cheap choice.  I was thinking of using off-the-shelf CAT6 cables (with the standard RJ45 connectors on the end).  At each electrode I would have a small PC board with two RJ45 jacks and a 4mm snap connector wired to one of the 8 wires or the shield.  That way up to 9 electrodes (counting the ground electrode connected to the shield) could be daisy-chained together.  It’s a cute idea, though it would probably cost about $3/electrode for parts.

    I’m not sure where I’ll find 4mm snap connectors that can be mounted on a PC board.  The snap size is a common one (all the ESD wrist straps use 4mm snaps, as well as most EKG electrodes), but most snap manufacturers seem to have proprietary size schemes which do not include any specs about the size of snaps, and all warn against mixing snaps from different manufacturers, as sizes are not standardized.  My best bet will probably be to go to a craft store that has snap sockets intended for setting in leather (so using posts rather than prongs), and find a socket that fits.  That may be hard to do, as they probably come in blister packs, which can’t be opened in the store for testing.

    One disadvantage of using cat6 cables and RJ45 connectors (other than the price) is that some idiot would undoubtedly try hooking it up to an ethernet port on a computer. It probably wouldn’t damage the computer, but I wouldn’t want to count on that.

2012 July 28

Instrumentation amp protoboard rev2.1

Revision 2.1 of the instrumentation amp protoboard. This version allows the screw terminals for Gnd input to be disconnected from the board Gnd when a barrel connector is plugged in, or not, depending on jumper wires.

In Instrumentation amp protoboard, I showed an earlier draft design for the instrumentation amp protoboard. After tweaking the design a bit, I think I’m ready to try fabricating it.

I’m planning to try fabricating through iteadstudio this time, since they have the cheapest rates I’ve found yet: 10 boards for $9.90 + $3.90 shipping, for only $13.80.  Of course, the shipping is from China, so even air mail may take a while, and I don’t know what their turnaround time is for orders.  They also have small-batch orders that are even cheaper: $45 for 50 boards, $75 for 100 boards, making this very attractive for classroom use.  Of course, if the board gets just a tiny bit bigger, the price doubles or quadruples, since they have a 5cm×5cm bounding box for this price.

This will be the 4th different PCB prototype service I’ve tried. The others are 4pcb.com (good service, USA made, but a bit pricey), batchPCB (a little slower, but cheaper, probably from China), and OSH Park (USA made, cheap if boards are tiny or you need 3 copies , accepts Eagle brd file, don’t know how fast yet).

I think that someone using Eagle for design might do best with OSH Park, since learning how to use Eagle to produce the Gerber files needed by the other fab houses was a bit of a pain.

iteadstudio does provide Eagle design-rule check and CAM files, but they seem to be pretty much the same as the default Eagle ones—I’ve not gone through them carefully to see if there are any subtle changes.  They do have the most awkward way for delivering the Gerber files, requiring that they be e-mailed as a zip file, rather than accepting upload over the web like the other services.

Worksheet for designing layout. This PNG image is a little small, but Eagle can make a PDF output that is big enough for easy layout.

I improved the top documentation layer, so that the combination of the documentation and top silkscreen make a useful worksheet for students to design their layout on. If printed at 3.5× real size, the worksheet fits nicely on a page and leaves room in each resistor for adding a value.

I tried a couple of slightly different layouts for the EKG blinky circuit with optional Arduino output, and it seems to be fairly easy to lay out.  The hard parts for students will be coming up with the circuit design and soldering it up without shorting adjacent pads.

I’ll have to write up some documentation for the board, to explain the options for power (from an Arduino, from a DC power barrel, or from screw terminals; whether an RC filter is added to the power input or not; where the power and Gnd connections are available on the board, …).  I’ll probably also have to write some assembly/soldering instructions for the parts of the board that aren’t student customized.

2012 July 26

Instrumentation amp protoboard

OSH Park’s artistic rendering of the EKG blinky board. The battery clip (for 2 CR-2032 batteries) takes up most of the space.

After designing and ordering the PC board for my EKG blinky circuit, I decided to try designing a prototyping board for students to design their own EKG (or other instrumentation amplifier applications).

Eagle’s depiction of the protoboard. The blue layer is the routing on the bottom (which I made with very fat wires, since there was no need for thin ones).

I decided to leave off the battery clip, but add a barrel jack for a 5v wall wart.  I also added a 4-pin header (not just a 2-pin header) for connecting to an Arduino (allowing the Arduino to power the board and to read the Vbias signal as well as the output).  The header is not dedicated to any particular function—each pin is connected to 3 pads and nothing else.

The only parts of the circuit I prewired for the students were the power distribution and the Rgain resistor for the INA126P.  For the other inputs and outputs for the amplifiers, I’ve provided 4 empty pads (3 for the inputs of the instrumentation amp).  I’ve also provided 10 clusters of 3 pads, unconnected to the rest of the circuit.  Students can use these for nodes in the circuit that are not the inputs or outputs of the amplifiers.

The top left has screw terminals for the EKG wires. Bottom left is a power barrel and screw terminals for power input. Moving across are a 4-pin header output (male or female—I’ve not decided which yet), an LED with room for a series resistor, and a trimpot. There are spaces for six non-dedicated resistors (in addition to Rgain and a series resistor for the LED).

I’ve not put any dedicated places for capacitors, but the standard 0.1″ spacing allows them to be placed between any pair of adjacent conductors.  It will be necessary to use a few of the 3-hole clusters to connect capacitors.

I’m considering modifying the design some more, to be able to add a resistor into the power path before the 220μF capacitor, to get better low-pass filtering of wall wart power.  Students could always jumper it with a wire if they did not want the resistor.

Design image showing only the top-of-board layers, for students to design their wiring and component layout before soldering.

For student design efforts, I’ll distribute a file with the top layers show, so that students can print a full-page picture and sketch in the capacitors, resistors, and wires they want to add, before soldering anything up.

The protoboard is about 2″ on a side, so would cost me $20 for 3 copies from OSH Park.  Getting 40 boards for the class would drop the price to about $4/board from OSH Park.  We could get 40–60 boards from 4pcb.com for about $200, but we’d have to cut them apart ourselves. I think that 4pcb.com gets cheaper once we get up into the 1000s of boards, but we never will, as we only need 40–80 a year and will want to redesign every few years.

 

2012 July 24

EKG blinky

I ordered a printed circuit board from OSH Park, which has replaced DorkbotPDX that I blogged about a week ago.  The price is still just $5/square inch for 3 copies ($10/square inch for 4-layer boards), including shipping.  I submitted an Eagle .brd file tonight that I designed today.

OSH Park’s artistic rendering of the EKG blinky board. The battery clip (for 2 CR-2032 batteries) takes up most of the space and the batteries will be most of the weight. There will be 3 screw terminals on the upper left for attaching the EKG leads, and the blinking LED in the bottom right. I added a trimpot to the design so that gain could be adjusted as needed.

OSH Park’s artistic rendition of what the back of the board should look like. Soldering may be a bit tight, but not as bad as SMD parts.

The board is a version of my EKG circuit including an LED that should flash in time with the heartbeat (as well as providing header pins for attaching to an Arduino or oscilloscope.  I feel pretty pleased that I got the board down to about 2.4 square inches, so I’m getting 3 copies of the board for $12.15, especially as I used all through-hole parts and most of the space is taken up by the battery pack.

I’m not planning to have students solder up this board for the circuits class—there is no design task there, just technician-level skills.  I plan to design a somewhat larger board that allows prototyping instrumentation amp circuits similar to this EKG circuit, but which doesn’t have fixed wiring.  I’m still trying to decide whether to have resistors lying flat (as on this board), or mounted vertically from the board, as I usually do on a breadboard.  For this board, since the result is a wearable EKG, I wanted as much durability as I could easily get, but for the prototyping board, the ease of wiring resistors between holes 0.1″ apart may trump the extra robustness of laying them flat on the PC board.

« Previous Page

%d bloggers like this: