Monday, 2 September 2013

Life of an Electrophysiologist (de-noising)

For three weeks I have been banging my head against the wall. The reason? Tracking down a peculiar source of noise in my recordings. What I thought would be a brief period of systematically stripping-and-rebuilding my rig to identify the source turned into one of the biggest tests of my problem-solving abilities in this project so far. It certainly was a very frustrating time, but in retrospect I now consider this long journey as a rite of passage for an aspiring electrophysiologist.

In the post below I will outline my story but also try to explain some of the technical stuff hoping that some people with similar problems might find it useful. And if not, at least find solace in the knowledge that they are not alone with difficult problems. I'm only mentioning my major steps in resolving the problem here as I could fill an entire book if I explained _all_ the things I've done.

It all started when I decided that my current noise level was not good enough. Yes, a little bit of high-pass-filtering got rid of most of it, but bringing an engineering mindset to neuroscience meant that I wanted to find out where this noise is coming from and how it can be removed.

My initial assumption was that some component inside the Faraday-cage was trying to break my day so I first grounded everything that could potentially pick up noise. I started out by taking a multimeter to test the resistance between each component and ground. It turns out that the coating on metal components actually insulates them. For example, these post holders (in combination with a post of course) will not electrically connect to the table-top. Further I found out that the 'Signal Ground' connection on the back of the amplifier is continuous with the ground at the back of the headstage (at least thats the case for Molecular Instruments amplifiers). Sounds logical but my assumption was that shields, Faraday, etc would somehow be de-coupled as having multiple ground-paths could induce ground-loops. I proceeded testing every conductive part of my setup until I was confident that all components on my rig had a low-resistance path to ground.

At this point I noticed a peculiarity: despite my noise being in the kHz-range, setting the low-pass filter on the amplifier (down to 100Hz) didn't make any difference whatsoever. Wrapping the model-cell into grounded tin-foil didn't have any effect either. Even disconnecting the headstage from the amplifier entirely left the noise unchanged. This led me to believe that the problem must be somewhere between the amplifier and the PC or the amplifier itself.

Consequently, I spent the next days trying to figure out my National Instruments USB-6212 BNC digitizer (which I got second hand). After studying the manual and a few e-mails with tech support later I was pretty certain that the digitizer was functional. A software called NI Measurement and Automation Explorer (MAX) comes with the digitizer and allows you to set the analog input mode for each channel and record basic traces. Choosing the correct analog input setting for my circuit was very important but also something I didn't understand much at that point. If you now think "...the what?" you are probably not alone. Most digitizers, especially the ones designed for electrophysiology (e.g. HEKAMolecular Devices), will be pre-configured so that you only have to hook up your BNCs from the amplifier. My digitizer, however, is a general purpose one which gives you more flexibility but also assumes more knowledge. There are six possible input settings, and choosing the right one required some background reading (linklink and Figure 1). If you look at the specs of the above two digitizers you'll see that one uses differential, the other one single-ended input mode which of course didn't help me figuring out which one I needed.

I know now that Floating Signal Source (FS)/Differential is the right setting for my circuit, but back then FS/Referenced Single Ended (RSE) made more sense to me. After all, the output of the amplifier goes from 0-10V. There are many reasons for and against differential (see links above). In general, however, it simply means that the signal (inside) line of the BNC is referenced against the outside line. In my circuit the outside line acts as the 0V level and the signal line can't go below 0V which basically means its single-ended - my rationale for choosing RSE. Later, of course, that turned out to be less right (but not downright wrong). RSE can work fine and effectively allows you to double the number of analog input channels on the digitzer, but the grounding needs to be set up in the right way which was beyond my understanding.

Figure 1: Input modes for analog input on a USB-6212 digitizer. Reproduced without permission but I'm trying to explain their product so they shouldn't complain.

