## Saturday, July 14, 2007

### Temperature Logging Part II

OK, so I had the temperature (sorry if this reads like a novel--I'm writing this one after the fact), but I already had that with a kitchen thermometer. The whole point of this is data collection. From the docs and examples, I think most people are using the Arduino attached to a computer, which makes logging a simple matter of reading the serial port and writing to the hard drive. But the temperatures I'm going to be logging will be located far away from a USB port.

My initial plan was to write the values to the "EEPROM" (no, me neither), but:

• It only supports 512 bytes. At one sample every two minutes, that's only 4 hours.
• It only supports a limited number of writes. Large, but limited.
• I don't really need the ability to save the values through a power cycle.
Instead I went with an array in RAM. I just have to be sure to get the data before I turn it off or the battery runs out.

And how do I get the data off? I have a button that tells the thing to dump the data to the serial port. This is really a simple feature, but I learned a lot while doing it. That's because, even as an electronics n00b, my analog electronics sk1llz leave my digital ones in the dust.

Here's the schematic for a digital switch. Notice that it doesn't really work like an analog switch. That's because you aren't sending electricity around a digital circuit like with a simple flashlight, you are sending voltage around the circuit. Or so this one experience indicated to me. D2 is the digital port. When S is open, as shown, D2 is HIGH (i.e. 5V) with respect to ground. If I close S, current flows (which is why R exists--to limit the current, which means R should be as high as feasibly possible, at least so I infer), but more to the point D2 and ground are electrically connected, meaning it is now LOW (0V).

Question: I think I could have had D2 at LOW by default and switched to HIGH. Would that save power? Ideally, a voltage doesn't have a current, but I don't know how the voltage comparison happens internally.

Anyway, this circuit and the previous one can be put in parallel. The thermistor one reads temps until the buffer array is full and the switch one waits for someone to press it and when someone does, it spews data.

All that remained was to make it small and robust enough to survive an afternoon outside, with light breezes, sunshine, etc. So I soldered the components onto a board (seriosly, this project is like 1/4 of all the soldering I've ever done--I'm a total, total N))B) and slapped it into a tupperware container.