Coder Social home page Coder Social logo

onewire-over-uart's Introduction

onewire-over-uart:

Access Dallas 1-wire bus on your PC with simple and cheap hardware.

This project is based on Maxim's application note: Using a UART to Implement a 1-Wire Bus Master

http://www.maximintegrated.com/app-notes/index.mvp/id/214

Please also see this post from vbranimir: https://haklabos.wordpress.com/projekti/digitemp/

NOTE: parasitic power mode is not supported.

License

Part of the project are based on previous works, most of which does not contain explicit licenses. Please contact the authors separately via the email addresses listed in individual files if necessary. Other codes are licensed under WTFPL.


Hardware

The original version mentioned in Maxim's application note is shown as below.

Schematics

However you can use a simplified version:

Schematics

If you are sure your UART host has open-drain outputs, simply tie TX and RX together as mentioned by vbranimir. Transistors can either be BJTs or MOSFETs. The diode used in the simplified version should be fast and has a relatively low forwarding voltage. 1N4148 is known to work.

A USB to UART converter with TTL output is required, unless you are using a SBC with native TTL UART (NOT RS-232!) such as Raspberry Pi. Many USB to UART converters have TTL UART interfaces. RS-232 UARTs should be avoided since its voltage is very high and can damage your device. If you have to use one of such, insert a MAX232 or equivalent chip between the RS-232 port and the circuits mentioned above. It is usually easier and cheaper to just get a USB to UART converter with TTL output.

Here are a few tested converters, many of which are less than $5:

  • SiLabs CP2102 USB to UART converters. Common and cost-effective.

    Photo

  • Prolific PL2303 USB to UART converters. Common and cost-effective. Some boards have problems with power output, especially 3.3V. Try powering your 1-wire device separately should problems arise.

    Photo

  • FTDI FT232L USB to UART converters. More expensive.

    Photo

  • Cypress CY7C65211 USB to UART/I2C/SPI converters. Less common on the market, this one is broken out from a Cypress MCU development board.

    Photo

  • WCH CH340G USB to UART converters. Common and cheap in China but might be slow.

    Photo

  • Microchip MCP2221(A) USB to UART/I2C converters. DIY-friendly.

    Photo


Software

Type make to get lsow and digitemp_evil compiled. To build for Windows under Linux, try installing mingw-w64 and then type make OS=Windows_NT CC=i686-w64-mingw32-gcc-posix. Project files for MS Visual Studio Express are now included.

lsow is a tool that list devices on a onewire bus connected to a USB to UART converter. Simply type something like lsow /dev/ttyUSB0 (or something like lsow COM0: under Windows) and it will show device IDs found on the bus.

digitemp_evil is a demonstration program that reads temperature values from DS18S20/DS18B20/DS1822 onewire digital temperature sensors. Type digitemp_evil /dev/ttyUSB0 to read IDs and temperature values. It will wait for conversion to complete, which usually takes around 0.75 seconds. Additionally, Windows users can use digitemp_monitor.bat to monitor the temperature. Linux users can simply use the watch command.

Terminal Output

Alternatively you can use digitemp_DS9097 in the digitemp package as mentioned by vbranimir.

onewire-over-uart's People

Contributors

dword1511 avatar l29ah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

onewire-over-uart's Issues

MOSFET selection

Hello,

I have seen Maxim recommends 7002 mosfets, however I don't have any available.
image

Could I use ZXMN3A01F transistors?

I am not sure about how to select a proper mosfet for the Open drain circuit

Thank you

windows uart routines errors

Hello and thanx for your project.
ReadFile and WriteFile will rise exeption becourse it cannot be used with lpNumberOfBytesRead equal to NULL. You can provide NULL pointer ONLY if lpOverlapped is not NULL. You can check it with MSDN.

What's the license?

Hi - I'm evaluating using this codebase but what license is this code under? My preference would be an MIT/BSD style license but I can't see any licensing information anywhere. Cheers!

Linking error on linux

with -static option in makefile you get error:

/usr/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
Makefile:22: recipe for target 'digitemp_evil' failed
make: *** [digitemp_evil] Error 1

Tested on Fedora 25 with gcc version 6.3.1 20161221 (Red Hat 6.3.1-1) (GCC)

Can this be used with hwmon?

Great piece of software!

I'm looking for a way to add temperature sensors to my motherboard directly (without arduino like middleware) so they are visible to hwmon just like other built-in sensors and I could use fancontrol to control some fans based on the new sensors data.

So, can I use onewire-over-uart for that?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.