Thinking that I had ruled out the digitizer as my problem source I turned to the amplifier. To make sure it works correctly I took my beloved Axoclamp-2B to one of our in-vitro rigs and hooked it up. Result: works fine. Just to make sure though, I got a second, similar amplifier (Axoclamp-2A) and took both of them back to my rig to compare. With both of them good-to-go I wanted to get to the bottom of my noise by only plugging in the absolute minimum number of devices (i.e. amplifier and oscilloscope, Figure 2), and then, step-by-step, plug in one device after the other. At this point its worth mentioning that I identified two types of noise: One very high-frequency/high amplitude noise (>25kHz) and one that was drifting between 2 and 3kHz (Figure 3). To test the oscilloscope itself I turned on the recording PC (carefully monitoring my noise levels while doing so). It seemed that the very high frequency noise was coming from the oscilloscope which meant that from then on I monitored my noise from the PC. I'm not entirely sure what that noise is as I have encountered it again in later stages with the oscilloscope unplugged, but only when I pick up the headstage with my bare hands without grounding myself. Figure 4 and 5 show that noise, if anyone knows what it is, please let me know. I haven't followed it up, it looks like a positive feedback loop of some sort but it is not a problem unless I completely un-ground the headstage.

With the high frequency noise removed and the original Axoclamp-2B amplifier plugged in I realised that my 2-3kHz noise was still there. Only amplifier (which worked on the in-vitro rig), headstage with model-cell (of which I had two each to make sure they are not the source of my problem), digitizer and PC were plugged in. How could there still be noise? I proceeded to check which connection to the amplifier could be carrying the noise (Figure 3), but it proved inconclusive. 

Figure 2: Oscilloscope trace. This, and the amplifier lights were all I could see at the start.
Figure 3:Excerpt of my not entirely systematic protocol to figure out where the noise comes from
Figure 4: The low-noise portion of the trace shows the noise level when the oscilloscope is unplugged
Figure 5: Close up of the very high-frequency noise. This is sampled at 50kHz and what you see is 25kHz sine. The shape of the sine looks very much like an aliasing effect so disregard it. I didn't bother scanning it at a very high rate as I don't think knowing the frequency would make a difference.
I set up the second amplifier (Axoclamp-2A) to see whether I could re-produce the noise I found on the Axoclamp-2B. This would also serve as confirmation whether the amplifier is the culprit (despite that fact that I tested it on an in-vitro rig) or if the problem is further downstream. If they both show the same noise, I reasoned, its unlikely that the amplifier is the problem and the noise is picked up somewhere else. The amplifiers sat on top of each other so that I could just switch over all the connections between them without changing anything else on the rig. What I found was that the noise patterns looked very different despite being set up in exactly the same way (Figure 6 and 7). This led me to believe that it must have something to do with the amplifier, but I couldn't really make much sense of it. Nothing else in the room was running, so where do such different noise patterns come from? Thinking that it might be coming through the power supply I tracked down the people in our building who know how exactly the power lines have been installed in the labs, but it didn't help much either. Even if it was the mains line, the amplifiers surely would have a circuit in place that doesn't let that kind of noise through. And if it did, how can they be so different?

Figure 6: Noise on the Axoclamp-2B: drifting between 2 and 3kHz.
Figure 7: Noise on the Axoclamp-2A. Around 12Hz frequency. Expressing the amount of sense this made to me in per-cent: Zero %.

By now I had asked all the people with electrophysiology experience around me to have a look and see if they can help but no-one had seen this noise pattern before. A colleague then suggested that we had a temporarily unused HEKA ITC-18 digitizer I could test since the amplifier for that rig was being serviced. Even though I didn't think the digitizer was the source of my problem, nothing else made sense either, so I gave it a try. And finally there was a glimmer of hope: the signal on the ITC-18 was OK.

That night I sat down with manuals and specifications for both digitizers, knowing that the answer must be somewhere in those documents. The key difference I found was the input-mode for the analog input channels: My USB-6212 was set to FS/RSE whereas the ITC-18 was, by default, set to differential. Using MAX to set the input channel on the USB-6212 to FS/Differential showed me the same signal I saw on the ITC-18. To re-iterate: I tried differential on the USB-6212 before but thought it just white noise without any signal. Further, it was counter-intuitive that the analog input mode was the culprit if two very similar amplifiers show such different noise. My guess now is that they manage the signal grounding differently resulting in such big differences when the analog input channel is not set up in the right way.

