One Wire Bricklet

Features

  • 1-wire communication with any 1-wire capable device
  • Offers high-level commands (bus search, reset, write, read, write command)
  • Supports 3.3V, 5V and external supply voltage
  • Supports up to 64 1-wire devices simultaneously

Description

The One-Wire Bricklet can be used to communicate with any 1-wire capable device.

The API uses a set of high-level commands (bus search, reset, write, read, write command). Each command will give immediate status feedback for easy error detection.

Up to 64 devices can be connected to the bus and used at the same time.

A jumper can be used to switch between 3.3V, 5V or an external supply voltage for the connected 1-wire devices.

An example application would be to read the temperature of a MAX31820 1-wire ambient temperature sensor.

The One Wire Bricklet has a 7 pole Bricklet connector and is connected to a Brick with a 7p-10p Bricklet cable.

Technical Specifications

Property Value
Current Consumption 35mW (7mA at 5V)
   
Maximum Bus Size 64
Supported Voltage 3.3V, 5V and external supply
Commands bus search, reset, write, read, write command
   
Dimensions (W x D x H) 30 x 30 x 14mm (1.18 x 1.18 x 0.55")
Weight 6.5g

Resources

Connectivity

You can connect any 1-Wire device to the VCC/DAT/GND (voltage, data, ground) pins.

The jumper can be used to switch the supply voltage applied to VCC between 3.3V and 5V. If the jumper is set to NC, you can connect an external power supply to VCC. If you want to use an external power supply, you can not put the jumper on the 3.3V/5V pin headers.

One Wire Bricklet connectivity

Example: MAX31820

The following example uses Python to read the temperature of a MAX31820 temperature sensor with the API of the One Wire Bricklet:

ow.write_command(0, 0x4E)     # WRITE SCRATCH PAD
ow.write(0x00)                # ALARM H (unused)
ow.write(0x00)                # ALARM L (unused)
ow.write(0x7F)                # CONFIGURATION: 12 bit mode

while True:
    ow.write_command(0, 0x44) # CONVERT T (start temperature conversion)
    time.sleep(1)             # Wait for conversion to finish

    ow.write_command(0, 0xBE) # READ SCRATCH PAD

    t_low = ow.read().data    # Read LSB
    t_high = ow.read().data   # Read MSB

    print('Temperature: {0} °C'.format((t_low | (t_high << 8)) / 16.0))

Test your One Wire Bricklet

To test a One Wire Bricklet you need to have Brick Daemon and Brick Viewer installed. Brick Daemon acts as a proxy between the USB interface of the Bricks and the API bindings. Brick Viewer connects to Brick Daemon. It helps to figure out basic information about the connected Bricks and Bricklets and allows to test them.

Connect the One Wire Bricklet to a Brick with a Bricklet Cable and connect a 1-wire device to the Bricklet.

If you connect the Brick to the PC over USB, you should see a new tab named "One Wire Bricklet" in the Brick Viewer after a moment. Select this tab. If everything went as expected you can now use Brick Viewer to communicate with a connected 1-wire device.

One Wire Bricklet in Brick Viewer

After this test you can go on with writing your own application. See the Programming Interface section for the API of the One Wire Bricklet and examples in different programming languages.

Case

A laser-cut case for the One Wire Bricklet is available.

Case for One Wire Bricklet

The assembly is easiest if you follow the following steps:

  • Screw spacers to the Bricklet,
  • screw bottom plate to bottom spacers,
  • build up side plates,
  • plug side plates into bottom plate and
  • screw top plate to top spacers.

Below you can see an exploded assembly drawing of the One Wire Bricklet case:

Exploded assembly drawing for One Wire Bricklet

Hint: There is a protective film on both sides of the plates, you have to remove it before assembly.

Programming Interface

See Programming Interface for a detailed description.

Language API Examples Installation
C/C++ API Examples Installation
C# API Examples Installation
Delphi/Lazarus API Examples Installation
Java API Examples Installation
JavaScript API Examples Installation
LabVIEW API Examples Installation
Mathematica API Examples Installation
MATLAB/Octave API Examples Installation
Perl API Examples Installation
PHP API Examples Installation
Python API Examples Installation
Ruby API Examples Installation
Shell API Examples Installation
Visual Basic .NET API Examples Installation
TCP/IP API    
Modbus API