5

Can somebody give me simple example code for Microsoft Windows 10 Core for IoT - Windows Universal App project C# , for having Raspberry Pi 2 with Windows 10 and reading temperature from GPIO with DS18B20 sensor ?

Hrvoje Kusulja
  • 385
  • 1
  • 4
  • 9

3 Answers3

3

Sample project is available here: https://github.com/selomkofori/ds18b20_win10iot

The DS18B20 is a digital temperature sensor that uses a 1-wire interface which only requires 1 port pin for communication.

Unlike other platforms, Windows 10 IoT does not have libraries or micro-second timer resolution needed to read 1-wire devices.

This project uses the UART0 Rx/Tx pins to communicate and read temperature values from the DS18B20, and can probably be easily adapted to read other 1-wire devices.

The code is based on Electric Imp's 1-wire bus over UART found here: https://electricimp.com/docs/resources/onewire/

A second alternative is to acquire a DS2428-100 Single-channel 1-Wire Master chip that can interface between I2C and 1-Wire devices. The following code can be used for that: https://github.com/Rinsen/OneWire

A third alternative is to use an Arduino device in "slave mode", and accessed via the I2C bus. See: http://blog.oscarliang.net/raspberry-pi-arduino-connected-i2c/

granth
  • 131
  • 3
2

Highly unlikely.

The DS18B20 requires being able to do timings of the order of microseconds.

Currently Windows IoT on the Pi seems to have a delay granularity of a millisecond.

joan
  • 71,852
  • 5
  • 76
  • 108
1

BMP180 Sensor project will do temperature for you. The sensors are only $7.00 on Amazon. Use the link above and it will guide you all the way through the process. Just not the same chip.

Curtis
  • 223
  • 1
  • 9