Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Temperature Sensor?


  • Please log in to reply
37 replies to this topic

#1 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 18 August 2010 - 07:07 PM

I have a little electronic thermometer. Its got a temperature sensor obviously, so I want to use it on my nerduino... the sensor has a red and black cable on, how would I use this? I'll go look at tutorials for an arduino temperature sensor in case they have two wires too.

#2 Steven Behnke

Steven Behnke

    Advanced Member

  • Members
  • PipPipPip
  • 70 posts
  • LocationLas Vegas, NV

Posted 18 August 2010 - 07:12 PM

The way I've seen these kinds of devices work on the Arduino is that they plug into the analog in and then ground. Measuring the analog value can then somehow be converted into an actual temperature value, but I'm not exactly sure how to calibrate it. I believe makezine.com has a Garduino project that uses a temperature sensor, moisture sensor and light sensor. They should all be fairly similar. I can't wait to order more gadgets for my Netduino so I can give more specific advice.

#3 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 18 August 2010 - 07:35 PM

The way I've seen these kinds of devices work on the Arduino is that they plug into the analog in and then ground.


If I where to do this, is there any risk of messing up my netduino?

#4 Szymon

Szymon

    Advanced Member

  • Members
  • PipPipPip
  • 108 posts
  • LocationPoland, Krakow

Posted 18 August 2010 - 07:47 PM

On arduino I used these two temperature sensors:
DS18S20 One Wire Digital Temperature Sensor
SHT15 Humidity and Temperature Sensor

Both are very easy to use and produce good results. Last year I've built several wireless units that were measuring temperature, humidity and light level around the house. I put them in the repurposed AirWick Mini automatic refreshners (so I also got a motion sensor as bounus). Here are some photos: http://cid-4c7ec0c21...tal electronics

Anyway, if anyone here is interested I can look into converting the drivers for these sensors to .NET MF.

#5 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 18 August 2010 - 07:58 PM

On arduino I used these two temperature sensors:
DS18S20 One Wire Digital Temperature Sensor
SHT15 Humidity and Temperature Sensor

Both are very easy to use and produce good results. Last year I've built several wireless units that were measuring temperature, humidity and light level around the house. I put them in the repurposed AirWick Mini automatic refreshners (so I also got a motion sensor as bounus). Here are some photos: http://cid-4c7ec0c21...tal electronics

Anyway, if anyone here is interested I can look into converting the drivers for these sensors to .NET MF.

Wow that is very clever! I like the housing for it too, it blends in perfectly

#6 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 18 August 2010 - 08:26 PM

Anyway, if anyone here is interested I can look into converting the drivers for these sensors to .NET MF.


I for one would definitely be interested! :)

#7 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 18 August 2010 - 08:36 PM

I have a little electronic thermometer. Its got a temperature sensor obviously, so I want to use it on my nerduino... the sensor has a red and black cable on, how would I use this?

Does it look like this or this? If yes, then it is a thermistor - a resistor whose resistance varies with temperature (see the description on Wikipedia for more details). To get the temperature, you need to measure resistance, so you put one wire to analog input and the other to 3.3 V. Depending on the thermistor range (measure its resistance at room temperature to get the idea), you may need to add second resistor between analog input and ground (a voltage divider) - you can start with a trimpot and see, how the analog input changes when the thermistor warms up or colds down (analog input pin actually measures voltage, but for the temperature calculation it does not make big difference, as there is direct relationship between the resistance and voltage). You can then write down a table of measured values for known temperatures and make a graph out of it - then you will probably need to approximate the points with at least quadratic or cubic curve to get the formula (interestingly, Microsoft Office Excel can do that).

Note: There are two types of thermistors depending on how the resistance changes - for PTC (Positive Temperature Coefficient) the resistance increases with increasing temperature, for NTC (Negative) the resistance decreases.

If the device has a glass case, then it is a silicon PTC temperature sensor, and it is important to have the wires connected properly - black is probably ground, red positive voltage, and care should be taken about the current - usually, those sensors are rated for something like 1~2 mA.

Also, please note that most temperature sensors have operating range about -50 .. +120~150°C, so using a soldering iron for 'calibration' may not be the best idea Posted Image

#8 Szymon

Szymon

    Advanced Member

  • Members
  • PipPipPip
  • 108 posts
  • LocationPoland, Krakow

Posted 18 August 2010 - 08:39 PM

I for one would definitely be interested! :)


Chris,
First I want to finish a little tutorial on using shift registers (74HC595) to extend number of outputs of netduino. I'm using 7 segment LEDs as example (this is actually one of basic tutorials for arduino too). I have all code working so hopefully it will be ready this week. Then I can add the temperature sensor so together it could make a digital termometer with LED display.

#9 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 18 August 2010 - 08:39 PM

I for one would definitely be interested! :)

Elze Kool has published Sensirion SHT11 classes (SHT1x series sensors differ only in precision).

#10 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 18 August 2010 - 08:43 PM

