Showing posts with label logging. Show all posts
Showing posts with label logging. Show all posts

Tuesday, July 8, 2008

New Results

Latest solar trough configuration:

A few details:

  1. Those are just simple, band-sawn parabolic arches. The mirror is attached with velcro. Works awesome. Ly.
  2. I suspended the mirror from the pipe thinking that would keep the focal length constant while allowing simples changes of elevation. Why do I always go straight for the complicatedest solution in the universe?
And data from same:

The highest temp on there is almost 140°C. That's over 280°F. According to my rough calculations, the four steepest upward slopes indicate powers in the range of 20-25 watts. (Some of those dropouts are me messing around with the setup, some are cloud cover. Also, I later discovered that true solar south is like 15 or 20° east of where I've been pointing.)

Two big changes from the last run, other than the already-mentioned one of shortening the excess pipe.

  1. Painted the pipe flat black.
  2. Used a laser pointer to adjust the focus. I mounted a frosted glass square (I happen to have a bunch I bought for just such a use as this) at what I thought would be the focal length. Then I stood back and aimed the laser pointer in a roughly perpendicular way and looked where the point fell. This really needs a System to keep it perpendicular, but anyway I was able to determine that my focus was off by over an inch.
I'm thinking the Mark III will be the last iteration. Pointing in the right direction, and simplifying the pointing a little, may let me add another 10-20 degrees to the peak but that will be about as far as I can go with these simple materials and using an open-air design.

Monday, June 2, 2008

Things That Don't Work vs Things That Do

I've never been completely happy with my temperature logger. It's a bit fragile in the sense that if anything at all goes wrong, and there's no way to tell that at the time, I lose the entire run. I lost a run Memorial Day weekend.

Instead of storing the measurements on the Arduino, I'd like to instantly beam them onto my computer far inside the safety of the house. That way I can track things realtime as well as be assured that I have them. Coincidentally, for my birthday, I got both another Arduino1 and Making Things Talk.

The book describes a great number of schemes to make microcontrollers talk to each other and to computers. You can use wireless networking, bluetooth, XBee, etc (I have only the vaguest notion what some of these are). Naturally the easiest protocols require the most expensive hardware. I only need one way, slow communication, so I got a simple RF module.

Claim:

It works just like a serial port! Just connect the transmitter to the TX pin and the receiver to the RX pin! It Just Works(tm)!

Reality:

No.

Perhaps my unit was faulty. I found many tutorials and guides across the internets and while results varies, I can't ever really say it worked. I did see data appear for a short time, but mainly what I saw was noise. Or nothing at all, which is even less explicable.

Last night I had a brainwave. Or brainstorm. Something happened to my brain and it resulted in an idea. Why not use a wireless laptop as the go between? The kids have these OLPC dealies. The laptop has a USB port and does WiFi. I have a WiFi router (specifically purchased, used, to work with these laptops). About 30 minutes and 10 lines of Python later, I was reading values from /dev/ttyUSB0 and sending them out over a socket to my desktop to another 15 minutes and 20 lines of Python.

The guts of the entire scheme are already there. But with so much success so fast, I'd like to add features. For instance, instant graphing of values on both ends. A protocol so that the laptop knows if there's been an error and can tell me, out in the field. When I have more than one sensor, I'll need a way to indicate which sensor had what value. It'll be like a complete Science Sensing Station!

1If you are at all interested in robots, sensors, controlling stuff with computers, electronics or just plain messing around, I highly recommend the Arduino. That SparkFun item is all you need, assuming you have a USB port (and possibly a cable). Well....you may also need some external electronics, depending on what you want to do. LEDs, resistors, motors, etc.

Sunday, July 22, 2007

Temperature Logging Part III: The Exciting Conclusion

Some pics of the final state: You might notice an extra button. I decided to write to EEPROM rather than an array after all. The reason was an unreliable power situation. A 9V battery lasts for a few hours and I didn't want to lose hours of data at the last second. So we have a switch for power on/off, a button for "send data" and a button for "start collecting data". The last one is I can control when the EEPROM starts getting overwritten the next time I turn it on.

That relatively minor change forced a paradigm shift in what processing was done where. Originally, I was just reading the voltage ratio from the pin and sending it to the PC that did the work to convert to degrees. The pin reports a value in 10 bits (i.e. 0-1023) but the EEPROM stores only bytes (i.e. 0-255). I could have renormalized to the smaller range, but only at the loss of a lot of precision. Instead, I now calculate the temp right on the Arduino. Surprisingly (to me, anyway), you can use the regular math library functions like log(). So then I end up with a temperature that practically speaking won't get above 255 or below 0, and even if it did I could add or subtract a constant to recenter it to my working range. I will describe what temperature I was logging in another post, but for now here's the pretty graph.

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.

Friday, July 13, 2007

Temperature Logging Part I

There have been many times when I've wanted to log temperatures. No useful reasons, I just like collecting data. The problem is that temperature logging devices are like $50 and up and of course they only do that one thing. After the orgy of temperature data collection is done, it just sits on the shelf.

But I'd been hearing about this Arduino dealie, which is an open-source microcontroller that only costs about $35. I figured that I could put a thermistor on there and make my own logger, which would not only be cheaper but I'd also have a versatile device for other projects. I've never used a microcontroller before, plus electronics above the level of a flashlight circuit confuses me, so it's been an adventure. Fortunately the Arduino is supereasy.

For that matter, the electronics of this were prettyeasy. The hardest part was doing the math to convert a thermistor reading into a temperature one. I harvested a thermistor from a broken (except for the thermistor) electronic thermometer. (It was easy to identify, since it was sticking way up away from the rest of the circuit board and and had "therm" written next to it.)

A thermistor varies its resistance based on temperature. That means that if you apply a voltage, you'll get a varying amount of current out. But the Arduino input port measures voltage level, which means you need to turn a varying resistance into a varying voltage instead. That's easy with a voltage divider.

"Th" is the thermistor, and A1 is the steak sauce Arduino analog input port. The total voltage drop across both resistors is a constant 5V, but how much drops across each resistor depends on the ratio of their values. So when the thermistor changes, the voltage at A1 also changes.

Now you just need a way to convert a voltage reading to a temperature reading. I assumed it would be a linear relationship, but it isn't, it's exponential. When you buy a thermistor, apparently they give you two numbers. A baseline resistance (at 25°C,) and a number B. Apparently you are supposed to know this equation:

RT = RTzeB(1/T - 1/Tz)

Oh sure, THAT equation! RT is the resistance of the thermistor, which you can figure out based on the read voltage and known values of the circuit. RTz is the resistance at 25°C (or whatever baseline), which is Tz. T is the temperature you want and B is the magic number.

I didn't get my thermistor from any fancy-shmancy store so I didn't have the magic number. Instead, I used the thermistor to measure hot and cold water (calibrated by a kitchen thermometer). Plugging in those readings I was able to solve for B. Just using math got me within 2 or 3 degrees (over the range 0-100°C--I haven't tested outside that range). Then a little empirical fudging got me right on the money.