Showing results for 
Search instead for 
Did you mean: 

Wie kann man onewire auf dem STM32MP135 mit python nutzen?


I want to read a temperature sensor DS18B20 with onewire with the STM32MP135 in Python?
Does anyone know how to do this best?
I've already tried installing the onwire library from python, but that fails. I don't want to program it in C.

I'm new here, so I hope I've classified my problem correctly.


ST Employee

Hi @birnnehi 


I succeeded to use DS18B20 with STM32MP157F-DK2 with the following setup

Connect sensor on:

  • CN2 pin 8 and pin 10 shorted together (USART3_TX and USART3_RX): sensor data (usually yellow wire)
  • CN2 pin 6 (VSS) : sensor ground (usually black wire)
  • CN2 pin 4 (+5V): sensor supply (usually red wire)

install PyDigiTemp python module

Boot the board using "stm32mp157f-dk2-a7-examples" device tree (option 2 in U-Boot when prompted).
This define USART3 as ttySTM1 on pins listed above.

If needed to confirm the tty port used on your system, please have a look to


Then such kind of python code should work:


from digitemp.master import UART_Adapter
from digitemp.device import TemperatureSensor

sensor = TemperatureSensor(UART_Adapter('/dev/ttySTM1'))
temperature = sensor.get_temperature()






In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Uwe Bonnes
Principal II

If the MP1 runs linux, there is also owfs, the one-wire-filesystem.