Does it look like this or this? If yes, then it is a thermistor - a resistor whose resistance varies with temperature (see the description on Wikipedia for more details). To get the temperature, you need to measure resistance, so you put one wire to analog input and the other to 3.3 V. Depending on the thermistor range (measure its resistance at room temperature to get the idea), you may need to add second resistor between analog input and ground (a voltage divider) - you can start with a trimpot and see, how the analog input changes when the thermistor warms up or colds down (analog input pin actually measures voltage, but for the temperature calculation it does not make big difference, as there is direct relationship between the resistance and voltage). You can then write down a table of measured values for known temperatures and make a graph out of it - then you will probably need to approximate the points with at least quadratic or cubic curve to get the formula (interestingly, Microsoft Office Excel can do that).

Note: There are two types of thermistors depending on how the resistance changes - for PTC (Positive Temperature Coefficient) the resistance increases with increasing temperature, for NTC (Negative) the resistance decreases.

If the device has a glass case, then it is a silicon PTC temperature sensor, and it is important to have the wires connected properly - black is probably ground, red positive voltage, and care should be taken about the current - usually, those sensors are rated for something like 1~2 mA.

Also, please note that most temperature sensors have operating range about -50 .. +120~150°C, so using a soldering iron for 'calibration' may not be the best idea Posted Image


It is from a store bought thermometer so it is encased in a black plastic so I can not see it, but I do know it only has a red and white wire, so it is probably what you gave me a link to. I put 4.5 volts through it to make sure it worked after that and it did so I think I don't have to worry about the voltage and current. So I put the red wire on an analog pin, and the white to a ground pin?

#11 Steven Behnke

Steven Behnke

    Advanced Member

  • Members
  • PipPipPip
  • 70 posts
  • LocationLas Vegas, NV

Posted 18 August 2010 - 08:50 PM

It is from a store bought thermometer so it is encased in a black plastic so I can not see it, but I do know it only has a red and white wire, so it is probably what you gave me a link to. I put 4.5 volts through it to make sure it worked after that and it did so I think I don't have to worry about the voltage and current. So I put the red wire on an analog pin, and the white to a ground pin?



Do you have a multimeter? Maybe you should touch the red and black wire to your multimeter's probes and see if the ohms change based on the temperature changes of the thermometer to see if it is acting as a variable resistor?

#12 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 18 August 2010 - 08:53 PM

Do you have a multimeter? Maybe you should touch the red and black wire to your multimeter's probes and see if the ohms change based on the temperature changes of the thermometer to see if it is acting as a variable resistor?

I do... I'll test it now....

#13 Szymon

Szymon

    Advanced Member

  • Members
  • PipPipPip
  • 108 posts
  • LocationPoland, Krakow

Posted 18 August 2010 - 08:56 PM

Elze Kool has published Sensirion SHT11 classes (SHT1x series sensors differ only in precision).


Oh, thats right. I've seen it before but forgot about it. So I will just check how it works with netduino.

#14 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 18 August 2010 - 09:05 PM

Do you have a multimeter? Maybe you should touch the red and black wire to your multimeter's probes and see if the ohms change based on the temperature changes of the thermometer to see if it is acting as a variable resistor?

well it decided to not work (multimeter) I am really sure it is though, what else could it be with only 2 wires?

#15 Steven Behnke

Steven Behnke

    Advanced Member

  • Members
  • PipPipPip
  • 70 posts
  • LocationLas Vegas, NV

Posted 18 August 2010 - 09:11 PM

I don't know? I'm reminded of the scenes from sci-movies where the hero is trying to disarm the bomb. "Just cut the red wire!" "They are all red!"

#16 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 18 August 2010 - 09:17 PM

well it decided to not work (multimeter) I am really sure it is though, what else could it be with only 2 wires?

Plastic package with two wires? Looks like a transistor? Then it can be KTY8x PTC thermistor (the site is in Czech, just look at the pictures :- )

#17 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 18 August 2010 - 09:19 PM

I don't know? I'm reminded of the scenes from sci-movies where the hero is trying to disarm the bomb. "Just cut the red wire!" "They are all red!"

Well, it can't hurt the netduino if I test it right? lets say I were to put a wire from analog 0 to Gnd, just a wire, would the netduino get hurt?

#18 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 18 August 2010 - 09:30 PM

I don't know? I'm reminded of the scenes from sci-movies where the hero is trying to disarm the bomb. "Just cut the red wire!" "They are all red!"


:)
  • Omar (OZ) likes this

#19 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 18 August 2010 - 09:35 PM

:)

Would you happen to know how to do this? Can you confirm the analog and gnd idea?

#20 Szymon

Szymon

    Advanced Member

  • Members
  • PipPipPip
  • 108 posts
  • LocationPoland, Krakow

Posted 18 August 2010 - 09:37 PM

Oh, thats right. I've seen it before but forgot about it. So I will just check how it works with netduino.


I tested Elze Kool's SHT11 class and it works great on netduino. It compiled and run without any modifications (besides pin assignments in initialization). So this clearly demonstrates the power of .NET MF code portability (he was using Embedded Master in his demo).

Btw. Elze uses interesting convention to separate input providers from the driver code. I assume he did it in case the sensor would be attached on a different type of bus. For example via an I2C extender chip. I'm curious if you use similar pattern in your code? Are there any other best practices for .NET Micro Framework programming?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.