- Packaging is difficult and requires creative engineering. Essentially every connection becomes a potential point of failure. Wires break. Solder joints look good but don't actually make good connections. Wires proliferate and strangle the beauty of the project.
- Power management is tricky. Batteries require yet another set of connections and are physically heavy. They must generally be packaged, either together or separately, with your project. Their lifetime in any given application is harder to predict than a software programmer typically imagines.
- PCBs >> Soldering >> Breadboards. Breadboards are great for prototyping, but terrible even for demoing for more than about an hour---they are very delicate, and once a wire is pulled out it takes a long time to figure out how to replace it. Soldering is a major step up in ruggedness, but error-prone for the beginner. I have not yet sent out a schematic to have my own PCB board made, but I now understand why people do, and why there are so many "breakout boards" at Sparkfun. PCBs are another step up in ruggedness and ease of use (and another step down in terms of mutability.) As your design stabilizes, there is a natural progression toward ruggedness and away from changeability.
- In my limited experience, success depends just as much on methodical testing in hardware as it does in software, if not more. Breadboards seem to make testing easier because they give you places to put your multimeter probes.
- You will end up using your basic software debugging skills, such as proper logging sent through the serial interface back to the computer, just as much in Arduino programming as in pure software, if not more.
- Be gentle and forgiving with yourself. A lot of things can go wrong in the construction of even simple circuits. To be successful, you will have to tolerate this frustration and treat yourself as you would a child that you are mentoring.
This is a blog about Agile open-source invention of both hardware and software for the benefit of all humanity. I welcome you to join me. Presently this blog is only for my essays; the real work is begin published at our GitHub repos: https://github.com/PIFAH/PIFAH . Follow me on twitter at @RobertLeeRead.
Tuesday, May 26, 2015
Some Simple Lessons for the Arduino Hacker Who Started As a Programmer
To the software hacker with no experience in electronics, working with an Arduino poses some problems. The programming will seem like a breeze. The breadboarding is straightforward. But practical, deployable electronics pose some problems that software programming does not prepare one for.
Thursday, May 7, 2015
Success with the Relay and Basic layout
After the MOSFET disaster I used the other component available to me from the Arduino Experiment Kit (ARDX), the relay.
A relay is a physical switch that actually moves and is controlled by a small current. They are less reliable than solid state switches. But I had one.
I basically followed the example of using a relay that came with my ARDX. (This is Circuit 11 in that book.) It is important to note that it requires a transistor to switch power to the relay. The Arduino digital outputs provide so little current they can't reliably switch the relay.
The coil inside the relay is also an inductive load, requiring a fly-back diode to protect the circuit.
I dutifully:
Finally, after about 6 hours of labor, the system works, by which I mean the heating cloth gets hot on demand.
A relay is a physical switch that actually moves and is controlled by a small current. They are less reliable than solid state switches. But I had one.
I basically followed the example of using a relay that came with my ARDX. (This is Circuit 11 in that book.) It is important to note that it requires a transistor to switch power to the relay. The Arduino digital outputs provide so little current they can't reliably switch the relay.
The coil inside the relay is also an inductive load, requiring a fly-back diode to protect the circuit.
I dutifully:
- Spent an hour breadboarding this circuit,
- Spent about an hour laying out the soldered circuit board (this is a separate skill which I am very bad at),
- Spent about an hour stripping jumper wires and placing the components on the board in preparation for soldering,
- Spent about two hours soldering, and correcting my soldering.
Here is the circuit board with the transistor (there is a resistor on its input), the relay, and the diode. Soldered to it are the battery leads for power, and four wires going back to the Arduino: +5V and GND for powering the transistor and the temperature sensor. Their is one signal wire fro controlling the relay (basically "turn on the heater") and one wire leading back from the temperature sensor.
I had misunderstand the pinouts for the Relay --- I have to say that in my experience data sheets are not written well for beginners.
Below are the components of the system laid out.
Note the Arduino and Breadboard system on the left --- I originally used the breadboard, which is now empty. Although not powered on in the photo, the doll has an LED which shows if it is too cool, too hot, or just right. Note the doll and its Arduino, its temperature sensor and LED, are completely separated from the Incubator itself. I call the test system the "Test Preemie".
The Incubator (which is an ambitious title for a warmer with a thermostat) consists of the components on the left. I drive it with a lantern battery in part to show that the heating circuit is completely separate form the Arduino system as well. In fact you can hook up the batteries in series which gives 12V, and four times the wattage, as a demonstration. At 12V the heating cloth heats up VERY quickly, but of course the Preemie has much more thermal mass than the cloth. It is possible that people who might need this would have 6-12 V available from batteries or cell phone chargers or something.
I am now ready for real testing, I hope. I just have to take the sensor off the old circuit and solder it in here, and then I can make a physical incubator, adjust the temperatures in the "Test" sketch and the "Incubator" sketch and see if I can keep the Test Preemie happy.
Let me remind everyone that this project is in its early phases, and that I am doing it mostly to support Engineers Without Borders. I don't think we have done enough research into neonatology to understand the fitness of this system for actually trying to keep a child alive. However, I believe it is reasonable for prototyping and research to advance hand-in-hand.
There are a number of things that are potentially weird about this approach. Not least of them is that you could do the control of the heater at body temperature with a simple circuit, eliminating the Arduino and its expense and complexity. However, if you did that you would not have a platform available for other enhancements, and it is easier to control and report on this with the Arduino first.
Wednesday, May 6, 2015
Lessons from An Electronics Noob
One of my great heroes, Jeri Ellsworth, has spoken publicly (and made a great video) about the importance of trying and failing in learning electronics.
I personally am tempted to generalize her statement to everything else. In fact I would say that is the great genius of Agile methodologies and Test-Driven Development in particular.
On Saturday, I got my "test preemie" working---a success. Monday I started on the incubator, thinking it would take about 3 hours.
And failed, and failed, and failed some more.
I had it all working on the breadboard---easy as pie. But breadboards are fragile. I don't want to go to Mini Maker Faire with a breadboard. I wanted to solder up a prototyping board to make a sturdier solution.
Using tips suggested by this gentleman for prototyping, I laid out my protoboard, and bent the components into place.
I soldered it up, and it didn't work. I had missed a connection. I fixed it, and tried again, and it didn't work. I realized I had soldered the MOSFET in backwards. This is easy to do---the little ICs are little on 3/10ths of an inch wide and they aren't "marked" in anyway---you have to look at the data sheet to which pin goes where.
So I painstakingly desoldered it. Desoldering is harder than soldering; you have to use a "solder sucker" and then "soldering braid" to wick up the molten solder.
And, if you bent the pins of the components over as hinted above, it is even harder to get them out.
Then I carefully resoldered the MOSFET back in --- the WRONG WAY AGAIN. Imagine a face palm that evacuates the brain pan.
So I carefully desoldered the MOSFET again. With each operation, my board was getting messier and messier.
Then I put a clean MOSFET in---and it worked! For about 4 minutes. Then I broke one of the pins leading to the Arduino off. No worries---I could just solder a new lead in place. To make it sturdier this time, I stripped a solid 24 gage wire and soldered it in.
Then, nothing.
It seemed to draw current but wouldn't heat the little 8 Ohm resistance cloth to keep the baby warm. So, to try to isolate it, I took it over to my power supply, away from the Arduino, and tested the MOSFET and heater load in isolation---or so I thought. It soaked up every amp my power supply would give and converted into heat---INSIDE THE MOSFET, which began to smoke, right before it melted the plastic off my leads.
Trying again and again, it behaves as if there is a short INSIDE the MOSFET. I don't know if this possible, or if somehow I have a stray gob of solder which neither my eye, nor the multimeter can see.
I spent at least 10 hours debugging this, and am completely stuck. So, I am retreating but not surrendering---I ordered some new MOSFETs and will build a completely new board when I get them.
Until then, I will try to do the same thing a "relay", a physical switch which does what a MOSFET does more reliably.
I have learned:
I personally am tempted to generalize her statement to everything else. In fact I would say that is the great genius of Agile methodologies and Test-Driven Development in particular.
On Saturday, I got my "test preemie" working---a success. Monday I started on the incubator, thinking it would take about 3 hours.
And failed, and failed, and failed some more.
I had it all working on the breadboard---easy as pie. But breadboards are fragile. I don't want to go to Mini Maker Faire with a breadboard. I wanted to solder up a prototyping board to make a sturdier solution.
Using tips suggested by this gentleman for prototyping, I laid out my protoboard, and bent the components into place.
I soldered it up, and it didn't work. I had missed a connection. I fixed it, and tried again, and it didn't work. I realized I had soldered the MOSFET in backwards. This is easy to do---the little ICs are little on 3/10ths of an inch wide and they aren't "marked" in anyway---you have to look at the data sheet to which pin goes where.
So I painstakingly desoldered it. Desoldering is harder than soldering; you have to use a "solder sucker" and then "soldering braid" to wick up the molten solder.
And, if you bent the pins of the components over as hinted above, it is even harder to get them out.
Then I carefully resoldered the MOSFET back in --- the WRONG WAY AGAIN. Imagine a face palm that evacuates the brain pan.
So I carefully desoldered the MOSFET again. With each operation, my board was getting messier and messier.
Then I put a clean MOSFET in---and it worked! For about 4 minutes. Then I broke one of the pins leading to the Arduino off. No worries---I could just solder a new lead in place. To make it sturdier this time, I stripped a solid 24 gage wire and soldered it in.
Then, nothing.
It seemed to draw current but wouldn't heat the little 8 Ohm resistance cloth to keep the baby warm. So, to try to isolate it, I took it over to my power supply, away from the Arduino, and tested the MOSFET and heater load in isolation---or so I thought. It soaked up every amp my power supply would give and converted into heat---INSIDE THE MOSFET, which began to smoke, right before it melted the plastic off my leads.
Trying again and again, it behaves as if there is a short INSIDE the MOSFET. I don't know if this possible, or if somehow I have a stray gob of solder which neither my eye, nor the multimeter can see.
I spent at least 10 hours debugging this, and am completely stuck. So, I am retreating but not surrendering---I ordered some new MOSFETs and will build a completely new board when I get them.
Until then, I will try to do the same thing a "relay", a physical switch which does what a MOSFET does more reliably.
I have learned:
- This stuff is hard and takes practice to develop basic skills.
- It is easy to make mistakes which make things very confusing.
- You could probably learn a lot from watching someone experienced do this. YouTube videos are the best I have in that department.
- Breadboards are fragile.
- Soldering sucks.
- This is an excellent way for a grown man to feel stupid.
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:
- I got my daughter to volunteer an old doll for this purpose that is at least smaller than a normal full-term child.
- I tested the RGB LED circuit from the ARDX, and made sure that I could control the color.
- I tested the Temperature sensor, and made sure I could measure temperature correctly.
- 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.
- 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.)
- 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.
- 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.
- I tested again by plugging back into my breadboard (which still had the temperature sensor).
- I scored a Radio Shack perf board and broke off a single line of pad to be able to solder.
- I broke off a line of 3 male-to-male connectors that came with Arduino spare parts kit.
- 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.)
- I tested this again.
- Then I soldered in the TMP36, and tested that that worked at the end of my wire.
- 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.)
- Then I tested that again.
- 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.
- Then I tested that again.
- I carefully wrapped all the exposed wires in electrical tape.
- I inserted the LED at my doll's neck, and put the temperature sensor at her belly.
- 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.
* * *
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.
Friday, May 1, 2015
How I Spent April and Engineers Without Borders
When I resigned from the government, I had planned to spend the entire month of April watching movies.
Instead, I built and electronics lab, published 25 of my ideas, and have been trying to learn basic electronics.
Possibly this is a sign of mental instability.
I have been working a great deal for the Instrumentation Group of the Austin Chapter of Engineers Without Borders (EWB). I'm doing this in part to stay involved with other people and avoid navel-gazing.
EWB does engineering. They are not really doing "invention" in the sense that I want to do it. They are producing potentially novel solutions but they are "designs" not "inventions". For the most part, what we are trying to accomplish is relatively straightforward electrical engineering based on using an Arduino.
This is aligned with what I want to do, however, because:
Instead, I built and electronics lab, published 25 of my ideas, and have been trying to learn basic electronics.
Possibly this is a sign of mental instability.
I have been working a great deal for the Instrumentation Group of the Austin Chapter of Engineers Without Borders (EWB). I'm doing this in part to stay involved with other people and avoid navel-gazing.
EWB does engineering. They are not really doing "invention" in the sense that I want to do it. They are producing potentially novel solutions but they are "designs" not "inventions". For the most part, what we are trying to accomplish is relatively straightforward electrical engineering based on using an Arduino.
This is aligned with what I want to do, however, because:
- It is helping me to learn basic electronics.
- Many of published ideas require computer control in one way or another, and mastering micro-controllers will help. In particular, my various ideas around biochar production will benefit from this.
- I have always believed the greatest room for invention is that intersection of software and they physical world, despite the fact that I personally am more expert at pure software.
EWB Austin is heavily influenced by the University of Texas members. It is going to shut down for the summer. We have been invited to the Austin Mini Maker Faire, and am working to have several of our Arduino project ready by May 16th.
When I have done this, however, I am going to go back to more of the invention-oriented work I have written about.
As always, I welcome collaboration---y'all don't be shy. I'm happy to shift priorities based on what excites others.
Subscribe to:
Posts (Atom)