HOME
StumbleUpon.Com Recommend to StumbleUpon

Overview/ Introduction

Maxim (Dalsemi, Dallas) '1-Wire'(trademark) family of chips
E.g. DS1820 temperature sensors

       (filename: OverView-OneWire.htm)

Many years ago... I was writing about them in the 1990's I think... the "1-Wire" family of chips was created by a company then independent called Dallas. (It was absorbed first into "Dalsemi", which in turn became part of Maxim.)

digram to show 1-Wire chips in context

"1-Wire" is a trademark, so you shouldn't get too many false hits, searching on that. "OneWire" is another form. Use "OneWire Arduino", and you'll get some Good Stuff... but also some false hits.

"Family of Chips"

There are many "1-Wire" chips. They share certain properties. It is almost like talking of the "family" of computers running Linux.

We'll come to what they have in common in a moment.

Within the family, there are sensor chips... the ones for sensing temperature have proved propular, e.g. the DS18B20. There are sensors for other things, too... the state of digital lines, sensors for analog voltages.

And there are 1-Wire chips with outputs, too. And chips with EEPROM, "real-time clocks". Etc.

Each blue element labeled "SD..." in the above is a 1-Wire chip.

What they have in common

The 1-Wire chips are designed to be connected together in networks.

The diagram shows three 1-Wire chips sharing a "network". (And the dotted-line wide box at the right is intended to suggest the fact that more 1-Wire chips could be added to the network.)

1-Wire chips have become popular even when not connected to each other, as above, but the fact that they can be is where there popularity began.

It is also where they got their name, even though, really, you need two wire... the wire I've shown in red on the diagram, plus a ground wire, shown in black, which any electronic circuit needs.

