jeanmimib
Posts: 1
Joined: Tue Jan 08, 2019 7:12 pm

DS18B20 alarm trigger register

Tue Jan 08, 2019 8:14 pm

The DS18B20 can store high and low temperature in trigger register. These register are stored in EEPROM as the configuration register for setting the precision. With current w1_therm driver it is possible to set the precision and store it in EEPROM.
But I can't figure how to write the high and low temperature alarms in EEPROM.
Any idea ?

danjperron
Posts: 3131
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: DS18B20 alarm trigger register

Tue Jan 08, 2019 9:18 pm

You check my bit banging method.
https://github.com/danjperron/BitBangingDS18B20

You could change the resolution of your sensor using configDS18B20.

**** The user mode bit banging do not use the 1 wire driver . Please use another pin or disable the 1 wire interface.

About Minimum and maximum alarm. I.M.O. you should keep that information into the Raspberry Pi because there is no pin on the DS18B20 to specify an alarm. You have to read the register to get it. Then it is way way faster to compare the temperature of your sensor from variable store into the PI. This make no sense to use alarm inside the DS18B20.

Also the current 1 wire driver doesn't use the alarm info. Then I don't see why you want it.

B.T.W. when you read the sensor with the 1 wire driver it will output the 8 registers.

Code: Select all

[email protected]:/sys/bus/w1/devices/28-000004575f0a $ cat w1_slave
50 01 ff ff 7f ff 10 10 2e : crc=2e YES
50 01 ff ff 7f ff 10 10 2e t=21000
TH = 0xFF TL=0xFF
Last edited by danjperron on Tue Jan 08, 2019 9:26 pm, edited 1 time in total.

User avatar
bensimmo
Posts: 3566
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: DS18B20 alarm trigger register

Tue Jan 08, 2019 9:22 pm

You can also use the w1thermsensor to set precision (bundled with Raspbian iirc, maybe just the full desktop version?)
https://github.com/timofurrer/w1thermse ... /README.md

Return to “Device Tree”