However, no matter what setting I used in MAX, as soon as used my recording program, Axograph X, I was back to my old noise problem. After looking through all the options on how to set analog input channels in Axograph, MAX and the vast sea of NI support pages I eventually e-mailed the developer of Axograph. A brief e-mail exchange brought the problem to the surface: a small mistake in the Axograph source-code (i.e. a bug) meant that channels are automatically initialized as RSE, overriding any setting done in MAX, without giving the user an option to change it. This is because previous generations of NI digitizers have hardware switches to choose between single-ended and differential, thus, the recording software didn't have to care about it. Only the latest generation of NI digitizers have a software switch and Axograph simply hadn't caught up with that yet. The developer fixed the code, re-compiled the program and sent me the download link. A quick re-install and everything worked fine.

So, after weeks of figuring out the electric circuit of my rig, I finally found the answer. While it is certainly anything but fun, the understanding you gain of your recording hardware is irreplaceable. Otherwise the moral of the story is, if you want to do electrophysiology, especially on a novel experimental setup, you WILL go through a lot of pain. No pain no gain.

Wednesday, 17 July 2013

Guiding Light

After a 9-month hiatus it is high time to start updating my blog again. The reason for the lack of attention for this blog was, well, that I had to do science. Most of the technical aspects of my setup are finished and the current framework in which we conduct science unfortunately doesn't reward sharing scientific progress in real-time. For the remainder of my PhD however I am planning to update more regularly again, describing the components not on here yet and sharing more detail about the ones already mentioned.

In the meantime, Christoph Schmidt-Hieber (UCL) has started sharing some code for his/their virtual-reality setup (link). In his first batch of uploaded data he shares the code for reading mouse-input directly. I highly recommend having a look if you are interested in setting up such a system.

More Light! 

Since my last post I have improved my light-source a little more. The system I built here produces enough light, unfortunately it also introduces a lot of electric noise into the system as electronic components have to be placed close to the recording site. To get around this I ordered a light-guide and a condenser lens. These I have combined with a 7-LED assembly (using Luxeon Rebel LEDs) and a LED driver unit for easy power supply and dim-control.

Seven LEDs of this rating need an appropriate amount of cooling so the base-plate was mounted on a fairly big heat-sink. Again, my heat-dissipation assessment was done by keeping them on for a long time and seeing if the heat-sink becomes too hot.


Heat-sink, breakout board and condenser lens assembly.

Some Guidance 

Feeding light into a light-guide is a rather simple process if you don't care too much about leaking some in the process and since I've got enough light to illuminate a mid-sized apartment, I don't. The condenser-lens concentrates the beam at a 25mm distance and creates a waist of 12mm. To capture most of the light I chose a 1/2in (12.7mm) light-guide and mounted it at the appropriate distance. While there are certainly mores sophisticated ways to do this, a simple base-plate and cube of aluminium did the job.

The rather simplistic diagram that comes with the condenser lens. At 25mm distance we get a 12mm beam diameter. Diagram (c) Polymer Optics Ltd.

The assembly of heat-sink, LEDs, lens and light-guide. Not the prettiest solution and you get some stray-light which can be easily shielded though.

The initial idea for my light-source included having a well circumscribed spot so we can illuminate the craniotomy without shining too much light into the eyes of the mouse. For that end I use a focusing-assembly. It is provided by the same company as the light-guide so the parts fitted together without any hassle. The result is a very bright, well focused-spot, perfect for my purposes. Having the LEDs away from the recording site also means that there is no noticeable noise introduced into the system. Finally, the heat produced at the end of the light-guide is minimal so no IR-filter is necessary.

Output. The focusing assembly creates a well circumscribed spot.

Sunrise, Sunset 

The circuit for switching the light on and off as well as dimming is still in the same box I used before. I won't go into detail about the circuit for the LED-driver as the spec-sheet that comes with it contains all the information and also because I forgot to take a photo of it before boxing it up. I have, however, made sure again that it is simple to use and clean. An on/off switch and a dimmer knob are the only visible components.

