Hi, can someone help me configure DS18B20 temperature sensor using python on jetson nano? This is a one wire configurable type of sensor, can this be used to read data? When connected to the board on pin12 and ran simple_input.py, I could see the output βhighβ, but now I need to read data. How do I go about this?
Have a reference to below topic.
Hi, i spend today few hours to connect DS18B20 temperature sensor to my Jetson Nano A02 and i succes!!! Itβs a few steps:
-
I am install pydigitemp library using pip
-
Connect to J44 UART A02 header : Pin 2 β TXD , Pin 3 β RXD , Pin 6 ->GND and 3.3V i get from J41 header. PS. Important B01 version of Nano have other pin numbers J50 header Pin 4 β TXD, Pin 3 β RXD, Pin 7 β GND
-
On DS18B20 sensor TXD,RXD is conected together to Data pin and 4.7K Ohms pull up resistor to VCC pin
- I wrote this program(Demo Code from library documentation;) ):
from digitemp.master import UART_Adapter
from digitemp.device import AddressableDevice
from digitemp.device import DS18B20
bus = UART_Adapter(β/dev/ttyS0β) #J44 header name
sensor = DS18B20(bus)
sensor.info()
print(sensor.get_temperature())
Importand DS18B20 class is only for this version sensor, for other type sensors read library documentation
https://github.com/mcsakoff/pydigitemp/issues/1
- And Violla!!! its working!!! Bye
and multiple sensors version
from digitemp.master import UART_Adapter
from digitemp.device import AddressableDevice
from digitemp.device import DS18B20
print(AddressableDevice(UART_Adapter(β/dev/ttyS0β)).get_connected_ROMs())
bus = UART_Adapter(β/dev/ttyS0β) # DS9097 connected to COM1
sensor_01 = DS18B20(bus, rom=β28FF2DAE02198A03β)
sensor_02 = DS18B20(bus, rom=β28FF0BDD02198A47β)
sensor_01.info()
print(sensor_01.get_temperature())
sensor_02.info()
print(sensor_02.get_temperature())
and connected sensors in parasite power mode:
Both senors GND and VDD together, and 4.7K Ohms resistor pull up Data to VCC