Created: 2014-05-18 21:05
Updated: 2015-06-25 19:10


SHT1x is a Golang implementation of Luca Nobili's rpiSht1x

For using the Sensirion SHT (SHT71/SHT75/SHT15/SHT11/SHT10) series of temperature and humidity sensors on a Raspberry Pi in Go.

Using a modified version of gpio for Go

Full example

This needs to be run as root

package main

import "fmt"
import ""
import ""

func main() {

	fmt.Println("Create SHT sensor")
	sht := SHT1x.New(rpi.GPIO_P1_11, rpi.GPIO_P1_07)

	fmt.Println("read temp")
	temp := sht.ReadTemperature()
	fmt.Printf("temp (°C): %.2f\n", temp)

	humid := sht.ReadHumidity()
	fmt.Printf("Humid (rel%%): %.2f\n", humid)

	temp2, humid2 := sht.ReadTempAndHumidity()

	fmt.Printf("temp (°C): %.2f\n", temp2)
	fmt.Printf("Humid (rel%%): %.2f\n", humid2)



To install the SHT1x package:

go get

To build Go on the Raspberry Pi follow these instructions


SHT1x Datasheet


  • Calculate the CRC
  • Return errors on failures
  • Some tests
Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more