Making the sun rise for my mice was never easier. On/off switch and a dimming knob are the only visible components.



Conclusion 

Yes, it could have been bought off the shelve and I can't blame anyone who does. However, there are some advantages: I couldn't have taken a commercial light-source and mount it into my system as easily as this. Further, the dimmer switch on my system is easily accessible and turns smoothly. My experience with commercial solutions is that the dimmer knob often takes some force to turn, making it difficult to operate with one hand while looking down a stereoscope. I use the dimmer-function quite often to keep the animals as undisturbed as possible during virtual foraging. I leave the lights off and, if I need light, keep the brightness down as much as possible. Finally, I could use LEDs of various wave-lengths, such as red, to disturb the animal even less.

This solution has been used in experiments and works very well. I can use it in its current form for all my experiment without having to move it in any way, an important point when it comes to streamlining experiments and keeping awake animals calm. This completes my 3-post series on making a light-source, I hope it is helpful for some.



PS: An even better Solution

A colleague who has helped me a lot over the past 2-3 years with all electronics-related things has picked up the idea. He happened to have a broken light source kicking around (after disassembling it turned out that only the power switch was broken. Oh well). He yanked out the insides and replaced them with the components described above, although he did refine the circuit a little bit. The result is a light-source that can't be distinguished from the original on the outside, only that it has higher brightness, higher efficiency, longer lifetime at a much smaller cost.

Custom light-source built into the box of a broken commercial one.

Friday, 28 September 2012

Go Rebel

The inferior performance of the previous LED lighting system meant that it was unusable under high magnification. Straight after that first attempt I ordered a new set of LEDs that have a significantly higher rating.

The Philips Luxeon Rebel series of LEDs come in various wavelengths and third parties offer lenses and baseboards for them. To recap: I need my light system to fulfill three requirements:
a) small size so it fits into the system
b) bright enough to allow working under high magnification 
c) narrow light beam so that the bright light doesn't disturb the animal

So for the next generation of my light system I picked what is technically an RGB mixer lens which produces a  +/- 6° beam + baseplate that doubles as breakout board for the LED contacts and a heat-sink mounting point. Instead of Red, Green and Blue I just put in 3 high-power white LEDs.

a) Small Size so it Fits into the System

When the LEDs arrived it became clear that size won't be an issue. In fact, one problem with the LEDs is how small they are. Don't be fooled by the amount of light they are producing, they are about 2 x 5 mm. On that space are 3 contacts: cathode, anode and heatsink. All of which are in the same plane on the underside. This means, arranging 3 LEDs so that they are connected in series AND have good contact with the heat sink becomes next to impossible. Luckily there are also baseplates available which break out the contacts and allow to easily to attach a heatsink to its bottom.

Luxeon Rebel Tri-LED breakout board. Apart from the insulated contacts this is made of aluminium for good heat transfer to the heat sink that goes on the underside.


One LED on a tape measure to see the size of them. In the bottom picture you can see the three contacts.

While it is possible to put solder on all of the contacts, heating the contacts all up again to solder them down is next to impossible because they need to sit flat on the baseboard and there is no way to access to contacts with a standard soldering iron once they are in place.

A technique called reflow soldering was the best way to deal with this problem. In brief, you apply a paste that contains solder to the contacts and stick the components together. This is followed by applying heat until the paste melts and turns solid. I haven't used this technique before, but it seemed straightforward enough and there is a great tutorial on the Sparkfun website how to do this with a skillet (or any hot surface for that matter). 

After finding a workshop that had some soldering paste (easier said than done) and finding a hotplate (which we usually use to gently heat and stir delicate solutions...) I carefully applied paste to the contacts and popped the LEDs on it (see pictures below). After that I slid it on the hot-plate and waited a few seconds until the solder melted and made contact with the LED.

Apply solder paste
Pop LEDs on, push them down a little bit but make sure that paste on cathode and anode doesn't make contact 
The hotplate. Exciting, I know.
Put on hotplate for a brief period to melt solder paste. Also, in this picture you can see that I simply connected the breakout contacts of the LEDs in series. And of course the cable will be soldered onto the last two contacts.

