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 ?

3 Answers 3


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.

  • Ok, thank you for info, is there any official documentation about this limitation or specification attribute ? Jun 11, 2015 at 12:19
  • I have not seen any, but I have not looked. I am basing my opinion on posts like this.
    – joan
    Jun 11, 2015 at 14:16
  • Now that RTM version is out, is it sill limitation ? Aug 11, 2015 at 18:53

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/


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.