Documentation ¶
Overview ¶
Package ds18b20 interfaces to Dallas Semi / Maxim DS18S20, DS18B20 and MAX31820 1-wire temperature sensors.
Note that both DS18B20 and MAX31820 use family code 0x28.
Both powered sensors and parasitically powered sensors are supported as long as the bus driver can provide sufficient power using an active pull-up.
The DS18B20/DS18S20 alarm functionality and reading/writing the 2 alarm bytes in the EEPROM are not supported.
More details ¶
See https://periph.io/device/ds18b20/ for more details about the device.
Datasheets ¶
https://datasheets.maximintegrated.com/en/ds/DS18B20-PAR.pdf
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertAll ¶
ConvertAll performs a conversion on all DS18B20 devices on the bus.
During the conversion it places the bus in strong pull-up mode to power parasitic devices and returns when the conversions have completed. This time period is determined by the maximum resolution of all devices on the bus and must be provided.
ConvertAll uses time.Sleep to wait for the conversion to finish, which takes from 94ms to 752ms.
Types ¶
type Dev ¶
type Dev struct {
// contains filtered or unexported fields
}
Dev is a handle to a Dallas Semi / Maxim DS18B20 temperature sensor on a 1-wire bus.
func New ¶
New returns an object that communicates over 1-wire to the DS18B20 sensor with the specified 64-bit address.
resolutionBits must be in the range 9..12 and determines how many bits of precision the readings have. The resolution affects the conversion time: 9bits:94ms, 10bits:188ms, 11bits:375ms, 12bits:750ms.
A resolution of 10 bits corresponds to 0.25C and tends to be a good compromise between conversion time and the device's inherent accuracy of +/-0.5C.
func (*Dev) LastTemp ¶
func (d *Dev) LastTemp() (physic.Temperature, error)
LastTemp reads the temperature resulting from the last conversion from the device.
It is useful in combination with ConvertAll.
func (*Dev) SenseContinuous ¶
SenseContinuous implements physic.SenseEnv.