Instead of building my own circuit to drive the LEDs I decided to invest into a LED driver. Very conveniently it takes 24V DC input and produces 3 - 33V output (depending on how many LEDs are connected in series) at 1000mA max. current. It has a an analogue and digital dimmer pin to adjust brightness. 

One problem with such powerful LEDs is thermal management. The LEDs have a maximum temperature of 135°C, which means you can run them at full power without a heat sink for about 5 seconds before they blow (or melt?). The baseplate provides a small amount of cooling, but far too little. While one can go into long and complicated calculations how much heat-dissipation is required I simply picked a generously sized heat sink, some heat-transfer tape and stuck it to the baseplate. Well... it wasn't enough. I ended up combining two heat sinks until I felt comfortable with the amount of dissipated heat (which I professionally assessed by touching the heat sink every minute or so and checked how hot it is). There is a heat sink calculator on this excellent website but I ended up not using it as I had the heat sinks ordered before I discovered it.

LEDs on double heat-sink. Between baseplate and heat sink is thermal transfer tape.
The lens for the LEDs fits perfectly and slots into the baseplate. I've used some superglue to fix it, hoping that the LEDs stick to their promise of lasting for the next 9001 (or so) years.

Lens that goes over the LEDs.

b) Bright Enough to Allow Working Under High Magnification   

The brightness of this assembly is really quite remarkable. I've made the mistake of looking straight at the LEDs without the lens on when I turned it on for the first time. It took a while until I regained full vision. Each of these LEDs at full power (i.e. at 1000mA (!!) ) produces 310 lumens according to the manufacturer. These LEDs are rated in lumen rather than microcandela (mcd) which makes it hard to compare to the previous set of LEDs I had and it is difficult to convert between these units so I won't try. According to the internet, a 60W incandescent light bulb has about 800 lumens. Keep in mind that a 60W bulb can light up an entire room quite easily. My LEDs with the lens focus ~85% of its 930lm in a +/-6° beam. Here is a comparison between the two systems I've made:

The old system: seven "super bright" LEDs, at 2.5 cm, focused in one point.
The lightcano.

c) Narrow Light Beam so that the Bright Light Doesn't Disturb the Animal 

This is the only point in which the new LEDs lack behind the previous system. The lenses are not focusing the light well enough. That said, I could build a shield to focus the light in a narrower beam. However, I've found it easier to make a little cover that blocks the light from shining directly into the mouse's eyes without blocking the its view onto the virtual reality screen. While the mouse can still see the entire environment lighting up, none of the intense light is frying its retina.

Conclusion 

Having tested the new lighting system in an experiment and compared it to the old I can say that the difference is like day and night - literally. A key disadvantage of the new system is that the light is less focused and therefore I can't avoid the eyes of the mice but with a small shield this problem is easily circumvented. An upside of the light intensity is the fact that I can place it further away, and therefore its even less in the way. The fantastic brightness means that whatever worries I had about illuminating the brain surface are now gone.

Friday, 7 September 2012

The Good, the Bad and the Ugly

A key consideration if one wants to do electrophysiology on a virtual reality rig is space for all the required equipment. One such thing is the light source. Ideally it only lights up a small area so that the animal won't be stressed or disturbed by the sudden bright light. To get an ideal solution for this I decided to make a frame for LEDs that would allow me to shield stray light and place it just where I needed it using a snake-arm on a magnetic base.

The Good

The light-source, like all other bits of equipment for this project, will be used in a clean facility. That means no loose cables or half-done jobs. However, to drive the LEDs a small circuit was required that would provide the right current and voltage. Further, being able to dim the LEDs might be beneficial. Less light means less disturbance for the animal. And of course, a nice enclosure makes everything look a bit more professional.

Box and frame. No electrical safety test was required as only 24V DC is going into the housing.

The top of the box features an on/off switch and a knob that dims the LEDs. Of course the knob is just a potentiometer underneath. The box is made of plastic, but the quality is good and it comes with anti-slip pads so that it sits on any surface quite firmly. Drilling the holes to fit switch and potentiometer through was even easier than drilling the aluminium frame for the heating mad system.

