max31865

package module
v0.0.0-...-8f9a7d8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2019 License: MIT Imports: 5 Imported by: 0

README

vemo-france/max31865

This is a golang/periph port of Adafruit's MAX31865 library. It's used to drive a MAX31865 ic or board such as Adafruit's MAX31865 breakout board on any device supported by periph. That ic is a PT100/PT1000 (precision temperature sensor) amplifier.

Installation

go get github.com/vemo-france/max31865

Usage

package main

import (
	"fmt"
	"log"

	"github.com/vemo-france/max31865"
)

func main() {

	if err := max31865.Init(); err != nil {
		log.Fatalf("initialization failed : %s", err)
	}

	// pass in pin names as defined in periph
	sensor := max31865.Create("8", "9", "10", "11")

	// 100 is sensor's resistance at 0°C in ohms (PT100 -> 100, PT1000 -> 1000)
	// 430 is reference resistance in ohms (430 for adafruit's board)
	temp := sensor.ReadTemperature(100, 430)

	fmt.Printf("Temperature is %f°C\n", temp)
}

TODO

  • Handle 2, 3 et 4 wires sensors
  • Create and ReadTemperature can fail, so we should return ( ??, error) to handle that

Documentation

Index

Constants

View Source
const (
	WIRE_2 = 0
	WIRE_3 = 1
	WIRE_4 = 0
)

Variables

This section is empty.

Functions

func Init

func Init() error

Types

type Sensor

type Sensor struct {
	// contains filtered or unexported fields
}

func Create

func Create(cs string, miso string, mosi string, clk string) *Sensor

func (*Sensor) ReadRTD

func (s *Sensor) ReadRTD() uint16

func (*Sensor) ReadTemperature

func (s *Sensor) ReadTemperature(RTDnominal float32, refResistor float32) float32

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL