Weekend Report: Arduino + Multiple DS1820 Temperature Sensors Working
This weekend I received the temperature sensors to instrument my little Stirling engine and got them working with an Arduino Uno.
I learned a few things.
First, a neat thing about these sensors is they are "one-wire" capable. You can connect the Ground and Vdd pins to ground and they'll steal power from the signal line to charge a little internal capacitor to run from. I was able to get three sensors working simultaneously in this mode, but experienced errors requesting the temperature with more than three. Digging in, this appears to be a common limitation. The little cap doesn't charge up quickly enough and the chip poops out under load. That's not a showstopper; I'll just run power to them properly.
Second, I'm straying off into the messy world of interacting with sensors. The running frequency of the engine is about 2 Hz (cycles per second), so each cycle is about 500 (ms) milliseconds. Reading the temperature from the sensor takes about 30 milliseconds, so reading data sequentially from all three sensors takes about 90ms start to finish. That's about 1/5th of a cycle, and I'm curious how much the temperature varies within a cycle, so that might be an issue. Going down the rabbit hole it looks like the DallasTemperature library for Arduino has a couple of ways around this. There is a function where you can trigger the data collection and then retrieve the converted temperature sometime later that only takes about 2ms. There's also another function that retrieves the raw 12-bit temperature data from the ADC. I'll play around with these and see which one is faster.
This is from the WaitForConversion sample included with the library.
Two more things on the Stirling engine front.
1. I now understand the function of the Tuning line. The momentum of the water in this column serves to compress the air in the working volume during one portion of the cycle and reduce the pressure during another portion. I'm a little fuzzy on what part of the cycle these occur, but if I sit down with a P-V diagram I should be able to puzzle it out pretty quickly.
2. I went to the good hardware store and picked up various sizes of steel ball bearings to make check valves to turn the engine into a water pump. I hope to work on that this week, but it's iffy. I need to swap out the calipers, pads, and rotors on my new truck to get it on the road, I want to get the i^2c pressure sensors working with the Arduino, and it is patch Tuesday week, so Thursday and Friday are shot. Add to that the garden, the kittens, the requirement to sleep, and my patient spouse's completely reasonable request to make my driveway significantly less Sanford-and-Sons-ish and it'll probably be Sunday before I can get into F360.