Saturday, May 2, 2015

An Artificial Test Preemie for an Incubator



I've been working with the Greater Austin Chapter of Engineers without Borders.

One of our projects is the creation of a low-cost incubator for premature babies.  Preemies can't keep themselves warm. This is similar to the excellent work of Embraceglobal.org, but we are aiming for an even cheaper cost-point.  We are beginners; we do not believe we are going to outperform or compete with Embrace or make a life-saving tool in the short term.

I have been strongly influenced by the my acquaintance Kent Beck and his methodology of "Test Driven Development" (TDD). I don't claim to always use TDD in my career managing programmers, but I use it in most of the programming that I completely control.

If you want to build an incubator, you need a test baby.

As part of trying to learn to use the Arduino (and some basic electronics), I built a Test Preemie.  The basic idea is to have a physical doll smaller than a full-term infant that lets you have a visual indication of when it is a proper temperature.  Additionally, it lets you read the precise temperature from the USB port of the Arduino (and its history.)  You can't put the Arduino in the incubator because it is its own source of heat. I needed a way to put a visual indicator and the temperature sensor on the end of a wire so that the Arduino controller for the Test Preemie can be kept separate.

Presumably, a completely different Arduino or other control mechanism will actually control the heat, or the alarm, for the incubator.

What we are trying to do with the Artificial Test Preemie is to make testing easier by giving you both an independent temperature measurement, and a physical object to test with.

Obviously, there are improvements to this---we'll discuss that at the end of the article---but for now I would like to tell you what I did, in order to document it.  I'm not particularly proud of this work, but in the PIFAH project I try to document everything.

(I documented all of this as I did at EWB GitHub Repository, but am rewriting it for this article.)

So the basic approach is to use a standard TMP36 temperature sensor.  This requires 3 wires: +5V, Ground, and the signal (temperature) wire.  As an initial design, I just want to let you say if the preemie is too cold, just right, or too hot.

Luckily, both the TMP36 and a multi-color RGB that can glow blue (too cold), green (just right), and red (too hot) is included with the Arduino Experiment Kit (ARDX), including a nice explanation and bread-board diagrams for how to use use them.

The code, which is called a "sketch" in Arduino programming, for using these basic circuits is also included.

So basically I just implemented these circuits separately (and simultaneously) on my Arduino, and mashed together the C-code for each circuit.



It is traditional, and almost always best, to build a circuit first on a breadboard as shown above, which is included with the ARDX. However, breadboard are fragile.  I wanted something sturdier for the testing of the actual incubator (which I haven't started yet).  Also, I wanted something to show at the upcoming Austin Mini Maker Faire, and something sturdier was required.

I had some old 8-wire telephone interface network wire.  I used this to run the wires the foot and half from the Arduino to the Preemie.

Arduino experts build "shields", which are pluggable components for expanding the Arduino. However, I didn't have one, and I wanted a stand alone system.

Remember, I am not very experienced with electronics, not even the basic of how to make connections.  So I'm describing below a home-grown solution---I don't claim this is good or recommend it.

What I actually did:

  1. I got my daughter to volunteer an old doll for this purpose that is at least smaller than a normal full-term child. 
  2. I tested the RGB LED circuit from the ARDX, and made sure that I could control the color.
  3. I tested the Temperature sensor, and made sure I could measure temperature correctly.
  4. I put both of these on a breadboard, and wrote a sketch that controlled the RGB LED circuit from the temperature, seeing a minimum and maximum temperature to control the color.
  5. I cut 18" of telephone wire, and carefully cut away the vinyl wrapping, then carefully stripped the insulation of the end of each of the colored wires (I only needed 7 of the 8.)
  6. I carefully wrote out a plan of what color I would use for the pins on the Arduino and the pins on the TMP36 and the LED.
  7. I soldered the correctly colored wire to my RGB LED. I wired the resistor in-line.  This is critical---if you miss the resistor it calls for, even for 1 second, you will burn out your LED.


  8. I tested again by plugging back into my breadboard (which still had the temperature sensor).
  9. I scored a Radio Shack perf board and broke off a single line of pad to be able to solder.
  10. I broke off a line of 3 male-to-male connectors that came with Arduino spare parts kit.
  11. A soldered the correct wires that connected to the RGB LED to the short sides of the male-to-male connectors, making a tiny "plug" that I could insert into holes 9,10, and 11 of the Arduino digital output (as the original circuit called for.)
  12. I tested this again.
  13. Then I soldered in the TMP36, and tested that that worked at the end of my wire.
  14. Then I soldered that to a different 3-pin plug that I made (different because it is physically on the other side of the Arduino Uno.)
  15. Then I tested that again.
  16. I soldered the TMP36 signal wire to a single male-to-male connector (because it is in a different location and could not be grouped with the others.
  17. Then I tested that again.
  18. I carefully wrapped all the exposed wires in electrical tape.
  19. I inserted the LED at my doll's neck, and put the temperature sensor at her belly.
  20. I tested again, and used some extra electrical tape to try to combat the fragility of my solder joints.
Note that in doing all of this my soldering and wire-stripping failed several times.  Once the power wire broke.  I tested each solder connection with my multimeter before I accepted it.

Doing hardware work requires just as much testing as software! If I had been working with someone else, I would have treated this as a series of written stories with estimates and tests.

Then net result is a physical Test Preemie which is more sturdy than a breadboard (but still dangerously fragile.) The photo at the top of this article shows that.

I now feel ready to work on using a completely different Arduino, a MOSFET, and a lantern battery, and a heating strip to try to actually keep the Preemie warm enough to survive.  By building a test apparatus first, I can follow the "Red/Green" testing paradigm. I am beginning with a failing test---they baby is cold---and will try to create a Green test and keep the test Preemie alive.

The Sketch for the Arduino can be found here.

I invite you to collaborate with me and Engineers Without Borders in this open-source project of building a new kind of infant warmer!  Maybe, maybe, after a lot of testing, we will save a life.

* * *

I hope that the reader will think of improvements and open them as Issues at the GitHub Repo: https://github.com/PIFAH/EWB/issues.

However, it is clear that this could be made sturdier, could use a smaller wire, could be a complete datalogger, could have an LCD temperature readout, could be made out of a doll the mass, heat capacity and thermal conductivity of a baby, and could be turned into a training tool.  I'm not going to enter those thing as issues, because my goal here is to get involvement from others.  There is no need for the test apparatus to get TOO far ahead of the actual incubator.





No comments:

Post a Comment