New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
w1: add ability to change temperature sensor precision #1412
Conversation
… for temperature readings of 1wire devices
…mp sensors like DS18B20 based on the PR (raspberrypi/linux#1412) for the raspberry pi kernel, i would like to propose my changes upstream as well. The changes entitle basic write operations for the 1Wire driver which are needed to change e.g. the precision of temperature sensors like the very popular DS18B20. Writing to SRAM and commiting the values to EEPROM is possible. Since many sensors come "preconfigured" with a lower precision, people are stuck that precision when running on a kernel based device (unlike the Dallas 1Wire library for e.g. Arduino, which supports writing the configuration/scratchpad). Signed-off-by: x29a <0.x29a.0@gmail.com>
The 4.1 kernel tree is not longer used. |
how exactly do I write the resolution bit in the w1_slave after the x29a commits? |
Note, this change got accepted upstream with 4.7, i also updated the docs, so its basically: |
i have changed to 11bit precision by plugging the sensor on arduino and when plugged on raspberry the resolution is still 12bit. |
im not sure if the arduino method writes the precision to SRAM or EEPROM, you would have to elaborate but that is out of the scope of this PR. In order to save the precision of 11bit permanently with the w1 changes, you would have to write a 0 to the w1_slave, so something like then check again with arduino and after unplugging the sensor/reboot the device. Please note again, the changes were introduced with 4.7, which version are you running? self compiled with the patch applied? |
It can write both SRAM and EEPROM. This is the important instruction: Right now I’m using standard 4.4. I would prefer to not use dev version if I can.
|
updated to 4.9 with $ sudo rpi-update BRANCH=next |
The output of the echo command running as root is received by the shell running as user pi, and the shell is trying to write it to w1_slave. You need the whole pipeline run as root:
|
The DS18B20 temperature sensor is quite popular with the rpi and yet it is not possible to change the precision with which the sensors are converting their temperature values.
Since some sensors come preconfigured with a low precision, people are stuck to e.g. 9bit when using the rpi when 12bit are possible.
This has been tested on an rpi1 running at 4.1.13+ with a DS18B20 sensor. Other sensors support the commands as well but are disabled for now because of lack of testability.