The second part of the system was the holder for the LEDs. I decided that using 7 "super bright" white LEDs will be sufficient. The description on the seller website said they are so bright that looking into them directly would hurt your eyes. Well, I thought, if one hurts your eyes, seven must burn your brain. And falling short of that, still enough to illuminate a work surface.

These LEDs are designed to emit light at a 20 degree angle, accompanied by some stray light, suiting my application quite well. While using a convex lens would have been the more elegant solution to focus the light I opted for the cheap and easy way of just shielding any unwanted light. With so many lumens at my disposal, shielding some won't be a problem, or so I thought.

The Bad 

Unfortunately, it turned out that the "super bright" white LEDs are not as bright after all. While it is true that they are unpleasant to look into, it's nowhere near bright enough to light up an area to look at it under high magnification. Even when 7 of them are focusing on point only 4cm away from the LEDs it didn't produce enough illumination. While in the picture below it certainly looks like the LEDs almost burn a whole into the table, it really wasn't that bright. Add the fact that they can't be placed at the ideal angle to shine onto the surface of the brain and it becomes rather useless.

~4cm distance from LEDs. While the light is nicely concentrated in one spot it didn't produce enough illumination, the picture is quite misleading.

One problem with using a simple potentiometer to alter the voltage on the LED for dimming is that LED have an exponential voltage response. That means that low voltages for large parts produce almost the same (low) amount of light, and only the last few hundred mV approaching the LEDs max. voltage rating produce a huge change in response. However, LEDs are very sensitive to applying too much voltage, which means if you turn the pot too far you will fry the LEDs. That is also the reason why proper LED drivers are a bit more sophisticated.

Luckily, in the process of soldering up the LEDs a friend from the workshop showed me some real LEDs. These are industry-grade, not some hobby-project components. They hurt your eyes even when standing on the other side of the room. Exactly the kind of thing I needed. On top of that a real LED driver (which can be bought for <£20.-) will be used instead of just a potentiometer, allowing dimming the LEDs linearly.

The Ugly

Approaching the halfway point of my PhD at an alarming pace I decided that time is becoming a currency ever-increasing in value. It makes a lot of sense, therefore, to save time where possible, even at the risk that one of my contraptions won't last for the next 50 years. While some soldering couldn't be circumvented, I decided to use a mini-breadboard and some jumper-wires to assemble the circuitry inside the box. With hindsight, it didn't save an awful lot of time, but at least it made it a lot easier to assemble and take apart again in case there were any mistakes in the circuitry.

This might fall to pieces the first time someone knocks it but until then it will do the job. If I can find a glue-gun I'll just glue it all down.

Instead of using a double-stranded wire I used two single-stranded ones (blue and red) to connect the LEDs. That was purely for the reason that I didn't have a double-stranded one available and I needed to get this up and running.

Conclusion:

Arguably it is a viable option to simply buy an off-the shelf lightsource with some gooseneck light-guides. However, designing your own lighting system guarantees that it will fit exactly where you want it and only illuminate the area required. While my current solution is suboptimal due to low light output, the next generation will hopefully do the job.

Tuesday, 8 May 2012

Thinking Inside the Box (Heating Mat DIY part 2)

Here is the long promised follow up to this post.

In brief: I want to build a heating mat that keeps animals warm while under anesthesia. Three components are required for that: a heating blanket, a thermometer (thermocouple to be correct) and a PID controller that regulates the heat output to keep it at a set point. In other words: if the mouse body temperature drops, the heating mat gets warmer to compensate. In the previous post I put together such a system on a prototyping board and here I document how I put this system into an instrument case for use on a bench.

The reason why I made an effort to put everything inside a well organised case and not just throw the prototype onto the bench is threefold:
  1. We will use this during surgery in a sterile environment, therefore having something that can be cleaned easily is imperative.
  2. Everyone should be able to use it, not just myself. For that reason it is important to keep it simple and intuitive.
  3. Any instrument used in the office or lab needs to pass electrical safety testing and I have serious doubts my protoype with exposed mains contacts would have fared well in the test.
  4.  

