View Full Version : temperature sensor

01-14-2012, 12:26 AM
I'd like to build a device that measures and records temperatures in a number of places in a heat pump system. I have a number of DS18S20 sensors, and wonder if there is a sample schematic that I could use to begin building the electronics. If there is a better sensor, I don't need to use the DS18S20s; it's just that I already have a bunch of them, but I'm open to suggestions. I have a couple BS2s, but I'm not sure they will work with those sensors. Ultimately the controller will measure and compare temperatures and turn on and off circulators, but I'm just beginning the project.

01-14-2012, 01:23 AM
Take a look at the BS2pxx for the one wire commands
here's the data sheet

01-14-2012, 01:24 AM
Not really much in the way of electronics required. They require only 3 connections - Ground, Power, and data. It communicates with the micro over the 1 wire bus. Multiple DS18S20's can co-exist on a single pin. All the required information is in the data sheet.

01-14-2012, 04:10 AM
If the BS2 can't do everything you want to do, the Propeller chip is well equipped to work with these types of 1-wire sensors. But I would use JonnyMac's 1-wire object instead of other options available on the Propeller OBEX:


I have some other code posted on that same thread, but it's all built upon JonnyMac's better work. I know that JonnyMac's code works with both DS1822 and DS18B20. I'm guessing it also works with the DS18S20, but perhaps some slight modification might be necessary.

01-14-2012, 04:43 PM
Thanks, ElectricAye, but this looks to be far beyond my present abilities. I'll try reading the data sheets and spend a little more time in the books.

Tracy Allen
01-14-2012, 05:52 PM
To use one-wire with the BASIC Stamp, you need one of the 'p series Stamps. BS2p, BS2pe or BS2px. They have a OWIN and OWOUT commands that make it relatively easy. There are other sensors you could use, but the nice thing about the OW sensors is that they can be strung out along one wire like Christmas tree lights. No need for separate wires to each sensor. There are however distance constraints, that people are always blissfully ignoring.

The Stamp manual has descriptions of the commands and a summary of the OW protocol, which waxes rather technical. However, there is demo code there specifically for reading temperatures from the DS1820. Hmmm. The text says DS1820, but it looks like the demo code is actually for the DS1822. The difference is 8 bit (DS1820 and DS18S20) vs 12 bit (DS18B20 and DS1822) resolution. No matter. If you want to pursue it, there is code available you can use. The DS18S20 is the higher accuracy version of the 8-bit+sign DS1820. The nomenclature can be confusing!

01-17-2012, 04:29 AM
In the demo code near the end where the conversion to F is being finished, it states "IF (tsign) THEN tempF = 32 - tempF". Should the statement inside the parentheses be (tsign = 1), or what am I missing? In my manual, it clearly states that the demo code is for a DS1822 instead of DS1820, but won't the demo code work with either sensor?