User Tools

Site Tools


howto:usbtemp

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
howto:usbtemp [2023/06/02 11:02] – created Wulf Rajekhowto:usbtemp [2023/06/05 01:01] (current) Wulf Rajek
Line 5: Line 5:
 https://usbtemp.s3.amazonaws.com/manuals/usb-thermometer_installation-en.pdf https://usbtemp.s3.amazonaws.com/manuals/usb-thermometer_installation-en.pdf
  
 +Generate device by serial number for easier identification of probe like /dev/serial/by-serial/AYAV...:
 <code> <code>
-dmesg | tail 
- 
 sudo vi /etc/udev/rules.d/usbtemp.rules sudo vi /etc/udev/rules.d/usbtemp.rules
 SUBSYSTEM!="tty", GOTO="serial_end" SUBSYSTEM!="tty", GOTO="serial_end"
Line 16: Line 15:
 sudo udevadm control --reload-rules sudo udevadm control --reload-rules
 sudo udevadm trigger sudo udevadm trigger
 +</code>
 +
 +<code>
 +dmesg | tail
  
 sudo apt-get install digitemp sudo apt-get install digitemp
Line 23: Line 26:
  
 sudo usermod -a -G dialout wuff sudo usermod -a -G dialout wuff
-wuff@gondor:~/Downloads/digitemp$ newgrp dialout+newgrp dialout
  
 #initialisation #initialisation
Line 30: Line 33:
 #read temp #read temp
 digitemp_DS9097 -t 0 digitemp_DS9097 -t 0
 +</code>
 +
 +Python scripting example:
 +<code>
 +#sudo pip install DS18B20 pydigitemp
 +mkdir digitemp
 +cd digitemp
 +git clone https://github.com/mcsakoff/pydigitemp
 +mv pydigitemp/digitemp .
 +rm -rf pydigitemp
 +</code>
 +<code python digitemp.py>
 +from digitemp.master import UART_Adapter
 +from digitemp.device import DS18B20
 +import time
 +bus = UART_Adapter('/dev/ttyUSB0')
 +sensor = DS18B20(bus)
 +while True:
 +    print(sensor.get_temperature())
 +    time.sleep(1)
 </code> </code>
howto/usbtemp.1685700166.txt.gz · Last modified: 2023/06/02 11:02 by Wulf Rajek