The Box

While there are loads of generic instrument casings out there I decided to take a nice one to make the instrument look as professional as possible from the outside. After all, it has to blend in with other top notch scientific equipment. More importantly though, I don't want to give our beloved and omnipresent health and safety inspector any reason for concern. She really has enough on her plate with untidy cables, sharp screwdrivers murder weapons lying around and expired electrical safety stickers. Truly, we are blessed with a guardian angel who spots danger where lesser people (such as myself) stare certain death in the eye without even noticing.

To keep things simple, there is one mains connector and power-switch at the back. At the front we have the connector for the thermocouple and the heating mat along with the PID controller display and the buttons to program it. The heat-sink is screwed straight onto the back panel with the op-amp mounted onto a thermal transfer pad on the other side of the panel. Since heat-sink as well as panel are made of aluminium there won't be any trouble with heat-transfer.

The layout idea.
The mains inlet contains a 1A fuse. It wasn't that easy to wire up mains connector and power switch. It's one of those things where every seller assumes that you know what to do and therefore don't provide wiring diagrams.


The most time-consuming work after soldering was to cut the front and rear panel. For that I used a mill to cut around the edges. This was followed by filing the corners until the part fitted in. It doesn't have to be the cleanest job in the world as all panel-mounted parts have some extra cover material around the edges to hide the ugly.


Milling
Filing
Placing the part. They either clip in directly or have a retention clip.

Rear panel done.
Repeat for front panel.

After clipping in mains inlet and power switch as well as heatsink I placed the amplifier in the case. After that I grounded  the front, rear and side-panels for safety reasons. Top and bottom panels as well as corners of the case are not conductive and therefore don't need to be grounded. Finally, the rest of the components just about fitted in and I was able to put the lid on the case.



One policy regarding instrument safety around here is that if there is a mains-cable running into a device the housing needs to be safety-grounded. Therefore all conductive panels are connected to the earth of the mains inlet at the back.

Add the 12V DC power supply for the heating mat, put in the PID controller as well as the connectors and this is good to go. In the top right hand corner you can see the op-amp and the heat transfer pad.

Once the lid is on, the chaos is gone.



 

Blanket

Instead of soldering the heating blanket directly to the output I wanted it to connect to the outside of the box. That way it was interchangeable so if it breaks or has to be exchanged for some other reason there is no need to open up the box. We chose a simple 3-pole connector that is usually used for microphones but has also found its place in various scientific instruments. Here are a few pictures of the construction process:

Only keep a stub of the original cables.

Any cable with 2 strands will do. I recommend something fairly flexible so you can position the blanket easily during surgery. The peeled back portion it the shield which will be grounded.

Do a better soldering job than I did. On the left you see the shield being soldered to the 3rd pole.

Put the connector together.

The finished mat. Heat-shrink is used to protect the soldering joints.

 

Thermocouple

The only component I had to buy from a scientifc equipment supplier and the price made me cringe. Industrial thermocouples cost a fraction of this but I'm not confident using them with animals. Otherwise its a standard t-type thermocouple so I could just plug it into the PID controller.

Its blue.

Amplifier

The non-inverting amplifier used to drive the the mat including an RC filter for the PID output (see previous post for more information) has been soldered onto a strip board. The heat-sink has been up-sized as well as the previous, smaller one got hot to the touch.

This could have been a lot smaller had I used a matrix board instead of a stripboard. The blue feet allow me to simply stick the board to the base plate of the box.


Finally

ID tag and electrical safety sticker. A proud moment. If you are in dire straits and you find yourself buying lab equipment from a shady person in a dark alley (who hasn't been there?) please check the appliance ID. If it is CCNS00206, be so kind and return it to me.
Testing with direct feedback.

To my surprise everything worked the first time around. No mixed up poles, no loose connectors, I switched it on and it worked. I guess you automatically put in that extra bit of caution when playing with mains power. What is left at this stage is to tune the PID controller. It is important to start with careful values as there is a significant lag between increase in heating mat and rise of mouse body temperature. More information on that on Wikipedia.