element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Summer of Green Tech Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Summer of Green Tech Design Challenge
  • More
  • Cancel
Summer of Green Tech Design Challenge
Forum Has anyone used the OneWire protocol with the Seeeduino XIAO under MicroPython?
  • Blog
  • Forum
  • Documents
  • Leaderboard
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Summer of Green Tech Design Challenge requires membership for participation - click to join
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 5 replies
  • Subscribers 68 subscribers
  • Views 1006 views
  • Users 0 members are here
Related

Has anyone used the OneWire protocol with the Seeeduino XIAO under MicroPython?

Alistair
Alistair over 1 year ago

I am trying to use the OneWire protocol to talk to a DS18B20, but I don't think it is currently compiled in to MicroPython for SAMD21 based devices.

Am I correct? If so are there any recommended alternative libraries. If not then any thought as to what I am doing wrong?

  • Sign in to reply
  • Cancel

Top Replies

  • Alistair
    Alistair over 1 year ago in reply to scottiebabe +1
    That is the command I was needed. Thanks. Yes, it confirms that onewire is not compiled in for some reason. It is documented as it should be, so perhaps I should try and nightly build and see what I get…
  • shabaz
    0 shabaz over 1 year ago

    I've not used any of the boards/protocols you mention. However, MicroPython allows for general GPIO manipulation, and I believe 1-wire is slow enough that you could manually bit-bang your protocol if needed. That's what the author of this library has done:

    https://github.com/robert-hh/Onewire_DS18X20

    That library should work (or could be edited, since it is entirely in Python, manually bit-banging - no compiling needed).

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • scottiebabe
    0 scottiebabe over 1 year ago

    Can you post what you see when you type help('modules') into the REPL

    image

    (Pico example)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Alistair
    0 Alistair over 1 year ago in reply to shabaz

    Thanks for the the link. Following the same logic I found the same library, but sadly it is not detecting the sensor. I checked the wiring by connecting to an Arduino for a test and it worked, so I suspect it is an oddity around the XIAO and Micropython in some way. Perhaps it is timing as that feels critical and relying on quick execution looking at the code. I might connect it up to the scope to see what is actually happening at the hardware end and see it that gives me a clue. Thanks for the pointer though. 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Alistair
    0 Alistair over 1 year ago in reply to scottiebabe

    That is the command I was needed. Thanks. Yes, it confirms that onewire is not compiled in for some reason. It is documented as it should be, so perhaps I should try and nightly build and see what I get. 

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • shabaz
    0 shabaz over 1 year ago in reply to Alistair

    There are sleep_us() operations in the code, it's very likely they may need tweaking (checking with an oscilloscope), since the timings won't be too accurate in that way at the microsecond level with MicroPython.

    I2C is a better protocol for on-board sensors (appreciate that doesn't help with the immediate problem, but for future use).

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube