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

#21 segu

segu

    Advanced Member

  • Members
  • PipPipPip
  • 31 posts
  • LocationLima - Peru

Posted 19 August 2010 - 05:24 AM

@Szymon

On arduino I used these two temperature sensors:
DS18S20 One Wire Digital Temperature Sensor
...

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


And the One wire ... any news? I am very interested and be very grateful if you do that :)

Many thanks ... ;)

#22 Guest_dichotomousgal_*

Guest_dichotomousgal_*
  • Guests

Posted 19 August 2010 - 05:28 AM

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


That would be great. I'm looking for some cool projects to do with an 11 yr old.. and those drivers would help. :)

#23 Szymon

Szymon

    Advanced Member

  • Members
  • PipPipPip
  • 108 posts
  • LocationPoland, Krakow

Posted 19 August 2010 - 11:06 AM

@segu & @dichotomousgal I'm working on my little tutorial right now, and it should be ready before weekend. I let you know here when it's published. Hope you like it :-)

#24 segu

segu

    Advanced Member

  • Members
  • PipPipPip
  • 31 posts
  • LocationLima - Peru

Posted 19 August 2010 - 10:34 PM

@segu & @dichotomousgal

I'm working on my little tutorial right now, and it should be ready before weekend. I let you know here when it's published. Hope you like it :-)


Szymon

Waiting for that, will help me a lot

Thanks :)

segu

#25 Roel

Roel

    New Member

  • Members
  • Pip
  • 6 posts

Posted 20 August 2010 - 07:13 AM

There is a class of the TMP102 from Sparkfun http://www.sparkfun....roducts_id=9418 It's from Jens Kuehners book Expert .Net Micro Framework. I don't think I can post it because of copyright but now you can find it. Roel

#26 segu

segu

    Advanced Member

  • Members
  • PipPipPip
  • 31 posts
  • LocationLima - Peru

Posted 22 August 2010 - 01:39 AM

There is a class of the TMP102 from Sparkfun

http://www.sparkfun....roducts_id=9418

It's from Jens Kuehners book Expert .Net Micro Framework. I don't think I can post it because of copyright but now you can find it.

Roel


Thank you for noting that book. I will search for One wire (maybe he talks something). TMP102 is I2C, I use 1wire because the wires I use/need are 30 meters long, can not be that long with I2C :(

Regards

#27 Szymon

Szymon

    Advanced Member

  • Members
  • PipPipPip
  • 108 posts
  • LocationPoland, Krakow

Posted 22 August 2010 - 09:45 AM

Szymon

Waiting for that, will help me a lot

Thanks :)

segu


I have published the article on my blog: http://forums.netdui...-blinking-leds/

Now I will look into writing the driver for one-wire DS18B20 sensor.

#28 pascal06

pascal06

    Advanced Member

  • Members
  • PipPipPip
  • 95 posts
  • LocationFrance

Posted 22 August 2010 - 11:25 AM

I have published the article on my blog: http://forums.netdui...-blinking-leds/

Now I will look into writing the driver for one-wire DS18B20 sensor.


Hello Szymo,

Congratulation for your article !!

Regarding OneWire, look at this:
http://bansky.net/bl...k/comments.html

Here is my test:
OutputPort port = new OutputPort(Pins.GPIO_PIN_D2, false);

while (true)
{
    port.Write(true);
    port.Write(false);
}

With my oscilloscope I see that the period is 115.28 uS. So it take 115.28 / 2 = 57.64 uS to change Digital Port state. To slow for OneWire communication.

It seems that we need a OneWire implementation in NativeCode, like tinyclr:
http://www.tinyclr.c...de to NETMF.pdf

Pascal

#29 Szymon

Szymon

    Advanced Member

  • Members
  • PipPipPip
  • 108 posts
  • LocationPoland, Krakow

Posted 26 August 2010 - 09:44 AM


With my oscilloscope I see that the period is 115.28 uS. So it take 115.28 / 2 = 57.64 uS to change Digital Port state. To slow for OneWire communication.


Hi Pascal,
Great that you confirmed this with the oscilloscope. I tried this myself and came to the same conlusion like you and Pavel. See here http://forums.netdui...ntation-needed/

@Segu,
I'm afraid that right now if you want to use any OneWire devices you will have to use FEZ boards.

#30 Szymon

Szymon

    Advanced Member

  • Members
  • PipPipPip
  • 108 posts
  • LocationPoland, Krakow

Posted 26 August 2010 - 09:56 AM

The wikipedia article on 1-wire talks about bridge chips. http://en.wikipedia.org/wiki/1-Wire
For example I found this one DS2482-800 that works over I2C. This might be a viable short term solution.

The same article also mentions that UART ports could be used:

If a parallel port is inconvenient or the operating system interferes with the timing, a UART running at 100 kbit/s with a few resistors and special software can produce and sense acceptable 1-wire pulses.


Does anyone you know how to make this work?

#31 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 26 August 2010 - 10:38 AM

Does anyone you know how to make this work?

