e026046.pdf
(
273 KB
)
Pobierz
MICRO
PROCESSOR
USB Interface for
the 1-Wire Bus
from four to two wires
Design by L. Lemmens
The 1-Wire bus from Dallas Semiconductor is very suitable for use in a
small (home) network with various switches, sensors and actuators. The
simplicity of the hardware is in sharp contrast to the complexity of the
protocol on this bus, but fortunately this problem has been solved by the
manufacturer with dedicated interface ICs and software that simplifies
the communication between the PC and 1-Wire devices.
Last April we published a design for
a serial interface for the PC, which
made it possible to communicate
with devices on the 1-Wire bus using
development software supplied by
Dallas Semiconductor. This month
we have an almost identical circuit,
but for use with the USB port (USB =
Universal Serial Bus). This port is
beginning to be used more fre-
quently for connecting peripherals to
PCs and Macs. The serial port has
now fallen out of favour in that
respect. Some people are of the opin-
ion that the trusty old RS232 inter-
face will soon disappear from the PC
and certainly from modern laptops.
The future will tell if they’re right.
The USB does have several major
advantages compared to the serial
port. Just the fact that several
devices can be connected to a single
USB port via a hub is a huge
improvement. In the past, every
device required its own serial port,
or we had to make use of clumsy
switch boxes (which sometimes
introduced problems of their own). It
is also a boon that many peripherals
can draw their supply from the USB
46
Elektor Electronics
6/2002
MICRO
PROCESSOR
port or hub, removing the need for
separate power supply adapters and
cables. The final advantage is that
USB devices can be plugged in even
when the PC is running; the operat-
ing system on the computer detects
this immediately and automatically
installs the appropriate driver for the
device. This is a huge enhancement
for the computer world, and justifies
the eventual demise of the RS232
interface.
Communications via the USB
interface tend to be much more com-
plex than via the old serial interface,
even if that often caused a headache
when trying to set it to the correct
baud rate, data bits etc. Luckily the
blow is softened by the fact that
more ICs are introduced that take
care of the USB protocols, making
the USB completely transparent in
use. Together with the drivers that
the manufacturers of these ICs make
freely available on the Internet, they
make a complete USB interface, so
we don’t need to worry about what
happens on the USB. And in this
case the IC also takes care of the 1-
Wire bus.
1-Wire devices are parts that are
very suitable for a small network.
Two wires are sufficient to power
and communicate with these ICs.
The range includes switches, ther-
mostats, memories, potentiometers,
clock ICs and so on. For a full
overview of the range you should
refer to the article in the April issue
or the website of Maxim/Dallas
Semiconductor. Rumour has it that
the range will soon be extended to
include a humidity/temperature sen-
sor, which could find use in an air-
conditioning system. Most of the
questions we’re asked about this
bus come from people who would
like to set up a network at home for
measurement and control. We’ll take
a look at the requirements for con-
necting these devices to the PC via
the USB port.
+5V
IC2
+3V3
LF33CV
L1, L2 =
MURATA
BLM31AJ601SN1L
L2
C7
C6
C5
*
see text
*
100n
100n
1
µ
16V
D2
R3
K1
BAT85
USB
5
17
24
VB
VPP
VD
1
2
R1
27
6
7
SUSO
D–
Ω
IC1
10
D1
1-W
R2
27
Ω
DS2490
5
43
8
D+
1
6
1
PMOD
XI
19
XO
20
GND
5
2
12
L1
X1
DS9503
*
D3
C1
C2
C4
C3
BAT85
33p
33p
33p
33p
X1 =
12MHz
020092 - 11
Figure 1. Circuit diagram for the 1-Wire interface.
tocol. This IC handles all timings and
other details that could otherwise
make life a misery.
The first component on the USB
side is R3, a pull-up resistor that
takes the D+ line to the supply volt-
age, indicating to the USB host (the
PC) that a high-speed device is con-
nected to the bus. The presence of
this pull-up is also a signal to the
host that a driver should be loaded
for the USB device just plugged in.
R1 and R2 provide for the correct
termination of the USB data lines,
whilst C1 and C2 suppress high fre-
quencies and thereby decouple the
inputs (EMI suppression). L1 and L2
provide a similar function for the
supply lines on the USB connector.
IC2 is a 3.3V voltage regulator. If
necessary, you could use any other
regulator in a TO220 case that has
the same pin-out as an ‘ordinary’
78xx series voltage regulator.
IC1 has several supply pins. VD is
used for the supply of the 1-Wire bus.
The Vpp connection is for the pro-
gramming voltage for any possible
programmable devices (ROMs) on
the 1-Wire bus and needs to be at a
higher potential than the supply volt-
age of the IC fed to VB. In this appli-
cation the programming of any
devices is not possible since the
voltage on Vpp would need to be
12 V. It’s not too difficult to change the layout
of the circuit such that a 12 V connection can
be made to this pin, but that should be done
before IC1 is mounted! Just as for the serial
interface in April issue, the same warning
applies here: during programming, only one
EEPROM device may be connected to the
interface, using a short cable. You should also
never execute a programming command on a
bus that has non-EEPROM devices connected
to it; this could damage these devices or the
interface!
The two diodes D2 and D3 protect the 1-
Wire bus from excessive voltages. D1 has
been specifically designed to protect the
interface from electrostatic discharges on the
1-Wire bus. It consists of a very fast zener
diode with two low-value resistors. These
resistors don’t affect normal 1-Wire commu-
nications, but have a high resistance com-
pared to the zener when it is conducting. This
causes an electrostatic discharge to be dissi-
pated in the zener rather than find its way
into the interface.
Construction
We have designed a PCB for this circuit, but
this won’t be made available via the Readers’
Services due to its small size. The layout of
Figure 2
can be downloaded from our web-
site
www.elektor-electronics.co.uk
.
The construction of the circuit shouldn’t
cause problems for those of you who have sol-
dered SMD parts before. Start with these
Hardware
Figure 1
shows the circuit diagram
of the interface. It couldn’t really be
any simpler. IC1 is the most impor-
tant part, doing all the work in the
interface: the DS2490. On one side it
takes care of the USB interface, on
the other it handles the 1-Wire pro-
6/2002
Elektor Electronics
47
MICRO
PROCESSOR
parts, which have to be mounted on the track
side of the board. First tin one pad on the PCB
and solder the SMD to that pad only. Then
check that all other pins are lined up properly,
making any adjustments as necessary. Only
then should the other pins be soldered. Take
care with L1 and L2; they are on the track
side underneath the USB connector. Double
check that all joints on IC1 and D1 make a
good connection and that there aren’t any sol-
der bridges! After the SMDs it’s the turn of
the ordinary components. When that is fin-
ished, the circuit is ready for connecting to a
USB port on the PC and its first test.
D3
IC2
C6
D2
C7
C5
R2
C4
R1
K1
020092-1
X1
C2
C1
H6
C3
Figure 2. The PCB layout (also obtainable from www.elektor-electronics.co.uk).
COMPONENTS LIST
D2,D3 = BAT85
IC1 = DS2490
IC2 = LF33CV (Farnell # 302-4520)
Installation
We start with the interface without any 1-
Wire devices connected to it. Those of you
who constructed and used the serial interface
from the April issue won’t have much more to
do since the correct USB driver should
already be on the system. Otherwise the soft-
ware has to be downloaded from
www.ibutton.com/software/tmex/index.html
,
where we find the TMEX with iButton Viewer
(with drivers) and, if required, the 1-Wire Soft-
ware Developer’s Kit. In any case, the first-
named software package should be installed,
which is currently TM320_32.EXE (32-bit, ver-
sion 3.20 for Windows). This also stores the
driver for the USB in the correct directory.
This doesn’t always go faultlessly, so make
sure that you carefully read the instructions
Resistors:
R1,R2 = 27
Ω
R3 = 1k
5
Inductors:
L1,L2 = BLM31AJ601SN1 (Murata)
(Farnell # 581-094)
Capacitors:
C1-C4 = 33pF
C5,C6 = 100nF
C7 = 1µF 16V radial
Miscellaneous:
K1 = USB connector, type B, PCB
mount
X1 = 12MHz quartz crystal
Semiconductors:
D1 = DS9503
for USB that come with the installa-
tion software! If you do encounter
any problems you should refer to the
README and HELP files that have
been included by Dallas. Usually
Windows has to be restarted once
the installation has completed.
Now it is — as long as everything
is in order — a matter of ‘plug-and-
play’: plug the USB plug into the
interface and some rattling of the
hard disc tells you that the interface
has been detected and that Windows
is loading the appropriate driver. In
Windows
Device Manager
you should
be able to see the driver under the
heading
USB
, with the name ‘USB
host for 1-Wire microLAN’. Next you
should run the
iButton Viewer
appli-
cation from the Start Menu. The first
this will ask for is the port it should
use for the interface. In our case this
is the USB interface as shown in
Fig-
ure 3
. Note that this program calls
the adapter a DS1490 and not, as you
would expect, a DS2490. The DS1490
is a generic name given to USB inter-
faces such as the DS2490. If you are
unable to find the USB interface man-
ually, you should run the
Default
1-Wire Net
application and select the
Auto-Detect option. You should make
a note of the settings when the
DS1490 adapter has been found,
because the details are not stored
and will have to be entered by hand
when the Viewer is started again.
We are now ready to play and can
Figure 3. Selecting the USB interface in the iButton Viewer.
48
Elektor Electronics
6/2002
MICRO
PROCESSOR
connect one or more 1-Wire devices
to the bus. The Viewer should imme-
diately show the unique serial num-
ber of each device in the left-hand
column and, depending on the set-
tings of the program, open a window
that shows the properties of the
device and (where appropriate) any
settings that can be adjusted.
Fig-
ure 4
shows what could be expected
on the PC’s display.
And finally
This circuit is more or less the same
as that of the serial interface
described earlier; it is just a more
modern version using a different port
on the PC. All observations made in
the previous article regarding the 1-
Wire bus, the iButton Viewer, the
Software Developer’s Kit and the
devices that can be connected to
this bus, also apply to the use of this
USB interface.
Figure 4. The iButton Viewer in full swing.
(020092)
6/2002
Elektor Electronics
49
Plik z chomika:
gasma
Inne pliki z tego folderu:
bge.jpg
(23 KB)
detail1.htm
(4 KB)
detail2.htm
(4 KB)
e02a016.pdf
(1746 KB)
detail3.htm
(5 KB)
Inne foldery tego chomika:
1974
1975
1976
1977
1978
Zgłoś jeśli
naruszono regulamin