I spoke of the chips being connected to a "network". This doesn't mean you can plug them into your rounter and (directly) look at them with a browser across your LAN! You LAN is a network, of course, but it isn't the only sort. When 1-Wire chips are connected on a "network", the chips, the two wires, the adapter (if present... you don't always need one) and the controller, taken together, are called "a MicroLan"... another trademarked term, thankfully.

The "controller" may be a Windows, Mac or Linux computer. It may be an Arduino or Pi microcontroller.

I've marked the 1-Wire chips "SDx" as an abbreviation of "subordinate device". The terms "master" and "slave" are also used where I've used "controller" and "subordinate device".

In a MicroLan, the various SDs just get on with "doing their thing", most of the time. They keep "an ear out" for messages flowing across the two wires.

The controller will be much busier. It will be managing something, and using the SDs to help get the job done.

From time to time, the controller sends messages across the MicroLan. It might ask SD1 to tell it (the controller) what the temperature is where SD1 is. (The two wires can be quite long... many meters, though I've not worked beyond 20 meters.)

Depending on the answer, it might send a message to SD2, telling it to turn the heat on where SD1 is.

We'll talk about this more, soon.

You don't need an adaper!

For simple work with 1-Wire chips, you don't need an adapter between the controller and the 1-Wire chips, the subordinate devices.

For really simple work, can connect a single 1-Wire chip to a digital pin on, say, an Arduino, and "talk" with the chip directly, and without some of the complexities of using more of the 1-Wire chip's capabilities.

But if you want to go beyond "the simple"...

If, however, you want two or more SDs on a MicroLan, though, a problem should be evident to you.

Let's say that both SDs are temperature sensors. And that one is indoors and the other is outdoors.

If the controller wants to know the temperature in either location, it just "asks" the relevant subordinate device.

Ah. But... there is only one wire to and from the two chips. (Apart from the ground wire that "everyone knows" is there.)

Here's the trick of it...

Every 1-Wire chip is manufactured with a unique-to-it number burned into it. I'll refer to the number as the chip's "serial number", though in 1-Wire documentation you will see it referred to as the chip's "ROM ID". Whatever you call it, it will be a 64-bit number. Two bytes of that will be a code which tells you what type of 1-Wire chip the device is.

In real life, of course the number of a typical chip is arcane. For our example, we'll pretend for simplicity's sake the serial numbers of our chips are 12340001 and 12340002.

There are ways for the controller to "know" the serial numbers of the connected 1-Wire chips.

The controller is always in charge, and always initiates anything happening on the MicroLan.

To read chip 12340001, it would "say" to ALL of this chips on the MicroLAN: "Unless you are chip number 12340001, until further notice, stop listening to the MicroLan for a moment." (There is one command that every chip will "hear" even when it "isn't listening"... yes... the "Start listening again" command! (The time the others don't listen is not pre-determined. There is no "stop listening for 500 milliseconds" command.)

The controller then....

... and then the controller "tells" all the chips on the MicroLan "Start listening again."

So complicated! Not so very complicated, really. And it means that you can connect multiple subordinate chips to the controller with just one data wire, and a ground wire.

(The "data" wire also supplies the power used by the subordinate devices, in many circumstances!)

Pretty cool?

I hope that makes 1-Wire seem like worth looking onto? And gives you a start?

Remember for simple work, say with an Arduino, you don't need the adapter. The Arduino will be the controller.

You'll probably use a separate data line for each 1-Wire chip you want to connect. That saves you having to master the "stop listening"/ "start listening" stuff. It also means that you don't need to worry about the "serial number" ("ROM ID") of the chip you are connecting.

I'm told that without an adapter... and simple ones can't be connected to Arduinos easily... having multiple 1-Wire chips connected (as in the diagram above) is sometimes problematic... (But the "stop listening"/ "start listening" codes are available, if you can overcome the other issues. And you can buy fancier adapters which can talk to the Arduino across a serial link, talk to the MicroLan with commands passed to it as serial strings.)(The product description for the HA7E (see next paragraph) gives a hint about a possible cause of strings being problematic. ("... strong pull-up.." If what I'm thinking of is the root of the problems, they would be solved if you didn't use parasitic power.)

("Fancier adapter": One such is the HA7E, from EdsProducts.com ($40+ p&p at 10/17). You send Ascii commands over a (true) RS-232 interface (not difficult, but a slight nuisance, for the simple Arduino user), and it sends back what you needed. Takes care of sundry clever things. I nearly quoted big chunks of their excellent product description... but this is just an aside!!)

Two details, to finish this off...

1) At the right hand end of the diagram, there's the box labelled "At End".. and it seems, I hope, to show there's nothing at the end of the two wires (data/power and ground) which create the MicroLan. That's what I meant to show. You don't need to... indeed shouldn't!... connect the ends to anything.

2) The diagram looks a bit like a ladder lying horizontally. There are "no forks in the line". And there shouldn't be. In other words, the MicroLan can't do "star topologies".

Going further

Simple 1-Wire use, with an Arduino.

Limited pages about using 1-Wire with Lazarus, the free general purpose programming language which I've used quite a bit under Windows. Lazaus programs should also compile for Mac and Linux, but I have little personal experience of it under those operating systems.

For an extensive, dated and overgrown "garden" of 1-Wire stuff, in general. There's a lot there. Some of it general in nature, some of it going into the nuts and bolts of "doing 1-Wire" with Delphi (a Pascal-based IDE, once available to Windows hobbyists.) Much of the material in those pages will also be directly applicable to using 1-Wire with Lazarus, see previous paragraph... but some of the pages are "early efforts" when I was new to writing web pages, AND new to 1-Wire!)

A few words from the sponsor...

Please get in touch if you discover flaws in this page. Please mention the page's URL. (esp8266/Overview-OneWire.htm).

If you found this of interest, please mention in forums, give it a Facebook "like", Google "Plus", or whatever. If you want more of this stuff, help!? There's not much point in me writing these things, if no one feels they are of any use.



   Search this site                 powered by FreeFind
 
Site Map    What's New    Search


Click here to visit my main homepage where you can explore other areas, such as education, programming, investing.




Ad from page's editor: Yes.. I do enjoy compiling these things for you. I hope they are helpful. However... this doesn't pay my bills!!! Sheepdog Software (tm) is supposed to help do that, so if you found this stuff useful, (and you run a Windows or MS-DOS PC) please visit my freeware and shareware page, download something, and circulate it for me? Links on your page to this page would also be appreciated!
Click here to visit editor's freeware, shareware page.

How to email or write this page's editor, Tom Boyd


Valid HTML 4.01 Transitional Page WILL BE tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org. Mostly passes. A few "bad attributes" due to Google+ button, etc.


Why does this page cause a script to run? Because of the Google panels, and the code for the search button. Also, I have my web-traffic monitored for me by eXTReMe tracker. They offer a free tracker. If you want to try one, check out their site. Why do I mention the script? Be sure you know all you need to about spyware.

....... P a g e . . . E n d s .....