This is described in MAXIM Application Note 214. Unfortunately, there is no support for open-drain I/O mode on Netudino, required for this kind of communication (wiring RX and TX together). To be clear, the microprocessor supports open-drain I/O (called Multi-Drive), but there is no way how to set it in the current firmware implementation.

#32 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 26 August 2010 - 03:38 PM

This is described in MAXIM Application Note 214. Unfortunately, there is no support for open-drain I/O mode on Netudino, required for this kind of communication (wiring RX and TX together). To be clear, the microprocessor supports open-drain I/O (called Multi-Drive), but there is no way how to set it in the current firmware implementation.


Hi CW2,

If the MCU supports it, we could certainly enable it...

Chris

#33 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 26 August 2010 - 06:15 PM

If the MCU supports it, we could certainly enable it...

I am currently evaluating possibilities how to add open-drain mode to existing GPIO configuration mechanism - it may be actually very easy to do, for example by 'abusing' pulldown resistor mode (which is not supported by the microprocessor), or by adding a new GPIO_RESISTOR enum value (RESISTOR_OPENDRAIN or something like this).

#34 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 26 August 2010 - 06:16 PM

I am currently evaluating possibilities how to add open-drain mode to existing GPIO configuration mechanism - it may be actually very easy to do, for example by 'abusing' pulldown resistor mode (which is not supported by the microprocessor), or by adding a new GPIO_RESISTOR enum value (RESISTOR_OPENDRAIN or something like this).


.NET Micro Framework does support extension methods--so there are some options we could explore there as well...

#35 greg

greg

    Advanced Member

  • Members
  • PipPipPip
  • 169 posts
  • LocationChicago, IL

Posted 26 August 2010 - 06:25 PM

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?


I just tried to use Elze's class on my SHT15, finally got the app to deploy (that took a bit of tinkering -- didn't realize I had to recompile for MF4.1 and other goodies). However, the app immediately exits:


Resolving.

Link failure: some assembly references cannot be resolved!!


Assembly: MF_Sensirion_SHT11 (1.0.0.0) needs assembly 'mscorlib' (3.0.7186.0)

Assembly: MF_Sensirion_SHT11 (1.0.0.0) needs assembly 'Microsoft.SPOT.Hardware' (3.0.7186.0)

Assembly: WeatherSensorTest (1.0.0.0) needs assembly 'MF_Sensirion_SHT11' (1.0.0.0)

Error: a3000000

The program '[4] Micro Framework application: Managed' has exited with code 0 (0x0).
Waiting for debug commands...

I'm basically using his demo application as well. Anyone have any bright ideas?

#36 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 26 August 2010 - 06:29 PM

[code=auto:0]Assembly: MF_Sensirion_SHT11 (1.0.0.0) needs assembly 'mscorlib' (3.0.7186.0)
Assembly: MF_Sensirion_SHT11 (1.0.0.0) needs assembly 'Microsoft.SPOT.Hardware' (3.0.7186.0)
Assembly: WeatherSensorTest (1.0.0.0) needs assembly 'MF_Sensirion_SHT11' (1.0.0.0)

I'm basically using his demo application as well. Anyone have any bright ideas?

It looks like his assemblies were compiled against .NET MF 3.0 (i.e. is looking for the 3.0 core assemblies). You need to grab his source and recompile for .NET MF 4.1.

Chris

#37 greg

greg

    Advanced Member

  • Members
  • PipPipPip
  • 169 posts
  • LocationChicago, IL

Posted 26 August 2010 - 06:30 PM

It looks like his assemblies were compiled against .NET MF 3.0 (i.e. is looking for the 3.0 core assemblies). You need to grab his source and recompile for .NET MF 4.1.

Chris


Already did that. Changed it in the solution and did a rebuild.

EDIT: Ok - got it - after I removed the reference to the project and re-added the rebuilt DLL. Silly me - I thought adding the project as a reference would be enough. Man, I need to learn VS better.

RAW Temperature 12-Bit: 1606
RAW Humidity 8-Bit: 80
RAW Temperature 14-Bit: 6427
RAW Humidity 12-Bit: 1284
Temperature Farenheit: 76.203995019197464
Humidity in percent: 42.401607360044963
Temperature Farenheit: 76.257995016872883
Humidity in percent: 42.402734559991586
Temperature Farenheit: 76.275995016098022
Humidity in percent: 42.372413409314696
Temperature Farenheit: 76.311995014548302

Cool stuff.

Edited by greg, 26 August 2010 - 06:44 PM.


#38 Gaines

Gaines

    New Member

  • Members
  • Pip
  • 5 posts
  • LocationNashville, TN

Posted 19 April 2012 - 11:37 PM

Ok - got it

Did you use this wiring diagram?
http://wiring.org.co...aturesht15.html

If not, could you post how you wired it up? I keep getting initialization errors and don't know how to troubleshoot what I'm doing wrong.

Thanks,
Gaines
"When you talk EE use small words, I'm just a Software Developer." -Arron Chapman




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.