Skip to content
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

raspberry pi version #18

Open
pabloandresm opened this issue Aug 24, 2020 · 5 comments
Open

raspberry pi version #18

pabloandresm opened this issue Aug 24, 2020 · 5 comments

Comments

@pabloandresm
Copy link

Very nice investigation and code.

It is a shame that there is no C or Python code for Raspberry Pi. If yould be a very nice too have.

thanks

@cpetrich
Copy link
Owner

ok, point taken...

@hurra
Copy link

hurra commented Apr 16, 2021

You probably can check the serial number with

hexdump -v -e '7/1 "%02x-" 1/1 "%02x" "\n"' /sys/devices/w1_bus_master1/<family-id>/id

@leahneukirchen
Copy link

For the Raspberry Pi Pico, you can use the following CircuitPython script:

import board
from adafruit_onewire.bus import OneWireBus
ow_bus = OneWireBus(board.GP16)
print('-'.join(["%02x" % i for i in devices[0].rom]))

@scruss
Copy link

scruss commented Feb 16, 2022

And this in MicroPython for the Raspberry Pi Pico/RP2040, assuming pin 16 as above:

# print hex IDs of all ds18x20 sensors found on a pin
from machine import Pin
from onewire import OneWire
from ds18x20 import DS18X20

ds = DS18X20(OneWire(Pin(16)))

for i, sensor in enumerate(ds.scan()):
    print(i, ":", '-'.join(["%02x" % j for j in sensor]))

Other implementations might use something like Pin('PE0') to define a pin.

@cpetrich
Copy link
Owner

I've copied a Python code fragment in issue #20 (comment)
That could be used as a basis for porting the arduino code to Python.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants